public class XYSeries

  1. Object
  2. XYSeries

Known subtypesTimeSeries, XYValueSeries

An XY series encapsulates values for XY charts like line, time, area, scatter… charts.

Constructors

public XYSeries(String title)Builds a new XY series.
public XYSeries(String title, int scaleNumber)Builds a new XY series.

Methods

public int getScaleNumber()
public String getTitle()Returns the series title.
public void setTitle(String title)Sets the series title.
public void add(double x, double y)Adds a new value to the series.
public void add(int index, double x, double y)Adds a new value to the series at the specified index.
protected double getPadding(double x)
public void remove(int index)Removes an existing value from the series.
public void clear()Removes all the existing values and annotations from the series.
public void clearSeriesValues()Removes all the existing values from the series but annotations.
public void clearAnnotations()Removes all the existing annotations from the series.
public XYSeries.IndexXYMap<Double, Double> getXYMap()Returns the current values that are used for drawing the series.
public double getX(int index)Returns the X axis value at the specified index.
public double getY(int index)Returns the Y axis value at the specified index.
public void addAnnotation(String annotation, double x, double y)Add a String at (x,y) coordinates
public void addAnnotation(String annotation, int index, double x, double y)Add a String at (x,y) coordinates
public void removeAnnotation(int index)Remove a String at index
public double getAnnotationX(int index)Get X coordinate of the annotation at index
public double getAnnotationY(int index)Get Y coordinate of the annotation at index
public int getAnnotationCount()Get the annotations count
public String getAnnotationAt(int index)Get the String at index
public SortedMap<Double, Double> getRange(double start, double stop, boolean beforeAfterPoints)Returns submap of x and y values according to the given start and end
public int getIndexForKey(double key)
public int getItemCount()Returns the series item count.
public double getMinX()Returns the minimum value on the X axis.
public double getMinY()Returns the minimum value on the Y axis.
public double getMaxX()Returns the maximum value on the X axis.
public double getMaxY()Returns the maximum value on the Y axis.

Inherited methods

Constructor details

XYSeries

public XYSeries(String title)
Builds a new XY series.

Parameters

title String
the series title.

XYSeries

public XYSeries(String title, int scaleNumber)
Builds a new XY series.

Parameters

title String
the series title.
scaleNumber int
the series scale number

Method details

getScaleNumber

public int getScaleNumber()

getTitle

public String getTitle()
Returns the series title.

Returns

the series title

setTitle

public void setTitle(String title)
Sets the series title.

Parameters

title String
the series title

add

public void add(double x, double y)
Adds a new value to the series.

Parameters

x double
the value for the X axis
y double
the value for the Y axis

add

public void add(int index, double x, double y)
Adds a new value to the series at the specified index.

Parameters

index int
the index to be added the data to
x double
the value for the X axis
y double
the value for the Y axis

getPadding

protected double getPadding(double x)

remove

public void remove(int index)
Removes an existing value from the series.

Parameters

index int
the index in the series of the value to remove

clear

public void clear()
Removes all the existing values and annotations from the series.

clearSeriesValues

public void clearSeriesValues()
Removes all the existing values from the series but annotations.

clearAnnotations

public void clearAnnotations()
Removes all the existing annotations from the series.

getXYMap

public XYSeries.IndexXYMap<Double, Double> getXYMap()
Returns the current values that are used for drawing the series.

Returns

the XY map

getX

public double getX(int index)
Returns the X axis value at the specified index.

Parameters

index int
the index

Returns

the X value

getY

public double getY(int index)
Returns the Y axis value at the specified index.

Parameters

index int
the index

Returns

the Y value

addAnnotation

public void addAnnotation(String annotation, double x, double y)
Add a String at (x,y) coordinates

Parameters

annotation String
String text
x double
Not documented.
y double
Not documented.

addAnnotation

public void addAnnotation(String annotation, int index, double x, double y)
Add a String at (x,y) coordinates

Parameters

annotation String
String text
index int
the index to add the annotation to
x double
Not documented.
y double
Not documented.

removeAnnotation

public void removeAnnotation(int index)
Remove a String at index

getAnnotationX

public double getAnnotationX(int index)
Get X coordinate of the annotation at index

Parameters

index int
the index in the annotations list

Returns

the corresponding annotation X value

getAnnotationY

public double getAnnotationY(int index)
Get Y coordinate of the annotation at index

Parameters

index int
the index in the annotations list

Returns

the corresponding annotation Y value

getAnnotationCount

public int getAnnotationCount()
Get the annotations count

Returns

the annotations count

getAnnotationAt

public String getAnnotationAt(int index)
Get the String at index

Returns

String

getRange

public SortedMap<Double, Double> getRange(double start, double stop, boolean beforeAfterPoints)
Returns submap of x and y values according to the given start and end

Parameters

start double
start x value
stop double
stop x value
beforeAfterPoints boolean
if the points before and after the first and last visible ones must be displayed

Returns

a submap of x and y values

getIndexForKey

public int getIndexForKey(double key)

getItemCount

public int getItemCount()
Returns the series item count.

Returns

the series item count

getMinX

public double getMinX()
Returns the minimum value on the X axis.

Returns

the X axis minimum value

getMinY

public double getMinY()
Returns the minimum value on the Y axis.

Returns

the Y axis minimum value

getMaxX

public double getMaxX()
Returns the maximum value on the X axis.

Returns

the X axis maximum value

getMaxY

public double getMaxY()
Returns the maximum value on the Y axis.

Returns

the Y axis maximum value