Class DataProviderSeries<T>
- java.lang.Object
-
- com.vaadin.flow.component.charts.model.AbstractConfigurationObject
-
- com.vaadin.flow.component.charts.model.AbstractSeries
-
- com.vaadin.flow.component.charts.model.DataProviderSeries<T>
-
- All Implemented Interfaces:
Series,Serializable
public class DataProviderSeries<T> extends AbstractSeries
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 asyvalues.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLOSE_PROPERTYstatic StringHIGH_PROPERTYstatic StringLOW_PROPERTYstatic StringOPEN_PROPERTYstatic StringX_ATTRIBUTEstatic StringY_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description DataProviderSeries(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)Creates a new series using data from the given data provider.DataProviderSeries(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider, com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Creates a new series using data from the given data provider and y values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getChartAttributes()Returns a set of chart attributes(keys).com.vaadin.flow.data.provider.DataProvider<T,?>getDataProvider()Returns the underlying data provider.List<Map<String,Optional<Object>>>getValues()Returns a list mappings between chart attributes(keys) and values.booleanisAutomaticChartUpdateEnabled()Returns true if the chart is updated automatically when a DataChangeEvent is emitted by the data provider.voidsetAutomaticChartUpdateEnabled(boolean automaticChartUpdateEnabled)Sets if the chart should be updated automatically when a DataChangeEvent is emitted by the data provider.voidsetClose(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievingclosevalues from the bean provided by the data provider.voidsetHigh(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievinghighvalues from the bean provided by the data provider.voidsetLow(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievinglowvalues from the bean provided by the data provider.voidsetOpen(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievingopenvalues from the bean provided by the data provider.voidsetPointName(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievingnamevalues from the bean provided by the data provider.voidsetProperty(String propertyName, com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrieving the value for the given property name from the given data provider.voidsetX(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievingxvalues from the bean provided by the data provider.voidsetY(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)Sets the function used for retrievingyvalues 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 Detail
-
X_ATTRIBUTE
public static final String X_ATTRIBUTE
- See Also:
- Constant Field Values
-
Y_ATTRIBUTE
public static final String Y_ATTRIBUTE
- See Also:
- Constant Field Values
-
HIGH_PROPERTY
public static final String HIGH_PROPERTY
- See Also:
- Constant Field Values
-
LOW_PROPERTY
public static final String LOW_PROPERTY
- See Also:
- Constant Field Values
-
OPEN_PROPERTY
public static final String OPEN_PROPERTY
- See Also:
- Constant Field Values
-
CLOSE_PROPERTY
public static final String CLOSE_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataProviderSeries
public DataProviderSeries(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
Creates a new series using data from the given data provider.Many chart types such as
ChartType.BAR,ChartType.LINE,ChartType.AREAetc useyvalues 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.ERRORBARdo not requireyvalues but insteadhighandlowvalues. Functions for extracting these are set usingsetHigh(SerializableFunction)andsetLow(SerializableFunction)respectively.- Parameters:
dataProvider- the data provider which contains the data
-
DataProviderSeries
public DataProviderSeries(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider, com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
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 Detail
-
setProperty
public void setProperty(String propertyName, com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
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
public void setX(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievingxvalues 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
public void setY(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievingyvalues 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
public void setPointName(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievingnamevalues 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
public void setLow(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievinglowvalues 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
public void setHigh(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievinghighvalues 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
public void setOpen(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievingopenvalues 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
public void setClose(com.vaadin.flow.function.SerializableFunction<T,Object> callBack)
Sets the function used for retrievingclosevalues 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
public com.vaadin.flow.data.provider.DataProvider<T,?> getDataProvider()
Returns the underlying data provider.- Returns:
- the underlying data provider.
-
getValues
public List<Map<String,Optional<Object>>> 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
public Set<String> 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.
-
-