com.vaadin.flow.component.charts.model.
Class ListSeries
- java.lang.Object
-
- com.vaadin.flow.component.charts.model.AbstractConfigurationObject
-
- com.vaadin.flow.component.charts.model.AbstractSeries
-
- com.vaadin.flow.component.charts.model.ListSeries
-
All Implemented Interfaces:
public class ListSeries extends AbstractSeries
A series consisting of a list of numerical values. In this case, the numerical values will be interpreted as Y values, and X values will be automatically calculated, either starting at 0 and incrementing by 1, or from pointStart and pointInterval given in the plotOptions. If the axis has categories, these will be used. This option is not available for range series.
See Also:
-
-
Constructor Summary
Constructors Constructor and Description ListSeries()
ListSeries(Collection<Number> values)
Constructs a ListSeries with the given collection of values.
ListSeries(Number... values)
Constructs a ListSeries with the given array of values.
ListSeries(String name)
Constructs a ListSeries with the given series name.
ListSeries(String name, Collection<Number> values)
Constructs a ListSeries with the given series name and collection of values.
ListSeries(String name, Number... values)
Constructs a ListSeries with the given series name and array of values.
-
Method Summary
All Methods Modifier and Type Method and Description void
addData(Number number)
Adds a given number to the series and immediately updates the chart if it already has been drawn.
void
addData(Number number, boolean updateChartImmediately, boolean shift)
Adds a given number to the series and optionally immediately updates the chart if it has been drawn.
Number[]
getData()
void
setData(List<Number> data)
Sets the given list of numeric values as the values in this list series.
void
setData(Number... values)
Sets the values in the list series to the ones provided.
void
updatePoint(int pointIndex, Number newValue)
Updates the value of the data point at pointIndex to newValue and immediately updates it on the chart using animation if enabled.
-
Methods inherited from class com.vaadin.flow.component.charts.model.AbstractSeries
getColorAxis, getConfiguration, getId, getName, getPlotOptions, getStack, getxAxis, getyAxis, isVisible, setColorAxis, setConfiguration, setId, setName, setPlotOptions, setStack, setVisible, setVisible, setxAxis, setyAxis, setyAxis, updateSeries
-
-
-
-
Constructor Detail
-
ListSeries
public ListSeries()
-
ListSeries
public ListSeries(String name)
Constructs a ListSeries with the given series name.
Parameters:
name
-
-
ListSeries
public ListSeries(Number... values)
Constructs a ListSeries with the given array of values.
Parameters:
values
-
-
ListSeries
public ListSeries(Collection<Number> values)
Constructs a ListSeries with the given collection of values.
Parameters:
values
- the values to use
-
ListSeries
public ListSeries(String name, Number... values)
Constructs a ListSeries with the given series name and array of values.
Parameters:
name
-values
-
-
ListSeries
public ListSeries(String name, Collection<Number> values)
Constructs a ListSeries with the given series name and collection of values.
Parameters:
name
- the name of the seriesvalues
- the values to use
-
-
Method Detail
-
getData
public Number[] getData()
Returns:
An array of the numeric values
-
setData
public void setData(Number... values)
Sets the values in the list series to the ones provided.
Parameters:
values
-
-
setData
public void setData(List<Number> data)
Sets the given list of numeric values as the values in this list series.
Parameters:
data
-
-
addData
public void addData(Number number)
Adds a given number to the series and immediately updates the chart if it already has been drawn. If the chart has not yet been drawn all items are added to the chart when it is drawn the first time.
Parameters:
number
- the number to be added to the series
-
addData
public void addData(Number number, boolean updateChartImmediately, boolean shift)
Adds a given number to the series and optionally immediately updates the chart if it has been drawn. This method is useful if you want to add many items without a client/server round-trip for each item added. Do this by specifying false for the updateChartImmediately parameter.
Parameters:
number
- the number to be added to the seriesupdateChartImmediately
- if true the chart will be dynamically updated, using animation if enabled.shift
- If true, the first item from the series is removed. Handy if dynamically adjusting adding points and fixed amount of points should be kept visible.
-
updatePoint
public void updatePoint(int pointIndex, Number newValue)
Updates the value of the data point at pointIndex to newValue and immediately updates it on the chart using animation if enabled.
Parameters:
pointIndex
- the index of the point to updatenewValue
- the new value of the point
-
-