Package org.jfree.beans
Class AbstractChart
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- org.jfree.beans.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
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jfree.chart.JFreeChartchartThe underlying chart.protected java.awt.ImagechartBufferA buffer for the rendered chart.protected intchartBufferHeightThe height of the chart buffer.protected intchartBufferWidthThe width of the chart buffer.protected org.jfree.chart.ChartRenderingInfoinfoThe chart rendering info, which is used for tooltips and mouse events.protected org.jfree.chart.title.LegendTitlelegendThe chart's legend.protected LegendPositionlegendPositionThe current legend position (TOP, BOTTOM, LEFT, RIGHT or NONE).protected javax.swing.event.EventListenerListlistenersStorage for registered listeners.protected doublescaleXThe scale factor used to draw the chart.protected doublescaleYThe scale factor used to draw the chart.protected org.jfree.chart.title.TextTitlesourceSubtitleA subtitle that shows the data source.protected org.jfree.chart.title.TextTitlesubtitleA 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
-
-
Constructor Summary
Constructors Constructor Description AbstractChart()Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)voidaddLegendClickListener(LegendClickListener listener)Registers a listener to receive notification of legend clicks.voidchartChanged(org.jfree.chart.event.ChartChangeEvent event)Receives notification of changes to the chart, and redraws the chart.protected abstract org.jfree.chart.JFreeChartcreateDefaultChart()Creates the default chart for initial display to the user.protected javax.swing.JPopupMenucreatePopup()Creates a popup menu for display on the component.protected voiddoSaveAs()voidfireLegendClickEvent(LegendClickEvent event)Fires a legend click event.booleangetAntiAlias()Returns the flag that controls whether or not the chart is drawn with antialiasing.java.awt.ImagegetChartBackgroundImage()Returns the background image for the chart.floatgetChartBackgroundImageAlpha()Returns the alpha-transparency for the background image.java.awt.PaintgetChartBackgroundPaint()Returns the background paint for the chart.java.awt.PaintgetChartBorderPaint()Returns the paint used to draw the chart border, if it is visible.java.awt.StrokegetChartBorderStroke()Returns the stroke used to draw the outline for the chart.org.jfree.ui.RectangleInsetsgetChartPadding()Returns the chart padding.java.awt.FontgetLegendItemFont()Returns the font for the legend items.java.awt.PaintgetLegendItemPaint()Returns the paint used to display the legend items.LegendPositiongetLegendPosition()Returns the legend position.floatgetPlotBackgroundAlpha()Returns the alpha transparency used when filling the background of the plot area.java.awt.PaintgetPlotBackgroundPaint()Returns the background paint for the plot, ornull.java.awt.geom.Rectangle2DgetScreenDataArea()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.StringgetSource()Returns the text for the chart's source subtitle.java.awt.FontgetSourceFont()Returns the font for the chart's source subtitle.java.awt.PaintgetSourcePaint()Returns the paint used to draw the chart's source subtitle.java.lang.StringgetSubtitle()Returns the text for the chart's subtitle.java.awt.FontgetSubtitleFont()Returns the font for the chart's subtitle.java.awt.PaintgetSubtitlePaint()Returns the paint used to draw the chart's subtitle.java.lang.StringgetTitle()Returns the text for the chart title.java.awt.FontgetTitleFont()Returns the font for the chart title.java.awt.PaintgetTitlePaint()Returns the paint used to draw the chart title.java.lang.StringgetToolTipText(java.awt.event.MouseEvent e)Returns a string for the tooltip.booleanisChartBorderVisible()Returns a flag that controls whether or not the chart border is visible.booleanisPlotOutlineVisible()Returns the flag that controls whether or not the plot outline is visible.voidmouseClicked(java.awt.event.MouseEvent event)If the user clicks on the chart, see if that translates into an event that we report...voidmouseDragged(java.awt.event.MouseEvent e)Handles a 'mouse dragged' event.voidmouseEntered(java.awt.event.MouseEvent e)voidmouseExited(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent e)Implementation of the MouseMotionListener's method.voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)protected voidpaintComponent(java.awt.Graphics g)Paints this component, including the chart it contains.voidremoveLegendClickListener(LegendClickListener listener)Unregisters a listener so that it no longer receives notification of legend clicks.voidrestoreAutoBounds()Restores the auto-range calculation on both axes.voidrestoreAutoDomainBounds()Restores the auto-range calculation on the domain axis.voidrestoreAutoRangeBounds()Restores the auto-range calculation on the range axis.voidsetAntiAlias(boolean flag)Sets the flag that controls whether or not the chart is drawn with antialiasing, and fires aPropertyChangeEventfor theantiAliasproperty.voidsetChartBackgroundImage(java.awt.Image image)Sets the background image for the chart and sends aPropertyChangeEventto all registered listeners for thechartBackgroundImageproperty.voidsetChartBackgroundImageAlpha(float alpha)Sets the alpha transparency for the background image.voidsetChartBackgroundPaint(java.awt.Paint paint)Sets the background paint for the chart and sends aPropertyChangeEventto all registered listeners for thechartBackgroundPaintproperty.voidsetChartBorderPaint(java.awt.Paint paint)Sets the paint used to draw the chart border, if it is visible, and sends aPropertyChangeEventto all registered listeners for thechartBorderPaintproperty.voidsetChartBorderStroke(java.awt.Stroke stroke)Sets the stroke used to draw the outline for the chart and sends aPropertyChangeEventto all registered listeners for thechartBorderPaintproperty.voidsetChartBorderVisible(boolean visible)Sets the flag that controls whether or not a border is drawn around the chart, and fires aPropertyChangeEventfor thechartBorderVisibleproperty.voidsetChartPadding(org.jfree.ui.RectangleInsets padding)Sets the chart padding.voidsetLegendItemFont(java.awt.Font font)Sets the font for the legend items and sends aPropertyChangeEventto all registered listeners for thelegendItemFontproperty.voidsetLegendItemPaint(java.awt.Paint paint)Sets the paint used to display the legend items and sends aPropertyChangeEventto all registered listeners for thelegendItemPaintproperty.voidsetLegendPosition(LegendPosition position)Sets the legend position and sends aPropertyChangeEventto all registered listeners for thelegendPositionproperty.voidsetPlotBackgroundAlpha(float alpha)Sets the alpha transparency used when filling the background of the plot area and sends aPropertyChangeEventto all registered listeners for theplotBackgroundAlphaproperty.voidsetPlotBackgroundPaint(java.awt.Paint paint)Sets the background paint and sends aPropertyChangeEventto all registered listeners for theplotBackgroundPaintproperty.voidsetPlotOutlineVisible(boolean visible)Sets the flag that controls whether or not the plot outline is visible and sends aPropertyChangeEventto all registered listeners for theplotOutlineVisibleproperty.voidsetSource(java.lang.String title)Sets the text for the chart's source subtitle and sends aPropertyChangeEventto all registered listeners for thesourceproperty.voidsetSourceFont(java.awt.Font font)Sets the font for the chart's source subtitle and sends aPropertyChangeEventto all registered listeners for thesourceFontproperty.voidsetSourcePaint(java.awt.Paint paint)Sets the paint for the chart's source subtitle and sends aPropertyChangeEventto all registered listeners for thesourcePaintproperty.voidsetSubtitle(java.lang.String title)Sets the text for the chart's subtitle and sends aPropertyChangeEventto all registered listeners for thesubtitleproperty.voidsetSubtitleFont(java.awt.Font font)Sets the font for the chart's subtitle and sends aPropertyChangeEventto all registered listeners for thesubtitleFontproperty.voidsetSubtitlePaint(java.awt.Paint paint)Sets the paint for the chart's subtitle and sends aPropertyChangeEventto all registered listeners for thesubtitlePaintproperty.voidsetTitle(java.lang.String title)Sets the text for the chart title and sends aPropertyChangeEventto all registered listeners for thetitleproperty.voidsetTitleFont(java.awt.Font font)Sets the font for the chart title and sends aPropertyChangeEventto all registered listeners for thetitleFontproperty.voidsetTitlePaint(java.awt.Paint paint)Sets the paint for the chart title and sends aPropertyChangeEventto all registered listeners for thetitlePaintproperty.protected voidsetToolTipsEnabled(boolean flag)Switches the display of tooltips for the panel on or off.java.awt.PointtranslateJava2DToScreen(java.awt.geom.Point2D java2DPoint)Translates a Java2D point on the chart to a screen location.java.awt.geom.Point2DtranslateScreenToJava2D(java.awt.Point screenPoint)Translates a screen location to a Java2D point.voidzoom(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
-
-
-
-
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.
-
legendPosition
protected LegendPosition legendPosition
The current legend position (TOP, BOTTOM, LEFT, RIGHT or NONE).
-
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.
-
chartBufferHeight
protected int chartBufferHeight
The height of the chart buffer.
-
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
-
AbstractChart
public AbstractChart()
Default constructor.
-
-
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 aPropertyChangeEventfor theantiAliasproperty.- 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 aPropertyChangeEventfor thechartBorderVisibleproperty.- Parameters:
visible- the new value for the flag.- See Also:
isChartBorderVisible()
-
getChartBorderStroke
public java.awt.Stroke getChartBorderStroke()
Returns the stroke used to draw the outline for the chart.- Returns:
- The stroke.
- See Also:
setChartBorderStroke(Stroke)
-
setChartBorderStroke
public void setChartBorderStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the outline for the chart and sends aPropertyChangeEventto all registered listeners for thechartBorderPaintproperty.- Parameters:
stroke- the stroke (nullnot 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 aPropertyChangeEventto all registered listeners for thechartBorderPaintproperty.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getChartBorderPaint()
-
getChartBackgroundPaint
public java.awt.Paint getChartBackgroundPaint()
Returns the background paint for the chart.- Returns:
- The background paint for the chart (possibly
null). - See Also:
setChartBackgroundPaint(Paint)
-
setChartBackgroundPaint
public void setChartBackgroundPaint(java.awt.Paint paint)
Sets the background paint for the chart and sends aPropertyChangeEventto all registered listeners for thechartBackgroundPaintproperty.- Parameters:
paint- the paint (nullpermitted).- See Also:
getChartBackgroundPaint()
-
getChartBackgroundImage
public java.awt.Image getChartBackgroundImage()
Returns the background image for the chart.- Returns:
- The image (possibly
null). - See Also:
setChartBackgroundImage(Image)
-
setChartBackgroundImage
public void setChartBackgroundImage(java.awt.Image image)
Sets the background image for the chart and sends aPropertyChangeEventto all registered listeners for thechartBackgroundImageproperty.- Parameters:
image- the image (nullpermitted).- See Also:
getChartBackgroundImage()
-
getChartBackgroundImageAlpha
public float getChartBackgroundImageAlpha()
Returns the alpha-transparency for the background image.- Returns:
- The alpha value.
- See Also:
setChartBackgroundImageAlpha(float)
-
setChartBackgroundImageAlpha
public void setChartBackgroundImageAlpha(float alpha)
Sets the alpha transparency for the background image.- Parameters:
alpha- the new value.- See Also:
getChartBackgroundImageAlpha()
-
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 aPropertyChangeEventto all registered listeners for thetitleproperty.- Parameters:
title- the title (nullnot 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 aPropertyChangeEventto all registered listeners for thetitleFontproperty.- 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 aPropertyChangeEventto all registered listeners for thetitlePaintproperty.- 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 aPropertyChangeEventto all registered listeners for thesubtitleproperty.- Parameters:
title- the title.- See Also:
getSubtitle()
-
getSubtitleFont
public java.awt.Font getSubtitleFont()
Returns the font for the chart's subtitle.- Returns:
- The font for the chart's subtitle.
- See Also:
setSubtitleFont(Font)
-
setSubtitleFont
public void setSubtitleFont(java.awt.Font font)
Sets the font for the chart's subtitle and sends aPropertyChangeEventto all registered listeners for thesubtitleFontproperty.- Parameters:
font- the font (nullnot 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 aPropertyChangeEventto all registered listeners for thesubtitlePaintproperty.- Parameters:
paint- the paint (nullnot 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 aPropertyChangeEventto all registered listeners for thesourceproperty.- 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 aPropertyChangeEventto all registered listeners for thesourceFontproperty.- Parameters:
font- the font (nullnot 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 aPropertyChangeEventto all registered listeners for thesourcePaintproperty.- Parameters:
paint- the paint (nullnot 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 aPropertyChangeEventto all registered listeners for theplotOutlineVisibleproperty.- Parameters:
visible- the new flag value.- See Also:
isPlotOutlineVisible()
-
getPlotBackgroundAlpha
public float getPlotBackgroundAlpha()
Returns the alpha transparency used when filling the background of the plot area.- Returns:
- The alpha transparency.
- See Also:
setPlotBackgroundAlpha(float)
-
setPlotBackgroundAlpha
public void setPlotBackgroundAlpha(float alpha)
Sets the alpha transparency used when filling the background of the plot area and sends aPropertyChangeEventto all registered listeners for theplotBackgroundAlphaproperty.- Parameters:
alpha- the alpha transparency (in the range 0.0 to 1.0).- See Also:
getPlotBackgroundAlpha()
-
getPlotBackgroundPaint
public java.awt.Paint getPlotBackgroundPaint()
Returns the background paint for the plot, ornull.- Returns:
- The background paint (possibly
null). - See Also:
setPlotBackgroundPaint(Paint)
-
setPlotBackgroundPaint
public void setPlotBackgroundPaint(java.awt.Paint paint)
Sets the background paint and sends aPropertyChangeEventto all registered listeners for theplotBackgroundPaintproperty.- Parameters:
paint- the paint (nullpermitted).- See Also:
getPlotBackgroundPaint()
-
getLegendPosition
public LegendPosition getLegendPosition()
Returns the legend position.- Returns:
- The legend position.
- See Also:
setLegendPosition(LegendPosition)
-
setLegendPosition
public void setLegendPosition(LegendPosition position)
Sets the legend position and sends aPropertyChangeEventto all registered listeners for thelegendPositionproperty.- Parameters:
position- the position (nullnot permitted).- See Also:
getLegendPosition()
-
getLegendItemFont
public java.awt.Font getLegendItemFont()
Returns the font for the legend items.- Returns:
- The font.
- See Also:
setLegendItemFont(Font)
-
setLegendItemFont
public void setLegendItemFont(java.awt.Font font)
Sets the font for the legend items and sends aPropertyChangeEventto all registered listeners for thelegendItemFontproperty.- Parameters:
font- the font (nullnot permitted).- See Also:
getLegendItemFont()
-
getLegendItemPaint
public java.awt.Paint getLegendItemPaint()
Returns the paint used to display the legend items.- Returns:
- The paint.
- See Also:
setLegendItemPaint(Paint)
-
setLegendItemPaint
public void setLegendItemPaint(java.awt.Paint paint)
Sets the paint used to display the legend items and sends aPropertyChangeEventto all registered listeners for thelegendItemPaintproperty.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getLegendItemPaint()
-
paintComponent
protected void paintComponent(java.awt.Graphics g)
Paints this component, including the chart it contains.- Overrides:
paintComponentin classjavax.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:
mouseClickedin interfacejava.awt.event.MouseListener- Parameters:
event- the event.
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
Implementation of the MouseMotionListener's method.- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Parameters:
e- the event.
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
Handles a 'mouse dragged' event.- Specified by:
mouseDraggedin interfacejava.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-trueto enable tooltips,falseto disable tooltips.
-
getToolTipText
public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
Returns a string for the tooltip.- Overrides:
getToolTipTextin classjavax.swing.JComponent- Parameters:
e- the mouse event.- Returns:
- A tool tip or
nullif no tooltip is available.
-
addLegendClickListener
public void addLegendClickListener(LegendClickListener listener)
Registers a listener to receive notification of legend clicks.- Parameters:
listener- the listener (nullnot permitted).
-
removeLegendClickListener
public void removeLegendClickListener(LegendClickListener listener)
Unregisters a listener so that it no longer receives notification of legend clicks.- Parameters:
listener- the listener (nullnot permitted).
-
fireLegendClickEvent
public void fireLegendClickEvent(LegendClickEvent event)
Fires a legend click event.- Parameters:
event- the event.
-
chartChanged
public void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
Receives notification of changes to the chart, and redraws the chart.- Specified by:
chartChangedin interfaceorg.jfree.chart.event.ChartChangeListener- Parameters:
event- details of the chart change event.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
doSaveAs
protected void doSaveAs() throws java.io.IOException
- Throws:
java.io.IOException
-
-