org.jfree.experimental.chart.swt
Class ChartComposite

java.lang.Object
  extended by Composite
      extended by org.jfree.experimental.chart.swt.ChartComposite
All Implemented Interfaces:
java.awt.print.Printable, java.util.EventListener, org.jfree.chart.event.ChartChangeListener, org.jfree.chart.event.ChartProgressListener

public class ChartComposite
extends Composite
implements org.jfree.chart.event.ChartChangeListener, org.jfree.chart.event.ChartProgressListener, java.awt.print.Printable

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.


Field Summary
static boolean DEFAULT_BUFFER_USED
          Default setting for buffer usage.
static int DEFAULT_HEIGHT
          The default panel height.
static int DEFAULT_MAXIMUM_DRAW_HEIGHT
          The default limit below which chart scaling kicks in.
static int DEFAULT_MAXIMUM_DRAW_WIDTH
          The default limit below which chart scaling kicks in.
static int DEFAULT_MINIMUM_DRAW_HEIGHT
          The default limit below which chart scaling kicks in.
static int DEFAULT_MINIMUM_DRAW_WIDTH
          The default limit below which chart scaling kicks in.
static int DEFAULT_WIDTH
          The default panel width.
static int DEFAULT_ZOOM_TRIGGER_DISTANCE
          The minimum size required to perform a zoom on a rectangle
protected static java.util.ResourceBundle localizationResources
          The resourceBundle for the localization.
static java.lang.String PRINT_COMMAND
          Print action command.
static java.lang.String PROPERTIES_COMMAND
          Properties action command.
static java.lang.String SAVE_COMMAND
          Save action command.
static java.lang.String ZOOM_IN_BOTH_COMMAND
          Zoom in (both axes) action command.
static java.lang.String ZOOM_IN_DOMAIN_COMMAND
          Zoom in (domain axis only) action command.
static java.lang.String ZOOM_IN_RANGE_COMMAND
          Zoom in (range axis only) action command.
static java.lang.String ZOOM_OUT_BOTH_COMMAND
          Zoom out (both axes) action command.
static java.lang.String ZOOM_OUT_DOMAIN_COMMAND
          Zoom out (domain axis only) action command.
static java.lang.String ZOOM_OUT_RANGE_COMMAND
          Zoom out (range axis only) action command.
static java.lang.String ZOOM_RESET_BOTH_COMMAND
          Zoom reset (both axes) action command.
static java.lang.String ZOOM_RESET_DOMAIN_COMMAND
          Zoom reset (domain axis only) action command.
static java.lang.String ZOOM_RESET_RANGE_COMMAND
          Zoom reset (range axis only) action command.
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
ChartComposite(Composite comp, int style)
          Create a new chart composite with a default FillLayout.
ChartComposite(Composite comp, int style, org.jfree.chart.JFreeChart chart)
          Constructs a panel that displays the specified chart.
ChartComposite(Composite comp, int style, org.jfree.chart.JFreeChart chart, boolean useBuffer)
          Constructs a panel containing a chart.
