Type class
DataItem represents single element in data, for example a data point in a Serial Chart Series, e.g. a column.
DataItem defines relationship between structured data, required for specific chart type or task, and raw source data.
It also implements required calculations, updates related visual elements, etc.
@todo Description
Sources
DataItem can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.DataItem * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.DataItem * -------------------------------------------------------- */
Inheritance
DataItem extends BaseObjectEvents
.
DataItem is extended by LegendDataItem
, ChartDataItem
, SeriesDataItem
, AxisDataItem
, NavigationBarDataItem
.
Properties
adapter # |
Type Holds Adapter. |
---|---|
animations # |
Type A list of |
categories # |
Type An object containing categories. |
clonedFrom # |
Type Inherited from Reference to the original object this object was cloned from. We need to keep this so we can disassociate it from source object when this object is disposed. |
config # |
Type Inherited from Use this property to set JSON-based config. When set, triggers processing routine, which will go through all properties, and try to apply values, create instances, etc. Use this with caution, as it is a time-consuming process. It's used for initialchart setup only, not routine operations. |
dataContext # |
Type Sets to a reference to an original object from Component's data. A reference to an original object in Component's data, that this Data Item is derived from. |
dates # |
Type An object containing dates. |
depth # |
Type Depth of the Data Item. In nested data structures, like TreeMap, this indicates the level this data point is at, in relation to the parent Data Item. |
events # |
Type Inherited from An |
hasProperties # |
Type Default Indicates whether Data Item has any properties set. If it does not have any, the code can use this property to check whether they need to apply costly operation of re-applying properties, whenever Data Item-related element is redrawn, e.g. series. |
Type Sets hidden flag for data item. Mostly used to initially hide data item. Returns |
|
id # |
Type Inherited from Sets the user-defined id of the element. |
ignoreMinMax # |
Type Sets whether this data point should not be included in the scale and minimum/maximum calculations. Exclude from min/max calculations? E.g. some we may want to exclude a particular data point from influencing |
index # |
Type Data Item's position index in Component's data. |
isHiding # |
Type Default Indicates whether Data Item is currently animiting from visible to hidden state. |
isTemplate # |
Type Default Identifies if this object is a "template" and should not be treated as real object that is drawn or actually used in the chart. |
locations # |
Type An object containing locations for the Data Item. A location is a position within date or category, or, in some other cases, where there is no single point but rather some period. Click here for info how data item locations work |
opacity # |
Type Sets opacity for all Data Item's related elements (Sprites). |
parent # |
Type When we are using a nested data structure, like for example in a TreeMap, this property points to a parent Data Item of this one. |
properties # |
Type An object containing Data Item specific appearance properties in key-value pairs. Sometimes a single Data Item needs to apply different properties than the rest of the data That's where Data Item's Please note that you should set Data Item-specific properties using |
sprites # |
Type Default A list of E.g. an Data Item keeps track of all of them, so it can toggle all related visual elements when it itself is toggled. |
uid # |
Type Inherited from Returns object's internal unique ID. |
values # |
Type An object containing calculated values. |
visible # |
Type Sets visibility of the Data Item. Returns |
workingLocations # |
Type Current working locations. |
There are 5 inherited items currently hidden from this list. |
Methods
animate( animationOptions: ) |
Returns Creates and starts an |
---|---|
clone( cloneId?: ) |
Returns Inherited from Makes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them. |
constructor() |
Returns Constructor @todo Adding events to disposers produces errors in some cases, which means that chart is using disposed Data Items which is not right |
copyFrom( source: ) |
Returns Copies all properties and related data from different data item. |
dispatch( eventType: ) |
Returns Inherited from Dispatches an event using own event dispatcher. Will automatically populate event data object with event type and target (this element). It also checks if there are any handlers registered for this sepecific event. |
dispatchImmediately( eventType: ) |
Returns Inherited from Works like |
dispose() |
Returns Destroys this object and all related data. |
getCurrentThemes() |
Returns Inherited from Returns a list of themes that should be applied to this element. It could either be a list of themes set explicitly on this element, or system-wide. |
getDate( name: ) |
Returns Returns a Date value of the data field. |
getDuration( duration?: ) |
Returns Returns a duration (ms) the Data Item should take to animate from one value to another. If the duration is not specified via parameter, this method will try to request a default duration from the related |
getValue( name: ) |
Returns Returns a numeric value for specific data field. If If |
getWorkingValue( name: ) |
Returns Returns a current working value for a specific data field. The actual value may differ from the one returned by |
hide( duration?: ) |
Returns Hides the Data Item and related visual elements. |
isDisposed() |
Returns Inherited from Returns if this object has been already been disposed. |
setCalculatedValue( name: ) |
Returns |
setCategory( name: ) |
Returns Sets a related category for this Data Item. @todo Review description |
setDate( name: ) |
Returns Sets Date value to a data field. |
setLocation( name: ) |
Returns Sets a relative location for a data field. A location is always relative on a 0 to 1 scale, with 0 being beginning, 0.5 middle and 1 end. @todo Rewiew description |
setProperty( name: ) |
Returns Sets a Data Item-specific visual properties to apply to related elements. |
setValue( name: ) |
Returns Sets a numeric value for specific data field. |
setVisibility( value: ) |
Returns Sets visibility of the Data Item. |
setWorkingLocation( name: ) |
Returns Sets a current working location for a data field. @todo Rewiew description |
setWorkingValue( name: ) |
Returns Set current working numeric value for a specific data field. |
show( duration?: ) |
Returns Shows the Data Item and related visual elements. |
There are 5 inherited items currently hidden from this list. |
Events
#calculatedvaluechanged |
Param { property: Invoked when the calculated value has changed |
---|---|
#locationchanged |
Param { property: Invoked when the location of Data Item changes |
#propertychanged |
Param { property: Invoked when a property of the Data Item changes |
#valuechanged |
Param { property: Invoked when the value is changed |
#visibilitychanged |
Param { visible: Invoked when the visibility of the Data Item changes, i.e. Series is hidden |
#workinglocationchanged |
Param { property: Invoked when working location of Data Item changes |
#workingvaluechanged |
Param { property: Invoked when the internal/intermediate value has changed |
Adapters
#date |
Param { date: |
---|---|
#duration |
Param |
#value |
Param { field: |
#workingValue |
Param { field: |