ZoomCharts Documentation

ZoomCharts.Configuration.BaseApi

Inheritance hierarchy

This type is implemented by FacetChart, GeoChart, NetChart, PieChart and TimeChart.

Methods

addData: (data: BaseDataObjectBase, sourceId?: string): void

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
sourceId: string

the ID of the data source that will be updated. The default value is default.

addSubchartContainer: (container: HTMLElement): void
This property is deprected; use settings.parentChart instead.
Parameters
container: string | HTMLElement
back: (): this
Return value
Data type: this
clearHistory: (): this
Return value
Data type: this
customize: (name: string): this

Applies one of the built-in themes to the chart. This is an alternative to calling updateSettings({ theme: ZoomCharts.BaseApi.themes.dark }).

Parameters
name: string

The name of the theme to be applied, must be one of the values defined in the BaseApi.themes static property.

Return value
Data type: this
export: (type: "png" | "jpg" | "pdf" | "csv" | "xlsx", dimensions?: BaseExportDimensions, transparent?: boolean, fileName?: string): void

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
type: "png" | "jpg" | "pdf" | "csv" | "xlsx"

The format in which the data will be exported.

Specifies the dimensions for the image formats.

transparent: boolean
Version 1.12.0: default changed to 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.

fileName: string

Specifies the fileName to be used, excluding fileExtension

exportAsString: (type: "png" | "jpg" | "pdf" | "csv" | "xlsx", callback: (dataUri: string, mimeType: string, extension: string) => void, dimensions?: BaseExportDimensions, transparent?: boolean): void

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
type: "png" | "jpg" | "pdf" | "csv" | "xlsx"

The format in which the data will be exported.

callback: (dataUri: string, mimeType: string, extension: string) => void

The callback that will be invoked once the result is generated.

Parameters
dataUri: string

The data-uri that contains the generated image or data file.

mimeType: string

The mime type of the generated file.

extension: string

The extension of the generated file.

Specifies the dimensions for the image formats.

transparent: boolean

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.

exportGetDimensions: (dimensions: BaseExportDimensions): { width: number; height: number; scale: number; chartWidth: number; chartHeight: number; }
This property is deprected; use `exportImageGetDimensions` instead

Returns the dimensions for the image exported with exportImageAsString.

Parameters
Return value
Data type: anonymous type
Properties
width: number
height: number
scale: number
chartWidth: number
chartHeight: number
exportImageAsString: (type: "png" | "jpg" | "pdf" | "csv" | "xlsx", dimensions: BaseExportDimensions, transparent: boolean): string
This property is deprected; use `exportAsString` instead.

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
type: "png" | "jpg" | "pdf" | "csv" | "xlsx"
transparent: boolean
Return value
Data type: string

A base64 encoded data-URI that contains the image data. This URI can be used as the image source in <img src="">.

exportImageGetDimensions: (dimensions: BaseExportDimensions): { width: number; height: number; scale: number; chartWidth: number; chartHeight: number; }

Returns the dimensions for the image exported with exportImageAsString.

Parameters
Return value
Data type: anonymous type
Properties
width: number
height: number
scale: number
chartWidth: number
chartHeight: number
fullscreen: (isFullscreen?: boolean): boolean

Gets or sets the fullscreen state of the chart.

Parameters
isFullscreen: boolean

specify true or false to set the state, omit the value to get the current state.

Return value
Data type: boolean
home: (): boolean
Return value
Data type: boolean
off: (name: string, listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): boolean

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
name: string

the type of the event. Please see the documentation for on about valid values.

listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
Return value
Data type: boolean

true if the listener was removed, false if the listener was not previously registered.

on: (name: string, listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds event listener.

Parameters
name: string

The type of the event for which the listener will be added. See method overloads for valid values.

listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void

The callback function. It receives two arguments - the mouse event data and a separate object containing chart specific information.

Parameters
Overloads
on: (name: "chartUpdate", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for when the current view has changed (usually after panning and navigation).

Parameters
name: "chartUpdate"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "click", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for the mouse click (or touch tap) event.

Parameters
name: "click"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "doubleClick", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for the mouse double click (or touch double tap) event.

Parameters
name: "doubleClick"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "error", listener: (event: BaseMouseEvent, args: BaseChartErrorEventArguments) => void): void

Adds an event listener for the mouse click (or touch tap) event.

Parameters
name: "error"
listener: (event: BaseMouseEvent, args: BaseChartErrorEventArguments) => void
Parameters

An empty mouse event.

on: (name: "hoverChange", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for when the currently hovered item has changed.

Parameters
name: "hoverChange"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "pointerDown", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for pointer down event.

Parameters
name: "pointerDown"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "dataUpdated", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for pointer down event.

Parameters
name: "dataUpdated"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "positionChange", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for when chart placement on screen changes. Note that this is called on every animation frame.

Parameters
name: "positionChange"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "rightClick", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for the mouse right click (or touch longpress) event.

Parameters
name: "rightClick"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "selectionChange", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for when the currently selected item or items have changed.

Parameters
name: "selectionChange"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
on: (name: "settingsChange", listener: (event: BaseMouseEvent, args: BaseChartSettingsChangeEventArguments) => void): void

Adds an event listener for when the settings are updated through the API.

Parameters
name: "settingsChange"
on: (name: "tripleClick", listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): void

Adds an event listener for the mouse triple click (or touch triple tap) event.

Parameters
name: "tripleClick"
listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void
Parameters
paintNow: (force?: boolean): this

Does immediate repaint. Use to sync updates between multiple charts.

Parameters
force: boolean
Return value
Data type: this
profiler: (): BaseProfiler
Return value
Data type: BaseProfiler
reloadData: (sourceId?: string): void

Clears data cache and loads new data. The current view is preserved.

Parameters
sourceId: string
remove: (): void

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.

replaceData: (data: BaseDataObjectBase, sourceId?: string): void

Replaces the data already in the data cache with the given values.

Parameters
sourceId: string

the ID of the data source that will be updated. The default value is default.

replaceSettings: (changes: BaseSettings): this
Introduced in version 1.10.0.

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
changes: BaseSettings
Return value
Data type: this
restoreState: (state: string, animate?: boolean): void
Parameters
state: string
animate: boolean
resumePaint: (): void
Experimental property - the API might not be stable and is subject to change.

Decrements the suspend counter that was set using suspendPaint() method.

This method also automatically schedules an async repaint.

saveAsImage: (type: "png" | "jpg" | "pdf" | "csv" | "xlsx", dimensions: BaseExportDimensions, transparent: boolean): string
This property is deprected; use `exportAsString` instead

Saves the current chart state as an image.

Parameters
type: "png" | "jpg" | "pdf" | "csv" | "xlsx"
transparent: boolean
Return value
Data type: string

A base64 encoded data-URI that contains the image data. This URI can be used as the image source in <img src="">.

saveState: (): string
Return value
Data type: string
suspendPaint: (): void
Experimental property - the API might not be stable and is subject to change.

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.

updateFilters: (): void

Re-evaluate data filters on next paint.

updateSettings: (changes: BaseSettings): this

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
changes: BaseSettings
Return value
Data type: this
updateSize: (): this

Call when the container size has been changed to update the chart.

Return value
Data type: this
updateStyle: (): void

Re-evaluate style for all objects on next paint.

Properties

typeName: string

Gets the name of the chart the JavaScript object references. For example 'PieChart' or 'TimeChart'. This field is read-only.

X