All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class user.plot.PlotCanvas

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----user.plot.PlotCanvas

public class PlotCanvas
extends Canvas
implements Runnable, PlotTraceHandler, PlotStatusHandler, DataHandler
Include high resolution graphics in JAVA.

This package is designed for the scientific needs rather than for business graphics. It will display ten thousands of data points with error bars, but you will miss any fancy graphics options as stacked bars in 3D look or pie charts.

History:

Version 1.1
The initial version from Friedrich Schotte. The package was an extension of the Appler class.
Version 2.0
Revision by Hans Blom. The package is split into the following classes and interfaces:
PlotCanvas
This class is the plot canvas. The source is in this file.
PlotMarker
This class defines the plot markers.
PlotApplet
This class contains the general plot Applet methods. Note that it allows the plotting of the PlotCanvas into a new frame.
PlotDataApplet
This class contains the data I/O methods.
PlotTraceHandler
This interface can be implemented to supply an index for a plot trace, given a specified index. The trace index is used to define a trace color, plot markers, etc.
PlotStatusHandler
This interface can be implemented to handle the status messages.
DataHandler
This interface can be implemented to handle data ticks and tick labels.

See Also:
PlotApplet, PlotMarker, PlotDataApplet, PlotTraceHandler, PlotStatusHandler, DataHandler

Variable Index

 o ENTER
Enter the plot canvas.
 o EXIT
Exit the plot canvas.
 o LINEAR
Use a linear scaling for the X, or Y coordinate.
 o LOG
Use a logarithmic scaling for the X, or Y coordinate.
 o WITHIN
Stay within the plot canvas.

Constructor Index

 o PlotCanvas()
Constructor.

Method Index

 o addAllMarkers()
Add all markers to the vector with markers for the plot traces.
 o addDataTrace(Vector)
Add a vector containing all data points of a plot trace to the vector with plot traces.
 o addJoin(Boolean)
Add the flag which determines if the plot points should be joined with line pieces to the vector with join flags for the plot traces.
 o addMarker(int)
Add the specified marker to the vector with markers for the plot traces.
 o addMarker(String)
Add the marker, specified with its name to the vector with markers for the plot traces.
 o addTraceColor(Color)
Add a color to the vector with trace colors.
 o addXOffset(Double)
Add the offset to the X data to the vector with offsets of the plot traces.
 o addYOffset(Double)
Add the offset to the Y data to the vector with offsets of the plot traces.
 o destroyPaint()
Destroy the paint thread when it exists and it alive.
 o getAreaBackground()
Get the background color of the area where the data are plotted.
 o getDataSize()
Return the # plot traces stored in the vector with plot traces.
 o getDataTraceAt(int)
Get the vector with data points of the plot trace with the specified number.
 o getJoin(int)
Get the value of the join flag from the plot trace with the specified index from the vector with join flags.
 o getMarker(int)
Get the marker with the specified index from the vector with markers for the plot traces.
 o getNrJoin()
Get the # join flags stored in the vector with join flags for the plot traces.
 o getNrMarkers()
Get the # markers stored in the vector with markers for the plot traces.
 o getNrTickLines()
Get the # lines of the tick labels.
 o getNrTraceColors()
Get the # colors stored in the vector with trace colors.
 o getPlotStatusHandler()
Get the interface which handles the status messages.
 o getPlotTraceHandler()
Get the interface which supplies an index for a plot trace, given the specified index.
 o getTickLength()
Get the length of the tick marks.
 o getTickLines(double, double)
Return the tick label line where the specified value is converted to the requested labels.
 o getTraceColor(int)
Get the trace color with the specified index from the trace color vector.
 o getTraceIndex(int)
Supply a plot trace index, given the specified data index.
 o getUseJoin()
Get the value of the flag which determines if the plot points should be joined with line pieces.
 o getUseMarkers()
Get the flag which determines if markers should be used for the plot points as specified for the individual plot traces.
 o getXAxisLabel()
Get the label of the X-axis.
 o getXDataHandler()
Get the interface which handles the rounding of the X-data.
 o getXMax()
Get the maximum of the X values.
 o getXMin()
Get the minimum of the X values.
 o getXScaling()
