public class PlotLine
extends java.lang.Object
GUIChart
.
Each PlotLine
can have its width, color, set of data points and a histogram associated to it.
It can also become selected.
Lines are referred to by the GUIChart
by their letter. This letter is also stored in the line.Constructor and Description |
---|
PlotLine(char ch,
GUIChart gc) |
PlotLine(java.lang.String s,
char ch,
GUIChart gc) |
Modifier and Type | Method and Description |
---|---|
void |
addPoint(FloatPoint fp)
Add a data point to this
PlotLine . |
void |
addProperty(FloatProperty p)
Register a new
Property for this PlotLine . |
double |
evaluateYatX(double x)
Use linear interpolation to guess the value between 2 points; returns 0
if no such value exists.
|
javafx.scene.paint.Color |
getColor() |
double |
getCursorX() |
double |
getCursorY() |
java.util.ArrayList<java.lang.Integer> |
getHistogramBins() |
int |
getHistogramBinsCount()
Get the amount of bins for the histogram display.
|
double |
getHistogramMax() |
double |
getHistogramMin() |
char |
getCharacter() |
double |
getLineWidth() |
int |
getPointCount() |
FloatPoint |
getPointLeftTo(double value)
Returns the FloatPoint, x value of which is the closest to the value
provided, but smaller.
|
FloatPoint |
getPointRightTo(double value)
Returns the FloatPoint, x value of which is the closest to the value
provided, but greater.
|
java.util.concurrent.ConcurrentSkipListMap<java.lang.Double,FloatPoint> |
getPoints() |
FloatProperty |
getProperty(int propertyId)
Get the
FloatProperty , based on the given unique ID |
FloatProperty |
getPropertyByName(java.lang.String name)
Return a
Property , given its unique name. |
boolean |
isBeingRecorded() |
boolean |
isSelected()
Whether or not this
PlotLine is selected, when on the GUIChart . |
boolean |
isVisible() |
void |
reset()
Revert this
PlotLine to the default state, discarding the data. |
void |
sample()
Add a new
FloatPoint to the list. |
void |
setColor(javafx.scene.paint.Color c)
Set the color of this line.
|
void |
setCursorX(double x)
Set the
LineX Property . |
void |
setCursorY(double y)
Set the
LineY Property . |
void |
setHistogramBinsCount(int histogramBinsCount)
Set the amount of bins for the histogram display.
|
boolean |
setProperty(int propertyId,
float value)
Set the
Property , identified by its unique ID, to the value provided. |
void |
setRecorded(boolean rec)
Set whether or not should this line be recorded by the
GUIChart . |
void |
setSelected(boolean selected)
Set whether or not this
PlotLine is selected, when on the GUIChart |
java.lang.String |
toString() |
public PlotLine(java.lang.String s, char ch, GUIChart gc)
public PlotLine(char ch, GUIChart gc)
public int getHistogramBinsCount()
public void setHistogramBinsCount(int histogramBinsCount)
public double getHistogramMin()
public double getHistogramMax()
public java.util.ArrayList<java.lang.Integer> getHistogramBins()
ArrayList
of Integer
, each element representing the
number of samples in a single bin.public double getLineWidth()
public void reset()
PlotLine
to the default state, discarding the data.public FloatPoint getPointLeftTo(double value)
value
- public FloatPoint getPointRightTo(double value)
value
- public double evaluateYatX(double x)
x
- public void addPoint(FloatPoint fp)
PlotLine
.
Will automatically update the histogram, the LineSamples
Property
and request the repainting of the
enclosing GUIChart
fp
- public java.util.concurrent.ConcurrentSkipListMap<java.lang.Double,FloatPoint> getPoints()
ConcurrentSkipListMap
, which stores all the FloatPoint
s of this
PlotLine
public javafx.scene.paint.Color getColor()
Color
of this PlotLine
public double getCursorX()
LineX
Property
. This is used by the GUIChart
to determine where next FloatPoint
should be recorded when recording a
PlotLine
.sample()
,
GUIChart.sampleAllRelevant()
public double getCursorY()
LineY
Property
. This is used by the GUIChart
to determine where next FloatPoint
should be recorded when recording a
PlotLine
.sample()
,
GUIChart.sampleAllRelevant()
public void setCursorX(double x)
LineX
Property
.x
- the new value of the LineX
Property
.getCursorX()
public void setCursorY(double y)
LineY
Property
.y
- the new value of the LineY
Property
.getCursorY()
public void setRecorded(boolean rec)
GUIChart
.rec
- whether or not should this line be recorded by the GUIChart
.GUIChart.startRecording()
public boolean isBeingRecorded()
GUIChart
.public void setSelected(boolean selected)
PlotLine
is selected, when on the GUIChart
selected
- whether or not this PlotLine
is selected, when on the GUIChart
public boolean isSelected()
PlotLine
is selected, when on the GUIChart
.
This determines, whether it will be recorded when the next recording is initialized and more.GUIChart.sampleAllRelevant()
public char getCharacter()
PlotLine
public boolean isVisible()
public int getPointCount()
FloatPoint
s it his PlotLine
.
Calling this method is semantically equivalent to calling getPoints().size()
public java.lang.String toString()
toString
in class java.lang.Object
public void sample()
FloatPoint
to the list.
The position is determined by the LineX
and
LineY
Property
objects.getCursorX()
,
getCursorY()
,
getPoints()
public FloatProperty getPropertyByName(java.lang.String name)
Property
, given its unique name.name
- the name of the Property
to return.Property
, given its unique name.Property.getName()
public boolean setProperty(int propertyId, float value)
Property
, identified by its unique ID, to the value provided.
(Remark: for simplicity of implementation, all properties of a line are of type
FloatProperty
).
This method will safely fail (return false) if no such Property
exists.propertyId
- the unique ID of the Property
to adjustvalue
- the new value of this propertypublic void addProperty(FloatProperty p)
Property
for this PlotLine
. Once this
method is called, it is possible to set the value of this property and
retrieve it using the setLine[PropertyName] or getLine[PropertyName] CLUC
functions.
The registration of this property is handled by correctly adjusting the
name2IdMap
, id2NameMap
, property2idMap
and
property2idMap
HashMap
s.p
- the Property
to addpublic FloatProperty getProperty(int propertyId)
FloatProperty
, based on the given unique IDpropertyId
- FloatProperty
, based on the given unique IDProperty.getId()
public void setColor(javafx.scene.paint.Color c)
c
- The new color.