ValueAxisDataItem
Type class
Defines a DataItem for ValueAxis.
More info: DataItem
Sources
ValueAxisDataItem can be used (imported) via one of the following packages.
/** * Import from: "charts.ts" * Use like: am4charts.ValueAxisDataItem */import * as am4charts from "@amcharts/amcharts4/charts";/** * Include via: <script src="charts.js"></script> * Access items like: am4charts.ValueAxisDataItem */Inheritance
ValueAxisDataItem extends AxisDataItem.
ValueAxisDataItem is extended by DurationAxisDataItem, DateAxisDataItem.
Properties
endValueType
numberData point's numeric end value.
valueType
numberA data point's numeric value.
39 inherited items
adapterType
Adapter<this,IDataItemAdapters>Inherited fromDataItemHolds Adapter.
animationsType
Array<Animation>Inherited fromDataItemA list of
Animationsobjects currently mutating Data Item's values.axisBreakType
AxisBreakInherited fromAxisDataItemAn
AxisBreakthis data item falls within.axisFillType
AxisFillInherited fromAxisDataItemAn
AxisFillassociated element with this data item.If there is no fill element associated with data item, a new one is created and returned.
bulletType
SpriteInherited fromAxisDataItemSince 4.5.9Set it to an instance of any
Sprite. It will be displayed as an axis bullet in the middle of the cell, or specific value.If you need position bullet relatively to the cell, use
AxisBulletinstead. It has alocationproperty which can be used to indicate precise relative location within cell/range.Also,
AxisBulletis aContainerso you can push any other element into it.NOTE:
locationis relative to the parent axis range's scope, i.e.between its
dateandendDateforDateAxis, orvalue/endValue(ValueAxis), orcategory/endCategory(categoryAxis).let range = dateAxis.axisRanges.create(); range.date = new Date(2018, 0, 5); let flag = new am4plugins_bullets.FlagBullet(); flag.label.text = "Hello"; range.bullet = flag;var range = dateAxis.axisRanges.create(); range.date = new Date(2018, 0, 5); var flag = new am4plugins_bullets.FlagBullet(); flag.label.text = "Hello"; range.bullet = flag;{ // ... "xAxes": [{ "type": "DateAxis", // ... "axisRanges": [{ "date": new Date(2018, 0, 5), "bullet: { "type": "FlagBullet", "label": { "text": "Hello" } } }] }] }categoriesType
objectInherited fromDataItemAn object containing categories.
clonedFromType
$type.Optional<this>Inherited fromBaseObjectReference 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.
configType
objectInherited fromBaseObjectUse 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.
contentsType
ContainerInherited fromAxisDataItemReturns a
Containerto place all visual elements, related to data item in.If there is no Container, a new one is created.
dataContextType
ObjectInherited fromDataItemSets 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.
datesType
objectInherited fromDataItemAn object containing dates.
depthType
numberInherited fromDataItemDepth 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.
eventsType
EventDispatcher<AMEvent<this,IBaseObjectEvents>>Inherited fromBaseObjectEventsAn
EventDispatcherinstancegridType
GridInherited fromAxisDataItemA
Gridelement associated with this data item.If there is no grid element associated with data item, a new one is created and returned.
hasPropertiesType
booleanDefaultfalseInherited fromDataItemIndicates 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
booleanInherited fromDataItemSets hidden flag for data item. Mostly used to initially hide data item.
Returns
trueif this Data Item is currently hidden.idType
$type.Optional<string>Inherited fromBaseObjectSets the user-defined id of the element.
ignoreMinMaxType
booleanInherited fromDataItemSets 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
ValueAxisscale.indexType
numberInherited fromDataItemData Item's position index in Component's data.
isHidingType
booleanDefaultfalseInherited fromDataItemIndicates whether Data Item is currently animiting from visible to hidden state.
isTemplateType
booleanDefaultfalseInherited fromDataItemIdentifies if this object is a "template" and should not be treated as real object that is drawn or actually used in the chart.
itemIndexType
numberInherited fromAxisDataItemSince 4.7.8Actual index of the axis data item.
labelType
AxisLabelInherited fromAxisDataItemAn
AxisLabelelement associated with this data item.If there is no label element associated with data item, a new one is created and returned.
locationsType
objectInherited fromDataItemAn 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.
More info: Series: data item locations for info how data item locations work
maskType
AxisFillInherited fromAxisDataItemData item's mask.
maxPositionType
numberInherited fromAxisDataItemSince 4.5.11Allows hiding axis item (tick, label, grid) if it is closer to axis end than this relative position (0-1).
For axis labels it overrides
maxLabelPositionif set.// Hide all ticks and labels closer than 20% to axis end. axis.dataItems.template.maxPosition = 0.8;// Hide all ticks and labels closer than 20% to axis end. axis.dataItems.template.maxPosition = 0.8;{ // ... "xAxes": [{ // ... // Hide all ticks and labels closer than 20% to axis end. "dataItems": { "maxPosition": 0.8 } }] }minPositionType
numberInherited fromAxisDataItemSince 4.5.11Allows hiding axis item (tick, label, grid) if it is closer to axis beginning than this relative position (0-1).
For axis labels it overrides
minLabelPositionif set.// Hide all ticks and labels closer than 20% to axis beginning. axis.dataItems.template.minPosition = 0.2;// Hide all ticks and labels closer than 20% to axis beginning. axis.dataItems.template.minPosition = 0.2;{ // ... "xAxes": [{ // ... // Hide all ticks and labels closer than 20% to axis beginning. "dataItems": { "minPosition": 0.2 } }] }opacityType
numberInherited fromDataItemSets opacity for all Data Item's related elements (Sprites).
parentType
$type.Optional<this>Inherited fromDataItemWhen we are using a nested data structure, like for example in a TreeMap, this property points to a parent Data Item of this one.
pointType
IPointInherited fromAxisDataItemHolds a physical position of the grid line associated with this data item, so that it can be used when measuring distance between points, and hiding some of them so they don't overlap.
positionType
numberInherited fromAxisDataItemrelative position of data item on axis
propertiesType
objectInherited fromDataItemAn 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
Seriesit is part of. E.g. a single column, represented by a Data Item needs to be filled with a different color than the reset of theColumnSeriesit belongs to.That's where Data Item's
propertiescome into play.Please note that you should set Data Item-specific properties using
setProperty()method, rather than accesspropertiesobject directly.spritesType
Sprite[]Default[]Inherited fromDataItemA list of
Spriteelements that are associated with this Data Item.E.g. an
AxisData Item has several separate elements associated with it, likeAxisTick,AxisLabel, andGrid.Data Item keeps track of all of them, so it can toggle all related visual elements when it itself is toggled.
textType
stringInherited fromAxisDataItemText to be used as data item's label.
tickType
AxisTickInherited fromAxisDataItemAn
AxisTickelement associated with this data item.If there is no tick element associated with data item, a new one is created and returned.
uidType
stringInherited fromBaseObjectReturns object's internal unique ID.
valuesType
objectInherited fromDataItemAn object containing calculated values.
visibleType
booleanInherited fromDataItemSets visibility of the Data Item.
Returns
trueif this Data Item is currently visible.workingLocationsType
objectInherited fromDataItemCurrent working locations.
Methods
constructor()Returns
ValueAxisDataItemConstructor
23 inherited items
animate(animationOptions:IAnimationOptions[]|IAnimationOptions,
duration:number,
easing?: (value:number) =>number)Returns
AnimationInherited fromDataItemCreates and starts an
Animationto interpolate (morph) Data Item's properties and/or values.More info:
Animationclone(cloneId?:string)Returns
thisInherited fromBaseObjectMakes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them.
copyFrom(source:this)Returns
voidInherited fromAxisDataItemCopies all parameters from another
AxisDataItem.dispatch(eventType:Key,
data?:any)Returns
voidInherited fromBaseObjectEventsDispatches 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:Key,
data?:any)Returns
voidInherited fromBaseObjectEventsWorks like
dispatch, except event is triggered immediately, without waiting for the next frame cycle.dispose()Returns
voidInherited fromDataItemDestroys this object and all related data.
getCurrentThemes()Returns
ITheme[]Inherited fromBaseObjectReturns 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:string)Returns
DateInherited fromDataItemReturns a Date value of the data field.
getDuration(duration?:number)Returns
$type.Optional<number>Inherited fromDataItemReturns 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
Component.getValue(name:string,
calculated?:CalculatedValue)Returns
$type.Optional<number>Inherited fromDataItemReturns a numeric value for specific data field.
If
calculatedis not set, it will return a raw value, as it is in source data.If
calculatedis set, it will return a pre-calculated specific value.getWorkingValue(name:string)Returns
$type.Optional<number>Inherited fromDataItemReturns a current working value for a specific data field.
The actual value may differ from the one returned by
getValue(). The latter returns static values from the data source.getWorkingValue()returns current value, which is usually different if Data Item is animating from one state to another.hide(duration?:number,
delay?:number,
toValue?:number,
fields?:string[])Returns
$type.Optional<Animation>Inherited fromDataItemHides the Data Item and related visual elements.
isDisposed()Returns
booleanInherited fromBaseObjectReturns if this object has been already been disposed.
setCalculatedValue(name:string,
value:number,
calculated:CalculatedValue)Returns
voidInherited fromDataItemsetCategory(name:string,
value:string)Returns
voidInherited fromDataItemSets a related category for this Data Item.
setDate(name:string,
date:Date,
duration?:number)Returns
voidInherited fromDataItemSets Date value to a data field.
setLocation(name:string,
value:number,
duration?:number,
delay?:number)Returns
voidInherited fromDataItemSets 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.
setProperty(name:string,
value:any)Returns
voidInherited fromDataItemSets a Data Item-specific visual properties to apply to related elements.
setValue(name:string,
value:number,
duration?:number,
delay?:number)Returns
voidInherited fromDataItemSets a numeric value for specific data field.
setVisibility(value:boolean,
noChangeValues?:boolean)Returns
voidInherited fromAxisDataItemSets visibility of the Data Item.
setWorkingLocation(name:string,
value:number,
duration?:number,
delay?:number)Returns
$type.Optional<Animation>Inherited fromDataItemSets a current working location for a data field.
setWorkingValue(name:string,
value:number,
duration?:number,
delay?:number)Returns
$type.Optional<Animation>Inherited fromDataItemSet current working numeric value for a specific data field.
show(duration?:number,
delay?:number,
fields?:string[])Returns
$type.Optional<Animation>Inherited fromDataItemShows the Data Item and related visual elements.
Events
7 inherited items
calculatedvaluechangedParam { type:
"calculatedvaluechanged", target:ValueAxisDataItem, property:string}Inherited fromDataItemInvoked when the calculated value has changed
locationchangedParam { type:
"locationchanged", target:ValueAxisDataItem, property:string}Inherited fromDataItemInvoked when the location of Data Item changes
propertychangedParam { type:
"propertychanged", target:ValueAxisDataItem, property:string, value:any}Inherited fromDataItemInvoked when a property of the Data Item changes
valuechangedParam { type:
"valuechanged", target:ValueAxisDataItem, property:string}Inherited fromDataItemInvoked when the value is changed
visibilitychangedParam { type:
"visibilitychanged", target:ValueAxisDataItem, visible:boolean}Inherited fromDataItemInvoked when the visibility of the Data Item changes, i.e. Series is hidden
workinglocationchangedParam { type:
"workinglocationchanged", target:ValueAxisDataItem, property:string}Inherited fromDataItemInvoked when working location of Data Item changes
workingvaluechangedParam { type:
"workingvaluechanged", target:ValueAxisDataItem, property:string}Inherited fromDataItemInvoked when the internal/intermediate value has changed
Adapters
dateParam { date:
Date, field:string}durationParam
numbervalueParam { field:
string, value:number}workingValueParam { field:
string, workingValue:number}