Get the scaling type used at the X-axis.
 o getXTickSpacing()
Get the spacing between the ticks at the X-axis.
 o getYAxisLabel()
Get the label of the Y-axis.
 o getYDataHandler()
Get the interface which handles the rounding of the Y-data.
 o getYMax()
Get the maximum of the Y values.
 o getYMin()
Get the minimum of the Y values.
 o getYScaling()
Get the scaling type used at the Y-axis.
 o getYTickSpacing()
Get the spacing between the ticks at the Y-axis.
 o mouseDown(Event, int, int)
Handle the event when the user has clicked in the plot canvas.
 o mouseDrag(Event, int, int)
Handle the event when the mouse was dragged in the plot canvas.
 o mouseEnter(Event, int, int)
Handle the event when a mouse entered the plot canvas.
 o mouseExit(Event, int, int)
Handle the event when a mouse exited the plot canvas.
 o mouseUp(Event, int, int)
Handle the event when the mouse button went up.
 o nextTickValue(double, double)
Return the next tick value using the specified value and step.
 o paint(Graphics)
Paint the plot canvas.
 o quitPaint()
Quit the painting thread and wait until it has been died.
 o removeAllDataTraces()
Remove all plot traces from the vector with plot data.
 o removeAllJoins()
Remove all join points flags from the corresponding vector.
 o removeAllMarkers()
Remove all markers from the vector with plot markers.
 o removeAllTraceColors()
Remove all colors from the vector with trace colors.
 o removeDataTrace(Vector)
Remove the specified plot trace.
 o removeDataTraceAt(int)
Remove the plot trace at the specified index.
 o removeJoin(Boolean)
Remove the specified join points flag.
 o removeJoinAt(int)
Remove the specified join points flag at the specified index.
 o removeMarker(int)
Remove the marker, specified by its value.
 o removeMarker(String)
Remove the marker, specified by its name.
 o removeMarkerAt(int)
Remove the marker at the specified index.
 o removeTraceColor(Color)
Remove the specified color from the vector with trace colors.
 o removeTraceColorAt(int)
Remove the specified color from the vector with trace colors at the specified index.
 o resumePaint()
Resume the paint thread when it exists and it alive.
 o round(double, double)
Round the specified value within the specified range.
 o run()
Paint the plot canvas in the paint thread.
 o setAreaBackground(Color)
Set the background color of the area where the data are plotted.
 o setDataVector(Vector)
Set the vector containing all plot data.
 o setPlotStatusHandler(PlotStatusHandler)
Set the interface which handles the plot status messages.
 o setPlotTraceHandler(PlotTraceHandler)
Set the interface to supply an index for a plot trace, given the specified index.
 o setTickLength(int)
Set the length of the tick marks.
 o setUseJoin(boolean)
Set the flag which determines if the plot points should be joined with line pieces as specified for the individual plot traces.
 o setUseMarkers(boolean)
Set the flag which determines if markers should be used for the plot points as specified for the individual plot traces.
 o setXAxisLabel(String)
Set the label of the X-axis.
 o setXDataHandler(DataHandler)
Set the interface which handles the rounding of the X-data.
 o setXMax(Double)
Set the maximum of the X values.
 o setXMin(Double)
Set the minimum of the X values.
 o setXScaling(int)
Set the scaling type used at the X-axis.
 o setXTickSpacing(int)
Set the spacing between the ticks at the X-axis.
 o setYAxisLabel(String)
Set the label of the Y-axis.
 o setYDataHandler(DataHandler)
Set the interface which handles the rounding of the Y-data.
 o setYMax(Double)
Set the maximum of the Y values.
 o setYMin(Double)
Set the minimum of the Y values.
 o setYScaling(int)
Set the scaling type used at the Y-axis.
 o setYTickSpacing(int)
Set the spacing between the ticks at the Y-axis.
 o showMessage(String, int)
Show the plot status message.
 o suspendPaint()
Suspend the paint thread when it exists and it alive.
 o unZoom()
Unzoom the plot domain to the full plot area.
 o update(Graphics)
Update the plot.

Variables

 o LINEAR
 public static final int LINEAR
