import * as Anim from './types/anim.js'; import * as Data from './types/data.js'; import * as Config from './types/config.js'; import * as Styles from './types/styles.js'; import { EventType, EventMap, EventHandler } from './events.js'; import { LoaderOptions } from './module/loader.js'; import { Snapshot } from './module/cchart.js'; import { AnimControl } from './animcontrol.js'; import { AnimCompleting } from './animcompleting.js'; import { Mirrored } from './tsutils.js'; import { Plugin, PluginApi } from './plugins.js'; import Presets from './plugins/presets.js'; import { LazyCanvasOptions, HtmlCanvasApi } from './htmlcanvas.js'; import { CoordSystemApi } from './plugins/coordsys.js'; /** Options for the library. */ export type LibOptions = LoaderOptions; /** List of base and additional features: - logging: enables logging of the library to the console (switched off by default). - rendering: enables rendering of the library to the canvas (enabled by default). - tooltip: tooltips on the chart appearing on markers on mouse over. Since the tooltip uses the animation interface, calling animate() while the tooltip is enabled can cause unwanted behaviour. - cssProperties: enables setting the styles through --vizzu-... css properties. - shorthands: enables shorthand properties for chart config and style. - pivotData: enables setting the data in pivot table or data cube format. - pointerEvents: enables pointer events on the chart. */ export type Feature = 'logging' | 'tooltip' | 'rendering' | 'cssProperties' | 'coordSystem' | 'htmlCanvas' | 'shorthands' | 'pivotData' | 'pointerEvents'; export interface FeatureOptions { features?: Plugin[]; } export type VizzuOptions = FeatureOptions & LazyCanvasOptions; export type FeatureFunction = (feature: Feature | Plugin, enabled?: boolean) => PluginApi; export interface Features extends Record, FeatureFunction { coordSystem: CoordSystemApi; htmlCanvas: HtmlCanvasApi; } /** Class representing a single chart in Vizzu. */ export default class Vizzu { /** Promise representing the initialization will resolve when initialization is finished. Any API call will potentially cause an error before this promise is resolved. */ initializing: Promise; private _chart?; private _anim; private _plugins; /** Returns the chart preset collection. */ static get presets(): Presets; /** Setter method for Library options. */ static options(options: LibOptions): void; /** Initializes the library, if not called, first constructor call will do that. */ static initialize(): Promise; /** 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. */ constructor(options: VizzuOptions, initState?: Anim.Target); private _getFeatureList; /** If called as a function: (name, enabled): it enables/disables built-in features and registered plugins. (plugin, enabled?): registers the given plugin. Otherwise gives access to the interfaces of the registered plugins, where every plugin acceccible as a property with the plugin name. */ get feature(): Features; private _feature; /** 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 AnimControl 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. */ animate(target: Anim.AnimTarget, options?: Anim.ControlOptions): AnimCompleting; private _animate; private _runAnimation; /** Returns controls for the ongoing animation, if any. @deprecated since version 0.4.0 */ get animation(): AnimControl; /** Returns the version number of the library. */ version(): string; /** Property for read-only access to data metainfo object. */ get data(): Mirrored; /** Property for read-only access to chart parameter object. */ get config(): Mirrored; /** Property for read-only access to style object without default values. */ get style(): Mirrored; /** Property for read-only access to the style object after setting defaults. */ getComputedStyle(): Mirrored; /** Installs the provided event handler to the event specified by name. */ on(eventName: T, handler: EventHandler): void; /** Uninstalls the provided event handler from the event specified by name. */ off(eventName: T, handler: EventHandler): void; /** 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. */ store(): Snapshot; /** 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. */ detach(): void; }