Class Plot
- All Implemented Interfaces:
DataListener
CoordinateSystem
, Curves
,
an optional annotation layer and an optional Legend
. When rendered
these components are draw in this order.
Registrated PlotListeners
will be informed
when the plot changes.
A DataPlot
can be connected with a Plot instance.
This is done with the method connect()
which registrates
this Plot instance as
a DataListener
at the connected DataPlot.
After an received DataEvents
has been handled
the registrated PlotListeners will receive a
PlotEvent
of the type PlotEventType.DATA_PLOT_CHANGED
.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPlot
(ConfigParameters config) Creates an instance from the specified configuration parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlotListener
(PlotListener listener) Adds the specifiedPlotListener
.void
Connect the specifiedDataPlot
with this instance.void
dataChanged
(DataEvent event) Handles the receivedDataEvent
and notifiesPlotListeners
by an event of the typePlotEventType.DATA_CURVE_CHANGED
orPlotEventType.DATA_PLOT_CHANGED
.Returns the annotation layer.Creates a graphical representation of the complete plot.Returns the view of the coordinate system.Returns the graphical representations of all curves.Returns the graphical representations of the legend.boolean
Returns true if the legend is visible.protected void
notifyListeners
(PlotEvent event) Sends all registratedPlotListeners
the specified event.void
removePlotListener
(PlotListener listener) Removes the specfiedPlotListener
.void
setAnnotation
(GraphicalElement annotation) Sets the annotation layer.void
setCoordinateSystem
(CoordinateSystem coordinateSystem) Sets the coordinate system.transform
(GraphPoint point) Transforms a point from device-independent coordinates into data coordinates.
-
Field Details
-
COORDINATE_SYSTEM_KEY
Configuration parameter key.- See Also:
-
CURVE_FACTORY_KEY
Configuration parameter key.- See Also:
-
LEGEND_VISIBLE_KEY
Configuration parameter key.- See Also:
-
LEGEND_KEY
Configuration parameter key.- See Also:
-
INITIAL_HINT_FOR_NEXT_CURVE_KEY
Configuration parameter key.- See Also:
-
-
Constructor Details
-
Plot
Creates an instance from the specified configuration parameters.Key & Default Value Type Mandatory Description coordinateSystem = CartesianCoordinateSystem
ConfigParameters no Definition of the CoordinateSystem
.curveFactory = SimpleCurveFactory
ConfigParameters no Definition of the CurveFactory
.initialHintForNextCurve = null ConfigParameters no Definition of the initial Hint
which is needed by someSymbolFactories
likeBarFactory
.legend = default values of Legend
ConfigParameters no Configuration parameters of a Legend
.legendVisible = true boolean no If true the Legend
will be created.
-
-
Method Details
-
setCoordinateSystem
Sets the coordinate system. All curves will be regenerated and aPlotEvent
of typePlotEventType.COODINATE_SYSTEM_CHANGED
will be fired.- Parameters:
coordinateSystem
- New coordinate system.
-
addPlotListener
Adds the specifiedPlotListener
. Does nothing if already added. -
removePlotListener
Removes the specfiedPlotListener
. Does nothing if already removed. -
notifyListeners
Sends all registratedPlotListeners
the specified event. -
connect
Connect the specifiedDataPlot
with this instance.If this Plot instance is already connected with a DataPlot the connection will be released and a
PlotEvent
of the typePlotEventType.DATA_PLOT_DISCONNECTED
will be sent to all registratedPlotListeners
.It registers itself at dataPlot and all its
DataCurves
.Finally all curves will be generated and a PlotEvent of the type
PlotEventType.DATA_PLOT_CONNECTED
will be transmitted.- Parameters:
dataPlot
- Data to be connected with this plot instance. Can be null in order to disconnect this instance from any DataPlot.
-
transform
Transforms a point from device-independent coordinates into data coordinates.- Parameters:
point
- Point in device-independent coordinates.- Returns:
- transform point.
-
getCompletePlot
Creates a graphical representation of the complete plot.- Returns:
- GraphicalComposite containing the views of the coordinate system, the curves, and optionally the legend (in this order).
-
getCoordinateSystem
Returns the view of the coordinate system. -
getCurves
Returns the graphical representations of all curves. -
getAnnotation
Returns the annotation layer.- Returns:
- null if no annotation layer.
-
setAnnotation
Sets the annotation layer.- Parameters:
annotation
- Any kind of graphics which will be drawn on the top of the curves but may be covered by the legend. Can be null.
-
isLegendVisible
public boolean isLegendVisible()Returns true if the legend is visible. -
getLegend
Returns the graphical representations of the legend. -
dataChanged
Handles the receivedDataEvent
and notifiesPlotListeners
by an event of the typePlotEventType.DATA_CURVE_CHANGED
orPlotEventType.DATA_PLOT_CHANGED
. The following table shows what this method does:Source of event All hints for the next curve are null? Action Type of sent PlotEvent
DataCurve
Yes Recreate changed curve. DATA_CURVE_CHANGED DataCurve
No Recreate changed curve and all curves with large curve index. DATA_PLOT_CHANGED DataPlot
- Recreate all curves and Legend
view.DATA_PLOT_CHANGED - Specified by:
dataChanged
in interfaceDataListener
- Parameters:
event
- Data event informing where and what happened.
-