Use a linear scaling for the X, or Y coordinate.

 o LOG
 public static final int LOG
Use a logarithmic scaling for the X, or Y coordinate.

 o ENTER
 public static final int ENTER
Enter the plot canvas.

 o WITHIN
 public static final int WITHIN
Stay within the plot canvas.

 o EXIT
 public static final int EXIT
Exit the plot canvas.

Constructors

 o PlotCanvas
 public PlotCanvas()
Constructor.

Methods

 o setXAxisLabel
 public void setXAxisLabel(String x_axis_label)
Set the label of the X-axis.

Parameters:
x_axis_label - The specified label of the X-axis.
 o getXAxisLabel
 public String getXAxisLabel()
Get the label of the X-axis.

Returns:
The label of the X-axis.
 o setYAxisLabel
 public void setYAxisLabel(String y_axis_label)
Set the label of the Y-axis.

Parameters:
y_axis_label - The specified label of the Y-axis.
 o getYAxisLabel
 public String getYAxisLabel()
Get the label of the Y-axis.

Returns:
The label of the Y-axis.
 o setPlotTraceHandler
 public void setPlotTraceHandler(PlotTraceHandler trace_handler)
Set the interface to supply an index for a plot trace, given the specified index. Default the specified index is used.

Parameters:
trace_handler - The specified handler to supply a trace index.
See Also:
PlotTraceHandler
 o getPlotTraceHandler
 public PlotTraceHandler getPlotTraceHandler()
Get the interface which supplies an index for a plot trace, given the specified index.

Returns:
The interface which supplies a trace index.
See Also:
PlotTraceHandler
 o setPlotStatusHandler
 public void setPlotStatusHandler(PlotStatusHandler status_handler)
Set the interface which handles the plot status messages. Default these messages are ignored by the implementation of this class.

Parameters:
status_handler - The specified handler of the status messages.
See Also:
PlotStatusHandler
 o getPlotStatusHandler
 public PlotStatusHandler getPlotStatusHandler()
Get the interface which handles the status messages.

Returns:
The interface which handles the status messages.
See Also:
PlotStatusHandler
 o setXDataHandler
 public void setXDataHandler(DataHandler x_handler)
Set the interface which handles the rounding of the X-data. The default implementation by this class is sufficient for "normal" double values.

Parameters:
x_handler - The specified rounding interface.
See Also:
DataHandler
 o getXDataHandler
 public DataHandler getXDataHandler()
Get the interface which handles the rounding of the X-data.

Returns:
The interface which handles the rounding of the X-data.
See Also:
DataHandler
 o setYDataHandler
 public void setYDataHandler(DataHandler y_handler)
Set the interface which handles the rounding of the Y-data. The default implementation by this class is sufficient for "normal" double values.

Parameters:
y_handler - The specified rounding interface.
See Also:
DataHandler
 o getYDataHandler
 public DataHandler getYDataHandler()
Get the interface which handles the rounding of the Y-data.

Returns:
The interface which handles the rounding of the Y-data.
See Also:
DataHandler
 o setTickLength
 public void setTickLength(int tick_length)
Set the length of the tick marks.

Parameters:
tick_length - The specified length of the tick marks.
 o getTickLength
 public int getTickLength()
Get the length of the tick marks.

Returns:
The length of the tick marks.
 o setXTickSpacing
 public void setXTickSpacing(int x_tick_spacing)
Set the spacing between the ticks at the X-axis.

Parameters:
x_tick_spacing - The specified tick spacing.
 o getXTickSpacing
 public int getXTickSpacing()
Get the spacing between the ticks at the X-axis.

Returns:
The tick spacing.
 o setYTickSpacing
 public void setYTickSpacing(int y_tick_spacing)
Set the spacing between the ticks at the Y-axis.

Parameters:
y_tick_spacing - The specified tick spacing.
 o getYTickSpacing
 public int getYTickSpacing()
Get the spacing between the ticks at the Y-axis.

Returns:
The tick spacing.
 o addTraceColor
 public void addTraceColor(Color color)
Add a color to the vector with trace colors.

Parameters:
color - The specified trace color.
 o removeAllTraceColors
 public void removeAllTraceColors()
