ZoomCharts Documentation

Version: 1.21.1 (2024-11-08)

ZoomCharts.PieChart

Inheritance hierarchy

This type inherits from BaseApi.

Constructors

.ctor: (settings: PieChartSettings)
Parameters
Return value
Data type: PieChart

Methods

addData: (data: PieChartDataObjectRoot, sourceId?: string): void
Inherited from: BaseApi

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
Inherited from: BaseApi
This property is deprected; use settings.parentChart instead.
Parameters
container: string | HTMLElement
back: (): this
Inherited from: BaseApi
Return value
Data type: this
clearHistory: (): this
Inherited from: BaseApi
Return value
Data type: this
customize: (name: string): this
Inherited from: BaseApi

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

Parameters
name: string

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

Return value
Data type: this
expandSlice: (slice: PieChartSlice): boolean
Parameters
Return value
Data type: boolean
export: (type: "png" | "jpg" | "pdf" | "csv" | "xlsx", dimensions?: BaseExportDimensions, transparent?: boolean, fileName?: string): void
Inherited from: BaseApi

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
Inherited from: BaseApi

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; }
Inherited from: BaseApi
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
Inherited from: BaseApi
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; }
Inherited from: BaseApi

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
Inherited from: BaseApi

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
getActivePie: (): PieChartPie
Return value
Data type: PieChartPie
getActivePies: (): Array<PieChartPie>
Return value
Data type: Array<PieChartPie>
getActiveSlices: (): Array<PieChartSlice>
Return value
Data type: Array<PieChartSlice>
getPie: (): Array<string>
Return value
Data type: Array<string>
getPieOffset: (): number
Return value
Data type: number
getSliceDimensions: (sliceId: Array<string>, showPartial?: boolean): { centerX: number; centerY: number; r0: number; r1: number; a0: number; a1: number; }
Parameters
sliceId: Array<string>
showPartial: boolean
Return value
Data type: anonymous type
Properties
centerX: number
centerY: number
r0: number
r1: number
a0: number
a1: number
home: (): boolean
Inherited from: BaseApi
Return value
Data type: boolean
off: (name: string, listener: (event: BaseMouseEvent, args: BaseChartEventArguments) => void): boolean
Inherited from: BaseApi

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
Inherited from: BaseApi

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: PieChartChartEventArguments) => void): void
Parameters
name: "chartUpdate"
listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void
on: (name: "click", listener: (event: BaseMouseEvent, args: PieChartChartClickEventArguments) => void): void
Parameters
name: "click"
on: (name: "doubleClick", listener: (event: BaseMouseEvent, args: PieChartChartClickEventArguments) => void): void
Parameters
name: "doubleClick"
on: (name: "error", listener: (event: BaseMouseEvent, args: BaseChartErrorEventArguments) => void): void
Parameters
name: "error"
listener: (event: BaseMouseEvent, args: BaseChartErrorEventArguments) => void
Parameters

An empty mouse event.

on: (name: "hoverChange", listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void): void
Parameters
name: "hoverChange"
listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void
on: (name: "positionChange", listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void): void
Parameters
name: "positionChange"
listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void
on: (name: "rightClick", listener: (event: BaseMouseEvent, args: PieChartChartClickEventArguments) => void): void
Parameters
name: "rightClick"
on: (name: "selectionChange", listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void): void
Parameters
name: "selectionChange"
listener: (event: BaseMouseEvent, args: PieChartChartEventArguments) => void
on: (name: "settingsChange", listener: (event: BaseMouseEvent, args: BaseChartSettingsChangeEventArguments) => void): void
Parameters
name: "settingsChange"
on: (name: "tripleClick", listener: (event: BaseMouseEvent, args: PieChartChartClickEventArguments) => void): void
Parameters
name: "tripleClick"
paintNow: (force?: boolean): this
Inherited from: BaseApi

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

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

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

Parameters
sourceId: string
remove: (): void
Inherited from: BaseApi

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: PieChartDataObjectRoot, sourceId?: string): void
Inherited from: BaseApi

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: PieChartSettings): this
Inherited from: BaseApi
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
Return value
Data type: this
restoreState: (state: string, animate?: boolean): void
Inherited from: BaseApi
Parameters
state: string
animate: boolean
resumePaint: (): void
Inherited from: BaseApi
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
Inherited from: BaseApi
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
Inherited from: BaseApi
Return value
Data type: string
selection: (selected?: Array<string | PieChartSlice>): Array<PieChartSlice>

Retrieves or updates the selected slices on the chart.

Parameters

The slices or their IDs that should be selected. Any currently selected slices that are not present will be unselected.

Return value
Data type: Array<PieChartSlice>

An array of currently selected slices after the changes have been applied.

setPie: (pieId: Array<string>, offset?: number): this
Parameters
pieId: Array<string>
offset: number
Return value
Data type: this
setPieOffset: (offset: number): this
Parameters
offset: number
Return value
Data type: this
showInfoPopup: (x: number, y: number, slice: PieChartSlice): void
Parameters
suspendPaint: (): void
Inherited from: BaseApi
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.

updateFilter: (): PieChart
Return value
Data type: PieChart
updateFilters: (): void
Inherited from: BaseApi

Re-evaluate data filters on next paint.

updateSettings: (changes: PieChartSettings): this
Inherited from: BaseApi

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
Data type: this
updateSize: (): this
Inherited from: BaseApi

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

Return value
Data type: this
updateStyle: (): void
Inherited from: BaseApi

Re-evaluate style for all objects on next paint.

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.PieChart({ theme: ZoomCharts.PieChart.themes.dark });
chart.updateSettings({ theme: ZoomChart.PieChart.themes.dark });
chart.customize("dark");
Properties
Introduced in version 1.8.0.

Properties

typeName: string
Inherited from: BaseApi

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

X