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.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
-
-
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, ornull
.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 aPropertyChangeEvent
for theantiAlias
property.void
setChartBackgroundImage(java.awt.Image image)
Sets the background image for the chart and sends aPropertyChangeEvent
to all registered listeners for thechartBackgroundImage
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 aPropertyChangeEvent
to all registered listeners for thechartBackgroundPaint
property.void
setChartBorderPaint(java.awt.Paint paint)
Sets the paint used to draw the chart border, if it is visible, and sends aPropertyChangeEvent
to all registered listeners for thechartBorderPaint
property.void
setChartBorderStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the outline for the chart and sends aPropertyChangeEvent
to all registered listeners for thechartBorderPaint
property.void
setChartBorderVisible(boolean visible)
Sets the flag that controls whether or not a border is drawn around the chart, and fires aPropertyChangeEvent
for thechartBorderVisible
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 aPropertyChangeEvent
to all registered listeners for thelegendItemFont
property.void
setLegendItemPaint(java.awt.Paint paint)
Sets the paint used to display the legend items and sends aPropertyChangeEvent
to all registered listeners for thelegendItemPaint
property.void
setLegendPosition(LegendPosition position)
Sets the legend position and sends aPropertyChangeEvent
to all registered listeners for thelegendPosition
property.void
setPlotBackgroundAlpha(float alpha)
Sets the alpha transparency used when filling the background of the plot area and sends aPropertyChangeEvent
to all registered listeners for theplotBackgroundAlpha
property.void
setPlotBackgroundPaint(java.awt.Paint paint)
Sets the background paint and sends aPropertyChangeEvent
to all registered listeners for theplotBackgroundPaint
property.void
setPlotOutlineVisible(boolean visible)
Sets the flag that controls whether or not the plot outline is visible and sends aPropertyChangeEvent
to all registered listeners for theplotOutlineVisible
property.void
setSource(java.lang.String title)
Sets the text for the chart's source subtitle and sends aPropertyChangeEvent
to all registered listeners for thesource
property.void
setSourceFont(java.awt.Font font)
Sets the font for the chart's source subtitle and sends aPropertyChangeEvent
to all registered listeners for thesourceFont
property.void
setSourcePaint(java.awt.Paint paint)
Sets the paint for the chart's source subtitle and sends aPropertyChangeEvent
to all registered listeners for thesourcePaint
property.void
setSubtitle(java.lang.String title)
Sets the text for the chart's subtitle and sends aPropertyChangeEvent
to all registered listeners for thesubtitle
property.void
setSubtitleFont(java.awt.Font font)
Sets the font for the chart's subtitle and sends aPropertyChangeEvent
to all registered listeners for thesubtitleFont
property.void
setSubtitlePaint(java.awt.Paint paint)
Sets the paint for the chart's subtitle and sends aPropertyChangeEvent
to all registered listeners for thesubtitlePaint
property.void
setTitle(java.lang.String title)
Sets the text for the chart title and sends aPropertyChangeEvent
to all registered listeners for thetitle
property.void
setTitleFont(java.awt.Font font)
Sets the font for the chart title and sends aPropertyChangeEvent
to all registered listeners for thetitleFont
property.void
setTitlePaint(java.awt.Paint paint)
Sets the paint for the chart title and sends aPropertyChangeEvent
to all registered listeners for thetitlePaint
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
-
-
-
-
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 aPropertyChangeEvent
for theantiAlias
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 aPropertyChangeEvent
for thechartBorderVisible
property.- 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 aPropertyChangeEvent
to all registered listeners for thechartBorderPaint
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 aPropertyChangeEvent
to all registered listeners for thechartBorderPaint
property.- Parameters:
paint
- the paint (null
not 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 aPropertyChangeEvent
to all registered listeners for thechartBackgroundPaint
property.- Parameters:
paint
- the paint (null
permitted).- 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 aPropertyChangeEvent
to all registered listeners for thechartBackgroundImage
property.- Parameters:
image
- the image (null
permitted).- 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 aPropertyChangeEvent
to all registered listeners for thetitle
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 aPropertyChangeEvent
to all registered listeners for thetitleFont
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 aPropertyChangeEvent
to all registered listeners for thetitlePaint
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 aPropertyChangeEvent
to all registered listeners for thesubtitle
property.- 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 aPropertyChangeEvent
to all registered listeners for thesubtitleFont
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 aPropertyChangeEvent
to all registered listeners for thesubtitlePaint
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 aPropertyChangeEvent
to all registered listeners for thesource
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 aPropertyChangeEvent
to all registered listeners for thesourceFont
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 aPropertyChangeEvent
to all registered listeners for thesourcePaint
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 aPropertyChangeEvent
to all registered listeners for theplotOutlineVisible
property.- 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 aPropertyChangeEvent
to all registered listeners for theplotBackgroundAlpha
property.- 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 aPropertyChangeEvent
to all registered listeners for theplotBackgroundPaint
property.- Parameters:
paint
- the paint (null
permitted).- 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 aPropertyChangeEvent
to all registered listeners for thelegendPosition
property.- Parameters:
position
- the position (null
not 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 aPropertyChangeEvent
to all registered listeners for thelegendItemFont
property.- Parameters:
font
- the font (null
not 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 aPropertyChangeEvent
to all registered listeners for thelegendItemPaint
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 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:
mouseClicked
in interfacejava.awt.event.MouseListener
- Parameters:
event
- the event.
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
Implementation of the MouseMotionListener's method.- Specified by:
mouseMoved
in interfacejava.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 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
-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 classjavax.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).
-
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:
chartChanged
in interfaceorg.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 interfacejava.awt.event.ActionListener
-
doSaveAs
protected void doSaveAs() throws java.io.IOException
- Throws:
java.io.IOException
-
-