1 | import * as Anim from './types/anim.js';
|
2 | import * as Data from './types/data.js';
|
3 | import * as Config from './types/config.js';
|
4 | import * as Styles from './types/styles.js';
|
5 | import { EventType, EventMap, EventHandler } from './events.js';
|
6 | import { LoaderOptions } from './module/loader.js';
|
7 | import { Snapshot } from './module/cchart.js';
|
8 | import { AnimControl } from './animcontrol.js';
|
9 | import { AnimCompleting } from './animcompleting.js';
|
10 | import { Mirrored } from './tsutils.js';
|
11 | import { Plugin, PluginApi } from './plugins.js';
|
12 | import Presets from './plugins/presets.js';
|
13 | import { LazyCanvasOptions, HtmlCanvasApi } from './htmlcanvas.js';
|
14 | import { CoordSystemApi } from './plugins/coordsys.js';
|
15 |
|
16 | export type LibOptions = LoaderOptions;
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export type Feature = 'logging' | 'tooltip' | 'rendering' | 'cssProperties' | 'coordSystem' | 'htmlCanvas' | 'shorthands' | 'pivotData' | 'pointerEvents';
|
31 | export interface FeatureOptions {
|
32 | features?: Plugin[];
|
33 | }
|
34 | export type VizzuOptions = FeatureOptions & LazyCanvasOptions;
|
35 | export type FeatureFunction = (feature: Feature | Plugin, enabled?: boolean) => PluginApi;
|
36 | export interface Features extends Record<string, PluginApi>, FeatureFunction {
|
37 | coordSystem: CoordSystemApi;
|
38 | htmlCanvas: HtmlCanvasApi;
|
39 | }
|
40 |
|
41 | export default class Vizzu {
|
42 | |
43 |
|
44 |
|
45 | initializing: Promise<Vizzu>;
|
46 | private _chart?;
|
47 | private _anim;
|
48 | private _plugins;
|
49 |
|
50 | static get presets(): Presets;
|
51 |
|
52 | static options(options: LibOptions): void;
|
53 |
|
54 | static initialize(): Promise<void>;
|
55 | |
56 |
|
57 |
|
58 |
|
59 | constructor(options: VizzuOptions, initState?: Anim.Target);
|
60 | private _getFeatureList;
|
61 | /** If called as a function:
|
62 | (name, enabled): it enables/disables built-in features and registered plugins.
|
63 | (plugin, enabled?): registers the given plugin.
|
64 | Otherwise gives access to the interfaces of the registered plugins, where
|
65 | every plugin acceccible as a property with the plugin name. */
|
66 | get feature(): Features;
|
67 | private _feature;
|
68 | /** Initiates the animation either to the new chart state passed as the first
|
69 | argument, or through a sequence of keyframe charts passed as the first
|
70 | argument. If there is a currently running animation, all subsequent
|
71 | calls will schedule the corresponding animation after the end of the
|
72 | previous one.
|
73 | The new chart state or keyframe can be a full state specifier object with
|
74 | data, config and style, or a single chart config object.
|
75 | It accepts also a chart snapshot acquired from a previous state using
|
76 | the store() method of this class or a whole previous animation acquired
|
77 | using the store() method of the AnimControl object, which can be queried
|
78 | from the promise returned by the animate() method.
|
79 | The optional second parameter specifies the animation control options
|
80 | and also all the other animation options in case of only a single chart
|
81 | state passed as the first argument.
|
82 | This second option can be a scalar value, setting the overall
|
83 | animation duration. Passing explicit null as second parameter will
|
84 | result in no animation.
|
85 | The method returns a promise, which will resolve when the animation is
|
86 | finished. Since there can be multiple animations in the queue, the result
|
87 | promise provides a nested promise member `activated`,
|
88 | which resolves when the requested animation gets active. */
|
89 | animate(target: Anim.AnimTarget, options?: Anim.ControlOptions): AnimCompleting;
|
90 | private _animate;
|
91 | private _runAnimation;
|
92 | /** Returns controls for the ongoing animation, if any.
|
93 | @deprecated since version 0.4.0 */
|
94 | get animation(): AnimControl;
|
95 | /** Returns the version number of the library. */
|
96 | version(): string;
|
97 | /** Property for read-only access to data metainfo object. */
|
98 | get data(): Mirrored<Data.Metainfo>;
|
99 | /** Property for read-only access to chart parameter object. */
|
100 | get config(): Mirrored<Config.Chart>;
|
101 | /** Property for read-only access to style object without default values. */
|
102 | get style(): Mirrored<Styles.Chart>;
|
103 | /** Property for read-only access to the style object after setting defaults. */
|
104 | getComputedStyle(): Mirrored<Styles.Chart>;
|
105 | /** Installs the provided event handler to the event specified by name. */
|
106 | on<T extends EventType>(eventName: T, handler: EventHandler<EventMap[T]>): void;
|
107 | /** Uninstalls the provided event handler from the event specified by name. */
|
108 | off<T extends EventType>(eventName: T, handler: EventHandler<EventMap[T]>): void;
|
109 | /** Returns a reference to the actual chart state for further reuse.
|
110 | This reference includes the chart config, style parameters and the
|
111 | data filter but does not include the actual data and the animation options. */
|
112 | store(): Snapshot;
|
113 | /** Removes the reference of the chart from every place it attached itself,
|
114 | this method must be called in order to get the chart properly garbage
|
115 | collected. */
|
116 | detach(): void;
|
117 | }
|