ChartComposite(Composite comp, int style, org.jfree.chart.JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
          Constructs a JFreeChart panel.
ChartComposite(Composite comp, int style, org.jfree.chart.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
 void addChartMouseListener(org.jfree.chart.ChartMouseListener listener)
          Adds a listener to the list of objects listening for chart mouse events.
 void addSWTListener(SWTEventListener listener)
          Hook an SWT listener on the canvas where the chart is drawn.
 void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
          Receives notification of changes to the chart, and redraws the chart.
 void chartProgress(org.jfree.chart.event.ChartProgressEvent event)
          Receives notification of a chart progress event.
 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.
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.
 void doSaveAs()
          Opens a file chooser and gives the user an opportunity to save the chart in PNG format.
 void forceRedraw()
          Forces a redraw of the canvas by invoking a new PaintEvent.
 java.awt.geom.Point2D getAnchor()
          Returns the anchor point.
 org.jfree.chart.JFreeChart getChart()
          Returns the chart contained in the panel.
 org.jfree.chart.ChartRenderingInfo getChartRenderingInfo()
          Returns the chart rendering info from the most recent chart redraw.
 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.
 double getScaleX()
          Returns the X scale factor for the chart.
 double getScaleY()
          Returns the Y scale factory for the chart.
 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).
 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.
 java.lang.String getToolTipText(org.eclipse.swt.events.MouseEvent e)
          Returns a string for the tooltip.
 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.
 double getZoomInFactor()
          Returns the zoom in factor.
 double getZoomOutFactor()
          Returns the zoom out factor.
 boolean isDomainZoomable()
          Returns the flag that determines whether or not zooming is enabled for the domain axis.
 boolean isEnforceFileExtensions()
          Returns true if file extensions should be enforced, and false otherwise.
 boolean isRangeZoomable()
          Returns the flag that determines whether or not zooming is enabled for the range axis.
 void mouseDoubleClick(MouseEvent event)
           
 void mouseDown(MouseEvent event)
           
 void mouseMove(MouseEvent event)
           
 void mouseUp(MouseEvent event)
           
 void paintControl(PaintEvent e)
           
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
           
 void removeChartMouseListener(org.jfree.chart.ChartMouseListener listener)
          Removes a listener from the list of objects listening for chart mouse events.
 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.
 Rectangle scale(java.awt.geom.Rectangle2D rect)
          Applies any scaling that is in effect for the chart drawing to the given rectangle.
protected  void setAnchor(java.awt.geom.Point2D anchor)
          Sets the anchor point.
 void setChart(org.jfree.chart.JFreeChart chart)
          Sets the chart that is displayed in the panel.
 void setDisplayToolTips(boolean displayToolTips)
           
 void setDomainZoomable(boolean flag)
          Sets the flag that controls whether or not zooming is enable for the domain axis.
 void setEnforceFileExtensions(boolean enforce)
          Sets a flag that controls whether or not file extensions are enforced.
 void setHorizontalAxisTrace(boolean flag)
          A flag that controls trace lines on the horizontal axis.
 void setRangeZoomable(boolean flag)
          A flag that controls mouse-based zooming on the vertical axis.
 void setVerticalAxisTrace(boolean flag)
          A flag that controls trace lines on the vertical axis.
 void setZoomInFactor(double factor)
          Sets the zoom in factor.
 void setZoomOutFactor(double factor)
          Sets the zoom out factor.
 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.
 java.awt.Point translateScreenToJavaSWT(java.awt.Point screenPoint)
          Translates a screen location to a Java SWT point.
 void widgetDefaultSelected(SelectionEvent e)
          Handles action events generated by the popup menu.
 void widgetSelected(SelectionEvent e)
          Handles action events generated by the popup menu.
 void zoom(Rectangle selection)
          Zooms in on a selected region.
 void zoomInBoth(double x, double y)
          Zooms in on an anchor point (specified in screen coordinate space).
 void zoomInDomain(double x, double y)
          Decreases the length of the domain axis, centered about the given coordinate on the screen.
 void zoomInRange(double x, double y)
          Decreases the length of the range axis, centered about the given coordinate on the screen.
 void zoomOutBoth(double x, double y)
          Zooms out on an anchor point (specified in screen coordinate space).
 void zoomOutDomain(double x, double y)
          Increases the length of the domain axis, centered about the given coordinate on the screen.
 void zoomOutRange(double x, double y)
          Increases the length the range axis, centered about the given coordinate on the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_USED

public static final boolean DEFAULT_BUFFER_USED
Default setting for buffer usage.

See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
The default panel width.

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
The default panel height.

See Also:
Constant Field Values

DEFAULT_MINIMUM_DRAW_WIDTH

public static final int DEFAULT_MINIMUM_DRAW_WIDTH
The default limit below which chart scaling kicks in.

See Also:
Constant Field Values

DEFAULT_MINIMUM_DRAW_HEIGHT

public static final int DEFAULT_MINIMUM_DRAW_HEIGHT
The default limit below which chart scaling kicks in.

See Also:
Constant Field Values

DEFAULT_MAXIMUM_DRAW_WIDTH

public static final int DEFAULT_MAXIMUM_DRAW_WIDTH
The default limit below which chart scaling kicks in.

See Also:
Constant Field Values

DEFAULT_MAXIMUM_DRAW_HEIGHT

public static final int DEFAULT_MAXIMUM_DRAW_HEIGHT
The default limit below which chart scaling kicks in.

See Also:
Constant Field Values

DEFAULT_ZOOM_TRIGGER_DISTANCE

public static final int DEFAULT_ZOOM_TRIGGER_DISTANCE
The minimum size required to perform a zoom on a rectangle

See Also:
Constant Field Values

PROPERTIES_COMMAND

public static final java.lang.String PROPERTIES_COMMAND
Properties action command.

See Also:
Constant Field Values

SAVE_COMMAND

public static final java.lang.String SAVE_COMMAND
Save action command.

See Also:
Constant Field Values

PRINT_COMMAND

public static final java.lang.String PRINT_COMMAND
Print action command.

See Also:
Constant Field Values

ZOOM_IN_BOTH_COMMAND

public static final java.lang.String ZOOM_IN_BOTH_COMMAND
Zoom in (both axes) action command.

See Also:
Constant Field Values

ZOOM_IN_DOMAIN_COMMAND

public static final java.lang.String ZOOM_IN_DOMAIN_COMMAND
Zoom in (domain axis only) action command.

See Also:
Constant Field Values

ZOOM_IN_RANGE_COMMAND

public static final java.lang.String ZOOM_IN_RANGE_COMMAND
Zoom in (range axis only) action command.

See Also:
Constant Field Values

ZOOM_OUT_BOTH_COMMAND

public static final java.lang.String ZOOM_OUT_BOTH_COMMAND
Zoom out (both axes) action command.

See Also:
Constant Field Values

ZOOM_OUT_DOMAIN_COMMAND

public static final java.lang.String ZOOM_OUT_DOMAIN_COMMAND
Zoom out (domain axis only) action command.

See Also:
Constant Field Values

ZOOM_OUT_RANGE_COMMAND

public static final java.lang.String ZOOM_OUT_RANGE_COMMAND
Zoom out (range axis only) action command.

See Also:
Constant Field Values

ZOOM_RESET_BOTH_COMMAND

public static final java.lang.String ZOOM_RESET_BOTH_COMMAND
Zoom reset (both axes) action command.

See Also:
Constant Field Values

ZOOM_RESET_DOMAIN_COMMAND

public static final java.lang.String ZOOM_RESET_DOMAIN_COMMAND
Zoom reset (domain axis only) action command.

See Also:
Constant Field Values

ZOOM_RESET_RANGE_COMMAND

public static final java.lang.String ZOOM_RESET_RANGE_COMMAND
Zoom reset (range axis only) action command.

See Also:
Constant Field Values

localizationResources

protected static java.util.ResourceBundle localizationResources
The resourceBundle for the localization.

Constructor Detail

ChartComposite

public ChartComposite(Composite comp,
                      int style)
Create a new chart composite with a default FillLayout. This way, when drawn, the chart will fill all the space.

Parameters:
comp - The parent.
style - The style of the composite.

ChartComposite

public ChartComposite(Composite comp,
                      int style,
                      org.jfree.chart.JFreeChart chart)
Constructs a panel that displays the specified chart.

Parameters:
comp - The parent.
style - The style of the composite.
chart - the chart.

ChartComposite

public ChartComposite(Composite comp,
                      int style,
                      org.jfree.chart.JFreeChart chart,
                      boolean useBuffer)
Constructs a panel containing a chart.

Parameters:
comp - The parent.
style - The style of the composite.
chart - the chart.
useBuffer - a flag controlling whether or not an off-screen buffer is used.

ChartComposite

public ChartComposite(Composite comp,
                      int style,
                      org.jfree.chart.JFreeChart chart,
                      boolean properties,
                      boolean save,
                      boolean print,
                      boolean zoom,
                      boolean tooltips)
Constructs a JFreeChart panel.

Parameters:
comp - The parent.
style - The style of the composite.
chart - the chart.
properties - a flag indicating whether or not the chart property editor should be available via the popup menu.
save - a flag indicating whether or not save options should be available via the popup menu.
print - a flag indicating whether or not the print option should be available via the popup menu.
zoom - a flag indicating whether or not zoom options should be added to the popup menu.
tooltips - a flag indicating whether or not tooltips should be enabled for the chart.

ChartComposite

public ChartComposite(Composite comp,
                      int style,
                      org.jfree.chart.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.

Parameters:
comp - The parent.
style - The style of the composite.
jfreechart - the chart.
width - the preferred width of the panel.
height - the preferred height of the panel.
minimumDrawW - the minimum drawing width.
minimumDrawH - the minimum drawing height.
maximumDrawW - the maximum drawing width.
maximumDrawH - the maximum drawing height.
usingBuffer - a flag that indicates whether to use the off-screen buffer to improve performance (at the expense of memory).
properties - a flag indicating whether or not the chart property editor should be available via the popup menu.
save - a flag indicating whether or not save options should be available via the popup menu.
print - a flag indicating whether or not the print option should be available via the popup menu.
zoom - a flag indicating whether or not zoom options should be added to the popup menu.
tooltips - a flag indicating whether or not tooltips should be enabled for the chart.
Method Detail

getScaleX

public double getScaleX()
Returns the X scale factor for the chart. This will be 1.0 if no scaling has been used.

Returns:
The scale factor.

getScaleY

public double getScaleY()
Returns the Y scale factory for the chart. This will be 1.0 if no scaling has been used.

Returns:
The scale factor.

getAnchor

public java.awt.geom.Point2D getAnchor()
Returns the anchor point.

Returns:
The anchor point (possibly null).

setAnchor

protected void setAnchor(java.awt.geom.Point2D anchor)
Sets the anchor point. This method is provided for the use of subclasses, not end users.

Parameters:
anchor - the anchor point (null permitted).

getChart

public org.jfree.chart.JFreeChart getChart()
Returns the chart contained in the panel.

Returns:
The chart (possibly null).

setChart

public void setChart(org.jfree.chart.JFreeChart chart)
Sets the chart that is displayed in the panel.

Parameters:
chart - the chart (null permitted).

getChartRenderingInfo

public org.jfree.chart.ChartRenderingInfo getChartRenderingInfo()
Returns the chart rendering info from the most recent chart redraw.

Returns:
The chart rendering info (possibly null).

isDomainZoomable

public boolean isDomainZoomable()
Returns the flag that determines whether or not zooming is enabled for the domain axis.

Returns:
A boolean.

setDomainZoomable

public void setDomainZoomable(boolean flag)
Sets the flag that controls whether or not zooming is enable for the domain axis. A check is made to ensure that the current plot supports zooming for the domain values.

Parameters:
flag - true enables zooming if possible.

isRangeZoomable

public boolean isRangeZoomable()
Returns the flag that determines whether or not zooming is enabled for the range axis.

Returns:
A boolean.

setRangeZoomable

public void setRangeZoomable(boolean flag)
A flag that controls mouse-based zooming on the vertical axis.

Parameters:
flag - true enables zooming.

getZoomInFactor

public double getZoomInFactor()
Returns the zoom in factor.

Returns:
The zoom in factor.
See Also:
setZoomInFactor(double)

setZoomInFactor

public void setZoomInFactor(double factor)
Sets the zoom in factor.

Parameters:
factor - the factor.
See Also:
getZoomInFactor()

getZoomOutFactor

public double getZoomOutFactor()
Returns the zoom out factor.

Returns:
The zoom out factor.
See Also:
setZoomOutFactor(double)

setZoomOutFactor

public void setZoomOutFactor(double factor)
Sets the zoom out factor.

Parameters:
factor - the factor.
See Also:
getZoomOutFactor()

isEnforceFileExtensions

public boolean isEnforceFileExtensions()
Returns true if file extensions should be enforced, and false otherwise.

Returns:
The flag.

setEnforceFileExtensions

public void setEnforceFileExtensions(boolean enforce)
Sets a flag that controls whether or not file extensions are enforced.

Parameters:
enforce - the new flag value.

doSaveAs

public void doSaveAs()
              throws java.io.IOException
Opens a file chooser and gives the user an opportunity to save the chart in PNG format.

Throws:
java.io.IOException - if there is an I/O error.

zoomInBoth

public void zoomInBoth(double x,
                       double y)
Zooms in on an anchor point (specified in screen coordinate space).

Parameters:
x - the x value (in screen coordinates).
y - the y value (in screen coordinates).

zoomInDomain

public void zoomInDomain(double x,
                         double y)
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 getZoomInFactor().

Parameters:
x - the x coordinate (in screen coordinates).
y - the y-coordinate (in screen coordinates).

zoomInRange

public void zoomInRange(double x,
                        double y)
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 getZoomInFactor().

Parameters:
x - the x-coordinate (in screen coordinates).
y - the y coordinate (in screen coordinates).

zoomOutBoth

public void zoomOutBoth(double x,
                        double y)
Zooms out on an anchor point (specified in screen coordinate space).

Parameters:
x - the x value (in screen coordinates).
y - the y value (in screen coordinates).

zoomOutDomain

public void zoomOutDomain(double x,
                          double y)
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 getZoomOutFactor().

Parameters:
x - the x coordinate (in screen coordinates).
y - the y-coordinate (in screen coordinates).

zoomOutRange

public void zoomOutRange(double x,
                         double y)
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 getZoomOutFactor().

Parameters:
x - the x coordinate (in screen coordinates).
y - the y-coordinate (in screen coordinates).

zoom

public void zoom(Rectangle selection)
Zooms in on a selected region.

Parameters:
selection - the selected region.

chartChanged

public void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
Receives notification of changes to the chart, and redraws the chart.

Specified by:
chartChanged in interface org.jfree.chart.event.ChartChangeListener
Parameters:
event - details of the chart change event.

forceRedraw

public void forceRedraw()
Forces a redraw of the canvas by invoking a new PaintEvent.


addChartMouseListener

public void addChartMouseListener(org.jfree.chart.ChartMouseListener listener)
Adds a listener to the list of objects listening for chart mouse events.

Parameters:
listener - the listener (null not permitted).

removeChartMouseListener

public void removeChartMouseListener(org.jfree.chart.ChartMouseListener listener)
Removes a listener from the list of objects listening for chart mouse events.

Parameters:
listener - the listener.

chartProgress

public void chartProgress(org.jfree.chart.event.ChartProgressEvent event)
Receives notification of a chart progress event.

Specified by:
chartProgress in interface org.jfree.chart.event.ChartProgressListener
Parameters:
event - the event.

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.


scale

public Rectangle scale(java.awt.geom.Rectangle2D rect)
Applies any scaling that is in effect for the chart drawing to the given rectangle.

Parameters:
rect - the rectangle.
Returns:
A new scaled rectangle.

getScreenDataArea

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).

Returns:
The scaled data area.

getScreenDataArea

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).
y - the y-coordinate (for subplot selection).
Returns:
The scaled data area.

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.

