Package org.pepstock.charba.client.data
Class Data
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.data.Data
-
- All Implemented Interfaces:
ConfigurationElement,HasLabels
public final class Data extends NativeObjectContainer implements ConfigurationElement, HasLabels
CHART.JS entity object to configure the data options of a chart.
It contains labels and data sets.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Constructor Description Data(ChartEnvelop<IsChart> envelop)Creates the object with an empty native object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ActiveDatasetElement>createActiveElementsByDataIndex(int... dataIndexes)Creates a list of active elements instances by an array of data indexes, for all visible data sets.List<ActiveDatasetElement>createActiveElementsByDatasetIndex(int... datasetIndexes)Creates a list of active elements instances by an array of data set indexes, for visible data sets.List<Dataset>getDatasets()Returns the list of data sets.List<Dataset>getDatasets(boolean binding)Returns the list of data sets.LabelsHandlergetLabelsHandler()Returns an labels option handler instance.LabelsgetXLabels()Returns the labels for X axes.LabelsgetXLabels(boolean binding)Returns the labels for X axes.LabelsgetYLabels()Returns the labels for Y axes.LabelsgetYLabels(boolean binding)Returns the labels for Y axes.booleanisCanvasObjectHandling()Returnstrueif the plugin to manage canvas object (gradients and patterns) has been forcedly disable.
Pay attention that disabling the handler, your data sets configuration with gradients or patterns will e showed with default color.voidload(IsChart chart, Configuration configuration)Called to enable to load in the a configuration object the specific configuration item (by native object).DatasetretrieveDataset(DatasetContext context)Returns a data set instance by scriptable context, data set index and index.DatasetretrieveDataset(LegendItem legendItem)Returns a data set instance by legend item locator, data set index and index.DatasetretrieveDataset(TooltipItem tooltipItem)Returns a data set instance by tooltip item locator, data set index and index.GradientretrieveFillStyleAsGradient(LegendItem legendItem)Returns a gradient object set as background color for a data set related to legend item.PatternretrieveFillStyleAsPattern(LegendItem legendItem)Returns a pattern object set as background color for a data set related to legend item.GradientretrieveStrokeStyleAsGradient(LegendItem legendItem)Returns a gradient object set as border color for a data set related to legend item.PatternretrieveStrokeStyleAsPattern(LegendItem legendItem)Returns a pattern object set as border color for a data set related to legend item.voidsetCanvasObjectHandling(boolean canvasObjectHandling)Setstrueif the plugin to manage canvas object (gradients and patterns) have to be forcedly disable.
Pay attention that disabling the handler, your data sets configuration with gradients or patterns will e showed with default color.voidsetDatasets(Dataset... datasets)Sets a set of data sets for chart.voidsetXLabels(String... labels)Sets the labels for X axes of the data.voidsetXLabels(Labels labels)Sets the labels for X axes of the data.voidsetYLabels(String... labels)Sets the labels for Y axes of the data.voidsetYLabels(Labels labels)Sets the labels for Y axes of the data.-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkAndGetColor, checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Constructor Detail
-
Data
public Data(ChartEnvelop<IsChart> envelop)
Creates the object with an empty native object.- Parameters:
envelop- envelop containing the chart instance
-
-
Method Detail
-
getLabelsHandler
public LabelsHandler getLabelsHandler()
Description copied from interface:HasLabelsReturns an labels option handler instance.- Specified by:
getLabelsHandlerin interfaceHasLabels- Returns:
- an labels option handler instance
-
setXLabels
public void setXLabels(String... labels)
Sets the labels for X axes of the data.- Parameters:
labels- array of labels
-
setXLabels
public void setXLabels(Labels labels)
Sets the labels for X axes of the data.- Parameters:
labels- labels object to manage also multi-line labels
-
getXLabels
public Labels getXLabels()
Returns the labels for X axes.- Returns:
- the labels for X axes
-
getXLabels
public Labels getXLabels(boolean binding)
Returns the labels for X axes.- Parameters:
binding- iftruebinds the new labels in the container- Returns:
- the labels for X axes
-
setYLabels
public void setYLabels(String... labels)
Sets the labels for Y axes of the data.- Parameters:
labels- array of labels
-
setYLabels
public void setYLabels(Labels labels)
Sets the labels for Y axes of the data.- Parameters:
labels- labels object to manage also multiple line labels
-
getYLabels
public Labels getYLabels()
Returns the labels for Y axes.- Returns:
- the labels for Y axes
-
getYLabels
public Labels getYLabels(boolean binding)
Returns the labels for Y axes.- Parameters:
binding- iftruebinds the new labels in the container- Returns:
- the labels for Y axes
-
setDatasets
public void setDatasets(Dataset... datasets)
Sets a set of data sets for chart. If argument isnull, removes all data sets.- Parameters:
datasets- set of data set. Ifnull, removes all data sets
-
getDatasets
public List<Dataset> getDatasets()
Returns the list of data sets.- Returns:
- the list of data sets
-
getDatasets
public List<Dataset> getDatasets(boolean binding)
Returns the list of data sets.- Parameters:
binding- iftruebinds the new array list in the container- Returns:
- the list of data sets
-
isCanvasObjectHandling
public boolean isCanvasObjectHandling()
Returnstrueif the plugin to manage canvas object (gradients and patterns) has been forcedly disable.
Pay attention that disabling the handler, your data sets configuration with gradients or patterns will e showed with default color.- Returns:
trueif the plugin to manage canvas object (gradients and patterns) has been forcedly disable
-
setCanvasObjectHandling
public void setCanvasObjectHandling(boolean canvasObjectHandling)
Setstrueif the plugin to manage canvas object (gradients and patterns) have to be forcedly disable.
Pay attention that disabling the handler, your data sets configuration with gradients or patterns will e showed with default color.- Parameters:
canvasObjectHandling-trueif the plugin to manage canvas object (gradients and patterns) have to be forcedly disable
-
createActiveElementsByDatasetIndex
public List<ActiveDatasetElement> createActiveElementsByDatasetIndex(int... datasetIndexes)
Creates a list of active elements instances by an array of data set indexes, for visible data sets.- Parameters:
datasetIndexes- an array of data set indexes- Returns:
- a list of active elements instances by an array of data set indexes
-
createActiveElementsByDataIndex
public List<ActiveDatasetElement> createActiveElementsByDataIndex(int... dataIndexes)
Creates a list of active elements instances by an array of data indexes, for all visible data sets.- Parameters:
dataIndexes- an array of data indexes- Returns:
- a list of active elements instances by an array of data indexes
-
retrieveFillStyleAsGradient
public final Gradient retrieveFillStyleAsGradient(LegendItem legendItem)
Returns a gradient object set as background color for a data set related to legend item.- Parameters:
legendItem- legend item instance to get the data set related to.- Returns:
- a gradient object or
nullif not found by legend item
-
retrieveStrokeStyleAsGradient
public final Gradient retrieveStrokeStyleAsGradient(LegendItem legendItem)
Returns a gradient object set as border color for a data set related to legend item.- Parameters:
legendItem- legend item instance to get the data set related to.- Returns:
- a gradient object or
nullif not found by legend item
-
retrieveFillStyleAsPattern
public final Pattern retrieveFillStyleAsPattern(LegendItem legendItem)
Returns a pattern object set as background color for a data set related to legend item.- Parameters:
legendItem- legend item instance to get the data set related to.- Returns:
- a pattern object or
nullif not found by legend item
-
retrieveStrokeStyleAsPattern
public final Pattern retrieveStrokeStyleAsPattern(LegendItem legendItem)
Returns a pattern object set as border color for a data set related to legend item.- Parameters:
legendItem- legend item instance to get the data set related to.- Returns:
- a pattern object or
nullif not found by legend item
-
retrieveDataset
public final Dataset retrieveDataset(LegendItem legendItem)
Returns a data set instance by legend item locator, data set index and index.- Parameters:
legendItem- legend item instance to get the data set related to.- Returns:
- a data set instance or
nullif not found by legend item
-
retrieveDataset
public final Dataset retrieveDataset(TooltipItem tooltipItem)
Returns a data set instance by tooltip item locator, data set index and index.- Parameters:
tooltipItem- tooltip item instance to get the data set related to.- Returns:
- a data set instance or
nullif not found by tooltip item
-
retrieveDataset
public final Dataset retrieveDataset(DatasetContext context)
Returns a data set instance by scriptable context, data set index and index.- Parameters:
context- legend item instance to get the data set related to.- Returns:
- a data set instance by scriptable context item or
nullif not found by scriptable context
-
load
public void load(IsChart chart, Configuration configuration)
Description copied from interface:ConfigurationElementCalled to enable to load in the a configuration object the specific configuration item (by native object).- Specified by:
loadin interfaceConfigurationElement- Parameters:
chart- chart instanceconfiguration- chart configuration instance
-
-