com.vaadin.flow.component.charts.model.
Class DataProviderSeries<T>
All Implemented Interfaces:
A series which is based on data from a DataProvider.
You must use setY(SerializableFunction)
to define which part of the
data bean to use as y
values.
Note that even if you use a lazy loading DataProvider
, this series
will work in an eager fashion and load all the data from the provider at
once.
See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDataProviderSeries
(DataProvider<T, ?> dataProvider) Creates a new series using data from the given data provider.
DataProviderSeries
(DataProvider<T, ?> dataProvider, SerializableFunction<T, Object> callBack) Creates a new series using data from the given data provider and y values.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a set of chart attributes(keys).
DataProvider<T,
?> Returns the underlying data provider.
Returns a list mappings between chart attributes(keys) and values.
boolean
Returns true if the chart is updated automatically when a DataChangeEvent is emitted by the data provider.
void
setAutomaticChartUpdateEnabled
(boolean automaticChartUpdateEnabled) Sets if the chart should be updated automatically when a DataChangeEvent is emitted by the data provider.
void
setClose
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
close
values from the bean provided by the data provider.void
setHigh
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
high
values from the bean provided by the data provider.void
setLow
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
low
values from the bean provided by the data provider.void
setOpen
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
open
values from the bean provided by the data provider.void
setPointName
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
name
values from the bean provided by the data provider.void
setProperty
(String propertyName, SerializableFunction<T, Object> callBack) Sets the function used for retrieving the value for the given property name from the given data provider.
void
setX
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
x
values from the bean provided by the data provider.void
setY
(SerializableFunction<T, Object> callBack) Sets the function used for retrieving
y
values from the bean provided by the data provider.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
-
Field Details
-
X_ATTRIBUTE
See Also:
-
Y_ATTRIBUTE
See Also:
-
HIGH_PROPERTY
See Also:
-
LOW_PROPERTY
See Also:
-
OPEN_PROPERTY
See Also:
-
CLOSE_PROPERTY
See Also:
-
-
Constructor Details
-
DataProviderSeries
Creates a new series using data from the given data provider.
Many chart types such as
ChartType.BAR
,ChartType.LINE
,ChartType.AREA
etc usey
values to define the data points to show in the chart. For these chart types you should use eitherDataProviderSeries(DataProvider, SerializableFunction)
orsetY(SerializableFunction)
to define the function (lambda) which extracts the values from the bean in the provider.Other chart types such as
ChartType.ERRORBAR
do not requirey
values but insteadhigh
andlow
values. Functions for extracting these are set usingsetHigh(SerializableFunction)
andsetLow(SerializableFunction)
respectively.Parameters:
dataProvider
- the data provider which contains the data -
DataProviderSeries
Creates a new series using data from the given data provider and y values.
Parameters:
dataProvider
- the data provider which contains the datacallBack
- the function which retrieves the y values
-
-
Method Details
-
setProperty
Sets the function used for retrieving the value for the given property name from the given data provider.
Parameters:
propertyName
- the property namecallBack
- the function which retrieves the value for the property -
setX
Sets the function used for retrieving
x
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
setY
Sets the function used for retrieving
y
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
setPointName
Sets the function used for retrieving
name
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
setLow
Sets the function used for retrieving
low
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
setHigh
Sets the function used for retrieving
high
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
setOpen
Sets the function used for retrieving
open
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
setClose
Sets the function used for retrieving
close
values from the bean provided by the data provider.How exactly the values are used depends on the used chart type.
Parameters:
callBack
- the function which retrieves the values -
getDataProvider
Returns the underlying data provider.
Returns:
the underlying data provider.
-
getValues
Returns a list mappings between chart attributes(keys) and values. For example: x->1, x->2, y->2, y->3 for linear chart
Returns:
-
getChartAttributes
Returns a set of chart attributes(keys).
Returns:
-
isAutomaticChartUpdateEnabled
public boolean isAutomaticChartUpdateEnabled()Returns true if the chart is updated automatically when a DataChangeEvent is emitted by the data provider. Default is true.
Returns:
-
setAutomaticChartUpdateEnabled
public void setAutomaticChartUpdateEnabled(boolean automaticChartUpdateEnabled) Sets if the chart should be updated automatically when a DataChangeEvent is emitted by the data provider. Default is true.
Parameters:
automaticChartUpdateEnabled
- True sets the chart updating to enabled, false disables it.
-