Class AbstractChart

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, org.jfree.chart.event.ChartChangeListener
    Direct Known Subclasses:
    AbstractCategoryChart, AbstractXYChart, JPieChart

    public abstract class AbstractChart
    extends javax.swing.JComponent
    implements org.jfree.chart.event.ChartChangeListener, java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
    A base class for creating chart beans.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.jfree.chart.JFreeChart chart
      The underlying chart.
      protected java.awt.Image chartBuffer
      A buffer for the rendered chart.
      protected int chartBufferHeight
      The height of the chart buffer.
      protected int chartBufferWidth
      The width of the chart buffer.
      protected org.jfree.chart.ChartRenderingInfo info
      The chart rendering info, which is used for tooltips and mouse events.
      protected org.jfree.chart.title.LegendTitle legend
      The chart's legend.
      protected LegendPosition legendPosition
      The current legend position (TOP, BOTTOM, LEFT, RIGHT or NONE).
      protected javax.swing.event.EventListenerList listeners
      Storage for registered listeners.
      protected double scaleX
      The scale factor used to draw the chart.
      protected double scaleY
      The scale factor used to draw the chart.
      protected org.jfree.chart.title.TextTitle sourceSubtitle
      A subtitle that shows the data source.
      protected org.jfree.chart.title.TextTitle subtitle
      A subtitle for the chart.
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractChart()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)  
      void addLegendClickListener​(LegendClickListener listener)
      Registers a listener to receive notification of legend clicks.
      void chartChanged​(org.jfree.chart.event.ChartChangeEvent event)
      Receives notification of changes to the chart, and redraws the chart.
      protected abstract org.jfree.chart.JFreeChart createDefaultChart()
      Creates the default chart for initial display to the user.
      protected javax.swing.JPopupMenu createPopup()
      Creates a popup menu for display on the component.
      protected void doSaveAs()  
      void fireLegendClickEvent​(LegendClickEvent event)
      Fires a legend click event.
      boolean getAntiAlias()
      Returns the flag that controls whether or not the chart is drawn with antialiasing.
      java.awt.Image getChartBackgroundImage()
      Returns the background image for the chart.
      float getChartBackgroundImageAlpha()
      Returns the alpha-transparency for the background image.
      java.awt.Paint getChartBackgroundPaint()
      Returns the background paint for the chart.
      java.awt.Paint getChartBorderPaint()
      Returns the paint used to draw the chart border, if it is visible.
      java.awt.Stroke getChartBorderStroke()
      Returns the stroke used to draw the outline for the chart.
      org.jfree.ui.RectangleInsets getChartPadding()
      Returns the chart padding.
      java.awt.Font getLegendItemFont()
      Returns the font for the legend items.
      java.awt.Paint getLegendItemPaint()
      Returns the paint used to display the legend items.
      LegendPosition getLegendPosition()
      Returns the legend position.
      float getPlotBackgroundAlpha()
      Returns the alpha transparency used when filling the background of the plot area.
      java.awt.Paint getPlotBackgroundPaint()
      Returns the background paint for the plot, or null.
      java.awt.geom.Rectangle2D getScreenDataArea()
      Returns the data area for the chart (the area inside the axes) with the current scaling applied (that is, the area as it appears on screen).
      java.lang.String getSource()
      Returns the text for the chart's source subtitle.
      java.awt.Font getSourceFont()
      Returns the font for the chart's source subtitle.
      java.awt.Paint getSourcePaint()
      Returns the paint used to draw the chart's source subtitle.
      java.lang.String getSubtitle()
      Returns the text for the chart's subtitle.
      java.awt.Font getSubtitleFont()
      Returns the font for the chart's subtitle.
      java.awt.Paint getSubtitlePaint()
      Returns the paint used to draw the chart's subtitle.
      java.lang.String getTitle()
      Returns the text for the chart title.
      java.awt.Font getTitleFont()
      Returns the font for the chart title.
      java.awt.Paint getTitlePaint()
      Returns the paint used to draw the chart title.
      java.lang.String getToolTipText​(java.awt.event.MouseEvent e)
      Returns a string for the tooltip.
      boolean isChartBorderVisible()
      Returns a flag that controls whether or not the chart border is visible.
      boolean isPlotOutlineVisible()
      Returns the flag that controls whether or not the plot outline is visible.
      void mouseClicked​(java.awt.event.MouseEvent event)
      If the user clicks on the chart, see if that translates into an event that we report...
      void mouseDragged​(java.awt.event.MouseEvent e)
      Handles a 'mouse dragged' event.
      void mouseEntered​(java.awt.event.MouseEvent e)  
      void mouseExited​(java.awt.event.MouseEvent e)  
      void mouseMoved​(java.awt.event.MouseEvent e)
      Implementation of the MouseMotionListener's method.
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseReleased​(java.awt.event.MouseEvent e)  
      protected void paintComponent​(java.awt.Graphics g)
      Paints this component, including the chart it contains.
      void removeLegendClickListener​(LegendClickListener listener)
      Unregisters a listener so that it no longer receives notification of legend clicks.
      void restoreAutoBounds()
      Restores the auto-range calculation on both axes.
      void restoreAutoDomainBounds()
      Restores the auto-range calculation on the domain axis.
      void restoreAutoRangeBounds()
      Restores the auto-range calculation on the range axis.
      void setAntiAlias​(boolean flag)
      Sets the flag that controls whether or not the chart is drawn with antialiasing, and fires a PropertyChangeEvent for the antiAlias property.
      void setChartBackgroundImage​(java.awt.Image image)
      Sets the background image for the chart and sends a PropertyChangeEvent to all registered listeners for the chartBackgroundImage property.
      void setChartBackgroundImageAlpha​(float alpha)
      Sets the alpha transparency for the background image.
      void setChartBackgroundPaint​(java.awt.Paint paint)
      Sets the background paint for the chart and sends a PropertyChangeEvent to all registered listeners for the chartBackgroundPaint property.
      void setChartBorderPaint​(java.awt.Paint paint)
      Sets the paint used to draw the chart border, if it is visible, and sends a PropertyChangeEvent to all registered listeners for the chartBorderPaint property.
      void setChartBorderStroke​(java.awt.Stroke stroke)
      Sets the stroke used to draw the outline for the chart and sends a PropertyChangeEvent to all registered listeners for the chartBorderPaint property.
      void setChartBorderVisible​(boolean visible)
      Sets the flag that controls whether or not a border is drawn around the chart, and fires a PropertyChangeEvent for the chartBorderVisible property.
      void setChartPadding​(org.jfree.ui.RectangleInsets padding)
      Sets the chart padding.
      void setLegendItemFont​(java.awt.Font font)
      Sets the font for the legend items and sends a PropertyChangeEvent to all registered listeners for the legendItemFont property.
      void setLegendItemPaint​(java.awt.Paint paint)
      Sets the paint used to display the legend items and sends a PropertyChangeEvent to all registered listeners for the legendItemPaint property.
      void setLegendPosition​(LegendPosition position)
      Sets the legend position and sends a PropertyChangeEvent to all registered listeners for the legendPosition property.
      void setPlotBackgroundAlpha​(float alpha)
      Sets the alpha transparency used when filling the background of the plot area and sends a PropertyChangeEvent to all registered listeners for the plotBackgroundAlpha property.
      void setPlotBackgroundPaint​(java.awt.Paint paint)
      Sets the background paint and sends a PropertyChangeEvent to all registered listeners for the plotBackgroundPaint property.
      void setPlotOutlineVisible​(boolean visible)
      Sets the flag that controls whether or not the plot outline is visible and sends a PropertyChangeEvent to all registered listeners for the plotOutlineVisible property.
      void setSource​(java.lang.String title)
      Sets the text for the chart's source subtitle and sends a PropertyChangeEvent to all registered listeners for the source property.
      void setSourceFont​(java.awt.Font font)
      Sets the font for the chart's source subtitle and sends a PropertyChangeEvent to all registered listeners for the sourceFont property.
      void setSourcePaint​(java.awt.Paint paint)
      Sets the paint for the chart's source subtitle and sends a PropertyChangeEvent to all registered listeners for the sourcePaint property.
      void setSubtitle​(java.lang.String title)
      Sets the text for the chart's subtitle and sends a PropertyChangeEvent to all registered listeners for the subtitle property.
      void setSubtitleFont​(java.awt.Font font)
      Sets the font for the chart's subtitle and sends a PropertyChangeEvent to all registered listeners for the subtitleFont property.
      void setSubtitlePaint​(java.awt.Paint paint)
      Sets the paint for the chart's subtitle and sends a PropertyChangeEvent to all registered listeners for the subtitlePaint property.
      void setTitle​(java.lang.String title)
      Sets the text for the chart title and sends a PropertyChangeEvent to all registered listeners for the title property.
      void setTitleFont​(java.awt.Font font)
      Sets the font for the chart title and sends a PropertyChangeEvent to all registered listeners for the titleFont property.
      void setTitlePaint​(java.awt.Paint paint)
      Sets the paint for the chart title and sends a PropertyChangeEvent to all registered listeners for the titlePaint property.
      protected void setToolTipsEnabled​(boolean flag)
      Switches the display of tooltips for the panel on or off.
      java.awt.Point translateJava2DToScreen​(java.awt.geom.Point2D java2DPoint)
      Translates a Java2D point on the chart to a screen location.
      java.awt.geom.Point2D translateScreenToJava2D​(java.awt.Point screenPoint)
      Translates a screen location to a Java2D point.
      void zoom​(java.awt.geom.Rectangle2D selection)
      Zooms in on a selected region.
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • chart

        protected org.jfree.chart.JFreeChart chart
        The underlying chart.
      • legend

        protected org.jfree.chart.title.LegendTitle legend
        The chart's legend. We keep a separate reference to this, so that the legend can be added/removed from the chart.
      • subtitle

        protected org.jfree.chart.title.TextTitle subtitle
        A subtitle for the chart.
      • sourceSubtitle

        protected org.jfree.chart.title.TextTitle sourceSubtitle
        A subtitle that shows the data source.
      • info

        protected org.jfree.chart.ChartRenderingInfo info
        The chart rendering info, which is used for tooltips and mouse events.
      • listeners

        protected javax.swing.event.EventListenerList listeners
        Storage for registered listeners.
      • chartBuffer

        protected java.awt.Image chartBuffer
        A buffer for the rendered chart.
      • chartBufferWidth

        protected int chartBufferWidth
        The width of the chart buffer.
      • scaleX

        protected double scaleX
        The scale factor used to draw the chart.
      • scaleY

        protected double scaleY
        The scale factor used to draw the chart.
    • Constructor Detail

    • Method Detail

      • createDefaultChart

        protected abstract org.jfree.chart.JFreeChart createDefaultChart()
        Creates the default chart for initial display to the user. Subclasses implement this as appropriate for the chart type.
        Returns:
        The default chart.
      • getAntiAlias

        public boolean getAntiAlias()
        Returns the flag that controls whether or not the chart is drawn with antialiasing.
        Returns:
        The antialiasing flag.
        See Also:
        setAntiAlias(boolean)
      • setAntiAlias

        public void setAntiAlias​(boolean flag)
        Sets the flag that controls whether or not the chart is drawn with antialiasing, and fires a PropertyChangeEvent for the antiAlias property.
        Parameters:
        flag - the new flag value.
        See Also:
        getAntiAlias()
      • isChartBorderVisible

        public boolean isChartBorderVisible()
        Returns a flag that controls whether or not the chart border is visible. In general, it makes more sense to use a Swing border around the component, but when saving a chart to an image, it is sometimes useful to display an outline border.
        Returns:
        A flag that controls whether or not the chart border is visible.
        See Also:
        setChartBorderVisible(boolean)
      • setChartBorderVisible

        public void setChartBorderVisible​(boolean visible)
        Sets the flag that controls whether or not a border is drawn around the chart, and fires a PropertyChangeEvent for the chartBorderVisible property.
        Parameters:
        visible - the new value for the flag.
        See Also:
        isChartBorderVisible()
      • setChartBorderStroke

        public void setChartBorderStroke​(java.awt.Stroke stroke)
        Sets the stroke used to draw the outline for the chart and sends a PropertyChangeEvent to all registered listeners for the chartBorderPaint property.
        Parameters:
        stroke - the stroke (null not permitted).
        See Also:
        getChartBorderStroke()
      • getChartBorderPaint

        public java.awt.Paint getChartBorderPaint()
        Returns the paint used to draw the chart border, if it is visible.
        Returns:
        The paint used to draw the chart border (never null).
        See Also:
        setChartBorderPaint(Paint)
      • setChartBorderPaint

        public void setChartBorderPaint​(java.awt.Paint paint)
        Sets the paint used to draw the chart border, if it is visible, and sends a PropertyChangeEvent to all registered listeners for the chartBorderPaint property.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getChartBorderPaint()
      • setChartBackgroundPaint

        public void setChartBackgroundPaint​(java.awt.Paint paint)
        Sets the background paint for the chart and sends a PropertyChangeEvent to all registered listeners for the chartBackgroundPaint property.
        Parameters:
        paint - the paint (null permitted).
        See Also:
        getChartBackgroundPaint()
      • setChartBackgroundImage

        public void setChartBackgroundImage​(java.awt.Image image)
        Sets the background image for the chart and sends a PropertyChangeEvent to all registered listeners for the chartBackgroundImage property.
        Parameters:
        image - the image (null permitted).
        See Also:
        getChartBackgroundImage()
      • getChartPadding

        public org.jfree.ui.RectangleInsets getChartPadding()
        Returns the chart padding.
        Returns:
        The chart padding.
      • setChartPadding

        public void setChartPadding​(org.jfree.ui.RectangleInsets padding)
        Sets the chart padding.
        Parameters:
        padding - the padding.
      • getTitle

        public java.lang.String getTitle()
        Returns the text for the chart title.
        Returns:
        The text for the chart title.
        See Also:
        setTitle(String)
      • setTitle

        public void setTitle​(java.lang.String title)
        Sets the text for the chart title and sends a PropertyChangeEvent to all registered listeners for the title property.
        Parameters:
        title - the title (null not permitted).
        See Also:
        getTitle()
      • getTitleFont

        public java.awt.Font getTitleFont()
        Returns the font for the chart title.
        Returns:
        The font for the chart title.
        See Also:
        setTitleFont(Font)
      • setTitleFont

        public void setTitleFont​(java.awt.Font font)
        Sets the font for the chart title and sends a PropertyChangeEvent to all registered listeners for the titleFont property.
        Parameters:
        font - the font.
        See Also:
        getTitleFont()
      • getTitlePaint

        public java.awt.Paint getTitlePaint()
        Returns the paint used to draw the chart title.
        Returns:
        The paint used to draw the chart title.
        See Also:
        getTitlePaint()
      • setTitlePaint

        public void setTitlePaint​(java.awt.Paint paint)
        Sets the paint for the chart title and sends a PropertyChangeEvent to all registered listeners for the titlePaint property.
        Parameters:
        paint - the paint.
        See Also:
        getTitlePaint()
      • getSubtitle

        public java.lang.String getSubtitle()
        Returns the text for the chart's subtitle.
        Returns:
        The text for the chart's subtitle.
        See Also:
        setSubtitle(String)
      • setSubtitle

        public void setSubtitle​(java.lang.String title)
        Sets the text for the chart's subtitle and sends a PropertyChangeEvent to all registered listeners for the subtitle property.
        Parameters:
        title - the title.
        See Also:
        getSubtitle()
      • setSubtitleFont

        public void setSubtitleFont​(java.awt.Font font)
        Sets the font for the chart's subtitle and sends a PropertyChangeEvent to all registered listeners for the subtitleFont property.
        Parameters:
        font - the font (null not permitted).
        See Also:
        getSubtitleFont()
      • getSubtitlePaint

        public java.awt.Paint getSubtitlePaint()
        Returns the paint used to draw the chart's subtitle.
        Returns:
        The paint used to draw the chart's subtitle.
        See Also:
        setSubtitlePaint(Paint)
      • setSubtitlePaint

        public void setSubtitlePaint​(java.awt.Paint paint)
        Sets the paint for the chart's subtitle and sends a PropertyChangeEvent to all registered listeners for the subtitlePaint property.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getSubtitlePaint()
      • getSource

        public java.lang.String getSource()
        Returns the text for the chart's source subtitle.
        Returns:
        The text for the chart's sourcesubtitle.
        See Also:
        setSource(String)
      • setSource

        public void setSource​(java.lang.String title)
        Sets the text for the chart's source subtitle and sends a PropertyChangeEvent to all registered listeners for the source property.
        Parameters:
        title - the title.
        See Also:
        getSource()
      • getSourceFont

        public java.awt.Font getSourceFont()
        Returns the font for the chart's source subtitle.
        Returns:
        The font for the chart's source subtitle.
        See Also:
        setSourceFont(Font)
      • setSourceFont

        public void setSourceFont​(java.awt.Font font)
        Sets the font for the chart's source subtitle and sends a PropertyChangeEvent to all registered listeners for the sourceFont property.
        Parameters:
        font - the font (null not permitted).
        See Also:
        getSourceFont()
      • getSourcePaint

        public java.awt.Paint getSourcePaint()
        Returns the paint used to draw the chart's source subtitle.
        Returns:
        The paint used to draw the chart's source subtitle.
        See Also:
        setSourcePaint(Paint)
      • setSourcePaint

        public void setSourcePaint​(java.awt.Paint paint)
        Sets the paint for the chart's source subtitle and sends a PropertyChangeEvent to all registered listeners for the sourcePaint property.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getSourcePaint()
      • isPlotOutlineVisible

        public boolean isPlotOutlineVisible()
        Returns the flag that controls whether or not the plot outline is visible.
        Returns:
        The flag that controls whether or not the plot outline is visible.
        See Also:
        setPlotOutlineVisible(boolean)
      • setPlotOutlineVisible

        public void setPlotOutlineVisible​(boolean visible)
        Sets the flag that controls whether or not the plot outline is visible and sends a PropertyChangeEvent to all registered listeners for the plotOutlineVisible property.
        Parameters:
        visible - the new flag value.
        See Also:
        isPlotOutlineVisible()
      • setPlotBackgroundAlpha

        public void setPlotBackgroundAlpha​(float alpha)
        Sets the alpha transparency used when filling the background of the plot area and sends a PropertyChangeEvent to all registered listeners for the plotBackgroundAlpha property.
        Parameters:
        alpha - the alpha transparency (in the range 0.0 to 1.0).
        See Also:
        getPlotBackgroundAlpha()
      • setPlotBackgroundPaint

        public void setPlotBackgroundPaint​(java.awt.Paint paint)
        Sets the background paint and sends a PropertyChangeEvent to all registered listeners for the plotBackgroundPaint property.
        Parameters:
        paint - the paint (null permitted).
        See Also:
        getPlotBackgroundPaint()
      • setLegendPosition

        public void setLegendPosition​(LegendPosition position)
        Sets the legend position and sends a PropertyChangeEvent to all registered listeners for the legendPosition property.
        Parameters:
        position - the position (null not permitted).
        See Also:
        getLegendPosition()
      • setLegendItemFont

        public void setLegendItemFont​(java.awt.Font font)
        Sets the font for the legend items and sends a PropertyChangeEvent to all registered listeners for the legendItemFont property.
        Parameters:
        font - the font (null not permitted).
        See Also:
        getLegendItemFont()
      • setLegendItemPaint

        public void setLegendItemPaint​(java.awt.Paint paint)
        Sets the paint used to display the legend items and sends a PropertyChangeEvent to all registered listeners for the legendItemPaint property.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getLegendItemPaint()
      • paintComponent

        protected void paintComponent​(java.awt.Graphics g)
        Paints this component, including the chart it contains.
        Overrides:
        paintComponent in class javax.swing.JComponent
        Parameters:
        g - the graphics target.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent event)
        If the user clicks on the chart, see if that translates into an event that we report...
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        event - the event.
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent e)
        Implementation of the MouseMotionListener's method.
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Parameters:
        e - the event.
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent e)
        Handles a 'mouse dragged' event.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        e - the mouse event.
      • createPopup

        protected javax.swing.JPopupMenu createPopup()
        Creates a popup menu for display on the component.
        Returns:
        A popup menu.
      • getScreenDataArea

        public java.awt.geom.Rectangle2D getScreenDataArea()
        Returns the data area for the chart (the area inside the axes) with the current scaling applied (that is, the area as it appears on screen).
        Returns:
        The scaled data area.
      • restoreAutoBounds

        public void restoreAutoBounds()
        Restores the auto-range calculation on both axes.
      • restoreAutoDomainBounds

        public void restoreAutoDomainBounds()
        Restores the auto-range calculation on the domain axis.
      • restoreAutoRangeBounds

        public void restoreAutoRangeBounds()
        Restores the auto-range calculation on the range axis.
      • translateJava2DToScreen

        public java.awt.Point translateJava2DToScreen​(java.awt.geom.Point2D java2DPoint)
        Translates a Java2D point on the chart to a screen location.
        Parameters:
        java2DPoint - the Java2D point.
        Returns:
        The screen location.
      • translateScreenToJava2D

        public java.awt.geom.Point2D translateScreenToJava2D​(java.awt.Point screenPoint)
        Translates a screen location to a Java2D point.
        Parameters:
        screenPoint - the screen location.
        Returns:
        The Java2D coordinates.
      • zoom

        public void zoom​(java.awt.geom.Rectangle2D selection)
        Zooms in on a selected region.
        Parameters:
        selection - the selected region.
      • setToolTipsEnabled

        protected void setToolTipsEnabled​(boolean flag)
        Switches the display of tooltips for the panel on or off. Note that tooltips can only be displayed if the chart has been configured to generate tooltip items.
        Parameters:
        flag - true to enable tooltips, false to disable tooltips.
      • getToolTipText

        public java.lang.String getToolTipText​(java.awt.event.MouseEvent e)
        Returns a string for the tooltip.
        Overrides:
        getToolTipText in class javax.swing.JComponent
        Parameters:
        e - the mouse event.
        Returns:
        A tool tip or null if no tooltip is available.
      • addLegendClickListener

        public void addLegendClickListener​(LegendClickListener listener)
        Registers a listener to receive notification of legend clicks.
        Parameters:
        listener - the listener (null not permitted).
      • removeLegendClickListener

        public void removeLegendClickListener​(LegendClickListener listener)
        Unregisters a listener so that it no longer receives notification of legend clicks.
        Parameters:
        listener - the listener (null not permitted).
      • chartChanged

        public void chartChanged​(org.jfree.chart.event.ChartChangeEvent event)
        Receives notification of changes to the chart, and redraws the chart.
        Specified by:
        chartChanged in interface org.jfree.chart.event.ChartChangeListener
        Parameters:
        event - details of the chart change event.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • doSaveAs

        protected void doSaveAs()
                         throws java.io.IOException
        Throws:
        java.io.IOException