Remove all colors from the vector with trace colors.

See Also:
removeTraceColor, removeTraceColorAt
 o removeTraceColor
 public boolean removeTraceColor(Color color)
Remove the specified color from the vector with trace colors.

Parameters:
color - The trace color to remove
Returns:
trueif the argument was a component of the vector with trace colors; false otherwise
See Also:
removeAllTraceColors, removeTraceColorAt
 o removeTraceColorAt
 public void removeTraceColorAt(int index)
Remove the specified color from the vector with trace colors at the specified index.

Parameters:
index - The index of the trace color to remove
See Also:
removeAllTraceColors, removeTraceColor
 o getNrTraceColors
 public int getNrTraceColors()
Get the # colors stored in the vector with trace colors.

Returns:
The # trace colors.
 o getTraceColor
 public Color getTraceColor(int index)
Get the trace color with the specified index from the trace color vector. The foreground color of the PlotCanvas is returned when the vector is empty. If the index is larger than the available # colors stored (nr_colors), the color with index index % nr_colors is returned.

Parameters:
index - The specified index of the trace color.
Returns:
The trace color.
 o setAreaBackground
 public void setAreaBackground(Color background)
Set the background color of the area where the data are plotted. The default is the background of the PlotCanvas.

Parameters:
background - The specified plot area background.
 o getAreaBackground
 public Color getAreaBackground()
Get the background color of the area where the data are plotted. The default is the background of the PlotCanvas.

Returns:
The plot area background.
 o addXOffset
 public void addXOffset(Double x_offset)
Add the offset to the X data to the vector with offsets of the plot traces. The default offset is zero.

Parameters:
x_offset - The specified offset.
 o addYOffset
 public void addYOffset(Double y_offset)
Add the offset to the Y data to the vector with offsets of the plot traces. The default offset is zero.

Parameters:
x_offset - The specified offset.
 o setUseJoin
 public void setUseJoin(boolean use_join)
Set the flag which determines if the plot points should be joined with line pieces as specified for the individual plot traces.

Parameters:
use_join - true if the points can be joined; false otherwise.
See Also:
addJoin
 o getUseJoin
 public boolean getUseJoin()
Get the value of the flag which determines if the plot points should be joined with line pieces.

Returns:
true if the points can be joined.; false otherwise.
 o addJoin
 public void addJoin(Boolean join_element)
Add the flag which determines if the plot points should be joined with line pieces to the vector with join flags for the plot traces. The default is to join points.

Parameters:
join_element - true if the points of this plot trace are joined; false otherwise.
See Also:
setUseJoin
 o removeAllJoins
 public void removeAllJoins()
Remove all join points flags from the corresponding vector.

See Also:
removeJoin, removeJoinAt
 o removeJoin
 public boolean removeJoin(Boolean join_element)
Remove the specified join points flag.

Parameters:
join_element - The join flag component to remove.
Returns:
trueif the argument was a component of the join vector; false otherwise
See Also:
removeAllJoins, removeJoinAt
 o removeJoinAt
 public void removeJoinAt(int index)
Remove the specified join points flag at the specified index.

Parameters:
index - The index of the join flag component to remove.
See Also:
removeAllJoins, removeJoin
 o getNrJoin
 public int getNrJoin()
Get the # join flags stored in the vector with join flags for the plot traces.

Returns:
The # join flags.
 o getJoin
 public Boolean getJoin(int index)
Get the value of the join flag from the plot trace with the specified index from the vector with join flags. When no flag is found for the specified index null is returned.

Parameters:
index - The index of the join flag to obtain.
Returns:
The join flag.
 o setUseMarkers
 public void setUseMarkers(boolean use_markers)
Set the flag which determines if markers should be used for the plot points as specified for the individual plot traces.

Parameters:
use_markers - true if the points can be marked; false otherwise.
See Also:
addAllMarkers, addMarker, addMarker, PlotMarker
 o getUseMarkers
 public boolean getUseMarkers()
Get the flag which determines if markers should be used for the plot points as specified for the individual plot traces.

Returns:
true if the points can be marked; false otherwise.
See Also:
PlotMarker
 o addAllMarkers
 public void addAllMarkers()
