Package org.pepstock.charba.client.items
Class ChartElement
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.commons.AbstractReadOnlyPoint
-
- org.pepstock.charba.client.items.ChartElement
-
- All Implemented Interfaces:
IsPoint
- Direct Known Subclasses:
AnnotationElement
,ArcElement
,BarElement
,GeoFeatureElement
,MatrixElement
,PointElement
,SankeyElement
,TreeMapElement
public class ChartElement extends AbstractReadOnlyPoint
Calling some methods on your chart instance passing an argument of an event, will return the elements at the event position.
The elements are mapped by this object.
This is the CHART.JS item with all needed info about a data element, used to draw the chart.
This is the base element created by CHART.JS which is extended by the controllers to manage own elements.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ChartElement(String type, NativeObject nativeObject)
Creates the element using its type and a native java script object which contains all properties.protected
ChartElement(AbstractNode parent, Key childKey, String type, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IsPoint
getCenterPoint()
Returns the center point of the element.IsPoint
getCenterPoint(boolean useFinalPosition)
Returns the center point of the element.ChartContext
getContext()
Returns the context of the element.ElementProperties
getFinalPositionProps(List<Key> keys)
Returns the list of properties of the element, using the final position.ElementProperties
getFinalPositionProps(Key... keys)
Returns the list of properties of the element, using the final position.ChartElementOptions
getOptions()
Returns the element options.String
getType()
Returns the data set item options.boolean
isActive()
Returns if element is active.boolean
isSkipped()
Returnstrue
if skipped.boolean
isStop()
Returnstrue
if stopped.NativeObject
nativeObject()
Returns the native object instance.String
toString()
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractReadOnlyPoint
getX, getY
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, 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
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, 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, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.commons.IsPoint
isConsistent
-
-
-
-
Constructor Detail
-
ChartElement
protected ChartElement(String type, NativeObject nativeObject)
Creates the element using its type and a native java script object which contains all properties.- Parameters:
type
- chart element typenativeObject
- native java script object which contains all properties.
-
ChartElement
protected ChartElement(AbstractNode parent, Key childKey, String type, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.- Parameters:
parent
- parent node to use to add this element where changedchildKey
- the property name of this element to use to add it to the parent.type
- chart element typenativeObject
- native object to map java script properties
-
-
Method Detail
-
getType
public final String getType()
Returns the data set item options.- Returns:
- the data set item options.
-
getContext
public final ChartContext getContext()
Returns the context of the element.- Returns:
- the context of the element
-
getOptions
public ChartElementOptions getOptions()
Returns the element options.- Returns:
- the element options.
-
isActive
public final boolean isActive()
Returns if element is active.- Returns:
true
if the element is active.
-
isSkipped
public final boolean isSkipped()
Returnstrue
if skipped.- Returns:
true
if skipped.
-
isStop
public final boolean isStop()
Returnstrue
if stopped.- Returns:
true
if stopped.
-
getCenterPoint
public final IsPoint getCenterPoint()
Returns the center point of the element.- Returns:
- the center point of the element.
-
getCenterPoint
public final IsPoint getCenterPoint(boolean useFinalPosition)
Returns the center point of the element.- Parameters:
useFinalPosition
- if the position must be calculated with final dimensions or also during the animation.- Returns:
- the center point of the element.
-
getFinalPositionProps
public final ElementProperties getFinalPositionProps(Key... keys)
Returns the list of properties of the element, using the final position.- Parameters:
keys
- array of keys to request- Returns:
- an element instance.
-
getFinalPositionProps
public final ElementProperties getFinalPositionProps(List<Key> keys)
Returns the list of properties of the element, using the final position.- Parameters:
keys
- list of keys to request- Returns:
- an element instance.
-
toString
public final String toString()
- Overrides:
toString
in classAbstractReadOnlyPoint
-
nativeObject
public NativeObject nativeObject()
Returns the native object instance.- Returns:
- the native object instance.
-
-