Type class
DurationFormatter class. Formats numbers as durations.
1000
as 16:40
Click here Tutorial on duration formatting
Sources
DurationFormatter can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.DurationFormatter * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.DurationFormatter * -------------------------------------------------------- */
Inheritance
DurationFormatter extends BaseObject
.
DurationFormatter is not extended by any other symbol.
Properties
baseUnit # |
Type Default Base unit the values are in. A base unit will be used to recalculate the numeric value to millisecond timestamps. Available options:
|
---|---|
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. |
durationFormat # |
Type If set, this format will be used instead of the one determined dynamically based on the basedUnit and range of values. Click here Available fomatting codes |
durationFormats # |
Type Duration formats for various combination of base units. |
id # |
Type Inherited from Sets the user-defined id of the element. |
language # |
Type Holds reference to |
sprite # |
Type Holds reference to parent |
uid # |
Type Inherited from Returns object's internal unique ID. |
There are 4 inherited items currently hidden from this list. |
Methods
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 |
copyFrom( object: ) |
Returns Inherited from Copies all properties and related data from different element. |
dispose() |
Returns Inherited from Destroys this object and all related data. |
format( value: ) |
Returns Formats the number according as duration. For example Click here Tutorial on duration formatting |
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. |
getFormat( value: ) |
Returns Returns appropriate default format for the value. If For example if your However, you might want it to be formatted in the context of bigger scale, say 10 minutes (600 seconds). If you pass in
|
getMilliseconds( value: ) |
Returns Converts value to milliseconds according to |
getValueUnit( value: ) |
Returns Returns value's closest denominator time unit, e.g 100 seconds is |
isDisposed() |
Returns Inherited from Returns if this object has been already been disposed. |
toTimeStamp( value: ) |
Returns Converts numeric value to timestamp in milliseconds. |
There are 5 inherited items currently hidden from this list. |
Events
DurationFormatter does not have any events.
Adapters
DurationFormatter does not have any adapters.