Add all markers to the vector with markers for the plot traces. The default is to do not mark points.

See Also:
setUseMarkers, addMarker, addMarker, PlotMarker
 o addMarker
 public void addMarker(int marker)
Add the specified marker to the vector with markers for the plot traces. The default is to do not mark points.

Parameters:
marker - The specified marker.
See Also:
setUseMarkers, addAllMarkers, addMarker, PlotMarker
 o addMarker
 public void addMarker(String marker_name)
Add the marker, specified with its name to the vector with markers for the plot traces. The default is to do no mark points.

Parameters:
marker_name - The specified marker name.
See Also:
setUseMarkers, addAllMarkers, addMarker, PlotMarker
 o removeAllMarkers
 public void removeAllMarkers()
Remove all markers from the vector with plot markers.

See Also:
removeMarker, removeMarker, removeMarkerAt, PlotMarker
 o removeMarker
 public boolean removeMarker(int marker_value)
Remove the marker, specified by its value.

Parameters:
marker_value - The marker value ID of the marker to remove.
Returns:
true if the argument was a component of the marker vector; false otherwise
See Also:
removeAllMarkers, removeMarker, removeMarkerAt, PlotMarker
 o removeMarker
 public boolean removeMarker(String marker_name)
Remove the marker, specified by its name.

Parameters:
marker_name - The name of the marker to remove.
Returns:
true if the argument was a component of the marker vector; false otherwise
See Also:
removeAllMarkers, removeMarker, removeMarkerAt, PlotMarker
 o removeMarkerAt
 public void removeMarkerAt(int index)
Remove the marker at the specified index.

Parameters:
index - The index of the marker to remove.
See Also:
removeAllMarkers, removeMarker, removeMarker, PlotMarker
 o getNrMarkers
 public int getNrMarkers()
Get the # markers stored in the vector with markers for the plot traces.

Returns:
The # markers.
See Also:
PlotMarker
 o getMarker
 public PlotMarker getMarker(int index)
Get the marker with the specified index from the vector with markers for the plot traces. If no marker exists for the index null is returned.

Parameters:
index - The specified marker index.
Returns:
The marker of the plot trace with the specified index.
See Also:
PlotMarker
 o setXMin
 public void setXMin(Double xmin_obj)
Set the minimum of the X values. If no minimum is set, it will be determined from the plot data.

Parameters:
xmin_obj - The specfied minimum.
 o getXMin
 public Double getXMin()
Get the minimum of the X values. If no minimum is set, null is returned.

Returns:
The minimum of the X values.
 o setXMax
 public void setXMax(Double xmax_obj)
Set the maximum of the X values. If no maximum is set, it will be determined from the plot data.

Parameters:
xmax_obj - The specfied maximum.
 o getXMax
 public Double getXMax()
Get the maximum of the X values. If no maximum is set, null is returned.

Returns:
The maximum of the X values.
 o setYMin
 public void setYMin(Double ymin_obj)
Set the minimum of the Y values. If no minimum is set, it will be determined from the plot data.

Parameters:
ymin_obj - The specfied minimum.
 o getYMin
 public Double getYMin()
Get the minimum of the Y values. If no minimum is set, null is returned.

Returns:
The minimum of the Y values.
 o setYMax
 public void setYMax(Double ymax_obj)
Set the maximum of the Y values. If no maximum is set, it will be determined from the plot data.

Parameters:
ymax_obj - The specfied maximum.
 o getYMax
 public Double getYMax()
Get the maximum of the Y values. If no maximum is set, null is returned.

Returns:
The maximum of the Y values.
 o setXScaling
 public void setXScaling(int x_scaling)
Set the scaling type used at the X-axis. Linear or logarithmic scaling can be used.

Parameters:
x_scaling - The specified scaling type.
See Also:
LINEAR, LOG
 o getXScaling
 public int getXScaling()
Get the scaling type used at the X-axis. Linear or logarithmic scaling can be used.

Returns:
The scaling type.
See Also:
LINEAR, LOG
 o setYScaling
 public void setYScaling(int y_scaling)
Set the scaling type used at the Y-axis. Linear or logarithmic scaling can be used.

