Package org.faceless.graph2
Class LineSeries
- java.lang.Object
-
- org.faceless.graph2.Series
-
- org.faceless.graph2.AbstractLineSeries
-
- org.faceless.graph2.LineSeries
-
public class LineSeries extends AbstractLineSeries
The LineSeries represents the data found on a typical line graph - a collection of sampled values. Samples are set using theset(double, double)
method. For example, to plot a simple LineGraph:LineSeries series = new LineSeries("Samples"); series.set(1, 10); series.set(3, 12); series.set(7, 5); axesgraph.addSeries(series);
See theDateAxis
API documentation to see how to plot dates on a LineSeries.- See Also:
DateAxis
,AreaSeries
-
-
Constructor Summary
Constructors Constructor Description LineSeries(String name)
Create a new LineSeries
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SortedMap<Double,Double>
getData()
void
set(double x, double y)
Set a value on the graph.void
setMaxDataPoints(int points)
Set the maximum number of data points that will be drawn with this LineSeries.String
toString()
-
Methods inherited from class org.faceless.graph2.AbstractLineSeries
setDepth
-
Methods inherited from class org.faceless.graph2.Series
addBox, addLine, addMarker, getName, outputToSeries, outputToSeriesFunction, setStyle
-
-
-
-
Constructor Detail
-
LineSeries
public LineSeries(String name)
Create a new LineSeries- Parameters:
name
- the name of the series
-
-
Method Detail
-
set
public void set(double x, double y)
Set a value on the graph. Thex
parameter specifies the horizontal position on the graph, and must be a real number. They
parameter specifies the vertical position, and may be a real number orDouble.NaN
, which will result in a gap in the line where that point would have been.- Parameters:
x
- the X co-ordinate of the sampley
- the Y co-ordinate of the sample
-
getData
public SortedMap<Double,Double> getData()
Return aSortedMap
containing a copy of all the data points of this LineSeries, where the X and Y values are the Key and Value, stored asDouble
s.- Since:
- 2.3.4
-
setMaxDataPoints
public void setMaxDataPoints(int points)
Set the maximum number of data points that will be drawn with this LineSeries. This method is useful when plotting very large series - for example, when plotting data to a bitmap image 100 pixels wide, there is no point in plotting thousands of points. This method attempts to drop less significant points from the series, leaving peaks and troughs intact if possible. The default value is 0, which means all points will be plotted.- Parameters:
points
- the maximum number of data points to plot in this series, or 0 to not set a maximum- Since:
- 2.0.1
-
-