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
javax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and 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.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
AbstractChart()
Default constructor.
|
| Modifier and Type | Method and 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.
|
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, 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, updateUIadd, 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, validateTreeaction, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected org.jfree.chart.JFreeChart chart
protected org.jfree.chart.title.LegendTitle legend
protected LegendPosition legendPosition
protected org.jfree.chart.title.TextTitle subtitle
protected org.jfree.chart.title.TextTitle sourceSubtitle
protected org.jfree.chart.ChartRenderingInfo info
protected javax.swing.event.EventListenerList listeners
protected java.awt.Image chartBuffer
protected int chartBufferHeight
protected int chartBufferWidth
protected double scaleX
protected double scaleY
public AbstractChart()
protected abstract org.jfree.chart.JFreeChart createDefaultChart()
public boolean getAntiAlias()
setAntiAlias(boolean)public void setAntiAlias(boolean flag)
PropertyChangeEvent for the
antiAlias property.flag - the new flag value.getAntiAlias()public boolean isChartBorderVisible()
setChartBorderVisible(boolean)public void setChartBorderVisible(boolean visible)
PropertyChangeEvent for the
chartBorderVisible property.visible - the new value for the flag.isChartBorderVisible()public java.awt.Stroke getChartBorderStroke()
setChartBorderStroke(Stroke)public void setChartBorderStroke(java.awt.Stroke stroke)
PropertyChangeEvent to all registered listeners for the
chartBorderPaint property.stroke - the stroke (null not permitted).getChartBorderStroke()public java.awt.Paint getChartBorderPaint()
null).setChartBorderPaint(Paint)public void setChartBorderPaint(java.awt.Paint paint)
PropertyChangeEvent to all registered listeners for the
chartBorderPaint property.paint - the paint (null not permitted).getChartBorderPaint()public java.awt.Paint getChartBackgroundPaint()
null).setChartBackgroundPaint(Paint)public void setChartBackgroundPaint(java.awt.Paint paint)
PropertyChangeEvent to all registered listeners for the
chartBackgroundPaint property.paint - the paint (null permitted).getChartBackgroundPaint()public java.awt.Image getChartBackgroundImage()
null).setChartBackgroundImage(Image)public void setChartBackgroundImage(java.awt.Image image)
PropertyChangeEvent to all registered listeners for the
chartBackgroundImage property.image - the image (null permitted).getChartBackgroundImage()public float getChartBackgroundImageAlpha()
setChartBackgroundImageAlpha(float)public void setChartBackgroundImageAlpha(float alpha)
alpha - the new value.getChartBackgroundImageAlpha()public org.jfree.ui.RectangleInsets getChartPadding()
public void setChartPadding(org.jfree.ui.RectangleInsets padding)
padding - the padding.public java.lang.String getTitle()
setTitle(String)public void setTitle(java.lang.String title)
PropertyChangeEvent to all registered listeners for the
title property.title - the title (null not permitted).getTitle()public java.awt.Font getTitleFont()
setTitleFont(Font)public void setTitleFont(java.awt.Font font)
PropertyChangeEvent to all registered listeners for the
titleFont property.font - the font.getTitleFont()public java.awt.Paint getTitlePaint()
getTitlePaint()public void setTitlePaint(java.awt.Paint paint)
PropertyChangeEvent to all registered listeners for the
titlePaint property.paint - the paint.getTitlePaint()public java.lang.String getSubtitle()
setSubtitle(String)public void setSubtitle(java.lang.String title)
PropertyChangeEvent to all registered listeners for the
subtitle property.title - the title.getSubtitle()public java.awt.Font getSubtitleFont()
setSubtitleFont(Font)public void setSubtitleFont(java.awt.Font font)
PropertyChangeEvent to all registered listeners for the
subtitleFont property.font - the font (null not permitted).getSubtitleFont()public java.awt.Paint getSubtitlePaint()
setSubtitlePaint(Paint)public void setSubtitlePaint(java.awt.Paint paint)
PropertyChangeEvent to all registered listeners for the
subtitlePaint property.paint - the paint (null not permitted).getSubtitlePaint()public java.lang.String getSource()
setSource(String)public void setSource(java.lang.String title)
PropertyChangeEvent to all registered listeners for the
source property.title - the title.getSource()public java.awt.Font getSourceFont()
setSourceFont(Font)public void setSourceFont(java.awt.Font font)
PropertyChangeEvent to all registered listeners for the
sourceFont property.font - the font (null not permitted).getSourceFont()public java.awt.Paint getSourcePaint()
setSourcePaint(Paint)public void setSourcePaint(java.awt.Paint paint)
PropertyChangeEvent to all registered listeners for the
sourcePaint property.paint - the paint (null not permitted).getSourcePaint()public boolean isPlotOutlineVisible()
setPlotOutlineVisible(boolean)public void setPlotOutlineVisible(boolean visible)
PropertyChangeEvent to all
registered listeners for the plotOutlineVisible property.visible - the new flag value.isPlotOutlineVisible()public float getPlotBackgroundAlpha()
setPlotBackgroundAlpha(float)public void setPlotBackgroundAlpha(float alpha)
PropertyChangeEvent to all
registered listeners for the plotBackgroundAlpha property.alpha - the alpha transparency (in the range 0.0 to 1.0).getPlotBackgroundAlpha()public java.awt.Paint getPlotBackgroundPaint()
null.null).setPlotBackgroundPaint(Paint)public void setPlotBackgroundPaint(java.awt.Paint paint)
PropertyChangeEvent to all
registered listeners for the plotBackgroundPaint property.paint - the paint (null permitted).getPlotBackgroundPaint()public LegendPosition getLegendPosition()
setLegendPosition(LegendPosition)public void setLegendPosition(LegendPosition position)
PropertyChangeEvent to all
registered listeners for the legendPosition property.position - the position (null not permitted).getLegendPosition()public java.awt.Font getLegendItemFont()
setLegendItemFont(Font)public void setLegendItemFont(java.awt.Font font)
PropertyChangeEvent to all registered listeners for the
legendItemFont property.font - the font (null not permitted).getLegendItemFont()public java.awt.Paint getLegendItemPaint()
setLegendItemPaint(Paint)public void setLegendItemPaint(java.awt.Paint paint)
PropertyChangeEvent to all registered listeners for the
legendItemPaint property.paint - the paint (null not permitted).getLegendItemPaint()protected void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the graphics target.public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked in interface java.awt.event.MouseListenerevent - the event.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenere - the event.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - the mouse event.protected javax.swing.JPopupMenu createPopup()
public java.awt.geom.Rectangle2D getScreenDataArea()
public void restoreAutoBounds()
public void restoreAutoDomainBounds()
public void restoreAutoRangeBounds()
public java.awt.Point translateJava2DToScreen(java.awt.geom.Point2D java2DPoint)
java2DPoint - the Java2D point.public java.awt.geom.Point2D translateScreenToJava2D(java.awt.Point screenPoint)
screenPoint - the screen location.public void zoom(java.awt.geom.Rectangle2D selection)
selection - the selected region.protected void setToolTipsEnabled(boolean flag)
flag - true to enable tooltips, false to
disable tooltips.public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
getToolTipText in class javax.swing.JComponente - the mouse event.null if no tooltip is available.public void addLegendClickListener(LegendClickListener listener)
listener - the listener (null not permitted).public void removeLegendClickListener(LegendClickListener listener)
listener - the listener (null not permitted).public void fireLegendClickEvent(LegendClickEvent event)
event - the event.public void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
chartChanged in interface org.jfree.chart.event.ChartChangeListenerevent - details of the chart change event.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerprotected void doSaveAs() throws java.io.IOException
java.io.IOException