translateScreenToJavaSWT

public java.awt.Point translateScreenToJavaSWT(java.awt.Point screenPoint)
Translates a screen location to a Java SWT point.

Parameters:
screenPoint - the screen location.
Returns:
The Java2D coordinates.

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.

getHorizontalAxisTrace

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.

Returns:
A boolean.

setHorizontalAxisTrace

public void setHorizontalAxisTrace(boolean flag)
A flag that controls trace lines on the horizontal axis.

Parameters:
flag - true enables trace lines for the mouse pointer on the horizontal axis.

getVerticalAxisTrace

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.

Returns:
A boolean.

setVerticalAxisTrace

public void setVerticalAxisTrace(boolean flag)
A flag that controls trace lines on the vertical axis.

Parameters:
flag - true enables trace lines for the mouse pointer on the vertical axis.

setDisplayToolTips

public void setDisplayToolTips(boolean displayToolTips)
Parameters:
displayToolTips - the displayToolTips to set

getToolTipText

public java.lang.String getToolTipText(org.eclipse.swt.events.MouseEvent e)
Returns a string for the tooltip.

Parameters:
e - the mouse event.
Returns:
A tool tip or null if no tooltip is available.

displayPopupMenu

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.

Parameters:
x - horizontal position of the popup.
y - vertical position of the popup.

createChartPrintJob

public void createChartPrintJob()
Creates a print job for the chart.


createPopupMenu

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.
save - include a menu item for saving the chart.
print - include a menu item for printing the chart.
zoom - include menu items for zooming.
Returns:
The popup menu.

widgetDefaultSelected

public void widgetDefaultSelected(SelectionEvent e)
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)
Handles action events generated by the popup menu.

See Also:
org.eclipse.swt.events.SelectionListener#widgetSelected( org.eclipse.swt.events.SelectionEvent)

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Specified by:
print in interface java.awt.print.Printable
Throws:
java.awt.print.PrinterException

addSWTListener

public void addSWTListener(SWTEventListener listener)
Hook an SWT listener on the canvas where the chart is drawn. The purpose of this method is to allow some degree of customization.

Parameters:
listener - The SWT listener to attach to the canvas.

mouseDoubleClick

public void mouseDoubleClick(MouseEvent event)

mouseDown

public void mouseDown(MouseEvent event)

mouseUp

public void mouseUp(MouseEvent event)

mouseMove

public void mouseMove(MouseEvent event)

paintControl

public void paintControl(PaintEvent e)