Parameters:
y_scaling - The specified scaling type.
See Also:
LINEAR, LOG
 o getYScaling
 public int getYScaling()
Get the scaling type used at the Y-axis. Linear or logarithmic scaling can be used.

Returns:
The scaling type.
See Also:
LINEAR, LOG
 o setDataVector
 public void setDataVector(Vector data)
Set the vector containing all plot data. Each plot trace is represented by a vector which is stored in this vector.

Parameters:
data - The specified vector with plot data.
 o addDataTrace
 public void addDataTrace(Vector trace)
Add a vector containing all data points of a plot trace to the vector with plot traces. The data points are instances of the DataPoint class. Positions where the joining of lines should be interrupted can be marked with a null DataPoint instance.

Parameters:
trace - The specified vector with data points of the plot trace.
See Also:
DataPoint
 o removeAllDataTraces
 public void removeAllDataTraces()
Remove all plot traces from the vector with plot data.

See Also:
removeDataTrace, removeDataTraceAt
 o removeDataTrace
 public boolean removeDataTrace(Vector trace)
Remove the specified plot trace.

Parameters:
trace - The plot trace to remove
Returns:
true if the argument was a component of the vector with plot traces; false otherwise
See Also:
removeAllDataTraces, removeDataTraceAt
 o removeDataTraceAt
 public void removeDataTraceAt(int trace_index)
Remove the plot trace at the specified index.

Parameters:
trace_index - The index of the plot trace to remove
See Also:
removeAllDataTraces, removeDataTrace
 o getDataSize
 public int getDataSize()
Return the # plot traces stored in the vector with plot traces.

Returns:
The stored # plot traces.
 o getDataTraceAt
 public Vector getDataTraceAt(int trace_no)
Get the vector with data points of the plot trace with the specified number.

Parameters:
trace_no - The specified index of the data plot trace.
Returns:
The data plot trace vector.
 o unZoom
 public void unZoom()
Unzoom the plot domain to the full plot area.

 o resumePaint
 public void resumePaint()
Resume the paint thread when it exists and it alive. This method is typically intended to be called from the start() method in the Applet class, when appropriate.

See Also:
suspendPaint, destroyPaint, quitPaint
 o suspendPaint
 public void suspendPaint()
Suspend the paint thread when it exists and it alive. This method is typically intended to be called from the stop() method in the Applet class, when appropriate.

See Also:
resumePaint, destroyPaint, quitPaint
 o destroyPaint
 public void destroyPaint()
Destroy the paint thread when it exists and it alive. This method is typically intended to be called from the destroy() method in the Applet class, when appropriate.

See Also:
resumePaint, suspendPaint, quitPaint
 o quitPaint
 public void quitPaint()
Quit the painting thread and wait until it has been died. This method is not connected with the resumePaint(), suspendPaint() and destroyPaint() methods which are typically intended to be called from an Applet class.

See Also:
resumePaint, suspendPaint, destroyPaint
 o update
 public void update(Graphics g)
Update the plot. The plot canvas is completely initialised and painted during the paint() function, so nothing has to be done here.

Parameters:
g - The graphics content for the update.
Overrides:
update in class Component
See Also:
paint
 o paint
 public void paint(Graphics g)
Paint the plot canvas. First initialise the plot canvas parameters (sizes, and other plot parameters). It is always completely painted. The actual painting is done in a private thread which improves the performance of slow displays, because the painting can be interrupted by a new paint() call. This prevends a long stack of unhandled events at slow displays.

Overrides:
paint in class Canvas
 o run
 public void run()
Paint the plot canvas in the paint thread. Jump from this method when a QuitException has been thrown by the paint thread. It will be thrown when the thread should stop.

 o mouseEnter
 public boolean mouseEnter(Event evt,
                           int x,
                           int y)
Handle the event when a mouse entered the plot canvas. Show the corresponding status message when the mouse did enter the plot canvas. In all other situation the super method is called to handle the event.

The function returns true when the event was handled; false otherwise.

