Package org.pepstock.charba.client.data
Class AbstractDataPoint
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.data.AbstractDataPoint
-
- Direct Known Subclasses:
AbstractXYDataPoint
,BubbleMapDataPoint
,ChoroplethDataPoint
,SankeyDataPoint
,TimeSeriesItem
,TreeMapDataPoint
public abstract class AbstractDataPoint extends NativeObjectContainer
Maps the common methods for a data point.- Author:
- Andrea "Stock" Stocchero
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractDataPoint.CharbaProperty
Name of properties of native object.
No private because it is used by time series item
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDataPoint(NativeObject nativeObject)
Creates the object with a native object passed as argument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkAndSetType(Key property, Key typeProperty, DataPointType type)
Checks the type of the property, setting the right type property.double
getAttribute(Key key)
Returns a custom field value from data point.Date
getAttributeAsDate(Key key)
Returns a custom field value from data point.<T extends NativeObjectContainer>
TgetAttributeAsObject(Key key, NativeObjectContainerFactory<T> factory)
Returns a custom field value from data point.String
getAttributeAsString(Key key)
Returns a custom field value from data point.void
setAttribute(Key key, double value)
Sets a custom field to data point.void
setAttribute(Key key, String value)
Sets a custom field to data point.void
setAttribute(Key key, Date value)
Sets a custom field to data point.<T extends NativeObjectContainer>
voidsetAttribute(Key key, T value)
Sets a custom field to data point.-
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, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Constructor Detail
-
AbstractDataPoint
protected AbstractDataPoint(NativeObject nativeObject)
Creates the object with a native object passed as argument.- Parameters:
nativeObject
- native object which maps a data point
-
-
Method Detail
-
setAttribute
public final void setAttribute(Key key, double value)
Sets a custom field to data point.- Parameters:
key
- key of java script object to set.value
- value to set.
-
getAttribute
public final double getAttribute(Key key)
Returns a custom field value from data point.- Parameters:
key
- key of java script object to get.- Returns:
- custom field value from data point.
-
setAttribute
public final void setAttribute(Key key, String value)
Sets a custom field to data point.- Parameters:
key
- key of java script object to set.value
- value to set.
-
getAttributeAsString
public final String getAttributeAsString(Key key)
Returns a custom field value from data point.- Parameters:
key
- key of java script object to get.- Returns:
- custom field value from data point.
-
setAttribute
public final void setAttribute(Key key, Date value)
Sets a custom field to data point.- Parameters:
key
- key of java script object to set.value
- value to set.
-
getAttributeAsDate
public final Date getAttributeAsDate(Key key)
Returns a custom field value from data point.- Parameters:
key
- key of java script object to get.- Returns:
- custom field value from data point.
-
setAttribute
public final <T extends NativeObjectContainer> void setAttribute(Key key, T value)
Sets a custom field to data point.- Type Parameters:
T
- type of user object- Parameters:
key
- key of java script object to set.value
- value to set.
-
getAttributeAsObject
public final <T extends NativeObjectContainer> T getAttributeAsObject(Key key, NativeObjectContainerFactory<T> factory)
Returns a custom field value from data point.- Type Parameters:
T
- type of user object- Parameters:
key
- key of java script object to get.factory
- instance of factory to create the native object- Returns:
- custom field value from data point.
-
checkAndSetType
protected void checkAndSetType(Key property, Key typeProperty, DataPointType type)
Checks the type of the property, setting the right type property.- Parameters:
property
- the property of the data to storetypeProperty
- property to use to store the typetype
- type of the property to store in the object
-
-