ZoomCharts Documentation
ZoomCharts.TimeChart
Inheritance hierarchy
This type inherits from BaseApi.
Constructors
Methods
Adds the given data to whatever data the chart has currently loaded. The chart will automatically be updated to display this new data if it falls within the currently visible bounds.
Parameters
the ID of the data source that will be updated. The default value is default
.
Applies one of the built-in themes to the chart. This is an alternative to calling
updateSettings({ theme: ZoomCharts.TimeChart.themes.dark })
.
Parameters
The name of the theme to be applied, must be one of the values defined in the TimeChart.themes
static property.
Return value
rescale
parameter. Added the support for setting the auto
display unit.Gets or sets the current display unit. Note that setting the display unit might also result in changes of the current time range to ensure that the unit follows the min/max widths.
If unit: "auto"
is used to select the best-fit display unit, the chart determines the correct display unit
based on timeAxis.unitSizePolicy
setting.
Note that this method can be used to set a display unit that the chart is not configured to use but in this
case a warning will be displayed in the browser console because user interactions will not preserve this setting.
To avoid this, specify the needed display units in area.displayUnits
.
Parameters
If specified, updates the current display unit. Example values: m
, s
, h
, 2 h
, 10 m
, auto
.
When setting the display unit, specifies if the chart animates the transition.
Deprecated as of 1.14.0.
Return value
The current display unit in format {count} {unit}
or null
if the display unit is not yet set.
Launches a file download that contains an image or the data of the current state of the chart.
Note that in some browsers calling this method will send the data to a proxy. When handling sensitive data you should install the proxy
on your own server, see advanced.exportProxyURL
setting.
Parameters
The format in which the data will be exported.
Specifies the dimensions for the image formats.
false
.Specifies if the resulting image should have transparent background. This setting is only valid for png
image format. Default is false
.
Note that if area.style.fillColor
is set, this will have no effect.
Specifies the fileName to be used, excluding fileExtension
Saves the current chart state as a data-URI.
If image type is specified, the URI can be used as the image source in <img src="">
.
Note that some output settings might require sending the data to a proxy. When handling sensitive data you should install the proxy
on your own server, see advanced.exportProxyURL
setting.
Parameters
The format in which the data will be exported.
Specifies the dimensions for the image formats.
Specifies if the resulting image should have transparent background. This setting is only valid for png
image format. Default is false
.
Note that if area.style.fillColor
is set, this will have no effect.
Returns the dimensions for the image exported with exportImageAsString
.
Parameters
Return value
Saves the current chart state as an image.
Note that this method does not support custom DPI setting, for that exportAsString
method has to be used.
Parameters
Return value
A base64 encoded data-URI that contains the image data. This URI can be used as the image source in <img src="">
.
Returns the dimensions for the image exported with exportImageAsString
.
Parameters
Return value
Gets the currently enabled series
Return value
Gets all series even those that are not enabled
Return value
Removes an event listener that was added by a call to on
or by specifying it in settings.
Note that the listener must be the exact same reference, which means that anonymous functions should not be used in call to on
.
Parameters
the type of the event. Please see the documentation for on
about valid values.
Parameters
Return value
true
if the listener was removed, false
if the listener was not previously registered.
Adds event listener.
Parameters
The type of the event for which the listener will be added. See method overloads for valid values.
The callback function. It receives two arguments - the mouse event data and a separate object containing chart specific information.
Parameters
Overloads
Adds an event listener for when the scroll animation completes.
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
An empty mouse event.
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Removes chart from DOM. This method is automatically called when you create a new chart within the same container element.
This method should always be called when the chart HTML element is removed as otherwise there might be additional resources such as event handlers remaining that will prevent the browser from properly releasing memory.
Replaces the data already in the data cache with the given values.
Parameters
the ID of the data source that will be updated. The default value is default
.
Replaces the existing series configuration with new one instead of merging it like updateSettings
.
Parameters
Return value
Updates the chart settings but instead of merging some settings that are arrays or dictionaries (such as data
)
these collections are replaced completely. For example, this allows removal of series or value axis within TimeChart.
Parameters
Return value
Decrements the suspend counter that was set using suspendPaint()
method.
This method also automatically schedules an async repaint.
Scrolls the visible chart area left or right.
Parameters
how much to scroll
scroll with animation or without
adjust the scroll to snap according to the current displayUnit
The amount
property format: < amount unit
or > amount unit
.
<
scrolls to the left,>
scrolls to the rightamount
: integer amount of units to scrollunit
: one of the following:page
,bar
,y
,M
,d
,w
,h
,m
,s
,ms
.
Examples:
scroll("< 1 s")
- scrolls left 1 second, no animationscroll("> 10 y", true)
- scrolls right, 10 years with animation
Date
or moment
instances are now accepted.Gets or sets the selection in javascript timestamp (milliseconds). All timestamps are in UTC.
Use from: null, to: null
to remove selection. If the chart does not have a selection, the method
returns [null, null]
.
Note that this method will return [null, null]
if moment-timezone
library is still being downloaded.
Parameters
Return value
period
parameter now takes UTC timestamps and not the chart internal timestamps.Set displayed time range using period and anchor.
See initialDisplayAnchor
and initialDisplayPeriod
documentation for possible period / anchor values.
Parameters
Date
or moment
instances.Displays the info popup for a specified time interval. The interval must be visible on screen.
Note that if info.enabled
is set to false
this method
still works. In this case the info popup shown by this method will not be hidden as the user hovers the mouse over
the chart.
Parameters
UTC timestamp of the start of the interval (inclusive). The value will be automatically rounded down based on the current display unit.
Passing null
will hide the info popup.
UTC timestamp of the end of the interval (non-inclusive). The value will be automatically rounded up based on the current display unit.
If not specified, selects a single unit starting with the from
timestamp.
Optional HTML code that will be used as the contents of the info popup. If this is not specified, the default contents will be generated.
Suspends the animation of the chart until resumePaint()
is called.
This should be used when the chart element is hidden from the user to conserve browser resources.
Note that if suspendPaint()
is called multiple time then resumePaint()
has to be called the same number of times.
When the chart is animating, gets the target display unit (otherwise returns the current display unit).
See also
- Documentation -
targetTime()
Return value
When the chart is animating, gets the target time range (otherwise returns the current time range).
This method is useful when there are related data objects (such as data tables or other charts) that have
to be filtered based on the visible time range in the chart. By using onChartUpdate
event and this
method it is possible to start updating the page as soon as the animation change but do it for the values
the chart is animating towards.
If the data has not yet been loaded, this method returns [null, null]
.
See also
- Documentation -
targetDisplayUnit()
Return value
Date
or moment
instances.Gets or sets the displayed time range in JavaScript timestamp (milliseconds). Note that both
from
and to
must be specified for the time range to be updated.
All timestamps are specified in UTC.
Note that this method will return [null, null]
if moment-timezone
library is still being downloaded.
Parameters
Return value
Updates the chart settings. Only the settings that have to be changed should be passed. Note that some arrays
and dictionaries (such as data
) are merged by the ID values - if instead they should be replaced, use
replaceSettings()
method.
Parameters
Return value
center
parameter now takes an UTC timestamp and not the chart internal timestamp.center
parameter can now be passed as Date
or moment
instance.Decreases the visible time range on the chart.
Has no effect if the chart data has not been yet loaded.
Parameters
Static properties
Lists the predefined themes for the chart. These can be used within the settings objects or via the customize()
method:
var chart = new ZoomCharts.TimeChart({ theme: ZoomCharts.TimeChart.themes.dark });
chart.updateSettings({ theme: ZoomChart.TimeChart.themes.dark });
chart.customize("dark");
Properties
Disables all user interactions so that the initial view is always persisted.