public abstract class Dataset extends NativeObjectContainer implements HasDataset
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Dataset.Property
Name of common properties of native object related to a dataset.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Dataset(Type type,
IsDefaultOptions defaultValues)
Creates the dataset using a default and chart type related to the dataset, adding patterns and gradients element.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
applyGradient(Key key,
List<CanvasGradientItem> canvasGradientsList)
Stores the canvas gradients into dataset object by property name passed as key.
|
protected abstract void |
applyPattern(Key key,
List<CanvasPatternItem> canvasPatternsList)
Stores the canvas patterns into dataset object by property name passed as key.
|
BackgroundColorCallback |
getBackgroundColorCallback()
Returns the background color callback, if set, otherwise
null. |
BorderColorCallback |
getBorderColorCallback()
Returns the border color callback, if set, otherwise
null. |
BorderWidthCallback |
getBorderWidthCallback()
Returns the border width callback, if set, otherwise
null. |
List<Double> |
getData()
Returns the data property of a dataset for a chart is specified as an array of numbers.
|
List<Double> |
getData(boolean binding)
Returns the data property of a dataset for a chart is specified as an array of numbers.
|
Dataset |
getDataset()
Gets the dataset instance.
|
DataType |
getDataType()
Returns the data type of datasets.
|
protected String |
getDefaultBackgroundColorAsString()
Returns the default background color value based on type of chart.
|
protected String |
getDefaultBorderColorAsString()
Returns the default border color value based on type of chart.
|
protected int |
getDefaultBorderWidth()
Returns the default border width value based on type of chart.
|
protected IsDefaultOptions |
getDefaultValues()
Returns the default options instance.
|
BackgroundColorCallback |
getHoverBackgroundColorCallback()
Returns the hover background color callback, if set, otherwise
null. |
BorderColorCallback |
getHoverBorderColorCallback()
Returns the hover border color callback, if set, otherwise
null. |
BorderWidthCallback |
getHoverBorderWidthCallback()
Returns the hover border width callback, if set, otherwise
null. |
int |
getId()
Returns the unique id of datasets.
|
String |
getLabel()
Returns the label for the dataset which appears in the legend and tooltips.
|
<T extends AbstractPluginOptions> |
getOptions(AbstractPluginOptionsFactory<T> factory)
Returns the plugin options, if exist.
It uses a factory instance to create a plugin options. If factory argument is not consistent, null is returned. |
<T extends AbstractPluginOptions> |
getOptions(String pluginId,
AbstractPluginOptionsFactory<T> factory)
Returns the plugin dataset configuration, if exist.
It uses a factory instance to create a plugin options. |
Type |
getType()
Returns the type of dataset, based on type of chart.
|
boolean |
hasOptions(String pluginId)
Checks if there is any dataset configuration for a specific plugin, by its id.
|
protected Object |
invokeColorCallback(ScriptableContext context,
Scriptable<?> callback,
Key property,
String defaultValue,
boolean hasPattern)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the property in color ones.
|
boolean |
isHidden()
Returns if the dataset will appear or not.
|
void |
removeOptions(String pluginId)
Removes the plugin options.
|
void |
setBackgroundColor(BackgroundColorCallback backgroundColorCallback)
Sets the background color callback.
|
void |
setBorderColor(BorderColorCallback borderColorCallback)
Sets the border color callback.
|
void |
setBorderWidth(BorderWidthCallback borderWidthCallback)
Sets the border width callback.
|
void |
setData(double... values)
Sets the data property of a dataset for a chart is specified as an array of numbers.
|
void |
setData(List<Double> values)
Sets the data property of a dataset for a chart is specified as an array of numbers.
|
void |
setHidden(boolean hidden)
Sets if the dataset will appear or not.
|
void |
setHoverBackgroundColor(BackgroundColorCallback hoverBackgroundColorCallback)
Sets the hover background color callback.
|
void |
setHoverBorderColor(BorderColorCallback hoverBorderColorCallback)
Sets the hover border color callback.
|
void |
setHoverBorderWidth(BorderWidthCallback hoverBorderWidthCallback)
Sets the hover border width callback.
|
void |
setLabel(String label)
Sets the label for the dataset which appears in the legend and tooltips.
|
<T extends AbstractPluginOptions> |
setOptions(String pluginId,
T options)
Sets the plugin dataset configuration.
If dataset configuration options is null, the configuration of plugin will be removed. |
<T extends AbstractPluginOptions> |
setOptions(T options)
Sets the plugin options.
|
checkValue, empty, getArrayValue, getNativeChart, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, keys, remove, remove, removeIfExists, setArrayValue, setArrayValue, setArrayValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, typeprotected Dataset(Type type, IsDefaultOptions defaultValues)
type - chart type related to the datasetdefaultValues - default optionspublic final int getId()
public final DataType getDataType()
protected final IsDefaultOptions getDefaultValues()
public final BackgroundColorCallback getBackgroundColorCallback()
null.null.public final void setBackgroundColor(BackgroundColorCallback backgroundColorCallback)
backgroundColorCallback - the background color callback.public final BorderColorCallback getBorderColorCallback()
null.null.public final void setBorderColor(BorderColorCallback borderColorCallback)
borderColorCallback - the border color callback.public final BorderWidthCallback getBorderWidthCallback()
null.null.public final void setBorderWidth(BorderWidthCallback borderWidthCallback)
borderWidthCallback - the border width callback to setpublic final BackgroundColorCallback getHoverBackgroundColorCallback()
null.null.public final void setHoverBackgroundColor(BackgroundColorCallback hoverBackgroundColorCallback)
hoverBackgroundColorCallback - the hover background color callback.public final BorderColorCallback getHoverBorderColorCallback()
null.null.public final void setHoverBorderColor(BorderColorCallback hoverBorderColorCallback)
hoverBorderColorCallback - the hover border color callback.public final BorderWidthCallback getHoverBorderWidthCallback()
null.null.public final void setHoverBorderWidth(BorderWidthCallback hoverBorderWidthCallback)
hoverBorderWidthCallback - the hover border width callback to setprotected String getDefaultBackgroundColorAsString()
protected String getDefaultBorderColorAsString()
protected int getDefaultBorderWidth()
protected abstract void applyPattern(Key key, List<CanvasPatternItem> canvasPatternsList)
key - key property name to use to store canvas patterns into dataset object.canvasPatternsList - list of canvas patternsprotected abstract void applyGradient(Key key, List<CanvasGradientItem> canvasGradientsList)
key - key property name to use to store canvas gradients into dataset object.canvasGradientsList - list of canvas gradientspublic void setHidden(boolean hidden)
hidden - if the dataset will appear or not.public boolean isHidden()
falsepublic void setLabel(String label)
label - the label for the dataset which appears in the legend and tooltips.public String getLabel()
public void setData(double... values)
values - an array of numberspublic void setData(List<Double> values)
values - list of numbers.public List<Double> getData()
DataType.NUMBERS.public List<Double> getData(boolean binding)
binding - if true binds the new array list into containerDataType.NUMBERS.public Dataset getDataset()
HasDatasetgetDataset in interface HasDatasetpublic final Type getType()
public void removeOptions(String pluginId)
pluginId - plugin id.public <T extends AbstractPluginOptions> void setOptions(T options)
T - type of plugin options to storeoptions - plugin options used to configure the pluginpublic final <T extends AbstractPluginOptions> void setOptions(String pluginId, T options)
null, the configuration of plugin will be removed.T - type of plugin options to storepluginId - plugin id.options - options used to configure the plugin.null to remove the configuration if exist.public final boolean hasOptions(String pluginId)
pluginId - plugin id.true if there is an options, otherwise false.public final <T extends AbstractPluginOptions> T getOptions(String pluginId, AbstractPluginOptionsFactory<T> factory)
T - type of plugin options to returnpluginId - plugin id.factory - factory instance to create a plugin options.null if factory is null.public <T extends AbstractPluginOptions> T getOptions(AbstractPluginOptionsFactory<T> factory)
null is returned.T - type of plugin options to returnfactory - factory instance to create a plugin optionsnull is returned.protected final Object invokeColorCallback(ScriptableContext context, Scriptable<?> callback, Key property, String defaultValue, boolean hasPattern)
context - scriptable contextcallback - callback to invokeproperty - property of dataset used to store the colordefaultValue - default value to return in case of chart, callback or result of callback are not consistent.hasPattern - if true is able to manage also Pattern or CanvasPatternItem, otherwise it skips them.