Parameters:
evt - The event that caused the action.
x - The X position of the mouse pointer.
y - The Y position of the mouse pointer.
Returns:
true when the event was handled; false otherwise.
Overrides:
mouseEnter in class Component
 o mouseExit
 public boolean mouseExit(Event evt,
                          int x,
                          int y)
Handle the event when a mouse exited the plot canvas. Clear the corresponding status message when the mouse did exit the plot canvas. In all other situation the super method is called to handle the event.

The function returns true when the event was handled; false otherwise.

Parameters:
evt - The event that caused the action.
x - The X position of the mouse pointer.
y - The Y position of the mouse pointer.
Returns:
true when the event was handled; false otherwise.
Overrides:
mouseExit in class Component
 o mouseDown
 public boolean mouseDown(Event evt,
                          int x,
                          int y)
Handle the event when the user has clicked in the plot canvas. The zoom area is marked when the left mouse button is clicked.

The function returns true when the event was handled; false otherwise.

Parameters:
evt - The event that caused the action.
x - The X position of the mouse pointer.
y - The Y position of the mouse pointer.
Returns:
true when the event was handled; false otherwise.
Overrides:
mouseDown in class Component
 o mouseDrag
 public boolean mouseDrag(Event evt,
                          int x,
                          int y)
Handle the event when the mouse was dragged in the plot canvas. The zoom area selection is started when the mouse was not yet dragged; it is extended when the mouse was alreday dragged. handled; false otherwise.

The function returns true when the event was handled; false otherwise.

Parameters:
evt - The event that caused the action.
x - The X position of the mouse pointer.
y - The Y position of the mouse pointer.
Returns:
true when the event was handled; false otherwise.
Overrides:
mouseDrag in class Component
 o mouseUp
 public boolean mouseUp(Event evt,
                        int x,
                        int y)
Handle the event when the mouse button went up.
  • If the left button went up, we zoom in to the zoom area.
  • If the right button went up, we zoom out to the full plot area.

The function returns true when the event was handled; false otherwise.

Parameters:
evt - The event that caused the action.
x - The X position of the mouse pointer.
y - The Y position of the mouse pointer.
Returns:
true when the event was handled; false otherwise.
Overrides:
mouseUp in class Component
 o showMessage
 public void showMessage(String message,
                         int canvas_state)
Show the plot status message. This method is part of the PlotStatusHandler interface. This implementation does nothing.

Parameters:
message - The plot status message to show.
canvas_state - The enter, be within, or exit the plot canvas state.
See Also:
PlotStatusHandler, ENTER, WITHIN, EXIT
 o getNrTickLines
 public int getNrTickLines()
Get the # lines of the tick labels. This is the default implementation by this class of this method from the DataHandler interface. It is intended for "normal" floats.

Returns:
The # lines of the tick labels.
See Also:
DataHandler
 o getTickLines
 public String[] getTickLines(double value,
                              double step)
Return the tick label line where the specified value is converted to the requested labels. The specified step to the next tick value is used as scaling parameter.

This is the default implementation by this class of this method from the DataHandler interface. It is intended for "normal" floats.

Parameters:
value - The tick value to convert.
step - The step to the next tick value, intended for scaling.
Returns:
The tick label lines.
See Also:
DataHandler
 o getTraceIndex
 public int getTraceIndex(int data_index)
Supply a plot trace index, given the specified data index. Default the specified data index is returned.

Parameters:
data_index - The specified data index.
Returns:
The index of the plot trace.
See Also:
PlotTraceHandler
 o round
 public double round(double value,
                     double range)
Round the specified value within the specified range. This method is used for axis labeling.

This method is the default implementation of the corresponding method from the DataHandler interface. This implementation is suited for "normal" floats.

Parameters:
value - The value to round.
range - The range in which the rounding should be performed.
Returns:
The rounded value.
See Also:
DataHandler
 o nextTickValue
 public double nextTickValue(double value,
                             double step)
Return the next tick value using the specified value and step.

This is the default implementation of this method from the Datahandler class. It is straightforward

return value + step
and suited for "normal" floats.

Parameters:
value - The current tick value.
step - The step to the next tick value.
Returns:
The next tick value.
See Also:
Datahandler

All Packages  Class Hierarchy  This Package  Previous  Next  Index