Class OfflineRenderingChartPanel

All Implemented Interfaces:
ActionListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Printable, Serializable, EventListener, Accessible, ChartChangeListener, ChartProgressListener, OverlayChangeListener

A ChartPanel that applies offline rendering, for better performance when navigating (i.e. panning / zooming) charts with lots of data.

This chart panel uses a SwingWorker to perform the actual JFreeChart rendering. While rendering, a wait cursor is visible and the current buffered image of the chart will be scaled and drawn to the screen. When - while rendering - another refresh is requested, this will be either postponed until the current rendering is done or ignored when another refresh is requested.

See Also:
  • Constructor Details

    • OfflineRenderingChartPanel

      Constructs a double buffered JFreeChart panel that displays the specified chart.
      Parameters:
      chart - the chart.
    • OfflineRenderingChartPanel

      public OfflineRenderingChartPanel(JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
      Constructs a double buffered JFreeChart panel.
      Parameters:
      chart - the chart.
      properties - a flag indicating whether or not the chart property editor should be available via the popup menu.
      save - a flag indicating whether or not save options should be available via the popup menu.
      print - a flag indicating whether or not the print option should be available via the popup menu.
      zoom - a flag indicating whether or not zoom options should be added to the popup menu.
      tooltips - a flag indicating whether or not tooltips should be enabled for the chart.
    • OfflineRenderingChartPanel

      public OfflineRenderingChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
      Constructs a double buffered JFreeChart panel.
      Parameters:
      chart - the chart.
      width - the preferred width of the panel.
      height - the preferred height of the panel.
      minimumDrawWidth - the minimum drawing width.
      minimumDrawHeight - the minimum drawing height.
      maximumDrawWidth - the maximum drawing width.
      maximumDrawHeight - the maximum drawing height.
      properties - a flag indicating whether or not the chart property editor should be available via the popup menu.
      save - a flag indicating whether or not save options should be available via the popup menu.
      print - a flag indicating whether or not the print option should be available via the popup menu.
      zoom - a flag indicating whether or not zoom options should be added to the popup menu.
      tooltips - a flag indicating whether or not tooltips should be enabled for the chart.
    • OfflineRenderingChartPanel

      public OfflineRenderingChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean properties, boolean copy, boolean save, boolean print, boolean zoom, boolean tooltips)
      Constructs a double buffered JFreeChart panel.
      Parameters:
      chart - the chart.
      width - the preferred width of the panel.
      height - the preferred height of the panel.
      minimumDrawWidth - the minimum drawing width.
      minimumDrawHeight - the minimum drawing height.
      maximumDrawWidth - the maximum drawing width.
      maximumDrawHeight - the maximum drawing height.
      properties - a flag indicating whether or not the chart property editor should be available via the popup menu.
      copy - a flag indicating whether or not a copy option should be available via the popup menu.
      save - a flag indicating whether or not save options should be available via the popup menu.
      print - a flag indicating whether or not the print option should be available via the popup menu.
      zoom - a flag indicating whether or not zoom options should be added to the popup menu.
      tooltips - a flag indicating whether or not tooltips should be enabled for the chart.
  • Method Details

    • paintChartToBuffer

      protected BufferedImage paintChartToBuffer(Graphics2D g2, Dimension bufferSize, Dimension chartSize, Point2D anchor, ChartRenderingInfo info)
      Description copied from class: ChartPanel
      Paints the chart to fill the entire off-screen buffer image.
      Overrides:
      paintChartToBuffer in class ChartPanel
      Parameters:
      g2 - the graphics context to create an off-screen buffer image.
      bufferSize - the required off-screen buffer image size.
      chartSize - the size with which the chart should be drawn (apply scaling if not equal to bufferSize).
      anchor - the anchor point (in Java2D space) for the chart (null permitted).
      info - records info about the drawing (null means collect no info).
      Returns:
      the off-screen buffer image to draw onto the panel.
    • setCursor

      public void setCursor(Cursor cursor)
      Overrides:
      setCursor in class Component