|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectComposite
org.jfree.experimental.chart.swt.ChartComposite
public class ChartComposite
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 |
|---|
public static final boolean DEFAULT_BUFFER_USED
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public static final int DEFAULT_MINIMUM_DRAW_WIDTH
public static final int DEFAULT_MINIMUM_DRAW_HEIGHT
public static final int DEFAULT_MAXIMUM_DRAW_WIDTH
public static final int DEFAULT_MAXIMUM_DRAW_HEIGHT
public static final int DEFAULT_ZOOM_TRIGGER_DISTANCE
public static final java.lang.String PROPERTIES_COMMAND
public static final java.lang.String SAVE_COMMAND
public static final java.lang.String PRINT_COMMAND
public static final java.lang.String ZOOM_IN_BOTH_COMMAND
public static final java.lang.String ZOOM_IN_DOMAIN_COMMAND
public static final java.lang.String ZOOM_IN_RANGE_COMMAND
public static final java.lang.String ZOOM_OUT_BOTH_COMMAND
public static final java.lang.String ZOOM_OUT_DOMAIN_COMMAND
public static final java.lang.String ZOOM_OUT_RANGE_COMMAND
public static final java.lang.String ZOOM_RESET_BOTH_COMMAND
public static final java.lang.String ZOOM_RESET_DOMAIN_COMMAND
public static final java.lang.String ZOOM_RESET_RANGE_COMMAND
protected static java.util.ResourceBundle localizationResources
| Constructor Detail |
|---|
public ChartComposite(Composite comp,
int style)
comp - The parent.style - The style of the composite.
public ChartComposite(Composite comp,
int style,
org.jfree.chart.JFreeChart chart)
comp - The parent.style - The style of the composite.chart - the chart.
public ChartComposite(Composite comp,
int style,
org.jfree.chart.JFreeChart chart,
boolean useBuffer)
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.
public ChartComposite(Composite comp,
int style,
org.jfree.chart.JFreeChart chart,
boolean properties,
boolean save,
boolean print,
boolean zoom,
boolean tooltips)
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.
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)
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 |
|---|
public double getScaleX()
public double getScaleY()
public java.awt.geom.Point2D getAnchor()
null).protected void setAnchor(java.awt.geom.Point2D anchor)
anchor - the anchor point (null permitted).public org.jfree.chart.JFreeChart getChart()
null).public void setChart(org.jfree.chart.JFreeChart chart)
chart - the chart (null permitted).public org.jfree.chart.ChartRenderingInfo getChartRenderingInfo()
null).public boolean isDomainZoomable()
public void setDomainZoomable(boolean flag)
flag - true enables zooming if possible.public boolean isRangeZoomable()
public void setRangeZoomable(boolean flag)
flag - true enables zooming.public double getZoomInFactor()
setZoomInFactor(double)public void setZoomInFactor(double factor)
factor - the factor.getZoomInFactor()public double getZoomOutFactor()
setZoomOutFactor(double)public void setZoomOutFactor(double factor)
factor - the factor.getZoomOutFactor()public boolean isEnforceFileExtensions()
true if file extensions should be enforced, and
false otherwise.
public void setEnforceFileExtensions(boolean enforce)
enforce - the new flag value.
public void doSaveAs()
throws java.io.IOException
java.io.IOException - if there is an I/O error.
public void zoomInBoth(double x,
double y)
x - the x value (in screen coordinates).y - the y value (in screen coordinates).
public void zoomInDomain(double x,
double y)
getZoomInFactor().
x - the x coordinate (in screen coordinates).y - the y-coordinate (in screen coordinates).
public void zoomInRange(double x,
double y)
getZoomInFactor().
x - the x-coordinate (in screen coordinates).y - the y coordinate (in screen coordinates).
public void zoomOutBoth(double x,
double y)
x - the x value (in screen coordinates).y - the y value (in screen coordinates).
public void zoomOutDomain(double x,
double y)
getZoomOutFactor().
x - the x coordinate (in screen coordinates).y - the y-coordinate (in screen coordinates).
public void zoomOutRange(double x,
double y)
getZoomOutFactor().
x - the x coordinate (in screen coordinates).y - the y-coordinate (in screen coordinates).public void zoom(Rectangle selection)
selection - the selected region.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 forceRedraw()
public void addChartMouseListener(org.jfree.chart.ChartMouseListener listener)
listener - the listener (null not permitted).public void removeChartMouseListener(org.jfree.chart.ChartMouseListener listener)
listener - the listener.public void chartProgress(org.jfree.chart.event.ChartProgressEvent event)
chartProgress in interface org.jfree.chart.event.ChartProgressListenerevent - the event.public void restoreAutoBounds()
public void restoreAutoDomainBounds()
public void restoreAutoRangeBounds()
public Rectangle scale(java.awt.geom.Rectangle2D rect)
rect - the rectangle.
public Rectangle getScreenDataArea()
public Rectangle getScreenDataArea(int x,
int y)
x - the x-coordinate (for subplot selection).y - the y-coordinate (for subplot selection).
public java.awt.Point translateJava2DToScreen(java.awt.geom.Point2D java2DPoint)
java2DPoint - the Java2D point.
public java.awt.Point translateScreenToJavaSWT(java.awt.Point screenPoint)
screenPoint - the screen location.
public java.awt.geom.Point2D translateScreenToJava2D(java.awt.Point screenPoint)
screenPoint - the screen location.
public boolean getHorizontalAxisTrace()
public void setHorizontalAxisTrace(boolean flag)
flag - true enables trace lines for the mouse
pointer on the horizontal axis.public boolean getVerticalAxisTrace()
public void setVerticalAxisTrace(boolean flag)
flag - true enables trace lines for the mouse
pointer on the vertical axis.public void setDisplayToolTips(boolean displayToolTips)
displayToolTips - the displayToolTips to setpublic java.lang.String getToolTipText(org.eclipse.swt.events.MouseEvent e)
e - the mouse event.
null if no tooltip is available.
protected void displayPopupMenu(int x,
int y)
x - horizontal position of the popup.y - vertical position of the popup.public void createChartPrintJob()
protected Menu createPopupMenu(boolean properties,
boolean save,
boolean print,
boolean zoom)
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.
public void widgetDefaultSelected(SelectionEvent e)
org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(
org.eclipse.swt.events.SelectionEvent)public void widgetSelected(SelectionEvent e)
org.eclipse.swt.events.SelectionListener#widgetSelected(
org.eclipse.swt.events.SelectionEvent)
public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
throws java.awt.print.PrinterException
print in interface java.awt.print.Printablejava.awt.print.PrinterExceptionpublic void addSWTListener(SWTEventListener listener)
listener - The SWT listener to attach to the canvas.public void mouseDoubleClick(MouseEvent event)
public void mouseDown(MouseEvent event)
public void mouseUp(MouseEvent event)
public void mouseMove(MouseEvent event)
public void paintControl(PaintEvent e)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||