Skip to content

Vizzu / Modules / vizzu / Vizzu

Class: Vizzu

vizzu.Vizzu

Class representing a single chart in Vizzu.

Constructors

constructor

new Vizzu(container, initState?)

Creates a new chart and connects it to the div or canvas HTML element specified by its ID or DOM object. The new chart is empty by default, but can be set to an initial state in the second optional parameter.

Parameters

Name Type
container string | HTMLElement
initState? Chart | Target

Properties

config

config: Readonly\<Chart>

Property for read-only access to chart parameter object.


data

data: Readonly\<Metainfo>

Property for read-only access to data metainfo object.


initializing

initializing: Promise\<Vizzu>

Promise representing the initialization will resolve when initialization is finished. Any API call will potentially cause an error before this promise is resolved.


style

style: Readonly\<Chart>

Property for read-only access to style object without default values.

Accessors

animation

get animation(): Control

Returns controls for the ongoing animation, if any.

Deprecated

since version 0.4.0

Returns

Control


presets

Static get presets(): Preset

Returns the chart preset collection.

Returns

Preset

Methods

animate

animate(animTarget, animOptions?): Completing

Initiates the animation either to the new chart state passed as the first argument, or through a sequence of keyframe charts passed as the first argument. If there is a currently running animation, all subsequent calls will schedule the corresponding animation after the end of the previous one.

The new chart state or keyframe can be a full state specifier object with data, config and style, or a single chart config object. It accepts also a chart snapshot acquired from a previous state using the store() method of this class or a whole previous animation acquired using the store() method of the Anim.Control object, which can be queried from the promise returned by the animate() method.

The optional second parameter specifies the animation control options and also all the other animation options in case of only a single chart state passed as the first argument. This second option can be a scalar value, setting the overall animation duration. Passing explicit null as second parameter will result in no animation.

The method returns a promise, which will resolve when the animation is finished. Since there can be multiple animations in the queue, the result promise provides a nested promise member activated, which resolves when the requested animation gets active.

Parameters

Name Type
animTarget Animation | LazyTarget | Keyframes
animOptions? ControlOptions | Object

Returns

Completing


detach

detach(): void

Removes the reference of the chart from every place it attached itself, this method must be called in order to get the chart properly garbage collected.

Returns

void


feature

feature(name, enabled): void

Enable/disable additional features.

Parameters

Name Type
name Feature
enabled boolean

Returns

void


getComputedStyle

getComputedStyle(): Readonly\<Chart>

Property for read-only access to the style object after setting defaults.

Returns

Readonly\<Chart>


off

off(eventName, handler): void

Uninstalls the provided event handler from the event specified by name.

Parameters

Name Type
eventName Type
handler (event: Object) => void

Returns

void


on

on(eventName, handler): void

Installs the provided event handler to the event specified by name.

Parameters

Name Type
eventName Type
handler (event: Object) => void

Returns

void


store

store(): Snapshot

Returns a reference to the actual chart state for further reuse. This reference includes the chart config, style parameters and the data filter but does not include the actual data and the animation options.

Returns

Snapshot


version

version(): string

Returns the version number of the library.

Returns

string


options

Static options(options): void

Setter method for Library options.

Parameters

Name Type
options Options

Returns

void