@vaadin/charts 24.6.5 → 24.7.0-alpha10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -8,249 +8,10 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import type { Axis, Chart as HighchartsChart, ExtremesObject, Options, Point, Series } from 'highcharts';
12
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
13
- import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
14
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
-
16
- export type ChartCategories = string[] | { [key: number]: string };
17
-
18
- export type ChartCategoryPosition = 'bottom' | 'left' | 'right' | 'top';
19
-
20
- export type ChartStacking = 'normal' | 'percent' | null;
21
-
22
- export type ChartEvent = { target: HighchartsChart; type: string };
23
-
24
- export type ChartSeriesEvent = { target: Series; type: string };
25
-
26
- export type ChartPointEvent = { target: Point; type: string };
27
-
28
- /**
29
- * Fired when a new series is added.
30
- */
31
- export type ChartAddSeriesEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
32
-
33
- /**
34
- * Fired after a chart is exported.
35
- */
36
- export type ChartAfterExportEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
37
-
38
- /**
39
- * Fired after a chart is printed.
40
- */
41
- export type ChartAfterPrintEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
42
-
43
- /**
44
- * Fired before a chart is exported.
45
- */
46
- export type ChartBeforeExportEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
47
-
48
- /**
49
- * Fired before a chart is printed.
50
- */
51
- export type ChartBeforePrintEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
52
-
53
- /**
54
- * Fired when clicking on the plot background.
55
- */
56
- export type ChartClickEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
57
-
58
- /**
59
- * Fired when the chart has finished loading.
60
- */
61
- export type ChartLoadEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
62
-
63
- /**
64
- * Fired when drilldown point is clicked.
65
- */
66
- export type ChartDrilldownEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
67
-
68
- /**
69
- * Fired when drilling up from a drilldown series.
70
- */
71
- export type ChartDrillupEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
72
-
73
- /**
74
- * Fired after all the series has been drilled up if chart has multiple drilldown series.
75
- */
76
- export type ChartDrillupallEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
77
-
78
- /**
79
- * Fired when the chart is redraw. Can be called after a `Chart.configuration.redraw()`
80
- * or after an axis, series or point is modified with the `redraw` option set to `true`.
81
- */
82
- export type ChartRedrawEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
83
-
84
- /**
85
- * Fired when an area of the chart has been selected.
86
- */
87
- export type ChartSelectionEvent = CustomEvent<{ chart: HighchartsChart; originalEvent: ChartEvent }>;
88
-
89
- /**
90
- * Fired when the series has finished its initial animation.
91
- */
92
- export type ChartSeriesAfterAnimateEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
93
-
94
- /**
95
- * Fired when the checkbox next to the series' name in the legend is clicked.
96
- */
97
- export type ChartSeriesCheckboxClickEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
98
-
99
- /**
100
- * Fired when the series is clicked.
101
- */
102
- export type ChartSeriesClickEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
103
-
104
- /**
105
- * Fired when the series is hidden after chart generation time.
106
- */
107
- export type ChartSeriesHideEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
108
-
109
- /**
110
- * Fired when the legend item belonging to the series is clicked.
111
- */
112
- export type ChartSeriesLegendItemClickEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
113
-
114
- /**
115
- * Fired when the mouse leaves the graph.
116
- */
117
- export type ChartSeriesMouseOutEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
118
-
119
- /**
120
- * Fired when the mouse enters the graph.
121
- */
122
- export type ChartSeriesMouseOverEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
123
-
124
- /**
125
- * Fired when the series is shown after chart generation time.
126
- */
127
- export type ChartSeriesShowEvent = CustomEvent<{ series: Series; originalEvent: ChartSeriesEvent }>;
128
-
129
- /**
130
- * Fired when the point is clicked.
131
- */
132
- export type ChartPointClickEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
133
-
134
- /**
135
- * Fired when the legend item belonging to the point is clicked.
136
- */
137
- export type ChartPointLegendItemClickEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
138
-
139
- /**
140
- * Fired when the mouse leaves the area close to the point.
141
- */
142
- export type ChartPointMouseOutEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
143
-
144
- /**
145
- * Fired when the mouse enters the area close to the point.
146
- */
147
- export type ChartPointMouseOverEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
148
-
149
- /**
150
- * Fired when the point is removed from the series.
151
- */
152
- export type ChartPointRemoveEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
153
-
154
- /**
155
- * Fired when the point is selected either programmatically or by clicking on the point.
156
- */
157
- export type ChartPointSelectEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
158
-
159
- /**
160
- * Fired when the point is unselected either programmatically or by clicking on the point.
161
- */
162
- export type ChartPointUnselectEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
163
-
164
- /**
165
- * Fired when the point is updated programmatically through `.updateConfiguration()` method.
166
- */
167
- export type ChartPointUpdateEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
168
-
169
- /**
170
- * Fired when when the minimum and maximum is set for the X axis.
171
- */
172
- export type ChartXaxesExtremesSetEvent = CustomEvent<{
173
- axis: Axis;
174
- originalEvent: ExtremesObject & {
175
- target: Axis;
176
- type: string;
177
- };
178
- }>;
179
-
180
- /**
181
- * Fired when when the minimum and maximum is set for the Y axis.
182
- */
183
- export type ChartYaxesExtremesSetEvent = CustomEvent<{
184
- axis: Axis;
185
- originalEvent: ExtremesObject & {
186
- target: Axis;
187
- type: string;
188
- };
189
- }>;
190
-
191
- export interface ChartCustomEventMap {
192
- 'chart-add-series': ChartAddSeriesEvent;
193
-
194
- 'chart-after-export': ChartAfterExportEvent;
195
-
196
- 'chart-after-print': ChartAfterPrintEvent;
197
-
198
- 'chart-before-export': ChartBeforeExportEvent;
199
-
200
- 'chart-before-print': ChartBeforePrintEvent;
201
-
202
- 'chart-click': ChartClickEvent;
203
-
204
- 'chart-drilldown': ChartDrilldownEvent;
205
-
206
- 'chart-drillup': ChartDrillupEvent;
207
-
208
- 'chart-drillupall': ChartDrillupallEvent;
209
-
210
- 'chart-load': ChartLoadEvent;
211
-
212
- 'chart-redraw': ChartRedrawEvent;
213
-
214
- 'chart-selection': ChartSelectionEvent;
215
-
216
- 'series-after-animate': ChartSeriesAfterAnimateEvent;
217
-
218
- 'series-checkbox-click': ChartSeriesCheckboxClickEvent;
219
-
220
- 'series-click': ChartSeriesClickEvent;
221
-
222
- 'series-hide': ChartSeriesHideEvent;
223
-
224
- 'series-legend-item-click': ChartSeriesLegendItemClickEvent;
225
-
226
- 'series-mouse-out': ChartSeriesMouseOutEvent;
227
-
228
- 'series-mouse-over': ChartSeriesMouseOverEvent;
229
-
230
- 'series-show': ChartSeriesShowEvent;
231
-
232
- 'point-click': ChartPointClickEvent;
233
-
234
- 'point-legend-item-click': ChartPointLegendItemClickEvent;
235
-
236
- 'point-mouse-out': ChartPointMouseOutEvent;
237
-
238
- 'point-mouse-over': ChartPointMouseOverEvent;
239
-
240
- 'point-remove': ChartPointRemoveEvent;
241
-
242
- 'point-select': ChartPointSelectEvent;
243
-
244
- 'point-unselect': ChartPointUnselectEvent;
245
-
246
- 'point-update': ChartPointUpdateEvent;
247
-
248
- 'xaxes-extremes-set': ChartXaxesExtremesSetEvent;
249
-
250
- 'yaxes-extremes-set': ChartYaxesExtremesSetEvent;
251
- }
252
-
253
- export type ChartEventMap = ChartCustomEventMap & HTMLElementEventMap;
13
+ import { type ChartEventMap, ChartMixin } from './vaadin-chart-mixin.js';
14
+ export * from './vaadin-chart-mixin.js';
254
15
 
