Interface ITrace2D
- All Superinterfaces:
Comparable<ITrace2D>,EventListener,PropertyChangeListener,Serializable
- All Known Implementing Classes:
ATrace2D,Trace2DArithmeticMean,Trace2DArithmeticMeanX,Trace2DArithmeticMeanY,Trace2DAxisSwap,Trace2DBijective,Trace2DDebugger,Trace2DLtd,Trace2DLtdReplacing,Trace2DLtdSorted,Trace2DReplacing,Trace2DSimple,Trace2DSorted
Chart2D. ITrace2D contains the values to
display, the color for displaying and a suitable label. It may be seen as a
trace of the Chart2D 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 internal
TracePoint2D- instances or Arrays for unordered Data
(in the order of adding) for fast performance. Even an ITrace2D
constructed by a "function- Object" may be thinkable.
There are various constraints for Traces:
- ordered by x-values
- ordered by the order of addPoint- invocation (control form
outside)
- unique, single x- values
- limitation of tracepoints
- time- critical (fast- changing tracepoints)
Therefore there are various ITrace2D- 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 (see getZIndex(), setZIndex(Integer)).
Property Change events
The followingPropertyChangeEvent may be
fired to PropertyChangeListener instances that register
themselves with
addPropertyChangeListener(String, PropertyChangeListener).
<table * border="0">
getPropertyName()getSource()getOldValue()getNewValue()PROPERTY_ZINDEX
ITrace2D that changedNumber, the old valueNumber, the new valuePROPERTY_MAX_XITrace2D that changedDouble, the old valueDouble, the new valuePROPERTY_MIN_XITrace2D that changedDouble, the old valueDouble, the new valuePROPERTY_MAX_YITrace2D that changedDouble, the old valueDouble, the new valuePROPERTY_MIN_YITrace2D that changedDouble, the old valueDouble, the new valuePROPERTY_TRACEPOINT
ITrace2D that changedTracePoint2D, the
instance that was removednull, indication that an instance was removedPROPERTY_TRACEPOINT
ITrace2D that changednull, indication that a value was addedTracePoint2D, the new
instance that was added, identifying that an instance was removedPROPERTY_VISIBLEITrace2D that changedBoolean, the old state.Boolean, the new state.PROPERTY_PAINTERSITrace2D that changednull, indicating that a painter was added.ITracePainter, the new
painter.PROPERTY_PAINTERSITrace2D that changedITracePainter, the old
painter.null, indicating that a painter was removed.PROPERTY_POINT_HIGHLIGHTERS_CHANGED
ITrace2D that changednull, indicating that a point highlighter was added.IPointPainter, the
new highlighter.PROPERTY_POINT_HIGHLIGHTERS_CHANGED
ITrace2D that changedIPointPainter, the
old highlighter.null, indicating that a point highlighter was removed.PROPERTY_PAINTERSITrace2D that changedIPointPainter, the
old highlighter.null, indicating that a highlighter was removed.PROPERTY_STROKE
ITrace2D that changedStroke, the old stroke.Stroke, the new stroke.PROPERTY_COLORITrace2D that changedColor, the new color.Color, the new color.PROPERTY_ERRORBARPOLICY
ITrace2D that changednull, indicating that an error bar policy was added.IErrorBarPolicy, the new
error bar policy.PROPERTY_ERRORBARPOLICY
ITrace2D that changedIErrorBarPolicy, the old
error bar policy.null, indicating that an error bar policy was removed.PROPERTY_ERRORBARPOLICY_CONFIGURATION
ITrace2D that notifies the change of the configured
error bar policy.IErrorBarPolicy, the
instance with the configuration change.PROPERTY_POINT_CHANGED
ITrace2D that notifies the change of the contained
trace point.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).TracePoint2D the point whose location was modified.PROPERTY_NAMEITrace2D that notifies the change.String, the old value of
getName()String, the new value of
getName()PROPERTY_PHYSICALUNITS
ITrace2D that notifies the change.String, the old value of
getPhysicalUnits()String, the new value of
getPhysicalUnits()PROPERTY_LABEL
(triggered by setName(String) and
setPhysicalUnits(String, String))ITrace2D that notifies the change.String, the old value of
getLabel()String, the new value of
getLabel()- Version:
- $Revision: 1.41 $
- Author:
- Achim Westermann
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classSimple struct just for allowing to return a trace point along with a weighted distance. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property key defining thecolorproperty.static final StringThe property key defining a change ofinstances contained.IErrorBarPolicystatic final StringThe property key defining a change of the configuration of a contained.IErrorBarPolicystatic final StringThe property key defining thelabelproperty.static final StringThe property key defining themaxXproperty.static final StringThe property key defining themaxYproperty.static final StringThe property key defining theminXproperty.static final StringThe property key defining theminYproperty.static final StringThe property key defining thenameproperty.static final StringThe property key defining a change in the set ofinstances.ITracePainterstatic final StringThe property key defining thephysicalUnitsproperty.static final StringThe property key defining any change of a location of a contained.TracePoint2Dstatic final StringThe property key defining a change in the set ofinstances.IPointPainterstatic final StringThe property key defining thestrokeproperty.static final StringThe property key defining a change in the collection ofinstances within this trace.TracePoint2Dstatic final StringThe property key defining thevisibleproperty.static final StringThe property key defining thezIndexproperty.static final intThe minimum value for property zIndex: 0.static final intThe maximum value for property zIndex: 100. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComputingTrace(ITrace2D trace) Adds a trace that "should" compute values from the points added via.addPoint(ITracePoint2D)booleanaddErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy) Adds the given error bar policy to the internal set of error bar policies.booleanaddPoint(double x, double y) Adds a trace point to the internal data.booleanAdds the givenTracePoint2Dto the internal data.booleanaddPointHighlighter(IPointPainter<?> highlighter) Adds the given point painter to the internal set of point highlighters.voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Registers a property change listener that will be informed about changes of the property identified by the givenpropertyName.booleanaddTracePainter(ITracePainter<?> painter) Adds the given trace painter to the internal set of trace painters.booleancontainsTracePainter(ITracePainter<?> painter) Returns true if the given painter is contained in this compound painter.voidfirePointChanged(ITracePoint2D changed, int state) Method to trigger by,TracePoint2D.setLocation(double, double)oraddPoint(ITracePoint2D).removePoint(ITracePoint2D)getColor()Because the color is data common to a trace of aChart2Dit is stored here.Set<IErrorBarPolicy<?>>Returns theSet<that will be used to render error bars for this trace.IErrorBarPolicy>booleanReturns true if this trace has error bars configured.getLabel()Callback method for theChart2Dthat returns aStringdescribing the label of theITrace2Dthat will be displayed below the drawing area of theChart2D.intReturns the maximum amount ofTracePoint2Dinstances that may be added.doublegetMaxX()Returns the maximum value to be displayed on the x- axis of theChart2D.doublegetMaxY()Returns the maximum value to be displayed on the y- axis of the Chart2D.doublegetMinX()Returns the minimum value to be displayed on the x- axis of the Chart2D.doublegetMinY()Returns the minimum value to be displayed on the y- axis of the Chart2D.getName()Returns the name of this trace.getNearestPointEuclid(double x, double y) Returns the nearest point to the given normalized value coordinates of this trace in Euclid distance.getNearestPointManhattan(double x, double y) Returns the nearest point to the given normalized value coordinates of this trace in Manhattan distance.Returns the concatenation[x: ".getPhysicalUnitsX()", y: "getPhysicalUnitsY()"]Returns the physical unit string value for the x dimension.Returns the physical unit string value for the y dimension.Set<IPointPainter<?>>Returns theSet<that may be used to highlight points of this trace.IPointPainter>getPropertyChangeListeners(String property) Returns all property change listeners for the given property.intgetSize()Returns the amount ofTracePoint2Dinstances currently contained.Returns the Stroke that is used to render this instance.Set<ITracePainter<?>>Returns theSet<that will be used to paint this trace.ITracePainter>The z-index defines the order in which this instance will be painted.booleanisEmpty()Returns false if internalinstances are contained or true if not.TracePoint2DbooleanReturns true if this instance should be rendered.iterator()Returns anIteratorover the internalinstances.TracePoint2DSet<IPointPainter<?>>Clears all internal point highlighters used.voidRemoves all internalTracePoint2D.isEmpty()will return true afterwards.booleanremoveComputingTrace(ITrace2D trace) Remove a trace that "should" compute values from the points added via.addPoint(ITracePoint2D)booleanremoveErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy) Removes the given error bar policy from the internal set of error bar policies.booleanremovePoint(ITracePoint2D point) Removes the given point from this trace.booleanremovePointHighlighter(IPointPainter<?> highlighter) Removes the given point highlighter, if it's class is contained.voidUnregisters a property change listener that has been registered for listening on all properties.voidremovePropertyChangeListener(String property, PropertyChangeListener listener) Removes a property change listener for listening on the given property.booleanremoveTracePainter(ITracePainter<?> painter) Removes the given trace painter, if it's class is contained and if more painters are remaining.voidSet ajava.awt.Colorfor this trace.Set<IErrorBarPolicy<?>>setErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy) Replaces all internal error bar policies by the new one.voidAssingns a specific name to theITrace2Dwhich will be displayed by theChart2D.voidsetPhysicalUnits(String xunit, String yunit) Assigns a specific String representing the physical unit to theITrace2D(e.g.Set<IPointPainter<?>>setPointHighlighter(IPointPainter<?> highlighter) Replaces all internal point highlighters by the new one.voidsetRenderer(Chart2D renderer) This is a callback fromChart2D.addTrace(ITrace2D)and must not be invoked from elsewhere (needed for synchronization).voidAllows to specify the rendering of the ITrace2D.Set<ITracePainter<?>>setTracePainter(ITracePainter<?> painter) Replaces all internal trace painters by the new one.voidsetVisible(boolean visible) Set the visibility.voidSets the internal z-index property.booleanTests whether error bars are painted by this trace.booleanTests whether error bars in negative x direction are painted by this trace.booleanTests whether error bars in negative y direction are painted by this trace.booleanTests whether error bars in positive x direction are painted by this trace.booleanTests whether error bars in positive y direction are painted by this trace.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface java.beans.PropertyChangeListener
propertyChange
-
Field Details
-
PROPERTY_COLOR
The property key defining thecolorproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_ERRORBARPOLICY
The property key defining a change ofinstances contained.IErrorBarPolicyThis is fired from
,addErrorBarPolicy(IErrorBarPolicy)andremoveErrorBarPolicy(IErrorBarPolicy).setErrorBarPolicy(IErrorBarPolicy)Use in combination with
addPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_ERRORBARPOLICY_CONFIGURATION
The property key defining a change of the configuration of a contained.IErrorBarPolicyThis is fired whenever an
IErrorBarPolicynotifies this instance of a configuration change via an event for.IErrorBarPolicy.PROPERTY_CONFIGURATIONUse in combination with
addPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_LABEL
The property key defining thelabelproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).This is no real property as the
access two other fields.getLabel()- See Also:
-
PROPERTY_MAX_X
The property key defining themaxXproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_MAX_Y
The property key defining themaxYproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_MIN_X
The property key defining theminXproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_MIN_Y
The property key defining theminYproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_NAME
The property key defining thenameproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_PAINTERS
The property key defining a change in the set ofinstances. Use in combination withITracePainteraddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_PHYSICALUNITS
The property key defining thephysicalUnitsproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_POINT_CHANGED
The property key defining any change of a location of a contained.TracePoint2DUse in combination with
addPropertyChangeListener(String, PropertyChangeListener). Property change event with this property will be fired if methodorPoint2D.setLocation(java.awt.geom.Point2D)of any contained point is invoked.TracePoint2D.setLocation(double, double)- See Also:
-
PROPERTY_POINT_HIGHLIGHTERS_CHANGED
The property key defining a change in the set ofinstances. Use in combination withIPointPainteraddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_STROKE
The property key defining thestrokeproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_TRACEPOINT
The property key defining a change in the collection ofinstances within this trace. Use in combination withTracePoint2DaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_VISIBLE
The property key defining thevisibleproperty. Use in combination withaddPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
PROPERTY_ZINDEX
The property key defining thezIndexproperty.Use in combination with
addPropertyChangeListener(String, PropertyChangeListener).- See Also:
-
Z_INDEX_MIN
static final int Z_INDEX_MINThe minimum value for property zIndex: 0. -
ZINDEX_MAX
static final int ZINDEX_MAXThe maximum value for property zIndex: 100.the descriptive name for this trace.
-
-
Method Details
-
addComputingTrace
Adds a trace that "should" compute values from the points added via.addPoint(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
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 proper.Chart2D.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
Adds the givenTracePoint2Dto the internal data.Try to pass instances of
TracePoint2Dto this instance instead of invokingto 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,maxYandminYand 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
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
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 argumentpropertyNamechanges
-
addTracePainter
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
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
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_XandPROPERTY_MAX_Yare 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
Color getColor()Because the color is data common to a trace of aChart2Dit is stored here.On the other hand only the corresponding
Chart2Dmay detect the same color chosen for differentIChart2Dinstances to be displayed. Therefore it is allowed to return null. This is a message to theChart2Dto leave it the choice of the color. Then theChart2Dwill chose a color not owned by anotherITrace2Dinstance managed and assign it to the null- returning instance.The
Chart2Dwill often call this method. So try to cache the value in implementation and only check on modifications ofTracePointinstances 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
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
String getLabel()Callback method for theChart2Dthat returns aStringdescribing the label of theITrace2Dthat 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
nameandphysicalUnits.- Returns:
- a String describing the Axis being accessed.
-
getMaxSize
int getMaxSize()Returns the maximum amount of
TracePoint2Dinstances 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
TracePoint2Dinstances 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
Chart2Dwill often call this method. So try to cache the value in implementation and only check on modifications ofTracePointinstances 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
Chart2Dwill often call this method. So try to cache the value in implementation and only check on modifications ofTracePointinstances 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
Chart2Dwill often call this method. So try to cache the value in implementation and only check on modifications ofTracePointinstances or onadd- invocations for changes.- Returns:
- the minimum value of the internal data for the y- dimension.
-
getName
String getName()Returns the name of this trace.- Returns:
- the name of this trace.
- See Also:
-
getNearestPointEuclid
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
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
String getPhysicalUnits()Returns the concatenation[x: ".getPhysicalUnitsX()", y: "getPhysicalUnitsY()"]- Returns:
- the concatenation
[x: ".getPhysicalUnitsX()", y: "getPhysicalUnitsY()"] - See Also:
-
getPhysicalUnitsX
String getPhysicalUnitsX()Returns the physical unit string value for the x dimension.- Returns:
- the physical unit string value for the x dimension.
- See Also:
-
getPhysicalUnitsY
String getPhysicalUnitsY()Returns the physical unit string value for the y dimension.- Returns:
- the physical unit string value for the y dimension.
- See Also:
-
getPointHighlighters
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
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 ofTracePoint2Dinstances currently contained.- Returns:
- The amount of
instances currently contained.TracePoint2D
-
getStroke
Stroke getStroke()Returns the Stroke that is used to render this instance.- Returns:
- the Stroke that is used to render this instance.
- See Also:
-
getTracePainters
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
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 internalinstances 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
Iterator<ITracePoint2D> iterator()Returns anIteratorover the internalinstances.TracePoint2DImplementations should be synchronized. This method is meant to allow modifications of the intenal
TracePoint2Dinstances, 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
TracePoint2Dinstances decides how theChart2Dwill paint the trace.- Returns:
- an
Iteratorover the internalinstances.TracePoint2D
-
removeAllPointHighlighters
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
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
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
Removes the given point from this trace.- Parameters:
point- the point to remove.- Returns:
- true if the remove opertation was successful, false else.
-
removePointHighlighter
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
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 argumentpropertyNamechanges
-
removePropertyChangeListener
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
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
Set ajava.awt.Colorfor this trace.- Parameters:
color- the Color to set.
-
setErrorBarPolicy
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
Assingns a specific name to theITrace2Dwhich will be displayed by theChart2D.- Parameters:
name- the name for this trace.
-
setPhysicalUnits
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
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
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
Allows to specify the rendering of the ITrace2D. This Stroke will be assigned to theGraphics2Dby the renderingChart2Dwhen painting this instance.- Parameters:
stroke- the stroke to use for painting this trace.
-
setTracePainter
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
Sets the internal z-index property. This decides the order in which different traces within the sameare painted.Chart2DThe 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:
-
showsErrorBars
boolean showsErrorBars()Tests whether error bars are painted by this trace.Returns true if
- this trace contains
IErrorBarPolicyinstances. - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- 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
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowNegativeXErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- 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
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowNegativeYErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- 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
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowPositiveXErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- 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
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowPositiveYErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- Returns:
- true if this trace renders error bars in positive y direction.
- this trace contains at leaste one
-