Class MeterDataset
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.data.Dataset
-
- org.pepstock.charba.client.impl.charts.MeterDataset
-
- All Implemented Interfaces:
HasCallbackScope
,HasDataset
,IsDefaultAnimationContainer
,IsDefaultAnimationTransition
,HasAnimationOptions
- Direct Known Subclasses:
GaugeDataset
public class MeterDataset extends Dataset
The Meter chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset.
The minimum value of data is 0 (seeMINIMUM_VALUE
).
The dataset will have always 2 data and setting the color of data, the first is the value color and the second is the empty one.
To set the data, is mandatory to usesetValue(double)
) method.- Author:
- Andrea "Stock" Stocchero
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pepstock.charba.client.data.Dataset
Dataset.CanvasObjectProperty, Dataset.CommonProperty
-
-
Field Summary
Fields Modifier and Type Field Description static IsColor
DEFAULT_EMPTY_VALUE_COLOR
Default empty color, rgb(234, 234, 234).static double
DEFAULT_MAXIMUM_VALUE
Default maximum value is 100.0.static IsColor
DEFAULT_VALUE_COLOR
Default value color, rgb(140, 214, 16).static double
MINIMUM_VALUE
Minimum value is 0.0.-
Fields inherited from class org.pepstock.charba.client.data.Dataset
DEFAULT_HIDDEN, DEFAULT_NORMALIZED, DEFAULT_PARSING
-
-
Constructor Summary
Constructors Modifier Constructor Description MeterDataset(double max)
Creates a dataset setting the maximum value of dataset.MeterDataset(double max, IsDefaultOptions defaultValues)
Creates a dataset setting the maximum value of dataset and defaults value.protected
MeterDataset(ControllerType type, double max, IsDefaultOptions defaultValues)
Creates a dataset setting the maximum value of dataset and defaults value and the controller type in case of extension
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IsColor
getBorderColor()
Returns the color of the arc border.String
getBorderColorAsString()
Returns the color of the arc border, as string.int
getBorderRadius()
Returns the arc border radius (in pixels).ArcBorderRadius
getBorderRadiusAsObject()
Returns the arc border radius, as object.int
getBorderWidth()
Returns the width of the arc border.IsColor
getColor()
Returns the fill color for value.String
getColorAsString()
Returns the fill color for value.DescriptionLabel
getDescriptionLabel()
Returns the description element of meter chart.IsColor
getEmptyColor()
Returns the fill color for empty sector.String
getEmptyColorAsString()
Returns the fill color for empty sector.double
getMax()
Returns the maximum value of chart.double
getValue()
Returns the value of the chart.ValueLabel
getValueLabel()
Returns the value element of meter chart.void
setBackgroundColor(ColorCallback<DatasetContext> backgroundColorCallback)
Sets the background color callback.void
setBackgroundColor(NativeCallback backgroundColorCallback)
Sets the background color callback.void
setBorderColor(String borderColor)
Sets the color of the arc border.void
setBorderColor(ColorCallback<DatasetContext> borderColorCallback)
Sets the border color callback.void
setBorderColor(NativeCallback borderColorCallback)
Sets the border color callback.void
setBorderColor(IsColor borderColor)
Sets the color of the arc border.void
setBorderRadius(int borderRadius)
Sets the arc border radius (in pixels).void
setBorderRadius(ArcBorderRadius borderRadius)
Sets the arc border radius (in pixels).void
setBorderWidth(int borderWidth)
Sets the width of the arc border.void
setColor(String valueColor)
Sets the fill color for value.void
setColor(IsColor valueColor)
Sets the fill color for value.void
setData(double... values)
Throws an exception because not available.void
setData(List<Double> values)
Throws an exception because not available.void
setEmptyColor(String emptyValueColor)
Sets the fill color for empty sector.void
setEmptyColor(IsColor emptyValueColor)
Sets the fill color for empty sector.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
setValue(double value)
-
Methods inherited from class org.pepstock.charba.client.data.Dataset
createContext, getAnimationContainer, getBackgroundColorCallback, getBorderColorCallback, getClip, getClipAsObject, getData, getData, getDataCount, getDataset, getDataType, getDefaultBackgroundColorAsString, getDefaultBorderColorAsString, getDefaultBorderWidth, getDefaultHoverBackgroundColorAsString, getDefaultHoverBorderColorAsString, getDefaultHoverBorderWidth, getDefaultValues, getHoverBackgroundColorCallback, getHoverBorderColorCallback, getId, getLabel, getOptions, getOptions, getScope, getType, getTypedDataset, hasOptions, invokeColorCallback, isClip, isHidden, isNormalized, isParsing, removeOptions, setClip, setClip, setClip, setHidden, setLabel, setNormalized, setOptions, setOptions, setParsing
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
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
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.options.HasAnimationOptions
getAnimation, getAnimations, getTransitions, isAnimationEnabled, setAnimationEnabled
-
-
-
-
Field Detail
-
DEFAULT_VALUE_COLOR
public static final IsColor DEFAULT_VALUE_COLOR
Default value color, rgb(140, 214, 16).
-
DEFAULT_EMPTY_VALUE_COLOR
public static final IsColor DEFAULT_EMPTY_VALUE_COLOR
Default empty color, rgb(234, 234, 234).
-
DEFAULT_MAXIMUM_VALUE
public static final double DEFAULT_MAXIMUM_VALUE
Default maximum value is 100.0.- See Also:
- Constant Field Values
-
MINIMUM_VALUE
public static final double MINIMUM_VALUE
Minimum value is 0.0.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MeterDataset
public MeterDataset(double max)
Creates a dataset setting the maximum value of dataset. It uses the global options has default.- Parameters:
max
- maximum value of dataset.
-
MeterDataset
public MeterDataset(double max, IsDefaultOptions defaultValues)
Creates a dataset setting the maximum value of dataset and defaults value.- Parameters:
max
- maximum value of dataset.defaultValues
- default options
-
MeterDataset
protected MeterDataset(ControllerType type, double max, IsDefaultOptions defaultValues)
Creates a dataset setting the maximum value of dataset and defaults value and the controller type in case of extension- Parameters:
type
- controller type related to the datasetmax
- maximum value of dataset.defaultValues
- default options
-
-
Method Detail
-
getValueLabel
public final ValueLabel getValueLabel()
Returns the value element of meter chart.- Returns:
- the value element of meter chart
-
getDescriptionLabel
public final DescriptionLabel getDescriptionLabel()
Returns the description element of meter chart.- Returns:
- the description element of meter chart
-
setColor
public void setColor(IsColor valueColor)
Sets the fill color for value.- Parameters:
valueColor
- the fill color for value.
-
setColor
public void setColor(String valueColor)
Sets the fill color for value.- Parameters:
valueColor
- the fill color for value.
-
getColorAsString
public String getColorAsString()
Returns the fill color for value.- Returns:
- the fill color for value.
-
getColor
public IsColor getColor()
Returns the fill color for value.- Returns:
- the fill color for value.
-
setEmptyColor
public void setEmptyColor(IsColor emptyValueColor)
Sets the fill color for empty sector.- Parameters:
emptyValueColor
- the fill color for empty sector.
-
setEmptyColor
public void setEmptyColor(String emptyValueColor)
Sets the fill color for empty sector.- Parameters:
emptyValueColor
- the fill color for empty sector.
-
getEmptyColorAsString
public String getEmptyColorAsString()
Returns the fill color for empty sector.- Returns:
- the fill color for empty sector.
-
getEmptyColor
public IsColor getEmptyColor()
Returns the fill color for empty sector.- Returns:
- the fill color for empty sector.
-
getMax
public final double getMax()
Returns the maximum value of chart.- Returns:
- the max
-
getValue
public final double getValue()
Returns the value of the chart.- Returns:
- the value
-
setValue
public void setValue(double value)
- Parameters:
value
- the value to set
-
setBorderColor
public void setBorderColor(IsColor borderColor)
Sets the color of the arc border.- Parameters:
borderColor
- the color of the arc border
-
setBorderColor
public void setBorderColor(String borderColor)
Sets the color of the arc border.- Parameters:
borderColor
- the color of the arc border
-
getBorderColorAsString
public String getBorderColorAsString()
Returns the color of the arc border, as string.- Returns:
- the color of the arc border.
-
getBorderColor
public IsColor getBorderColor()
Returns the color of the arc border.- Returns:
- the color of the arc border
-
setBorderWidth
public void setBorderWidth(int borderWidth)
Sets the width of the arc border.- Parameters:
borderWidth
- the width of the arc border.
-
getBorderWidth
public int getBorderWidth()
Returns the width of the arc border.- Returns:
- the width of the arc border.
-
setBorderRadius
public void setBorderRadius(int borderRadius)
Sets the arc border radius (in pixels).- Parameters:
borderRadius
- the arc border radius (in pixels).
-
setBorderRadius
public void setBorderRadius(ArcBorderRadius borderRadius)
Sets the arc border radius (in pixels).- Parameters:
borderRadius
- the arc border radius (in pixels).
-
getBorderRadius
public int getBorderRadius()
Returns the arc border radius (in pixels).- Returns:
- the arc border radius (in pixels).
-
getBorderRadiusAsObject
public ArcBorderRadius getBorderRadiusAsObject()
Returns the arc border radius, as object.- Returns:
- the arc border radius, as object
-
setData
public final void setData(double... values)
Throws an exception because not available.
-
setBackgroundColor
public void setBackgroundColor(ColorCallback<DatasetContext> backgroundColorCallback)
Description copied from class:Dataset
Sets the background color callback.- Overrides:
setBackgroundColor
in classDataset
- Parameters:
backgroundColorCallback
- the background color callback.
-
setBackgroundColor
public void setBackgroundColor(NativeCallback backgroundColorCallback)
Description copied from class:Dataset
Sets the background color callback.- Overrides:
setBackgroundColor
in classDataset
- Parameters:
backgroundColorCallback
- the background color callback.
-
setHoverBackgroundColor
public void setHoverBackgroundColor(ColorCallback<DatasetContext> hoverBackgroundColorCallback)
Description copied from class:Dataset
Sets the hover background color callback.- Overrides:
setHoverBackgroundColor
in classDataset
- Parameters:
hoverBackgroundColorCallback
- the hover background color callback.
-
setHoverBackgroundColor
public void setHoverBackgroundColor(NativeCallback hoverBackgroundColorCallback)
Description copied from class:Dataset
Sets the hover background color callback.- Overrides:
setHoverBackgroundColor
in classDataset
- Parameters:
hoverBackgroundColorCallback
- the hover background color callback.
-
setBorderColor
public void setBorderColor(ColorCallback<DatasetContext> borderColorCallback)
Description copied from class:Dataset
Sets the border color callback.- Overrides:
setBorderColor
in classDataset
- Parameters:
borderColorCallback
- the border color callback.
-
setBorderColor
public void setBorderColor(NativeCallback borderColorCallback)
Description copied from class:Dataset
Sets the border color callback.- Overrides:
setBorderColor
in classDataset
- Parameters:
borderColorCallback
- the border color callback.
-
setHoverBorderColor
public void setHoverBorderColor(ColorCallback<DatasetContext> hoverBorderColorCallback)
Description copied from class:Dataset
Sets the hover border color callback.- Overrides:
setHoverBorderColor
in classDataset
- Parameters:
hoverBorderColorCallback
- the hover border color callback.
-
setHoverBorderColor
public void setHoverBorderColor(NativeCallback hoverBorderColorCallback)
Description copied from class:Dataset
Sets the hover border color callback.- Overrides:
setHoverBorderColor
in classDataset
- Parameters:
hoverBorderColorCallback
- the hover border color callback.
-
-