Interface ITrace2D
-
- All Superinterfaces:
java.lang.Comparable<ITrace2D>
,java.util.EventListener
,java.beans.PropertyChangeListener
,java.io.Serializable
- All Known Implementing Classes:
ATrace2D
,Trace2DArithmeticMean
,Trace2DArithmeticMeanX
,Trace2DArithmeticMeanY
,Trace2DAxisSwap
,Trace2DBijective
,Trace2DDebugger
,Trace2DLtd
,Trace2DLtdReplacing
,Trace2DLtdSorted
,Trace2DReplacing
,Trace2DSimple
,Trace2DSorted
public interface ITrace2D extends java.beans.PropertyChangeListener, java.lang.Comparable<ITrace2D>, java.io.Serializable
An interface used byChart2D
. ITrace2D contains the values to display, the color for displaying and a suitable label. It may be seen as a trace of theChart2D
that displays it.
Implementations may be optimized for different use- cases:
RingBuffers for fast changing data to keep the amount of trace points and consumption of memory constant, internal Lists for allowing the sorting the internalTracePoint2D
- instances or Arrays for unordered Data (in the order of adding) for fast performance. Even anITrace2D
constructed by a "function- Object" may be thinkable.There are various constraints for Traces:
- ordered by x-values
- ordered by the order ofaddPoint
- invocation (control form outside)
- unique, single x- values
- limitation of tracepoints
- time- critical (fast- changing tracepoints)
Therefore there are variousITrace2D
- implementations. Read their description to find the one you need. Some may not have been written yet.Comparable
should be implemented by using the internal property zIndex (seegetZIndex()
,setZIndex(Integer)
).Property Change events
The following
may be fired toPropertyChangeEvent
instances that register themselves withPropertyChangeListener
.addPropertyChangeListener(String, PropertyChangeListener)
getPropertyName()
getSource()
getOldValue()
getNewValue()
PROPERTY_ZINDEX
that changedITrace2D
, the old valueNumber
, the new valueNumber
PROPERTY_MAX_X
that changedITrace2D
, the old valueDouble
, the new valueDouble
PROPERTY_MIN_X
that changedITrace2D
, the old valueDouble
, the new valueDouble
PROPERTY_MAX_Y
that changedITrace2D
, the old valueDouble
, the new valueDouble
PROPERTY_MIN_Y
that changedITrace2D
, the old valueDouble
, the new valueDouble
PROPERTY_TRACEPOINT
that changedITrace2D
, the instance that was removedTracePoint2D
null
, indication that an instance was removedPROPERTY_TRACEPOINT
that changedITrace2D
null
, indication that a value was added
, the new instance that was added, identifying that an instance was removedTracePoint2D
PROPERTY_VISIBLE
that changedITrace2D
, the old state.Boolean
, the new state.Boolean
PROPERTY_PAINTERS
that changedITrace2D
null
, indicating that a painter was added.
, the new painter.ITracePainter
PROPERTY_PAINTERS
that changedITrace2D
, the old painter.ITracePainter
null
, indicating that a painter was removed.PROPERTY_POINT_HIGHLIGHTERS_CHANGED
that changedITrace2D
null
, indicating that a point highlighter was added.
, the new highlighter.IPointPainter
PROPERTY_POINT_HIGHLIGHTERS_CHANGED
that changedITrace2D
, the old highlighter.IPointPainter
null
, indicating that a point highlighter was removed.PROPERTY_PAINTERS
that changedITrace2D
, the old highlighter.IPointPainter
null
, indicating that a highlighter was removed.PROPERTY_STROKE
that changedITrace2D
, the old stroke.Stroke
, the new stroke.Stroke
PROPERTY_COLOR
that changedITrace2D
, the new color.Color
, the new color.Color
PROPERTY_ERRORBARPOLICY
that changedITrace2D
null
, indicating that an error bar policy was added.
, the new error bar policy.IErrorBarPolicy
PROPERTY_ERRORBARPOLICY
that changedITrace2D
, the old error bar policy.IErrorBarPolicy
null
, indicating that an error bar policy was removed.PROPERTY_ERRORBARPOLICY_CONFIGURATION
that notifies the change of the configured error bar policy.ITrace2D
null
, the instance with the configuration change.IErrorBarPolicy
PROPERTY_POINT_CHANGED
that notifies the change of the contained trace point.ITrace2D
null
because it would be too much overhead to store the old point in a additional instance as the original is modified in
.Point2D.setLocation(java.awt.geom.Point2D)
the point whose location was modified.TracePoint2D
PROPERTY_NAME
that notifies the change.ITrace2D
, the old value ofString
getName()
, the new value ofString
getName()
PROPERTY_PHYSICALUNITS
that notifies the change.ITrace2D
, the old value ofString
getPhysicalUnits()
, the new value ofString
getPhysicalUnits()
(triggered byPROPERTY_LABEL
andsetName(String)
)setPhysicalUnits(String, String)
that notifies the change.ITrace2D
, the old value ofString
getLabel()
, the new value ofString
getLabel()
- Version:
- $Revision: 1.41 $
- Author:
- Achim Westermann
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ITrace2D.DistancePoint
Simple struct just for allowing to return a trace point along with a weighted distance.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTY_COLOR
The property key defining thecolor
property.static java.lang.String
PROPERTY_ERRORBARPOLICY
The property key defining a change of
instances contained.IErrorBarPolicy
static java.lang.String
PROPERTY_ERRORBARPOLICY_CONFIGURATION
The property key defining a change of the configuration of a contained
.IErrorBarPolicy
static java.lang.String
PROPERTY_LABEL
The property key defining thelabel
property.static java.lang.String
PROPERTY_MAX_X
The property key defining themaxX
property.static java.lang.String
PROPERTY_MAX_Y
The property key defining themaxY
property.static java.lang.String
PROPERTY_MIN_X
The property key defining theminX
property.static java.lang.String
PROPERTY_MIN_Y
The property key defining theminY
property.static java.lang.String
PROPERTY_NAME
The property key defining thename
property.static java.lang.String
PROPERTY_PAINTERS
The property key defining a change in the set ofITracePainter
static java.lang.String
PROPERTY_PHYSICALUNITS
The property key defining thephysicalUnits
property.static java.lang.String
PROPERTY_POINT_CHANGED
The property key defining any change of a location of a containedTracePoint2D
static java.lang.String
PROPERTY_POINT_HIGHLIGHTERS_CHANGED
The property key defining a change in the set ofIPointPainter
static java.lang.String
PROPERTY_STROKE
The property key defining thestroke
property.static java.lang.String
PROPERTY_TRACEPOINT
The property key defining a change in the collection ofTracePoint2D
static java.lang.String
PROPERTY_VISIBLE
The property key defining thevisible
property.static java.lang.String
PROPERTY_ZINDEX
The property key defining thezIndex
property.static int
Z_INDEX_MIN
The minimum value for property zIndex: 0.static int
ZINDEX_MAX
The maximum value for property zIndex: 100.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addComputingTrace(ITrace2D trace)
Adds a trace that "should" compute values from the points added viaaddPoint(ITracePoint2D)
boolean
addErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Adds the given error bar policy to the internal set of error bar policies.boolean
addPoint(double x, double y)
Adds a trace point to the internal data.boolean
addPoint(ITracePoint2D p)
Adds the givenTracePoint2D
to the internal data.boolean
addPointHighlighter(IPointPainter<?> highlighter)
Adds the given point painter to the internal set of point highlighters.void
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Registers a property change listener that will be informed about changes of the property identified by the givenpropertyName
.boolean
addTracePainter(ITracePainter<?> painter)
Adds the given trace painter to the internal set of trace painters.boolean
containsTracePainter(ITracePainter<?> painter)
Returns true if the given painter is contained in this compound painter.void
firePointChanged(ITracePoint2D changed, int state)
Method to trigger by
,TracePoint2D.setLocation(double, double)
oraddPoint(ITracePoint2D)
removePoint(ITracePoint2D)
java.awt.Color
getColor()
Because the color is data common to a trace of aChart2D
it is stored here.java.util.Set<IErrorBarPolicy<?>>
getErrorBarPolicies()
Returns theSet<
that will be used to render error bars for this trace.IErrorBarPolicy
>boolean
getHasErrorBars()
Returns true if this trace has error bars configured.java.lang.String
getLabel()
Callback method for theChart2D
that returns aString
describing the label of theITrace2D
that will be displayed below the drawing area of theChart2D
.int
getMaxSize()
Returns the maximum amount ofTracePoint2D
instances that may be added.double
getMaxX()
Returns the maximum value to be displayed on the x- axis of theChart2D
.double
getMaxY()
Returns the maximum value to be displayed on the y- axis of the Chart2D.double
getMinX()
Returns the minimum value to be displayed on the x- axis of the Chart2D.double
getMinY()
Returns the minimum value to be displayed on the y- axis of the Chart2D.java.lang.String
getName()
Returns the name of this trace.ITrace2D.DistancePoint
getNearestPointEuclid(double x, double y)
Returns the nearest point to the given normalized value coordinates of this trace in Euclid distance.ITrace2D.DistancePoint
getNearestPointManhattan(double x, double y)
Returns the nearest point to the given normalized value coordinates of this trace in Manhattan distance.java.lang.String
getPhysicalUnits()
Returns the concatenation[x: "
.getPhysicalUnitsX()
", y: "getPhysicalUnitsY()
"]java.lang.String
getPhysicalUnitsX()
Returns the physical unit string value for the x dimension.java.lang.String
getPhysicalUnitsY()
Returns the physical unit string value for the y dimension.java.util.Set<IPointPainter<?>>
getPointHighlighters()
Returns theSet<
that may be used to highlight points of this trace.IPointPainter
>java.beans.PropertyChangeListener[]
getPropertyChangeListeners(java.lang.String property)
Returns all property change listeners for the given property.Chart2D
getRenderer()
int
getSize()
Returns the amount ofTracePoint2D
instances currently contained.java.awt.Stroke
getStroke()
Returns the Stroke that is used to render this instance.java.util.Set<ITracePainter<?>>
getTracePainters()
Returns theSet<
that will be used to paint this trace.ITracePainter
>java.lang.Integer
getZIndex()
The z-index defines the order in which this instance will be painted.boolean
isEmpty()
Returns false if internal
instances are contained or true if not.TracePoint2D
boolean
isVisible()
Returns true if this instance should be rendered.java.util.Iterator<ITracePoint2D>
iterator()
Returns anIterator
over the internalTracePoint2D
java.util.Set<IPointPainter<?>>
removeAllPointHighlighters()
Clears all internal point highlighters used.void
removeAllPoints()
Removes all internalTracePoint2D
.isEmpty()
will return true afterwards.boolean
removeComputingTrace(ITrace2D trace)
Remove a trace that "should" compute values from the points added via
.addPoint(ITracePoint2D)
boolean
removeErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Removes the given error bar policy from the internal set of error bar policies.boolean
removePoint(ITracePoint2D point)
Removes the given point from this trace.boolean
removePointHighlighter(IPointPainter<?> highlighter)
Removes the given point highlighter, if it's class is contained.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregisters a property change listener that has been registered for listening on all properties.void
removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Removes a property change listener for listening on the given property.boolean
removeTracePainter(ITracePainter<?> painter)
Removes the given trace painter, if it's class is contained and if more painters are remaining.void
setColor(java.awt.Color color)
Set ajava.awt.Color
for this trace.java.util.Set<IErrorBarPolicy<?>>
setErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Replaces all internal error bar policies by the new one.void
setName(java.lang.String name)
Assingns a specific name to theITrace2D
which will be displayed by theChart2D
.void
setPhysicalUnits(java.lang.String xunit, java.lang.String yunit)
Assigns a specific String representing the physical unit to theITrace2D
(e.g.java.util.Set<IPointPainter<?>>
setPointHighlighter(IPointPainter<?> highlighter)
Replaces all internal point highlighters by the new one.void
setRenderer(Chart2D renderer)
This is a callback fromChart2D.addTrace(ITrace2D)
and must not be invoked from elsewhere (needed for synchronization).void
setStroke(java.awt.Stroke stroke)
Allows to specify the rendering of the ITrace2D.java.util.Set<ITracePainter<?>>
setTracePainter(ITracePainter<?> painter)
Replaces all internal trace painters by the new one.void
setVisible(boolean visible)
Set the visibility.void
setZIndex(java.lang.Integer zIndex)
Sets the internal z-index property.boolean
showsErrorBars()
Tests whether error bars are painted by this trace.boolean
showsNegativeXErrorBars()
Tests whether error bars in negative x direction are painted by this trace.boolean
showsNegativeYErrorBars()
Tests whether error bars in negative y direction are painted by this trace.boolean
showsPositiveXErrorBars()
Tests whether error bars in positive x direction are painted by this trace.boolean
showsPositiveYErrorBars()
Tests whether error bars in positive y direction are painted by this trace.
-
-
-
Field Detail
-
PROPERTY_COLOR
static final java.lang.String PROPERTY_COLOR
The property key defining thecolor
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_ERRORBARPOLICY
static final java.lang.String PROPERTY_ERRORBARPOLICY
The property key defining a change of
instances contained.IErrorBarPolicy
This is fired from
,addErrorBarPolicy(IErrorBarPolicy)
andremoveErrorBarPolicy(IErrorBarPolicy)
.setErrorBarPolicy(IErrorBarPolicy)
Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_ERRORBARPOLICY_CONFIGURATION
static final java.lang.String PROPERTY_ERRORBARPOLICY_CONFIGURATION
The property key defining a change of the configuration of a contained
.IErrorBarPolicy
This is fired whenever an
IErrorBarPolicy
notifies this instance of a configuration change via an event for
.IErrorBarPolicy.PROPERTY_CONFIGURATION
Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_LABEL
static final java.lang.String PROPERTY_LABEL
The property key defining thelabel
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.This is no real property as the
access two other fields.getLabel()
- See Also:
- Constant Field Values
-
PROPERTY_MAX_X
static final java.lang.String PROPERTY_MAX_X
The property key defining themaxX
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_MAX_Y
static final java.lang.String PROPERTY_MAX_Y
The property key defining themaxY
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_MIN_X
static final java.lang.String PROPERTY_MIN_X
The property key defining theminX
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_MIN_Y
static final java.lang.String PROPERTY_MIN_Y
The property key defining theminY
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_NAME
static final java.lang.String PROPERTY_NAME
The property key defining thename
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_PAINTERS
static final java.lang.String PROPERTY_PAINTERS
The property key defining a change in the set ofITracePainter
addPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_PHYSICALUNITS
static final java.lang.String PROPERTY_PHYSICALUNITS
The property key defining thephysicalUnits
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_POINT_CHANGED
static final java.lang.String PROPERTY_POINT_CHANGED
The property key defining any change of a location of a containedTracePoint2D
Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
. Property change event with this property will be fired if method
orPoint2D.setLocation(java.awt.geom.Point2D)
of any contained point is invoked.TracePoint2D.setLocation(double, double)
- See Also:
- Constant Field Values
-
PROPERTY_POINT_HIGHLIGHTERS_CHANGED
static final java.lang.String PROPERTY_POINT_HIGHLIGHTERS_CHANGED
The property key defining a change in the set ofIPointPainter
addPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_STROKE
static final java.lang.String PROPERTY_STROKE
The property key defining thestroke
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_TRACEPOINT
static final java.lang.String PROPERTY_TRACEPOINT
The property key defining a change in the collection ofTracePoint2D
addPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_VISIBLE
static final java.lang.String PROPERTY_VISIBLE
The property key defining thevisible
property. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
PROPERTY_ZINDEX
static final java.lang.String PROPERTY_ZINDEX
The property key defining thezIndex
property.Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.- See Also:
- Constant Field Values
-
Z_INDEX_MIN
static final int Z_INDEX_MIN
The minimum value for property zIndex: 0.- See Also:
getZIndex()
,setZIndex(Integer)
, Constant Field Values
-
ZINDEX_MAX
static final int ZINDEX_MAX
The maximum value for property zIndex: 100.the descriptive name for this trace.
- See Also:
getZIndex()
,setZIndex(Integer)
, Constant Field Values
-
-
Method Detail
-
addComputingTrace
void addComputingTrace(ITrace2D trace)
Adds a trace that "should" compute values from the points added viaaddPoint(ITracePoint2D)
The given trace will be informed in case an add operation on this trace succeeds via
.addPoint(ITracePoint2D)
- Parameters:
trace
- the trace that will calculate it's points from the added points of this trace.
-
addErrorBarPolicy
boolean addErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Adds the given error bar policy to the internal set of error bar policies.It will be the last error bar policy to render (most forward on screen).
- Parameters:
errorBarPolicy
- the error bar policy to add for rendering this trace's error bars.- Returns:
- true if the painter was added (same instance was not contained before).
-
addPoint
boolean addPoint(double x, double y)
Adds a trace point to the internal data.Warning:
Do not call this method before this trace has been added to a chart or you will not succeed as the chart is needed to get the properChart2D.getTracePointProvider()
- Parameters:
x
- the x-value of the point to add.y
- the y-value of the point to add.- Returns:
- true if the operation was successful, false else.
- See Also:
addPoint(ITracePoint2D p)
-
addPoint
boolean addPoint(ITracePoint2D p)
Adds the givenTracePoint2D
to the internal data.Try to pass instances of
TracePoint2D
to this instance instead of invoking
to increase performance. Else the given point has to be copied into such an instance from the other method and delegated to this method.addPoint(double, double)
Implementations decide whether the point will be accepted or not. So they have to update the internal properties
minX
,maxX
,maxY
andminY
and also care about firing property change events for those properties by method
.PropertyChangeSupport.firePropertyChange(java.beans.PropertyChangeEvent)
- Parameters:
p
- the point to add.- Returns:
- true if the operation was successful, false else.
-
addPointHighlighter
boolean addPointHighlighter(IPointPainter<?> highlighter)
Adds the given point painter to the internal set of point highlighters.It will be the last point painter to paint highlighting if highlighting is active.
- Parameters:
highlighter
- the highlighter to add for highlighting this trace.- Returns:
- true if the highlighter was added (class of instance not contained before).
-
addPropertyChangeListener
void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Registers a property change listener that will be informed about changes of the property identified by the givenpropertyName
.- Parameters:
propertyName
- the name of the property the listener is interested inlistener
- a listener that will only be informed if the property identified by the argumentpropertyName
changes
-
addTracePainter
boolean addTracePainter(ITracePainter<?> painter)
Adds the given trace painter to the internal set of trace painters.It will be the last painter to paint (most forward).
- Parameters:
painter
- the painter to add for rendering this trace.- Returns:
- true if the painter was added (class of instance not contained before).
-
containsTracePainter
boolean containsTracePainter(ITracePainter<?> painter)
Returns true if the given painter is contained in this compound painter.- Parameters:
painter
- the painter to check whether it is contained.- Returns:
- true if the given painter is contained in this compound painter.
-
firePointChanged
void firePointChanged(ITracePoint2D changed, int state)
Method to trigger by
,TracePoint2D.setLocation(double, double)
oraddPoint(ITracePoint2D)
removePoint(ITracePoint2D)
Bound checks are performed and property change events for the properties
,PROPERTY_MAX_X
,PROPERTY_MIN_X
andPROPERTY_MAX_Y
are fired if the add bounds have changed due to the modification of the point.PROPERTY_MIN_Y
- Parameters:
changed
- the point that has been changed which may be a newly added point (from
, a removed one or a modified one.addPoint(ITracePoint2D)
state
- one of {
to inform about the type of change.ITracePoint2D.STATE_ADDED
,ITracePoint2D.STATE_CHANGED
,ITracePoint2D.STATE_REMOVED
-
getColor
java.awt.Color getColor()
Because the color is data common to a trace of aChart2D
it is stored here.On the other hand only the corresponding
Chart2D
may detect the same color chosen for differentIChart2D
instances to be displayed. Therefore it is allowed to return null. This is a message to theChart2D
to leave it the choice of the color. Then theChart2D
will chose a color not owned by anotherITrace2D
instance managed and assign it to the null- returning instance.The
Chart2D
will often call this method. So try to cache the value in implementation and only check on modifications ofTracePoint
instances or onadd
- invocations for changes.- Returns:
- The chosen java.awt.Color or null if the decision for the color
should be made by the corresponding
Chart2D
.
-
getErrorBarPolicies
java.util.Set<IErrorBarPolicy<?>> getErrorBarPolicies()
Returns theSet<
that will be used to render error bars for this trace.IErrorBarPolicy
>- Returns:
- the
Set<
that will be used to render error bars for this trace.IErrorBarPolicy
>
-
getHasErrorBars
boolean getHasErrorBars()
Returns true if this trace has error bars configured.If this returns false, no error bars will be painted for this trace.
- Returns:
- true if this trace has error bars configured.
-
getLabel
java.lang.String getLabel()
Callback method for theChart2D
that returns aString
describing the label of theITrace2D
that will be displayed below the drawing area of theChart2D
.This method should be implemented and finalized ASAP in the inheritance tree and rely on the property
name
andphysicalUnits
.- Returns:
- a String describing the Axis being accessed.
-
getMaxSize
int getMaxSize()
Returns the maximum amount of
TracePoint2D
instances that may be added. For implementations that limit the maximum amount this is a reasonable amount. Non-limiting implementations should returnInteger.MAX_VALUE
. This allows to detect the unlimitedness. Of course no implementation could store that amount of points.- Returns:
- The maximum amount of
TracePoint2D
instances that may be added.
-
getMaxX
double getMaxX()
Returns the maximum value to be displayed on the x- axis of theChart2D
. Implementations should be synchronized for multithreaded use. No exception is thrown. In case of empty data (no tracepoints) 0 should be returned, to let the Chart2D know.The
Chart2D
will often call this method. So try to cache the value in implementation and only check on modifications ofTracePoint
instances or onadd
- invocations for changes.- Returns:
- the maximum value of the internal data for the x- dimension.
-
getMaxY
double getMaxY()
Returns the maximum value to be displayed on the y- axis of the Chart2D. Implementations should be synchronized for multithreaded use. No exception is thrown. In case of empty data (no tracepoints) 0 should be returned. (watch division with zero).- Returns:
- the maximum value of the internal data for the y- dimension.
-
getMinX
double getMinX()
Returns the minimum value to be displayed on the x- axis of the Chart2D.Implementations should be synchronized for multithreaded use. No exception is thrown. In case of empty data (no tracepoints) 0 should be returned. (watch division with zero).
The
Chart2D
will often call this method. So try to cache the value in implementation and only check on modifications ofTracePoint
instances or onadd
- invocations for changes.- Returns:
- the minimum value of the internal data for the x- dimension.
-
getMinY
double getMinY()
Returns the minimum value to be displayed on the y- axis of the Chart2D.Implementations should be synchronized for multithreaded use. No exception is thrown. In case of empty data (no tracepoints) 0 should be returned. (watch division with zero).
The
Chart2D
will often call this method. So try to cache the value in implementation and only check on modifications ofTracePoint
instances or onadd
- invocations for changes.- Returns:
- the minimum value of the internal data for the y- dimension.
-
getName
java.lang.String getName()
Returns the name of this trace.- Returns:
- the name of this trace.
- See Also:
setName(String s)
-
getNearestPointEuclid
ITrace2D.DistancePoint getNearestPointEuclid(double x, double y)
Returns the nearest point to the given normalized value coordinates of this trace in Euclid distance.Please note that the arguments must be normalized value coordinates like provided by a
or the division of a pixel coordinate by the total pixel range of the chart.TracePoint2D.getScaledX()
Using the Manhattan distance is much faster than Euclid distance as it only includes basic addition an absolute value for computation per point (vs. square root, addition and quadrature for Euclid distance). However the euclid distance spans a circle for the nearest points which is visually more normal for end users than the Manhattan distance which forms a rhombus and reaches far distances in only one dimension.
- Parameters:
x
- the x value as a normalized value between 0 and 1.0.y
- the x value as a normalized value between 0 and 1.0.- Returns:
- the nearest point to the given normalized value coordinates of this trace in Euclid distance.
-
getNearestPointManhattan
ITrace2D.DistancePoint getNearestPointManhattan(double x, double y)
Returns the nearest point to the given normalized value coordinates of this trace in Manhattan distance.Please note that the arguments must be normalized value coordinates like provided by a
or the division of a pixel coordinate by the total pixel range of the chart.TracePoint2D.getScaledX()
Using the Manhattan distance is much faster than Euclid distance as it only includes basic addition an absolute value for computation per point (vs. square root, addition and quadrature for Euclid distance).
- Parameters:
x
- the x value as a normalized value between 0 and 1.0.y
- the x value as a normalized value between 0 and 1.0.- Returns:
- the nearest point to the given normalized value coordinates of this trace in Manhattan distance.
-
getPhysicalUnits
java.lang.String getPhysicalUnits()
Returns the concatenation[x: "
.getPhysicalUnitsX()
", y: "getPhysicalUnitsY()
"]- Returns:
- the concatenation
[x: "
.getPhysicalUnitsX()
", y: "getPhysicalUnitsY()
"] - See Also:
setPhysicalUnits(String x,String y)
-
getPhysicalUnitsX
java.lang.String getPhysicalUnitsX()
Returns the physical unit string value for the x dimension.- Returns:
- the physical unit string value for the x dimension.
- See Also:
setPhysicalUnits(String x,String y)
-
getPhysicalUnitsY
java.lang.String getPhysicalUnitsY()
Returns the physical unit string value for the y dimension.- Returns:
- the physical unit string value for the y dimension.
- See Also:
setPhysicalUnits(String x,String y)
-
getPointHighlighters
java.util.Set<IPointPainter<?>> getPointHighlighters()
Returns theSet<
that may be used to highlight points of this trace.IPointPainter
>This is used by the point highlighting feature:
Chart2D.enablePointHighlighting(boolean)
- Returns:
- the
Set<
that may be used to highlight points.IPointPainter
>
-
getPropertyChangeListeners
java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String property)
Returns all property change listeners for the given property.- Parameters:
property
- one of the constants with thePROPERTY_
prefix defined in this class or subclasses.- Returns:
- the property change listeners for the given property.
-
getRenderer
Chart2D getRenderer()
- Returns:
- Returns the renderer.
-
getSize
int getSize()
Returns the amount ofTracePoint2D
instances currently contained.- Returns:
- The amount of
instances currently contained.TracePoint2D
-
getStroke
java.awt.Stroke getStroke()
Returns the Stroke that is used to render this instance.- Returns:
- the Stroke that is used to render this instance.
- See Also:
setStroke(Stroke)
-
getTracePainters
java.util.Set<ITracePainter<?>> getTracePainters()
Returns theSet<
that will be used to paint this trace.ITracePainter
>The original set should be returned by contract to allow adding painters "silently" (vs. using
).addTracePainter(ITracePainter)
- Returns:
- the
Set<
that will be used to paint this trace.ITracePainter
>
-
getZIndex
java.lang.Integer getZIndex()
The z-index defines the order in which this instance will be painted.A higher value will bring it more "to the front".
- Returns:
- the z-index that will define the order in which this instance will be painted.
-
isEmpty
boolean isEmpty()
Returns false if internal
instances are contained or true if not.TracePoint2D
- Returns:
- false if internal
instances are contained or true if not.TracePoint2D
-
isVisible
boolean isVisible()
Returns true if this instance should be rendered.- Returns:
- true if this instance should be rendered.
-
iterator
java.util.Iterator<ITracePoint2D> iterator()
Returns anIterator
over the internalTracePoint2D
Implementations should be synchronized. This method is meant to allow modifications of the intenal
TracePoint2D
instances, so the original points should be returned.There is no guarantee that changes made to the contained tracepoints will be reflected in the display immediately. The order the iterator returns the
TracePoint2D
instances decides how theChart2D
will paint the trace.- Returns:
- an
Iterator
over the internalTracePoint2D
-
removeAllPointHighlighters
java.util.Set<IPointPainter<?>> removeAllPointHighlighters()
Clears all internal point highlighters used.Returns the
Set<
that was used to highlight points.IPointPainter
>This is used by the point highlighting feature:
Chart2D.enablePointHighlighting(boolean)
- Returns:
- the
Set<
that was be used to highlight points.IPointPainter
>
-
removeAllPoints
void removeAllPoints()
Removes all internalTracePoint2D
.isEmpty()
will return true afterwards.
-
removeComputingTrace
boolean removeComputingTrace(ITrace2D trace)
Remove a trace that "should" compute values from the points added via
.addPoint(ITracePoint2D)
- Parameters:
trace
- the trace that will calculate it's points from the added points of this trace.- Returns:
- true if the given trace was removed (recognized by the means of
).Object.equals(Object)
-
removeErrorBarPolicy
boolean removeErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Removes the given error bar policy from the internal set of error bar policies.- Parameters:
errorBarPolicy
- the error bar policy to remove.- Returns:
- true if the painter was removed (same instance contained before).
-
removePoint
boolean removePoint(ITracePoint2D point)
Removes the given point from this trace.- Parameters:
point
- the point to remove.- Returns:
- true if the remove opertation was successful, false else.
-
removePointHighlighter
boolean removePointHighlighter(IPointPainter<?> highlighter)
Removes the given point highlighter, if it's class is contained.- Parameters:
highlighter
- the highlighter to remove.- Returns:
- true if a point highlighter of the class of the given argument was removed.
-
removePropertyChangeListener
void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregisters a property change listener that has been registered for listening on all properties.- Parameters:
listener
- a listener that will only be informed if the property identified by the argumentpropertyName
changes
-
removePropertyChangeListener
void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Removes a property change listener for listening on the given property.- Parameters:
property
- one of the constants with thePROPERTY_
prefix defined in this class or subclasses.listener
- the listener for this property change.
-
removeTracePainter
boolean removeTracePainter(ITracePainter<?> painter)
Removes the given trace painter, if it's class is contained and if more painters are remaining.- Parameters:
painter
- the trace painter to remove.- Returns:
- true if a trace painter of the class of the given argument was removed.
-
setColor
void setColor(java.awt.Color color)
Set ajava.awt.Color
for this trace.- Parameters:
color
- the Color to set.
-
setErrorBarPolicy
java.util.Set<IErrorBarPolicy<?>> setErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Replaces all internal error bar policies by the new one.- Parameters:
errorBarPolicy
- the new sole painter to use.- Returns:
- the
Set<
that was used before.IErrorBarPolicy
>
-
setName
void setName(java.lang.String name)
Assingns a specific name to theITrace2D
which will be displayed by theChart2D
.- Parameters:
name
- the name for this trace.
-
setPhysicalUnits
void setPhysicalUnits(java.lang.String xunit, java.lang.String yunit)
Assigns a specific String representing the physical unit to theITrace2D
(e.g. Volt, Ohm, lux, ...) which will be displayed by theChart2D
- Parameters:
xunit
- the physical unit for the x axis.yunit
- the physical unit for the y axis.
-
setPointHighlighter
java.util.Set<IPointPainter<?>> setPointHighlighter(IPointPainter<?> highlighter)
Replaces all internal point highlighters by the new one.- Parameters:
highlighter
- the new sole highlighter to use.- Returns:
- the
Set<
that was used before or null if nothing changed.IPointPainter
>
-
setRenderer
void setRenderer(Chart2D renderer)
This is a callback fromChart2D.addTrace(ITrace2D)
and must not be invoked from elsewhere (needed for synchronization).Not the best design to put this to an interface, but Char2D should handle this interface only.
- Parameters:
renderer
- The renderer to set.
-
setStroke
void setStroke(java.awt.Stroke stroke)
Allows to specify the rendering of the ITrace2D. This Stroke will be assigned to theGraphics2D
by the renderingChart2D
when painting this instance.- Parameters:
stroke
- the stroke to use for painting this trace.
-
setTracePainter
java.util.Set<ITracePainter<?>> setTracePainter(ITracePainter<?> painter)
Replaces all internal trace painters by the new one.- Parameters:
painter
- the new sole painter to use.- Returns:
- the
Set<
that was used before.ITracePainter
>
-
setVisible
void setVisible(boolean visible)
Set the visibility. If argument is false, this instance will not be rendered by a Chart2D.- Parameters:
visible
- true if this trace should be painted, false else.
-
setZIndex
void setZIndex(java.lang.Integer zIndex)
Sets the internal z-index property. This decides the order in which different traces within the same
are painted.Chart2D
The higher the given value is the more this trace will be brought to front.
The value must not be lower than
Z_INDEX_MIN
(0) and higher thanZINDEX_MAX
(100).This might not be tested for increased performance but ignoring these bounds may result in wrong ordering of display.
- Parameters:
zIndex
- the z index of this trace - the lower the value the more in front the trace will appear amongst other traces in the same chart.- See Also:
getZIndex()
-
showsErrorBars
boolean showsErrorBars()
Tests whether error bars are painted by this trace.Returns true if
- this trace contains
IErrorBarPolicy
instances. - and at least one of these instances contains at least one
IErrorBarPainter
instance.
- Returns:
- true if this trace renders error bars.
- this trace contains
-
showsNegativeXErrorBars
boolean showsNegativeXErrorBars()
Tests whether error bars in negative x direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicy
instance thatIErrorBarPolicy.isShowNegativeXErrors()
. - and at least one of these instances contains at least one
IErrorBarPainter
instance.
- Returns:
- true if this trace renders error bars in negative x direction.
- this trace contains at leaste one
-
showsNegativeYErrorBars
boolean showsNegativeYErrorBars()
Tests whether error bars in negative y direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicy
instance thatIErrorBarPolicy.isShowNegativeYErrors()
. - and at least one of these instances contains at least one
IErrorBarPainter
instance.
- Returns:
- true if this trace renders error bars in negative y direction.
- this trace contains at leaste one
-
showsPositiveXErrorBars
boolean showsPositiveXErrorBars()
Tests whether error bars in positive x direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicy
instance thatIErrorBarPolicy.isShowPositiveXErrors()
. - and at least one of these instances contains at least one
IErrorBarPainter
instance.
- Returns:
- true if this trace renders error bars in positive x direction.
- this trace contains at leaste one
-
showsPositiveYErrorBars
boolean showsPositiveYErrorBars()
Tests whether error bars in positive y direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicy
instance thatIErrorBarPolicy.isShowPositiveYErrors()
. - and at least one of these instances contains at least one
IErrorBarPainter
instance.
- Returns:
- true if this trace renders error bars in positive y direction.
- this trace contains at leaste one
-
-