public abstract class Dataset extends AbstractNode implements HasDataset, HasAnimationOptions, HasCallbackScope
Modifier and Type | Class and Description |
---|---|
protected static class |
Dataset.CanvasObjectProperty
Name of common properties of native object related to a dataset.
|
protected static class |
Dataset.CommonProperty
Name of common properties of native object related to a dataset.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEFAULT_HIDDEN |
protected static boolean |
DEFAULT_NORMALIZED |
protected static boolean |
DEFAULT_PARSING |
Modifier | Constructor and Description |
---|---|
protected |
Dataset(Type type,
IsDefaultOptions defaultValues,
boolean hidden)
Creates the data set using a default and chart type related to the data set, adding patterns and gradients element.
|
Modifier and Type | Method and Description |
---|---|
protected DatasetContext |
createContext(NativeObject context)
Creates a data set context for callback.
|
AnimationContainer |
getAnimationContainer()
Returns an animation container instance to use in the default methods of this interface.
|
ColorCallback<DatasetContext> |
getBackgroundColorCallback()
Returns the background color callback, if set, otherwise
null . |
ColorCallback<DatasetContext> |
getBorderColorCallback()
Returns the border color callback, if set, otherwise
null . |
double |
getClip()
Returns how to clip relative to the chart area.
Positive value allows overflow, negative value clips that many pixels inside the chart area. |
Clip |
getClipAsObject()
Returns how to clip relative to the chart area.
Positive value allows overflow, negative value clips that many pixels inside the chart area. |
List<Double> |
getData()
Returns the data property of a data set for a chart is specified as a list of numbers.
Each point in the data list corresponds to the label at the same index on the x axis. |
List<Double> |
getData(boolean binding)
Returns the data property of a data set for a chart is specified as a list of numbers.
Each point in the data list corresponds to the label at the same index on the x axis. |
int |
getDataCount()
Returns the amount of data.
|
Dataset |
getDataset()
Gets the dataset instance.
|
DataType |
getDataType()
Returns the data type of data sets.
|
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 String |
getDefaultHoverBackgroundColorAsString()
Returns the default background color value based on type of chart.
|
protected String |
getDefaultHoverBorderColorAsString()
Returns the default border color value based on type of chart.
|
protected int |
getDefaultHoverBorderWidth()
Returns the default border width value based on type of chart.
|
protected IsDefaultOptions |
getDefaultValues()
Returns the default options instance.
|
ColorCallback<DatasetContext> |
getHoverBackgroundColorCallback()
Returns the hover background color callback, if set, otherwise
null . |
ColorCallback<DatasetContext> |
getHoverBorderColorCallback()
Returns the hover border color callback, if set, otherwise
null . |
int |
getId()
Returns the unique id of data sets.
|
String |
getLabel()
Returns the label for the data set 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 data set configuration, if exist.
It uses a factory instance to create a plugin options. |
String |
getScope()
Returns the scope of the data set, which is the options are used for defaults, chart defaults or chart.
|
Type |
getType()
Returns the type of data set, based on type of chart.
|
protected IsDefaultTypedDataset |
getTypedDataset()
Returns the typed data set for the type of the data set.
|
boolean |
hasOptions(String pluginId)
Checks if there is any data set configuration for a specific plugin, by its id.
|
protected Object |
invokeColorCallback(DatasetContext context,
Scriptable<?,DatasetContext> callback,
org.pepstock.charba.client.data.Dataset.CanvasObjectKey property,
String defaultValue)
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 |
isClip()
Returns if clips relative to the chart area.
|
boolean |
isHidden()
Returns if the data set at first drawing will appear or not.
|
boolean |
isNormalized()
Returns if you provide data with indices that are unique, sorted, and consistent across data sets and provide the normalized:
true option to let CHARBA know
that you have done so. |
boolean |
isParsing()
Returns how to parse the data set.
The parsing can be disabled by specifying parsing: false at chart options or data set.If parsing is disabled, data must be sorted and in the formats the associated chart type and scales use internally. |
void |
removeOptions(String pluginId)
Removes the plugin options.
|
void |
setBackgroundColor(ColorCallback<DatasetContext> backgroundColorCallback)
Sets the background color callback.
|
void |
setBackgroundColor(NativeCallback backgroundColorCallback)
Sets the background color callback.
|
void |
setBorderColor(ColorCallback<DatasetContext> borderColorCallback)
Sets the border color callback.
|
void |
setBorderColor(NativeCallback borderColorCallback)
Sets the border color callback.
|
void |
setClip(boolean clip)
Sets how to clip relative to the chart area.
If false allows overflow, otherwise true clips that many pixels inside the chart area. |
void |
setClip(Clip clip)
Sets how to clip relative to the chart area, by an object which configures clipping per side.
Positive value allows overflow, negative value clips that many pixels inside the chart area. |
void |
setClip(double clip)
Sets how to clip relative to the chart area.
Positive value allows overflow, negative value clips that many pixels inside the chart area. |
void |
setData(double... values)
Sets the data property of a data set for a chart is specified as an array of numbers.
Each point in the data array corresponds to the label at the same index on the x axis. |
void |
setData(List<Double> values)
Sets the data property of a data set for a chart is specified as a list of numbers.
Each point in the data list corresponds to the label at the same index on the x axis. |
protected void |
setHidden(boolean hidden)
Sets if the data set will appear or not.
|
void |
setHoverBackgroundColor(ColorCallback<DatasetContext> hoverBackgroundColorCallback)
Sets the hover background color callback.
|
void |
setHoverBackgroundColor(NativeCallback hoverBackgroundColorCallback)
Sets the hover background color callback.
|
void |
setHoverBorderColor(ColorCallback<DatasetContext> hoverBorderColorCallback)
Sets the hover border color callback.
|
void |
setHoverBorderColor(NativeCallback hoverBorderColorCallback)
Sets the hover border color callback.
|
void |
setLabel(String label)
Sets the label for the data set which appears in the legend and tooltips.
|
void |
setNormalized(boolean normalized)
Sets if you provide data with indices that are unique, sorted, and consistent across data sets and provide the normalized:
true option to let CHARBA know that
you have done so. |
<T extends AbstractPluginOptions> |
setOptions(String pluginId,
T options)
Sets the plugin data set configuration.
If data set configuration options is null , the configuration of plugin will be removed. |
<T extends AbstractPluginOptions> |
setOptions(T options)
Sets the plugin options.
|
void |
setParsing(boolean parsing)
Sets how to parse the data set.
The parsing can be disabled by specifying parsing: false at chart options or data set.If parsing is disabled, data must be sorted and in the formats the associated chart type and scales use internally. |
checkAndAddToParent, getChildKey, getParentNode, getRootNode, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
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, 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, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAnimation, getAnimations, getTransitions, isAnimationEnabled, setAnimationEnabled
extractScope
protected static final boolean DEFAULT_HIDDEN
protected static final boolean DEFAULT_PARSING
protected static final boolean DEFAULT_NORMALIZED
protected Dataset(Type type, IsDefaultOptions defaultValues, boolean hidden)
type
- chart type related to the data setdefaultValues
- default optionshidden
- if true
, it will be initially hidden.public final AnimationContainer getAnimationContainer()
HasAnimationOptions
getAnimationContainer
in interface HasAnimationOptions
public final int getDataCount()
public final int getId()
public final String getScope()
getScope
in interface HasCallbackScope
public final DataType getDataType()
protected final IsDefaultOptions getDefaultValues()
protected final IsDefaultTypedDataset getTypedDataset()
public ColorCallback<DatasetContext> getBackgroundColorCallback()
null
.null
.public void setBackgroundColor(ColorCallback<DatasetContext> backgroundColorCallback)
backgroundColorCallback
- the background color callback.public void setBackgroundColor(NativeCallback backgroundColorCallback)
backgroundColorCallback
- the background color callback.public ColorCallback<DatasetContext> getBorderColorCallback()
null
.null
.public void setBorderColor(ColorCallback<DatasetContext> borderColorCallback)
borderColorCallback
- the border color callback.public void setBorderColor(NativeCallback borderColorCallback)
borderColorCallback
- the border color callback.protected final DatasetContext createContext(NativeObject context)
context
- native context, passed by CHART.JSpublic ColorCallback<DatasetContext> getHoverBackgroundColorCallback()
null
.null
.public void setHoverBackgroundColor(ColorCallback<DatasetContext> hoverBackgroundColorCallback)
hoverBackgroundColorCallback
- the hover background color callback.public void setHoverBackgroundColor(NativeCallback hoverBackgroundColorCallback)
hoverBackgroundColorCallback
- the hover background color callback.public ColorCallback<DatasetContext> getHoverBorderColorCallback()
null
.null
.public void setHoverBorderColor(ColorCallback<DatasetContext> hoverBorderColorCallback)
hoverBorderColorCallback
- the hover border color callback.public void setHoverBorderColor(NativeCallback hoverBorderColorCallback)
hoverBorderColorCallback
- the hover border color callback.protected String getDefaultBackgroundColorAsString()
protected String getDefaultBorderColorAsString()
protected int getDefaultBorderWidth()
protected String getDefaultHoverBackgroundColorAsString()
protected String getDefaultHoverBorderColorAsString()
protected int getDefaultHoverBorderWidth()
protected final void setHidden(boolean hidden)
hidden
- if the data set will appear or not.public final boolean isHidden()
public void setParsing(boolean parsing)
false
at chart options or data set.parsing
- how to parse the data set.false
at chart options or data set.public boolean isParsing()
false
at chart options or data set.false
at chart options or data set.public void setNormalized(boolean normalized)
true
option to let CHARBA know that
you have done so.normalized
- if you provide data with indices that are unique, sorted, and consistent across data sets and provide the normalized: true
option to let
CHARBA know that you have done so.public boolean isNormalized()
true
option to let CHARBA know
that you have done so.true
option to let CHARBA know
that you have done so.public void setLabel(String label)
label
- the label for the data set which appears in the legend and tooltips.public String getLabel()
public void setClip(boolean clip)
false
allows overflow, otherwise true
clips that many pixels inside the chart area.clip
- If false
allows overflow, otherwise true
clips that many pixels inside the chart area.public void setClip(double clip)
clip
- positive value allows overflow, negative value clips that many pixels inside the chart area. 0 = clip at the chart areapublic void setClip(Clip clip)
clip
- object which configures clipping per sidepublic boolean isClip()
true
if clips relative to the chart area.public double getClip()
Clip
object or boolean, returns Undefined.DOUBLE
.Clip
object or boolean, returns Undefined.DOUBLE
public Clip getClipAsObject()
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 in the containerDataType.NUMBERS
.public Dataset getDataset()
HasDataset
getDataset
in interface HasDataset
public 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(DatasetContext context, Scriptable<?,DatasetContext> callback, org.pepstock.charba.client.data.Dataset.CanvasObjectKey property, String defaultValue)
context
- scriptable contextcallback
- callback to invokeproperty
- property of data set used to store the colordefaultValue
- default value to return in case of chart, callback or result of callback are not consistent.