| org.jfree.experimental.chart.swt.ChartComposite
ChartComposite | public class ChartComposite extends Composite implements ChartChangeListener,ChartProgressListener,SelectionListener,Printable(Code) | | A SWT GUI composite for displaying a
JFreeChart object.
The composite listens to the chart to receive notification of changes to any
component of the chart. The chart is redrawn automatically whenever this
notification is received.
|
Constructor Summary | |
public | ChartComposite(Composite comp, int style) Create a new chart composite with a default FillLayout. | public | ChartComposite(Composite comp, int style, JFreeChart chart) Constructs a panel that displays the specified chart. | public | ChartComposite(Composite comp, int style, JFreeChart chart, boolean useBuffer) Constructs a panel containing a chart. | public | ChartComposite(Composite comp, int style, JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) Constructs a JFreeChart panel. | public | ChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height, int minimumDrawW, int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) Constructs a JFreeChart panel. |
Method Summary | |
public void | chartChanged(ChartChangeEvent event) Receives notification of changes to the chart, and redraws the chart. | public void | chartProgress(ChartProgressEvent event) Receives notification of a chart progress event. | public void | createChartPrintJob() Creates a print job for the chart. | protected Menu | createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom) Creates a popup menu for the canvas.
Parameters: properties - include a menu item for the chart property editor. Parameters: save - include a menu item for saving the chart. Parameters: print - include a menu item for printing the chart. Parameters: zoom - include menu items for zooming. | protected void | displayPopupMenu(int x, int y) The idea is to modify the zooming options depending on the type of chart
being displayed by the panel. | public void | doSaveAs() Opens a file chooser and gives the user an opportunity to save the chart
in PNG format. | public void | forceRedraw() Forces a redraw of the canvas by invoking a new PaintEvent. | public Point2D | getAnchor() Returns the anchor point. | public JFreeChart | getChart() Returns the chart contained in the panel. | public boolean | getHorizontalAxisTrace() Returns the flag that controls whether or not a horizontal axis trace
line is drawn over the plot area at the current mouse location. | public double | getScaleX() Returns the X scale factor for the chart. | public double | getScaleY() Returns the Y scale factory for the chart. | public Rectangle | 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). | public Rectangle | getScreenDataArea(int x, int y) Returns the data area (the area inside the axes) for the plot or subplot,
with the current scaling applied.
Parameters: x - the x-coordinate (for subplot selection). Parameters: y - the y-coordinate (for subplot selection). | public String | getToolTipText(org.eclipse.swt.events.MouseEvent e) Returns a string for the tooltip.
Parameters: e - the mouse event. | public boolean | getVerticalAxisTrace() Returns the flag that controls whether or not a vertical axis trace
line is drawn over the plot area at the current mouse location. | public double | getZoomInFactor() Returns the zoom in factor. | public double | getZoomOutFactor() Returns the zoom out factor. | public boolean | isEnforceFileExtensions() Returns true if file extensions should be enforced, and
false otherwise. | public int | print(Graphics graphics, PageFormat pageFormat, int pageIndex) | public void | restoreAutoBounds() Restores the auto-range calculation on both axes. | public void | restoreAutoDomainBounds() Restores the auto-range calculation on the domain axis. | public void | restoreAutoRangeBounds() Restores the auto-range calculation on the range axis. | public Rectangle | scale(Rectangle2D rect) Applies any scaling that is in effect for the chart drawing to the
given rectangle.
Parameters: rect - the rectangle. | protected void | setAnchor(Point2D anchor) Sets the anchor point. | public void | setChart(JFreeChart chart) Sets the chart that is displayed in the panel. | public void | setDisplayToolTips(boolean displayToolTips) | public void | setEnforceFileExtensions(boolean enforce) Sets a flag that controls whether or not file extensions are enforced. | public void | setHorizontalAxisTrace(boolean flag) A flag that controls trace lines on the horizontal axis. | public void | setVerticalAxisTrace(boolean flag) A flag that controls trace lines on the vertical axis. | public void | setZoomInFactor(double factor) Sets the zoom in factor. | public void | setZoomOutFactor(double factor) Sets the zoom out factor. | public Point | translateJava2DToScreen(Point2D java2DPoint) Translates a Java2D point on the chart to a screen location.
Parameters: java2DPoint - the Java2D point. | public Point2D | translateScreenToJava2D(Point screenPoint) Translates a screen location to a Java2D point.
Parameters: screenPoint - the screen location. | public Point | translateScreenToJavaSWT(Point screenPoint) Translates a screen location to a Java SWT point.
Parameters: screenPoint - the screen location. | public void | widgetDefaultSelected(SelectionEvent e) Handles action events generated by the popup menu. | public void | widgetSelected(SelectionEvent e) Handles action events generated by the popup menu. | public void | zoom(Rectangle selection) Zooms in on a selected region. | public void | zoomInBoth(double x, double y) Zooms in on an anchor point (specified in screen coordinate space). | public void | zoomInDomain(double x, double y) Decreases the length of the domain axis, centered about the given
coordinate on the screen. | public void | zoomInRange(double x, double y) Decreases the length of the range axis, centered about the given
coordinate on the screen. | public void | zoomOutBoth(double x, double y) Zooms out on an anchor point (specified in screen coordinate space). | public void | zoomOutDomain(double x, double y) Increases the length of the domain axis, centered about the given
coordinate on the screen. | public void | zoomOutRange(double x, double y) Increases the length the range axis, centered about the given
coordinate on the screen. |
DEFAULT_BUFFER_USED | final public static boolean DEFAULT_BUFFER_USED(Code) | | Default setting for buffer usage.
|
DEFAULT_HEIGHT | final public static int DEFAULT_HEIGHT(Code) | | The default panel height.
|
DEFAULT_MAXIMUM_DRAW_HEIGHT | final public static int DEFAULT_MAXIMUM_DRAW_HEIGHT(Code) | | The default limit below which chart scaling kicks in.
|
DEFAULT_MAXIMUM_DRAW_WIDTH | final public static int DEFAULT_MAXIMUM_DRAW_WIDTH(Code) | | The default limit below which chart scaling kicks in.
|
DEFAULT_MINIMUM_DRAW_HEIGHT | final public static int DEFAULT_MINIMUM_DRAW_HEIGHT(Code) | | The default limit below which chart scaling kicks in.
|
DEFAULT_MINIMUM_DRAW_WIDTH | final public static int DEFAULT_MINIMUM_DRAW_WIDTH(Code) | | The default limit below which chart scaling kicks in.
|
DEFAULT_WIDTH | final public static int DEFAULT_WIDTH(Code) | | The default panel width.
|
DEFAULT_ZOOM_TRIGGER_DISTANCE | final public static int DEFAULT_ZOOM_TRIGGER_DISTANCE(Code) | | The minimum size required to perform a zoom on a rectangle
|
PRINT_COMMAND | final public static String PRINT_COMMAND(Code) | | Print action command.
|
PROPERTIES_COMMAND | final public static String PROPERTIES_COMMAND(Code) | | Properties action command.
|
SAVE_COMMAND | final public static String SAVE_COMMAND(Code) | | Save action command.
|
ZOOM_IN_BOTH_COMMAND | final public static String ZOOM_IN_BOTH_COMMAND(Code) | | Zoom in (both axes) action command.
|
ZOOM_IN_DOMAIN_COMMAND | final public static String ZOOM_IN_DOMAIN_COMMAND(Code) | | Zoom in (domain axis only) action command.
|
ZOOM_IN_RANGE_COMMAND | final public static String ZOOM_IN_RANGE_COMMAND(Code) | | Zoom in (range axis only) action command.
|
ZOOM_OUT_BOTH_COMMAND | final public static String ZOOM_OUT_BOTH_COMMAND(Code) | | Zoom out (both axes) action command.
|
ZOOM_OUT_DOMAIN_COMMAND | final public static String ZOOM_OUT_DOMAIN_COMMAND(Code) | | Zoom out (domain axis only) action command.
|
ZOOM_OUT_RANGE_COMMAND | final public static String ZOOM_OUT_RANGE_COMMAND(Code) | | Zoom out (range axis only) action command.
|
ZOOM_RESET_BOTH_COMMAND | final public static String ZOOM_RESET_BOTH_COMMAND(Code) | | Zoom reset (both axes) action command.
|
ZOOM_RESET_DOMAIN_COMMAND | final public static String ZOOM_RESET_DOMAIN_COMMAND(Code) | | Zoom reset (domain axis only) action command.
|
ZOOM_RESET_RANGE_COMMAND | final public static String ZOOM_RESET_RANGE_COMMAND(Code) | | Zoom reset (range axis only) action command.
|
localizationResources | protected static ResourceBundle localizationResources(Code) | | The resourceBundle for the localization.
|
ChartComposite | public ChartComposite(Composite comp, int style)(Code) | | Create a new chart composite with a default FillLayout.
This way, when drawn, the chart will fill all the space.
Parameters: comp - The parent. Parameters: style - The style of the composite. |
ChartComposite | public ChartComposite(Composite comp, int style, JFreeChart chart)(Code) | | Constructs a panel that displays the specified chart.
Parameters: comp - The parent. Parameters: style - The style of the composite. Parameters: chart - the chart. |
ChartComposite | public ChartComposite(Composite comp, int style, JFreeChart chart, boolean useBuffer)(Code) | | Constructs a panel containing a chart.
Parameters: comp - The parent. Parameters: style - The style of the composite. Parameters: chart - the chart. Parameters: useBuffer - a flag controlling whether or not an off-screen bufferis used. |
ChartComposite | public ChartComposite(Composite comp, int style, JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)(Code) | | Constructs a JFreeChart panel.
Parameters: comp - The parent. Parameters: style - The style of the composite. Parameters: chart - the chart. Parameters: properties - a flag indicating whether or not the chart propertyeditor should be available via the popup menu. Parameters: save - a flag indicating whether or not save options should beavailable via the popup menu. Parameters: print - a flag indicating whether or not the print optionshould be available via the popup menu. Parameters: zoom - a flag indicating whether or not zoom options shouldbe added to the popup menu. Parameters: tooltips - a flag indicating whether or not tooltips should beenabled for the chart. |
ChartComposite | public ChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height, int minimumDrawW, int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)(Code) | | Constructs a JFreeChart panel.
Parameters: comp - The parent. Parameters: style - The style of the composite. Parameters: jfreechart - the chart. Parameters: width - the preferred width of the panel. Parameters: height - the preferred height of the panel. Parameters: minimumDrawW - the minimum drawing width. Parameters: minimumDrawH - the minimum drawing height. Parameters: maximumDrawW - the maximum drawing width. Parameters: maximumDrawH - the maximum drawing height. Parameters: usingBuffer - a flag that indicates whether to use the off-screenbuffer to improve performance (at the expense of memory). Parameters: properties - a flag indicating whether or not the chart propertyeditor should be available via the popup menu. Parameters: save - a flag indicating whether or not save options should beavailable via the popup menu. Parameters: print - a flag indicating whether or not the print optionshould be available via the popup menu. Parameters: zoom - a flag indicating whether or not zoom options should be added to the popup menu. Parameters: tooltips - a flag indicating whether or not tooltips should be enabled for the chart. |
chartChanged | public void chartChanged(ChartChangeEvent event)(Code) | | Receives notification of changes to the chart, and redraws the chart.
Parameters: event - details of the chart change event. |
chartProgress | public void chartProgress(ChartProgressEvent event)(Code) | | Receives notification of a chart progress event.
Parameters: event - the event. |
createChartPrintJob | public void createChartPrintJob()(Code) | | Creates a print job for the chart.
|
createPopupMenu | protected Menu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom)(Code) | | Creates a popup menu for the canvas.
Parameters: properties - include a menu item for the chart property editor. Parameters: save - include a menu item for saving the chart. Parameters: print - include a menu item for printing the chart. Parameters: zoom - include menu items for zooming. The popup menu. |
displayPopupMenu | protected void displayPopupMenu(int x, int y)(Code) | | The idea is to modify the zooming options depending on the type of chart
being displayed by the panel.
Parameters: x - horizontal position of the popup. Parameters: y - vertical position of the popup. |
doSaveAs | public void doSaveAs() throws IOException(Code) | | Opens a file chooser and gives the user an opportunity to save the chart
in PNG format.
throws: IOException - if there is an I/O error. |
forceRedraw | public void forceRedraw()(Code) | | Forces a redraw of the canvas by invoking a new PaintEvent.
|
getAnchor | public Point2D getAnchor()(Code) | | Returns the anchor point.
The anchor point (possibly null ). |
getChart | public JFreeChart getChart()(Code) | | Returns the chart contained in the panel.
The chart (possibly null ). |
getHorizontalAxisTrace | public boolean getHorizontalAxisTrace()(Code) | | Returns the flag that controls whether or not a horizontal axis trace
line is drawn over the plot area at the current mouse location.
A boolean. |
getScaleX | public double getScaleX()(Code) | | Returns the X scale factor for the chart. This will be 1.0 if no
scaling has been used.
The scale factor. |
getScaleY | public double getScaleY()(Code) | | Returns the Y scale factory for the chart. This will be 1.0 if no
scaling has been used.
The scale factor. |
getScreenDataArea | public Rectangle getScreenDataArea()(Code) | | 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).
The scaled data area. |
getScreenDataArea | public Rectangle getScreenDataArea(int x, int y)(Code) | | Returns the data area (the area inside the axes) for the plot or subplot,
with the current scaling applied.
Parameters: x - the x-coordinate (for subplot selection). Parameters: y - the y-coordinate (for subplot selection). The scaled data area. |
getToolTipText | public String getToolTipText(org.eclipse.swt.events.MouseEvent e)(Code) | | Returns a string for the tooltip.
Parameters: e - the mouse event. A tool tip or null if no tooltip is available. |
getVerticalAxisTrace | public boolean getVerticalAxisTrace()(Code) | | Returns the flag that controls whether or not a vertical axis trace
line is drawn over the plot area at the current mouse location.
A boolean. |
isEnforceFileExtensions | public boolean isEnforceFileExtensions()(Code) | | Returns true if file extensions should be enforced, and
false otherwise.
The flag. |
restoreAutoBounds | public void restoreAutoBounds()(Code) | | Restores the auto-range calculation on both axes.
|
restoreAutoDomainBounds | public void restoreAutoDomainBounds()(Code) | | Restores the auto-range calculation on the domain axis.
|
restoreAutoRangeBounds | public void restoreAutoRangeBounds()(Code) | | Restores the auto-range calculation on the range axis.
|
scale | public Rectangle scale(Rectangle2D rect)(Code) | | Applies any scaling that is in effect for the chart drawing to the
given rectangle.
Parameters: rect - the rectangle. A new scaled rectangle. |
setAnchor | protected void setAnchor(Point2D anchor)(Code) | | Sets the anchor point. This method is provided for the use of
subclasses, not end users.
Parameters: anchor - the anchor point (null permitted). |
setChart | public void setChart(JFreeChart chart)(Code) | | Sets the chart that is displayed in the panel.
Parameters: chart - the chart (null permitted). |
setDisplayToolTips | public void setDisplayToolTips(boolean displayToolTips)(Code) | | Parameters: displayToolTips - the displayToolTips to set |
setEnforceFileExtensions | public void setEnforceFileExtensions(boolean enforce)(Code) | | Sets a flag that controls whether or not file extensions are enforced.
Parameters: enforce - the new flag value. |
setHorizontalAxisTrace | public void setHorizontalAxisTrace(boolean flag)(Code) | | A flag that controls trace lines on the horizontal axis.
Parameters: flag - true enables trace lines for the mousepointer on the horizontal axis. |
setVerticalAxisTrace | public void setVerticalAxisTrace(boolean flag)(Code) | | A flag that controls trace lines on the vertical axis.
Parameters: flag - true enables trace lines for the mousepointer on the vertical axis. |
translateJava2DToScreen | public Point translateJava2DToScreen(Point2D java2DPoint)(Code) | | Translates a Java2D point on the chart to a screen location.
Parameters: java2DPoint - the Java2D point. The screen location. |
translateScreenToJava2D | public Point2D translateScreenToJava2D(Point screenPoint)(Code) | | Translates a screen location to a Java2D point.
Parameters: screenPoint - the screen location. The Java2D coordinates. |
translateScreenToJavaSWT | public Point translateScreenToJavaSWT(Point screenPoint)(Code) | | Translates a screen location to a Java SWT point.
Parameters: screenPoint - the screen location. The Java2D coordinates. |
widgetDefaultSelected | public void widgetDefaultSelected(SelectionEvent e)(Code) | | Handles action events generated by the popup menu.
See Also: org.eclipse.swt.events.SelectionListener.widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) |
widgetSelected | public void widgetSelected(SelectionEvent e)(Code) | | Handles action events generated by the popup menu.
See Also: org.eclipse.swt.events.SelectionListener.widgetSelected(org.eclipse.swt.events.SelectionEvent) |
zoom | public void zoom(Rectangle selection)(Code) | | Zooms in on a selected region.
Parameters: selection - the selected region. |
zoomInBoth | public void zoomInBoth(double x, double y)(Code) | | Zooms in on an anchor point (specified in screen coordinate space).
Parameters: x - the x value (in screen coordinates). Parameters: y - the y value (in screen coordinates). |
zoomInDomain | public void zoomInDomain(double x, double y)(Code) | | Decreases the length of the domain axis, centered about the given
coordinate on the screen. The length of the domain axis is reduced
by the value of
ChartComposite.getZoomInFactor() .
Parameters: x - the x coordinate (in screen coordinates). Parameters: y - the y-coordinate (in screen coordinates). |
zoomInRange | public void zoomInRange(double x, double y)(Code) | | Decreases the length of the range axis, centered about the given
coordinate on the screen. The length of the range axis is reduced by
the value of
ChartComposite.getZoomInFactor() .
Parameters: x - the x-coordinate (in screen coordinates). Parameters: y - the y coordinate (in screen coordinates). |
zoomOutBoth | public void zoomOutBoth(double x, double y)(Code) | | Zooms out on an anchor point (specified in screen coordinate space).
Parameters: x - the x value (in screen coordinates). Parameters: y - the y value (in screen coordinates). |
zoomOutDomain | public void zoomOutDomain(double x, double y)(Code) | | Increases the length of the domain axis, centered about the given
coordinate on the screen. The length of the domain axis is increased
by the value of
ChartComposite.getZoomOutFactor() .
Parameters: x - the x coordinate (in screen coordinates). Parameters: y - the y-coordinate (in screen coordinates). |
zoomOutRange | public void zoomOutRange(double x, double y)(Code) | | Increases the length the range axis, centered about the given
coordinate on the screen. The length of the range axis is increased
by the value of
ChartComposite.getZoomOutFactor() .
Parameters: x - the x coordinate (in screen coordinates). Parameters: y - the y-coordinate (in screen coordinates). |
|
|