UNPKG

27.7 kBTypeScriptView Raw
1declare namespace Lib
2{
3
4/** Options for the library. */
5interface Options {
6
7 /** The URL for the webassembly binary (cvizzu.wasm). */
8 wasmUrl?: string;
9
10}
11
12}
13
14declare namespace Data
15{
16
17/** Additional info about a data series besides the contained data. */
18interface SeriesMetaInfo
19{
20 /** Name of the data series. It will be the unique id of the series to
21 reference it in various parts of the API, mainly in {@link Channel} and
22 {@link Data.Record}. This name will also be used by default for Axis and
23 Legend title. */
24 name: string;
25 /** Type of the data series:
26 - 'dimension' - categorical data containing strings
27 (dates should also be added as strings);
28 - 'measure' - continuous data containing numbers.
29 If not set, the library will attempt to determine the type based on
30 the type of the first value. Number type will result in measure,
31 string type will result in dimension. */
32 type?: 'dimension'|'measure';
33 /** Unit of the data series */
34 unit?: string;
35}
36
37interface AbstractSeriesInfo extends SeriesMetaInfo
38{
39 /** Count of values in the series. */
40 length: number;
41}
42
43/** Meta data about dimension data series */
44interface DimensionSeriesInfo extends AbstractSeriesInfo
45{
46 /** Distinct values in the series */
47 categories: Array<string>;
48}
49
50/** Meta data about measure data series */
51interface MeasureSeriesInfo extends AbstractSeriesInfo
52{
53 range: {
54 /** Minimal value in the series */
55 min: number;
56 /** Maximal value in the series */
57 max: number;
58 }
59}
60
61type SeriesInfo = DimensionSeriesInfo|MeasureSeriesInfo;
62
63/** Meta data about the data set */
64interface Metainfo
65{
66 series: SeriesInfo[];
67}
68
69/** Represents a categorical or data value */
70type Value = string|number;
71
72/** List of data values in a series. */
73type Values = string[]|number[];
74
75/** Defines a data series of the data set, and contains a particular variable's
76 values in the data set and meta info about the variable. */
77interface Series extends SeriesMetaInfo {
78 /** The array that contains the values of the data series. The value types
79 should match {@link Data.SeriesMetaInfo.type}. If the data series
80 is shorter than the longest data series defined, it will be internally
81 extended with empty values. */
82 values: Values;
83}
84
85/** A record of the data set, containing one value of each data series
86 corresponding to the same index. */
87interface Record {
88 /** Properties are provided for each data series, providing access to the value within
89 the record referenced by its {@link Data.Series.name|name}. */
90 [seriesName: Series["name"]]: Value;
91}
92
93type FilterCallback = (record: Record) => boolean;
94
95interface Filter {
96 /** A filter callback is called on each record of the dataset on chart
97 generation. If the callback returns false, the record will not be shown on the chart.
98 */
99 filter?: FilterCallback | null;
100}
101
102/** Data table specified by series. */
103interface TableBySeries extends Filter
104{
105 /** The series that make up the the data set. */
106 series: Series[];
107}
108
109/** Data table specified by records. */
110interface TableByRecords extends Filter
111{
112 /** The information about the data series in the records of the data set.
113 Note: not needed if it was previously specified. */
114 series?: SeriesMetaInfo[];
115 /** The array of data records that make up the data set. */
116 records: Value[][];
117}
118
119type CubeRow = Values|CubeRow[];
120
121/** Defines a data series of the data cube, and contains a particular variable's
122 values in the data cube and meta info about that variable. */
123interface CubeData extends SeriesMetaInfo {
124 /** A nested array that contains the values of the data series. Nesting
125 level should match the number of {@link Data.Cube.dimensions}. */
126 values: CubeRow;
127}
128
129/** N dimensional data cude */
130interface Cube extends Filter
131{
132 /** The list of the dimensions of the data cube. */
133 dimensions?: Series[];
134 /** The list of measures of the data cube. */
135 measures?: CubeData[];
136}
137
138/** Data set is a collection of related {@link Data.Series|data series}.
139 Each chart works on a single data set. */
140type Set = TableBySeries|TableByRecords|Cube;
141
142type SeriesList = string[]|string;
143
144}
145
146declare namespace Config
147{
148
149/* Units:
150 - no unit: the same unit as in the data;
151 - %: percentage relative to the min/max of the data;
152 - min,max: offset from min/max of the data;
153 - auto: automatic range based on chart config;
154 */
155type ChannelExtrema = number|`${number}%`|`${number}min`|`${number}max`|'auto';
156
157/** Channel range specifies how to scale the represented data. */
158interface ChannelRange {
159 min?: ChannelExtrema|null;
160 max?: ChannelExtrema|null;
161}
162
163/** Channels are the main building blocks of the chart. Each channel describes
164 a particular aspect of the markers (vertical & horizontal position, color, etc.)
165 and connects them to the underlying data. A single measure and an ordered list of
166 dimensions can be on each channel. The dimensions will recursively slice the
167 measure on the channel. The channels are represented on the chart as an
168 axis or legend. */
169interface Channel {
170 /** This title is shown on the axis or legend corresponding to the channel.
171 If 'auto', the title will be the name of the measure attached to
172 that channel. */
173 title?: string|'auto'|null;
174 /** List of {@link Data.Series.name|data series names} on the
175 channel. */
176 set? : Data.SeriesList|null;
177 /** List of {@link Data.Series.name|data series names} to be added to the
178 channel beside the ones already added. */
179 attach?: Data.SeriesList;
180 /** List of {@link Data.Series.name|data series names} to be removed from the
181 channel. */
182 detach?: Data.SeriesList;
183 /** Specifies the range that determines how the represented data scales
184 on the channel. */
185 range?: ChannelRange;
186 /** Only one dimension can be shown on an axis or legend by
187 name. This index specifies which attached series should be used. */
188 labelLevel?: number;
189}
190
191/** Channel configuration.
192 A data series' name or a list of the data series' names can be used as a
193 short-hand - instead of the {@link Channel|channel object} - to set data series
194 for the channel. Setting a channel to null will remove all data series from it. */
195interface Channels {
196 /** Parameters for the X-axis, determining the position of the markers on the
197 x-axis - or their angle when using polar coordinates.
198 Note: leaving x and y channels empty will result in a
199 chart "without coordinates" like a Treemap or a Bubble Chart. */
200 x?: Channel|Data.SeriesList|null;
201 /** Parameters for the Y-axis, determining the position of the markers on the
202 y-axis - or their radius when using polar coordinates) . */
203 y?: Channel|Data.SeriesList|null;
204 /** Parameters for the markers' base color. The markers' actual color can
205 also be affected by the lightness channel. */
206 color?: Channel|Data.SeriesList|null;
207 /** Parameters for markers' lightness. */
208 lightness?: Channel|Data.SeriesList|null;
209 /** Parameters for the markers' size. Effective only for circle and line
210 geometry affecting the circle area or the line width respectively.
211 */
212 size?: Channel|Data.SeriesList|null;
213 /** Parameters for the content of the labels that appear on the markers. */
214 label?: Channel|Data.SeriesList|null;
215 /** Splits the markers as all the other channels, but have no
216 effect on the markers' appearance. Thus, it only works with dimensions. */
217 noop?: Channel|Data.SeriesList|null;
218}
219
220/** The config contains all of the parameters needed to render a particular
221 static chart or a state of an animated chart. */
222interface Chart extends Channels {
223 /** List of the chart's channels' configuration. The chart object also
224 extends the channels object as a configuration shorthand. */
225 channels?: Channels;
226 /** This is the title shown on the top of the chart.
227 If set to null, the title will not be shown and will not take up any
228 space in the chart layout. */
229 title?: string|null;
230 /** Specifies which channel should be shown on the legend.
231 If set to null, the legend will not be shown and will not take up any
232 space in the chart layout. */
233 legend?: 'color'|'lightness'|'size'|null;
234 /** Sets the coordinate system for the chart. Switch to the 'polar'
235 coordinate system to create a chart from the pie/radial chart family. */
236 coordSystem?: 'cartesian'|'polar';
237 /** Rotates the plot area by the specified angle in degree.
238 Note: this is an experimental, not tested feature. */
239 rotate?: number;
240 /** Sets the geometric elements used for the markers to represent the data.*/
241 geometry?: 'rectangle'|'circle'|'area'|'line';
242 /** If both axes have measures on them, this parameter sets the
243 orientation of the chart, meaning to which axis the graphical elements
244 are oriented to. */
245 orientation?: 'horizontal'|'vertical';
246 /** - 'none': markers are sorted in the order as the corresponding data
247 appear in the data set.
248 - 'byValue': markers will be sorted by the corresponding measure (if present)
249 in decreasing order. */
250 sort?: 'none'|'byValue';
251 /** Reverts the order of the markers if set. */
252 reverse?: boolean;
253 /** Sets the alignment of the markers with relation to the x- or the y-axis depending
254 on where the measure is. In case both axes have measures on them, this is determined
255 by the {@link Chart.orientation|orientation} of the chart.
256 */
257 align?: 'none'|'min'|'center'|'max'|'stretch';
258 /** If set to true, markers will be split by the dimension(s) along the axis.
259 This works if you have at least one dimension and a measure on the same axis.In case
260 both axes have measures and dimension(s) on them, this is determined by the
261 {@link Chart.orientation|orientation} of the chart.*/
262 split?: boolean;
263}
264
265}
266
267declare namespace Styles
268{
269
270/** Length can be set in pixels or in percentage of the element or the element's
271 font size. Pixel is the default unit. */
272type Length = `${number}px`|`${number}%`|`${number}em`|number;
273
274/** Angle can be set in radians, degrees, gradians and turns.
275 Radians is the default unit. */
276type Angle = `${number}rad`|`${number}grad`|`${number}deg`|`${number}turn`
277 |number;
278
279/** The following CSS color formats are available:
280 rgb(), rgba(), #RRGGBB, #RRGGBBAA, #RGB. */
281type Color = `#${string}`
282 |`rgb(${number},${number},${number})`
283 |`rgba(${number},${number},${number},${number})`;
284
285interface Padding {
286 /** Top padding of the element. */
287 paddingTop?: Length|null;
288 /** Right padding of the element. */
289 paddingRight?: Length|null;
290 /** Bottom padding of the element. */
291 paddingBottom?: Length|null;
292 /** Left padding of the element. */
293 paddingLeft?: Length|null;
294}
295
296interface Font {
297 /** The family of the font. If not set, it inherits the root style font
298 family. */
299 fontFamily?: string|null;
300 /** The style of the font. */
301 fontStyle?: 'normal'|'italic'|'oblique'|null;
302 /** The weight of the font, numbers use the same scale as CSS. */
303 fontWeight?: 'normal'|'bold'|number|null;
304 /** The size of the font. Percentage values are relative to the root style font
305 size */
306 fontSize?: Length|null;
307}
308
309interface Box {
310 /** The background color of the element. */
311 backgroundColor?: Color|null;
312 /** The border color of the element. */
313 borderColor?: Color|null;
314 /** The border width of the element. */
315 borderWidth?: number|null;
316}
317
318interface Text {
319 /** The color of the displayed text. */
320 color?: Color|null;
321 /** The alignment of the displayed text. */
322 textAlign?: 'center'|'left'|'right'|null;
323 /** The background color of the displayed text. */
324 backgroundColor?: Color|null;
325 /** The format of the number. Only applicable for texts showing numerical
326 data such as marker and axis labels. 'grouped' uses thousand separators,
327 'prefixed' uses scientific notation. */
328 numberFormat?: 'none'|'grouped'|'prefixed'|null;
329 /** The maximum number of digits in fraction part if the text contains a
330 number. */
331 maxFractionDigits?: number|null;
332}
333
334/** The following CSS like filters can be used to alter the color:
335
336 - color: overrides the color.
337 - lightness: lightens or darkens the color; 0 means the original color, -1
338 means black, 1 means white.
339 - grayscale: desaturates the color. 0 means the original color, 1 means fully
340 desaturated.
341
342 none: no change.
343 */
344type ColorTransform = `color(${Color})`
345 | `lightness(${number})`
346 | `grayscale(${number})`
347 | `opacity(${number})`
348 | 'none';
349
350interface OrientedLabel extends Label {
351 /** Orientation of the label relatively to the axis or marker it is attached to. */
352 orientation?: 'normal'|'tangential'|'horizontal'|'vertical'|null;
353 /** Additional rotation of the label. */
354 angle?: Angle|null;
355}
356
357interface MarkerLabel extends OrientedLabel {
358 /** The label position relatively to the marker. */
359 position?: 'center'|'top'|'left'|'bottom'|'right'|null;
360 /** Defines the transformation used for calculating the label color
361 from the marker color. */
362 filter?: ColorTransform|null;
363 /** Sets the order of values on the label if both a measure and a dimension are
364 present. */
365 format?: 'measureFirst'|'dimensionsFirst'|null;
366}
367
368interface Guides {
369 /** The color of the guides.*/
370 color?: Color|null;
371 /** Line width of the guide in pixel. */
372 lineWidth?: number|null;
373}
374
375interface Tooltip extends Font, Box {
376 /** The layout of the tooltip text */
377 layout?: 'singleLine'|'multiLine';
378 /** The foreground color of the tooltip text */
379 color?: Color;
380 /** Color of the drop shadow */
381 shadowColor?: Color;
382 /** Corner radius for the info bubble */
383 borderRadius?: number;
384 /** Drop shadow distance from the info bubble */
385 dropShadow?: number;
386 /** Data point marker radius */
387 radius?: number;
388 /** Base size of the info bubble arrow */
389 arrowSize?: number;
390 /** Distance between the data point and the info bubble */
391 distance?: number;
392 /** Specifies the name of the data series dispalyed
393 at the first position on the tooltip */
394 seriesName?: string|null;
395}
396
397interface Logo extends Padding
398{
399 /** Width of the Vizzu logo */
400 width?: Length|null;
401 /** Color transformation applied on the colored Vizzu Logo */
402 filter?: ColorTransform|null;
403}
404
405interface DataPoint {
406 /** Color gradient used for the measure on the color channel.*/
407 colorGradient?: ColorGradient|null;
408 /** Color palette used for the dimension on the color channel.*/
409 colorPalette?: ColorPalette|null;
410 /** Lightness value associated with the minimum value of the lightness
411 channel's range. */
412 minLightness?: number|null;
413 /** Lightness value associated with the maximum value of the lightness
414 channel's range. */
415 maxLightness?: number|null;
416 /** Minimum of line width specified as proportion of plot area size.
417 e.g.: 0.01 means 1% of the width of the plot area. */
418 lineMinWidth?: number|null;
419 /** Maximum line width specified as proportion of plot area size.
420 e.g.: 0.01 means 1% of the width of the plot area. */
421 lineMaxWidth?: number|null;
422 /** Minimum circle radius specified as proportion of plot area size.
423 e.g.: 0.01 means 1% of the width of the plot area. */
424 circleMinRadius?: number|null;
425 /** Maximum circle radius specified as proportion of plot area size.
426 e.g.: 0.01 means 1% of the width of the plot area. */
427 circleMaxRadius?: number|null;
428 /** Spacing between bars/columns. The value specifies the size of the
429 spacing as a factor of the marker size.
430 e.g.: 0.1 means 10% of marker height/width depending on the chart's orientation. */
431 rectangleSpacing?: number|null;
432}
433
434interface Marker extends DataPoint {
435 /** Width of the marker border in pixels. */
436 borderWidth?: number|null;
437 /** Opacity of the marker border. */
438 borderOpacity?: number|null;
439 borderOpacityMode?: 'straight'|'premultiplied'|null;
440 /** Opacity of the marker fill color. */
441 fillOpacity?: number|null;
442 /** Style settings for guide lines drawn for the markers. */
443 guides?: Guides|null;
444 /** Style settings for the marker labels. */
445 label?: MarkerLabel|null;
446}
447
448 /** Style settings for the values shown on the axis to display the scale
449 being used or the categories along the axis. */
450interface AxisLabel extends OrientedLabel {
451 /** Label position relatively to the plot. */
452 position?: 'axis'|'max-edge'|'min-edge'|null;
453 /** Label alignment relatively to the position on the plot. */
454 side?: 'positive'|'negative'|null;
455}
456
457 /** Style settings of the {@link Config.Channel.title|Axis title} */
458interface AxisTitle extends Label {
459 /** Title position relatively to the plot. */
460 position?: 'axis'|'min-edge'|'max-edge'|null;
461 /** Title alignment relatively to the position on the plot. */
462 side?: 'positive'|'upon'|'negative'|null;
463 /** Title position on the axis or edge. */
464 vposition?: 'begin'|'middle'|'end'|null;
465 /** Title alignment on the axis or edge. */
466 vside?: 'positive'|'upon'|'negative'|null;
467 /** The orientation of the title. */
468 orientation?: 'horizontal'|'vertical'|null;
469}
470
471interface Ticks {
472 /** Color of the ticks on the axis. */
473 color?: Color|null;
474 /** Line width of the ticks on the axis. */
475 lineWidth?: number|null;
476 /** Length of the ticks on the axis. */
477 length?: Length|null;
478 /** Position of the ticks on the axis relatively to the axis line. */
479 position?: 'outside'|'inside'|'center'|null;
480}
481interface Interlacing {
482 /** Color of the interlacing pattern. */
483 color?: Color|null;
484}
485
486interface Axis {
487 /** Color of the axis line. */
488 color?: Color|null;
489 /** Style parameters of the axis title. */
490 title?: AxisTitle|null;
491 /** Style parameters of the axis labels. */
492 label?: AxisLabel|null;
493 ticks?: Ticks|null;
494 guides?: Guides|null;
495 interlacing?: Interlacing|null;
496}
497
498interface Plot extends Padding, Box {
499 /** Style settings for the markers. */
500 marker?: Marker|null;
501 /** Style settings for the x-axis - or the angle when using polar coordinates. */
502 xAxis?: Axis|null;
503 /** Style settings for the y-axis - or the radius when using polar coordinates. */
504 yAxis?: Axis|null;
505 /** Controls drawing outside of the plot area. If hidden, clipping will be
506 set for the boundary of the coordinate system. */
507 overflow?: 'hidden'|'visible';
508}
509
510interface LegendMarker {
511 /** Shape of the legend marker. */
512 type?: 'circle'|'square'|null;
513 /** Size of the legend marker (diameter or side length). */
514 size?: Length|null;
515}
516
517interface Legend extends Padding, Box {
518 /** Width of the legend's boundary box. */
519 width?: Length|null;
520 /** Limit for the width of the boundary box. */
521 maxWidth?: Length|null;
522 /** Style settings for the legend's title. */
523 title?: Label|null;
524 /** Style settings for the labels on the legend. */
525 label?: Label|null;
526 marker?: LegendMarker|null;
527}
528
529 /** Color and position pairs separated by spaces,
530 where position is a number between 0 and 1. */
531type ColorStop = `${Color} ${number}`;
532
533/** Color gradient is specified by a comma separated list of ColorStops.
534 This is used when a measure is on the color channel. */
535type ColorGradient = ColorStop
536 | `${ColorStop},${ColorStop}`
537 | `${ColorStop},${ColorStop},${ColorStop}`
538 | `${ColorStop},${ColorStop},${ColorStop},${ColorStop}`
539 | `${ColorStop},${ColorStop},${ColorStop},${ColorStop},${ColorStop}`
540 | string;
541
542/** Color palette is a list of colors separated by spaces.
543 This is used when only dimensions are on the color channel*/
544type ColorPalette = Color
545 | `${Color} ${Color}`
546 | `${Color} ${Color} ${Color}`
547 | `${Color} ${Color} ${Color} ${Color}`
548 | `${Color} ${Color} ${Color} ${Color} ${Color}`
549 | string;
550
551type Label = Padding & Font & Text;
552
553interface Chart extends Padding, Box, Font {
554 /** Style settings for the plot area. */
555 plot?: Plot|null;
556 /** Style settings for the legend. */
557 legend?: Legend|null;
558 /** Style settings for the main chart title. */
559 title?: Label|null;
560 /** Style settings for the tooltip. */
561 tooltip?: Tooltip|null;
562 /** Style settings of the Vizzu logo. */
563 logo?: Logo|null;
564}
565
566}
567
568
569/** Represents a state in the animation describing the data, the chart, and
570 the style parameters to be changed from the actual state.
571 Passing null as style will reset every style parameter to default. */
572interface AnimTarget {
573 /** Data set. */
574 data?: Data.Set;
575 /** Chart configuration changes. */
576 config?: Config.Chart;
577 /** Style changes. */
578 style?: Styles.Chart|null;
579}
580
581declare namespace Anim
582{
583
584/** Duration can be set in seconds or milliseconds.
585 In case no unit is set, it defaults to seconds. */
586type Duration = `${number}s`|`${number}ms`|number;
587
588type Easing = 'none' | 'linear' | 'step-start' | 'step-end' | 'ease'
589 | 'ease-in' | 'ease-out' | 'ease-in-out'
590 | `cubic-bezier(${number},${number},${number},${number})`;
591
592/** Animation parameters for an animation group. */
593interface GroupOptions
594{
595 /** Sets the easing used for the animation. */
596 easing?: Easing;
597 /** The length of time an animation should take to complete. */
598 duration?: Duration;
599 /** Waiting time interval before the animation starts. */
600 delay?: Duration;
601}
602
603/** If no animation settings are passed to Vizzu, it will use an automatic
604 setting depending on the actual configuration of the chart. This behavior can be
605 overridden via the animation setting parameter.
606
607 The animation between two states of the chart can require the transitioning
608 of several different chart properties. These properties are grouped into
609 separately configurable animation groups.
610
611 The parameters can also be set for the animation as a whole. These settings
612 rescale the durations and delays of the animation groups to the
613 specified total delay and duration.
614 */
615interface Options extends GroupOptions {
616 /** Determines if the animation should start automatically after the
617 animate() call. */
618 playState?: 'paused'|'running';
619 /** The starting position of the animation. */
620 position: number;
621 /** Animation group for style parameters. */
622 style?: GroupOptions;
623 /** Title animation parameters. */
624 title?: GroupOptions;
625 /** Legend animation parameters. */
626 legend?: GroupOptions;
627 /** Animation group for new markers fading in
628 (due to filtering or added/removed data series). */
629 show?: GroupOptions;
630 /** Animation group for markers fading out
631 (due to filtering or added/removed data series). */
632 hide?: GroupOptions;
633 /** Marker color animation group. */
634 color?: GroupOptions;
635 /** Coordinate system transformations animation group. */
636 coordSystem?: GroupOptions;
637 /** Marker geometry morph animation group. */
638 geometry?: GroupOptions;
639 /** Animation group for marker transitions in the direction of the y-axis. */
640 y?: GroupOptions;
641 /** Animation group for marker transitions in the direction of the x-axis. */
642 x?: GroupOptions;
643 /** Animation group for tooltip transitions. */
644 tooltip?: GroupOptions;
645}
646
647/** Control object for animation. */
648interface Control extends Promise<Vizzu> {
649 /** Seeks the animation to the position specified by time or progress
650 percentage. Seeking the animation to the end position will not trigger
651 the (@link Vizzu.animate|animation promise) to resolve. */
652 seek(value: `${number}%`|Duration): void;
653 /** Pauses the controlled animation. */
654 pause(): void;
655 /** Plays/resumes playing of the controlled animation. */
656 play(): void;
657 /** Stops the current animation seeking it back to its start position. */
658 stop(): void;
659 /** Changes the direction of the controlled animation. */
660 reverse(): void;
661 /** Cancels the animation, will reject the animation promise. */
662 cancel(): void;
663}
664
665}
666
667declare namespace Event
668{
669
670type Type =
671 'click'
672 |'mouseon'
673 |'mousemove'
674 |'wheel'
675 |'update'
676 |'background-draw'
677 |'title-draw'
678 |'logo-draw'
679 |'legend-background-draw'
680 |'legend-title-draw'
681 |'legend-label-draw'
682 |'legend-marker-draw'
683 |'legend-bar-draw'
684 |'plot-background-draw'
685 |'plot-marker-draw'
686 |'plot-marker-label-draw'
687 |'plot-marker-guide-draw'
688 |'plot-axis-draw'
689 |'plot-axis-title-draw'
690 |'plot-axis-label-draw'
691 |'plot-axis-tick-draw'
692 |'plot-axis-guide-draw'
693 |'plot-axis-interlacing-draw'
694 |'animation-begin'
695 |'animation-complete';
696
697/** The interface of the event object is passed to event handlers by the library.
698 Additional properties will vary by event type. */
699interface Object {
700 /** If called, the default action of the event will be canceled. */
701 preventDefault: () => void;
702}
703
704}
705
706type Snapshot = number;
707
708/** List of base and additional features:
709 - logging: enables logging of the library to the console
710 (switched off by default).
711 - rendering: enables rendering of the library to the canvas
712 (enabled by default).
713 - tooltip: tooltips on the chart appearing on markers on mouse over.
714 Since the tooltip uses the animation interface, calling animate() while
715 the tooltip is enabled can cause unwanted behaviour. */
716type Feature = 'tooltip'|'logging'|'rendering';
717
718/** Class representing a single chart in Vizzu. */
719export default class Vizzu {
720 /** Creates a new chart and connects it to the div or canvas HTML
721 element specified by its ID or DOM object. The new chart is empty by
722 default, but can be set to an initial state in the second optional
723 parameter. */
724 constructor(container: string|HTMLElement, initState?: AnimTarget|Config.Chart);
725 /** Promise representing the initialization will resolve when
726 initialization is finished. Any API call will potentially cause
727 an error before this promise is resolved. */
728 initializing: Promise<Vizzu>;
729 /** Installs the provided event handler to the event specified by name. */
730 on(eventName: Event.Type, handler: (event: Event.Object) => void): void;
731 /** Uninstalls the provided event handler from the event specified by name.
732 */
733 off(eventName: Event.Type, handler: (event: Event.Object) => void): void;
734 /** Initiates the animation to the new chart state passed as the first
735 argument. If there is a currently running animation, all subsequent
736 calls will schedule the corresponding animation after the end of the
737 previous one.
738
739 The new chart state can be a full state specifier object with
740 data, config and style, or a single chart config object.
741 It accepts also a chart snapshot acquired from a previous state using
742 the store() method.
743
744 The optional second parameter specifies the animation
745 options. This second option can be a scalar value, setting the overall
746 animation duration. Passing explicit null as second parameter will
747 result in no animation.
748
749 The animation will be initiated in the next cycle of the JS event loop.
750 The method returns a promise, which will resolve when the animation is
751 finished. */
752 animate(
753 animTarget: AnimTarget|Config.Chart|Snapshot,
754 animOptions?: Anim.Options|Anim.Duration|null)
755 : Anim.Control;
756 /** Returns a reference to the actual chart state for further reuse.
757 This reference includes the chart config, style parameters and the
758 data filter but does not include the actual data and the animation options.
759 */
760 store(): Snapshot;
761 /** Returns controls for the ongoing animation, if any.
762 @deprecated since version 0.4.0 */
763 get animation(): Anim.Control;
764 /** Returns the version number of the library. */
765 version(): string;
766 /** Property for read-only access to style object. */
767 style: Readonly<Styles.Chart>;
768 /** Property for read-only access to chart parameter object. */
769 config: Readonly<Config.Chart>;
770 /** Property for read-only access to data metainfo object. */
771 data: Readonly<Data.Metainfo>;
772 /** Enable/disable additional features. */
773 feature(name: Feature, enabled: boolean): void;
774 /** Returns the chart preset collection. */
775 static get presets(): import('./presets').Preset;
776 /** Setter method for Library options. */
777 static options(options: Lib.Options): void;
778}