255
16
  /**
256
17
  * `<vaadin-chart>` is a Web Component for creating high quality charts.
@@ -404,169 +165,13 @@ export type ChartEventMap = ChartCustomEventMap & HTMLElementEventMap;
404
165
  * @fires {CustomEvent} point-select -Fired when the point is selected either programmatically or by clicking on the point.
405
166
  * @fires {CustomEvent} point-unselect - Fired when the point is unselected either programmatically or by clicking on the point.
406
167
  * @fires {CustomEvent} point-update - Fired when the point is updated programmatically through `.updateConfiguration()` method.
168
+ * @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
169
+ * @fires {CustomEvent} point-drop - Fired when the point is dropped.
170
+ * @fires {CustomEvent} point-drag - Fired while dragging a point.
407
171
  * @fires {CustomEvent} xaxes-extremes-set - Fired when when the minimum and maximum is set for the X axis.
408
172
  * @fires {CustomEvent} yaxes-extremes-set - Fired when when the minimum and maximum is set for the Y axis.
409
173
  */
410
- declare class Chart extends ResizeMixin(ThemableMixin(ElementMixin(HTMLElement))) {
411
- readonly options: Options;
412
-
413
- /**
414
- * Configuration object that exposes the JS Api to configure the chart.
415
- *
416
- * Most important methods are:
417
- * - `addSeries (Object options, [Boolean redraw], [Mixed animation])`
418
- * - `addAxis (Object options, [Boolean isX], [Boolean redraw], [Mixed animation])`
419
- * - `setTitle (Object title, object subtitle, Boolean redraw)`
420
- *
421
- * Most important properties are:
422
- * - `configuration.series`: An array of the chart's series. Detailed API for Series object is
423
- * available in [API Site](http://api.highcharts.com/class-reference/Highcharts.Series)
424
- * - `configuration.xAxis`: An array of the chart's x axes. Detailed API for Axis object is
425
- * available in [API Site](http://api.highcharts.com/class-reference/Highcharts.Axis)
426
- * - `configuration.yAxis`: An array of the chart's y axes. Detailed API for Axis object is
427
- * available in [API Site](http://api.highcharts.com/class-reference/Highcharts.Axis)
428
- * - `configuration.title`: The chart title.
429
- *
430
- * For detailed documentation of available API check the [API site](http://api.highcharts.com/class-reference/classes.list)
431
- */
432
- configuration: HighchartsChart | undefined;
433
-
434
- /**
435
- * If categories are present names are used instead of numbers for the category axis.
436
- * The format of categories can be an `Array` with a list of categories, such as `['2010', '2011', '2012']`
437
- * or a mapping `Object`, like `{0:'1',9:'Target (10)', 15: 'Max'}`.
438
- */
439
- categories: ChartCategories | null | undefined;
440
-
441
- /**
442
- * Category-axis maximum value. Defaults to `undefined`.
443
- * @attr {number} category-max
444
- */
445
- categoryMax: number | null | undefined;
446
-
447
- /**
448
- * Category-axis minimum value. Defaults to `undefined`.
449
- * @attr {number} category-min
450
- */
451
- categoryMin: number | null | undefined;
452
-
453
- /**
454
- * The position of the category axis. Acceptable values are `left`, `right`, `top` and `bottom`
455
- * except for bar charts which only accept `left` and `right`.
456
- * With the default value, charts appear as though they have `category-position="bottom"`
457
- * except for bar charts that appear as though they have `category-position="left"`.
458
- *
459
- * Defaults to `undefined`
460
- * @attr {left|right|top|bottom} category-position
461
- */
462
- categoryPosition: ChartCategoryPosition | null | undefined;
463
-
464
- /**
465
- * Specifies whether to hide legend or show.
466
- * Legend configuration can be set up via additionalOptions property
467
- * @attr {boolean} no-legend
468
- */
469
- noLegend: boolean | null | undefined;
470
-
471
- /**
472
- * Specifies how series are stacked on top of each other.
473
- * Possible values are null, "normal" or "percent".
474
- * If "stack" property is not defined on the vaadin-chart-series elements, then series will be put into
475
- * the default stack.
476
- * @attr {normal|percent} stacking
477
- */
478
- stacking: ChartStacking | null | undefined;
479
-
480
- /**
481
- * Specifies whether the chart is a normal chart or a timeline chart.
482
- */
483
- timeline: boolean | null | undefined;
484
-
485
- /**
486
- * Represents the title of the chart.
487
- */
488
- title: string;
489
-
490
- /**
491
- * Whether or not to show tooltip when hovering data points.
492
- */
493
- tooltip: boolean | null | undefined;
494
-
495
- /**
496
- * Sets the default series type of the chart.
497
- * Note that `'bar'`, `'gauge'` and `'solidgauge'` should be set as default series type.
498
- */
499
- type: string | null | undefined;
500
-
501
- /**
502
- * Represents the subtitle of the chart.
503
- */
504
- subtitle: string | undefined;
505
-
506
- /**
507
- * Specifies whether to show chart in 3 or in 2 dimensions.
508
- * Some display angles are added by default to the "chart.options3d" (`{alpha: 15, beta: 15, depth: 50}`).
509
- * 3D display options can be modified via `additionalOptions`.
510
- * The thickness of a Pie chart can be set on `additionalOptions` through `plotOptions.pie.depth`.
511
- * 3D is supported by Bar, Column, Pie and Scatter3D charts.
512
- * More info available at [Highcharts](https://www.highcharts.com/docs/chart-concepts/3d-charts).
513
- */
514
- chart3d: boolean | null | undefined;
515
-
516
- /**
517
- * Specifies the message displayed on a chart without displayable data.
518
- * @attr {string} empty-text
519
- */
520
- emptyText: string;
521
-
522
- /**
523
- * Represents additional JSON configuration.
524
- */
525
- additionalOptions: Options | null | undefined;
526
-
527
- /**
528
- * When present, cartesian charts like line, spline, area and column are transformed
529
- * into the polar coordinate system.
530
- */
531
- polar: boolean | null | undefined;
532
-
533
- /**
534
- * Update the chart configuration.
535
- * This JSON API provides a simple single-argument alternative to the configuration property.
536
- *
537
- * Styling properties specified in this configuration will be ignored. To learn about chart styling
538
- * please see the CSS Styling section above.
539
- *
540
- * @param {!Options} jsonConfiguration Object chart configuration. Most important properties are:
541
- *
542
- * - annotations `Object[]` custom labels or shapes that can be tied to points, axis coordinates or chart pixel coordinates.
543
- * Detailed API for annotations object is available in [API Site](http://api.highcharts.com/highcharts/annotations)
544
- * - chart `Object` with options regarding the chart area and plot area as well as general chart options.
545
- * Detailed API for chart object is available in [API Site](http://api.highcharts.com/highcharts/chart)
546
- * - credits `Object` with options regarding the chart area and plot area as well as general chart options.
547
- * Detailed API for credits object is available in [API Site](http://api.highcharts.com/highcharts/credits)
548
- * - plotOptions `Object` wrapper for config objects for each series type.
549
- * Detailed API for plotOptions object is available in [API Site](http://api.highcharts.com/highcharts/plotOptions)
550
- * - series `Object[]` the actual series to append to the chart.
551
- * Detailed API for series object is available in [API Site](http://api.highcharts.com/highcharts/series)
552
- * - subtitle `Object` the chart's subtitle.
553
- * Detailed API for subtitle object is available in [API Site](http://api.highcharts.com/highcharts/subtitle)
554
- * - title `Object` the chart's main title.
555
- * Detailed API for title object is available in [API Site](http://api.highcharts.com/highcharts/title)
556
- * - tooltip `Object` Options for the tooltip that appears when the user hovers over a series or point.
557
- * Detailed API for tooltip object is available in [API Site](http://api.highcharts.com/highcharts/tooltip)
558
- * - xAxis `Object[]` The X axis or category axis. Normally this is the horizontal axis.
559
- * Detailed API for xAxis object is available in [API Site](http://api.highcharts.com/highcharts/xAxis)
560
- * - yAxis `Object[]` The Y axis or value axis. Normally this is the vertical axis.
561
- * Detailed API for yAxis object is available in [API Site](http://api.highcharts.com/highcharts/yAxis)
562
- * - zAxis `Object[]` The Z axis or depth axis for 3D plots.
563
- * Detailed API for zAxis object is available in [API Site](http://api.highcharts.com/highcharts/zAxis)
564
- *
565
- * @param {boolean=} resetConfiguration Optional boolean that should be set to true if no other chart configuration was set before or
566
- * if existing configuration should be discarded.
567
- */
568
- updateConfiguration(jsonConfiguration: Options, resetConfiguration?: boolean): void;
569
-
174
+ declare class Chart extends ChartMixin(ThemableMixin(ElementMixin(HTMLElement))) {
570
175
  addEventListener<K extends keyof ChartEventMap>(
571
176
  type: K,
572
177
  listener: (this: Chart, ev: ChartEventMap[K]) => void,