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