@vaadin/charts 24.0.0-alpha1 → 24.0.0-alpha11
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.
- package/LICENSE +1105 -248
- package/README.md +1 -1
- package/package.json +6 -6
- package/src/helpers.js +24 -0
- package/src/vaadin-chart-series.d.ts +7 -2
- package/src/vaadin-chart-series.js +75 -70
- package/src/vaadin-chart.d.ts +9 -4
- package/src/vaadin-chart.js +68 -75
- package/theme/vaadin-chart-base-theme.js +7 -2
- package/vaadin-chart-series.d.ts +1 -0
- package/vaadin-chart-series.js +1 -0
- package/web-types.json +228 -228
- package/web-types.lit.json +85 -85
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overvi
|
|
|
46
46
|
|
|
47
47
|
## License
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
This program is available under Vaadin Commercial License and Service Terms. For license terms, see LICENSE.
|
|
50
50
|
|
|
51
51
|
Vaadin collects usage statistics at development time to improve this product.
|
|
52
52
|
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/charts",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "24.0.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
41
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
39
|
+
"@vaadin/component-base": "24.0.0-alpha11",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha11",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha11",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha11",
|
|
43
43
|
"highcharts": "9.2.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"web-types.json",
|
|
53
53
|
"web-types.lit.json"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "641b3d96ceeb3e503a093682ebe686afdd8c3a68"
|
|
56
56
|
}
|
package/src/helpers.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function inflateFunctions(config) {
|
|
2
|
+
if (
|
|
3
|
+
// Check if param is a primitive/null/undefined value
|
|
4
|
+
!(config instanceof Object) ||
|
|
5
|
+
// Check if param is a plain object (not an array or HC object)
|
|
6
|
+
config.constructor !== Object
|
|
7
|
+
) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
Object.entries(config).forEach(([attr, targetProperty]) => {
|
|
11
|
+
if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
|
|
12
|
+
try {
|
|
13
|
+
// eslint-disable-next-line no-eval
|
|
14
|
+
config[attr.substr(4)] = eval(`(${targetProperty})`);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// eslint-disable-next-line no-eval
|
|
17
|
+
config[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
|
|
18
|
+
}
|
|
19
|
+
delete config[attr];
|
|
20
|
+
} else if (targetProperty instanceof Object) {
|
|
21
|
+
inflateFunctions(targetProperty);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2023 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import type { PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
|
|
7
12
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2023 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
12
|
import { Chart, deepMerge } from './vaadin-chart.js';
|
|
@@ -56,55 +61,6 @@ class ChartSeries extends PolymerElement {
|
|
|
56
61
|
return 'vaadin-chart-series';
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
get options() {
|
|
60
|
-
const options = deepMerge({}, this.additionalOptions);
|
|
61
|
-
|
|
62
|
-
if (this.type) {
|
|
63
|
-
options.type = this.type;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (this.title) {
|
|
67
|
-
options.name = this.title;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (this.values) {
|
|
71
|
-
options.data = this.values;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (this.markers) {
|
|
75
|
-
if (!this.__isMarkersValid()) {
|
|
76
|
-
this.markers = 'auto';
|
|
77
|
-
}
|
|
78
|
-
options.marker = this.__markersConfiguration;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (this.unit) {
|
|
82
|
-
options.yAxis = this.unit;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (this.stack) {
|
|
86
|
-
options.stack = this.stack;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (isFinite(this.valueMin)) {
|
|
90
|
-
options.yAxisValueMin = this.valueMin;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (isFinite(this.valueMax)) {
|
|
94
|
-
options.yAxisValueMax = this.valueMax;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (this.neckWidth) {
|
|
98
|
-
options.neckWidth = this.neckWidth;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (this.neckPosition) {
|
|
102
|
-
options.neckHeight = this.neckPosition;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return options;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
64
|
static get properties() {
|
|
109
65
|
return {
|
|
110
66
|
/**
|
|
@@ -269,6 +225,74 @@ class ChartSeries extends PolymerElement {
|
|
|
269
225
|
];
|
|
270
226
|
}
|
|
271
227
|
|
|
228
|
+
get options() {
|
|
229
|
+
const options = deepMerge({}, this.additionalOptions);
|
|
230
|
+
|
|
231
|
+
if (this.type) {
|
|
232
|
+
options.type = this.type;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (this.title) {
|
|
236
|
+
options.name = this.title;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (this.values) {
|
|
240
|
+
options.data = this.values;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (this.markers) {
|
|
244
|
+
if (!this.__isMarkersValid()) {
|
|
245
|
+
this.markers = 'auto';
|
|
246
|
+
}
|
|
247
|
+
options.marker = this.__markersConfiguration;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (this.unit) {
|
|
251
|
+
options.yAxis = this.unit;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (this.stack) {
|
|
255
|
+
options.stack = this.stack;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (isFinite(this.valueMin)) {
|
|
259
|
+
options.yAxisValueMin = this.valueMin;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (isFinite(this.valueMax)) {
|
|
263
|
+
options.yAxisValueMax = this.valueMax;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (this.neckWidth) {
|
|
267
|
+
options.neckWidth = this.neckWidth;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (this.neckPosition) {
|
|
271
|
+
options.neckHeight = this.neckPosition;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return options;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** @private */
|
|
278
|
+
get __markersConfiguration() {
|
|
279
|
+
const config = {};
|
|
280
|
+
switch (this.markers) {
|
|
281
|
+
case 'shown':
|
|
282
|
+
config.enabled = true;
|
|
283
|
+
break;
|
|
284
|
+
case 'hidden':
|
|
285
|
+
config.enabled = false;
|
|
286
|
+
break;
|
|
287
|
+
case 'auto':
|
|
288
|
+
default:
|
|
289
|
+
config.enabled = null;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return config;
|
|
294
|
+
}
|
|
295
|
+
|
|
272
296
|
/**
|
|
273
297
|
* Method to attach a series object of type `Highcharts.Series`.
|
|
274
298
|
* @param {!Series} series Object of type `Highcharts.Series`
|
|
@@ -413,25 +437,6 @@ class ChartSeries extends PolymerElement {
|
|
|
413
437
|
});
|
|
414
438
|
}
|
|
415
439
|
|
|
416
|
-
/** @private */
|
|
417
|
-
get __markersConfiguration() {
|
|
418
|
-
const config = {};
|
|
419
|
-
switch (this.markers) {
|
|
420
|
-
case 'shown':
|
|
421
|
-
config.enabled = true;
|
|
422
|
-
break;
|
|
423
|
-
case 'hidden':
|
|
424
|
-
config.enabled = false;
|
|
425
|
-
break;
|
|
426
|
-
case 'auto':
|
|
427
|
-
default:
|
|
428
|
-
config.enabled = null;
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
return config;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
440
|
/** @private */
|
|
436
441
|
__showWarn(propertyName, acceptedValues) {
|
|
437
442
|
console.warn(`<vaadin-chart-series> Acceptable values for "${propertyName}" are ${acceptedValues}`);
|
package/src/vaadin-chart.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2023 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import type { Axis, Chart as HighchartsChart, ExtremesObject, Options, Point, Series } from 'highcharts';
|
|
7
12
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -550,12 +555,12 @@ declare class Chart extends ResizeMixin(ThemableMixin(ElementMixin(HTMLElement))
|
|
|
550
555
|
*
|
|
551
556
|
* @param {!Options} jsonConfiguration Object chart configuration. Most important properties are:
|
|
552
557
|
*
|
|
558
|
+
* - annotations `Object[]` custom labels or shapes that can be tied to points, axis coordinates or chart pixel coordinates.
|
|
559
|
+
* Detailed API for annotations object is available in [API Site](http://api.highcharts.com/highcharts/annotations)
|
|
553
560
|
* - chart `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
554
561
|
* Detailed API for chart object is available in [API Site](http://api.highcharts.com/highcharts/chart)
|
|
555
562
|
* - credits `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
556
563
|
* Detailed API for credits object is available in [API Site](http://api.highcharts.com/highcharts/credits)
|
|
557
|
-
* - labels `Object[]` with HTML labels that can be positioned anywhere in the chart area
|
|
558
|
-
* Detailed API for labels object is available in [API Site](http://api.highcharts.com/highcharts/labels)
|
|
559
564
|
* - plotOptions `Object` wrapper for config objects for each series type.
|
|
560
565
|
* Detailed API for plotOptions object is available in [API Site](http://api.highcharts.com/highcharts/plotOptions)
|
|
561
566
|
* - series `Object[]` the actual series to append to the chart.
|
package/src/vaadin-chart.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2023 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import 'highcharts/es-modules/masters/highstock.src.js';
|
|
7
12
|
import 'highcharts/es-modules/masters/modules/accessibility.src.js';
|
|
13
|
+
import 'highcharts/es-modules/masters/modules/annotations.src.js';
|
|
8
14
|
import 'highcharts/es-modules/masters/highcharts-more.src.js';
|
|
9
15
|
import 'highcharts/es-modules/masters/highcharts-3d.src.js';
|
|
10
16
|
import 'highcharts/es-modules/masters/modules/data.src.js';
|
|
@@ -27,6 +33,7 @@ import Highcharts from 'highcharts/es-modules/masters/highstock.src.js';
|
|
|
27
33
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
28
34
|
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
29
35
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
36
|
+
import { inflateFunctions } from './helpers.js';
|
|
30
37
|
import { ChartSeries } from './vaadin-chart-series.js';
|
|
31
38
|
|
|
32
39
|
/** @private */
|
|
@@ -268,17 +275,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
268
275
|
return 'vaadin-chart';
|
|
269
276
|
}
|
|
270
277
|
|
|
271
|
-
/** @private */
|
|
272
|
-
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
273
|
-
const functionToCall = Highcharts[functionName];
|
|
274
|
-
if (functionToCall && typeof functionToCall === 'function') {
|
|
275
|
-
functionToCall.apply(this.configuration, args);
|
|
276
|
-
if (redrawCharts) {
|
|
277
|
-
Highcharts.charts.forEach((c) => c.redraw());
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
278
|
static get properties() {
|
|
283
279
|
return {
|
|
284
280
|
/**
|
|
@@ -476,10 +472,23 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
476
472
|
];
|
|
477
473
|
}
|
|
478
474
|
|
|
475
|
+
/** @private */
|
|
476
|
+
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
477
|
+
const functionToCall = Highcharts[functionName];
|
|
478
|
+
if (functionToCall && typeof functionToCall === 'function') {
|
|
479
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
480
|
+
functionToCall.apply(this.configuration, args);
|
|
481
|
+
if (redrawCharts) {
|
|
482
|
+
Highcharts.charts.forEach((c) => c.redraw());
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
479
487
|
constructor() {
|
|
480
488
|
super();
|
|
481
489
|
|
|
482
490
|
this._baseConfig = {
|
|
491
|
+
annotations: [],
|
|
483
492
|
chart: {
|
|
484
493
|
styledMode: true,
|
|
485
494
|
},
|
|
@@ -507,33 +516,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
507
516
|
};
|
|
508
517
|
}
|
|
509
518
|
|
|
510
|
-
/** @protected */
|
|
511
|
-
connectedCallback() {
|
|
512
|
-
super.connectedCallback();
|
|
513
|
-
this.__updateStyles();
|
|
514
|
-
beforeNextRender(this, () => {
|
|
515
|
-
// Detect if the chart had already been initialized. This might happen in
|
|
516
|
-
// environments where the chart is lazily attached (e.g Grid).
|
|
517
|
-
if (this.configuration) {
|
|
518
|
-
this.__reflow();
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
const options = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
523
|
-
this._jsonConfigurationBuffer = null;
|
|
524
|
-
this.__initChart(options);
|
|
525
|
-
this.__addChildObserver();
|
|
526
|
-
this.__checkTurboMode();
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/** @protected */
|
|
531
|
-
ready() {
|
|
532
|
-
super.ready();
|
|
533
|
-
|
|
534
|
-
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
535
|
-
}
|
|
536
|
-
|
|
537
519
|
/**
|
|
538
520
|
* @return {!Options}
|
|
539
521
|
*/
|
|
@@ -542,12 +524,10 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
542
524
|
deepMerge(options, this.additionalOptions);
|
|
543
525
|
|
|
544
526
|
if (this.type) {
|
|
545
|
-
options.chart = options.chart || {};
|
|
546
527
|
options.chart.type = this.type;
|
|
547
528
|
}
|
|
548
529
|
|
|
549
530
|
if (this.polar) {
|
|
550
|
-
options.chart = options.chart || {};
|
|
551
531
|
options.chart.polar = true;
|
|
552
532
|
}
|
|
553
533
|
|
|
@@ -572,7 +552,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
572
552
|
}
|
|
573
553
|
|
|
574
554
|
if (this.categories) {
|
|
575
|
-
options.xAxis = options.xAxis || {};
|
|
576
555
|
if (Array.isArray(options.xAxis)) {
|
|
577
556
|
// Set categories on first X axis
|
|
578
557
|
options.xAxis[0].categories = this.categories;
|
|
@@ -582,7 +561,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
582
561
|
}
|
|
583
562
|
|
|
584
563
|
if (isFinite(this.categoryMin)) {
|
|
585
|
-
options.xAxis = options.xAxis || {};
|
|
586
564
|
if (Array.isArray(options.xAxis)) {
|
|
587
565
|
// Set category-min on first X axis
|
|
588
566
|
options.xAxis[0].min = this.categoryMin;
|
|
@@ -592,7 +570,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
592
570
|
}
|
|
593
571
|
|
|
594
572
|
if (isFinite(this.categoryMax)) {
|
|
595
|
-
options.xAxis = options.xAxis || {};
|
|
596
573
|
if (Array.isArray(options.xAxis)) {
|
|
597
574
|
// Set category-max on first x axis
|
|
598
575
|
options.xAxis[0].max = this.categoryMax;
|
|
@@ -608,13 +585,13 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
608
585
|
}
|
|
609
586
|
|
|
610
587
|
if (this.emptyText) {
|
|
611
|
-
|
|
588
|
+
if (!options.lang) {
|
|
589
|
+
options.lang = {};
|
|
590
|
+
}
|
|
612
591
|
options.lang.noData = this.emptyText;
|
|
613
592
|
}
|
|
614
593
|
|
|
615
594
|
if (this.categoryPosition) {
|
|
616
|
-
options.chart = options.chart || {};
|
|
617
|
-
|
|
618
595
|
options.chart.inverted = this.__shouldInvert();
|
|
619
596
|
|
|
620
597
|
if (Array.isArray(options.xAxis)) {
|
|
@@ -627,14 +604,16 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
627
604
|
}
|
|
628
605
|
|
|
629
606
|
if (this.stacking) {
|
|
630
|
-
|
|
631
|
-
|
|
607
|
+
if (!options.plotOptions) {
|
|
608
|
+
options.plotOptions = {};
|
|
609
|
+
}
|
|
610
|
+
if (!options.plotOptions.series) {
|
|
611
|
+
options.plotOptions.series = {};
|
|
612
|
+
}
|
|
632
613
|
options.plotOptions.series.stacking = this.stacking;
|
|
633
614
|
}
|
|
634
615
|
|
|
635
616
|
if (this.chart3d) {
|
|
636
|
-
options.chart = options.chart || {};
|
|
637
|
-
|
|
638
617
|
options.chart.options3d = { ...this._baseChart3d, ...options.chart.options3d };
|
|
639
618
|
}
|
|
640
619
|
|
|
@@ -916,6 +895,33 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
916
895
|
};
|
|
917
896
|
}
|
|
918
897
|
|
|
898
|
+
/** @protected */
|
|
899
|
+
connectedCallback() {
|
|
900
|
+
super.connectedCallback();
|
|
901
|
+
this.__updateStyles();
|
|
902
|
+
beforeNextRender(this, () => {
|
|
903
|
+
// Detect if the chart had already been initialized. This might happen in
|
|
904
|
+
// environments where the chart is lazily attached (e.g Grid).
|
|
905
|
+
if (this.configuration) {
|
|
906
|
+
this.__reflow();
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const options = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
911
|
+
this._jsonConfigurationBuffer = null;
|
|
912
|
+
this.__initChart(options);
|
|
913
|
+
this.__addChildObserver();
|
|
914
|
+
this.__checkTurboMode();
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/** @protected */
|
|
919
|
+
ready() {
|
|
920
|
+
super.ready();
|
|
921
|
+
|
|
922
|
+
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
923
|
+
}
|
|
924
|
+
|
|
919
925
|
/**
|
|
920
926
|
* Implements resize callback from `ResizeMixin`
|
|
921
927
|
* to reflow when the chart element is resized.
|
|
@@ -1116,12 +1122,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1116
1122
|
*
|
|
1117
1123
|
* @param {!Options} jsonConfiguration Object chart configuration. Most important properties are:
|
|
1118
1124
|
*
|
|
1125
|
+
* - annotations `Object[]` custom labels or shapes that can be tied to points, axis coordinates or chart pixel coordinates.
|
|
1126
|
+
* Detailed API for annotations object is available in [API Site](http://api.highcharts.com/highcharts/annotations)
|
|
1119
1127
|
* - chart `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
1120
1128
|
* Detailed API for chart object is available in [API Site](http://api.highcharts.com/highcharts/chart)
|
|
1121
1129
|
* - credits `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
1122
1130
|
* Detailed API for credits object is available in [API Site](http://api.highcharts.com/highcharts/credits)
|
|
1123
|
-
* - labels `Object[]` with HTML labels that can be positioned anywhere in the chart area
|
|
1124
|
-
* Detailed API for labels object is available in [API Site](http://api.highcharts.com/highcharts/labels)
|
|
1125
1131
|
* - plotOptions `Object` wrapper for config objects for each series type.
|
|
1126
1132
|
* Detailed API for plotOptions object is available in [API Site](http://api.highcharts.com/highcharts/plotOptions)
|
|
1127
1133
|
* - series `Object[]` the actual series to append to the chart.
|
|
@@ -1148,7 +1154,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1148
1154
|
}
|
|
1149
1155
|
|
|
1150
1156
|
const configCopy = deepMerge({}, jsonConfiguration);
|
|
1151
|
-
|
|
1157
|
+
inflateFunctions(configCopy);
|
|
1152
1158
|
this._jsonConfigurationBuffer = this.__makeConfigurationBuffer(this._jsonConfigurationBuffer, configCopy);
|
|
1153
1159
|
|
|
1154
1160
|
beforeNextRender(this, () => {
|
|
@@ -1214,24 +1220,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1214
1220
|
delete configuration[entry];
|
|
1215
1221
|
}
|
|
1216
1222
|
|
|
1217
|
-
/** @private */
|
|
1218
|
-
__inflateFunctions(jsonConfiguration) {
|
|
1219
|
-
Object.entries(jsonConfiguration).forEach(([attr, targetProperty]) => {
|
|
1220
|
-
if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
|
|
1221
|
-
try {
|
|
1222
|
-
// eslint-disable-next-line no-eval
|
|
1223
|
-
jsonConfiguration[attr.substr(4)] = eval(`(${targetProperty})`);
|
|
1224
|
-
} catch (e) {
|
|
1225
|
-
// eslint-disable-next-line no-eval
|
|
1226
|
-
jsonConfiguration[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
|
|
1227
|
-
}
|
|
1228
|
-
delete jsonConfiguration[attr];
|
|
1229
|
-
} else if (targetProperty instanceof Object) {
|
|
1230
|
-
this.__inflateFunctions(targetProperty);
|
|
1231
|
-
}
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
1223
|
/** @private */
|
|
1236
1224
|
__initEventsListeners(configuration) {
|
|
1237
1225
|
this.__initChartEventsListeners(configuration);
|
|
@@ -1332,7 +1320,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1332
1320
|
}
|
|
1333
1321
|
|
|
1334
1322
|
// Strip off host selectors that target individual instances
|
|
1335
|
-
effectiveCss = effectiveCss.replace(/:host\(.+?\)/
|
|
1323
|
+
effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
|
|
1336
1324
|
const selector = match.substr(6, match.length - 7);
|
|
1337
1325
|
return this.matches(selector) ? '' : match;
|
|
1338
1326
|
});
|
|
@@ -1383,7 +1371,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1383
1371
|
|
|
1384
1372
|
path = path.split('.');
|
|
1385
1373
|
return path.reduce((obj, key) => {
|
|
1386
|
-
|
|
1374
|
+
if (!obj[key]) {
|
|
1375
|
+
obj[key] = {};
|
|
1376
|
+
}
|
|
1387
1377
|
return obj[key];
|
|
1388
1378
|
}, object);
|
|
1389
1379
|
}
|
|
@@ -1684,6 +1674,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1684
1674
|
if (this.configuration) {
|
|
1685
1675
|
const functionToCall = this.configuration[functionName];
|
|
1686
1676
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1677
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1687
1678
|
functionToCall.apply(this.configuration, args);
|
|
1688
1679
|
}
|
|
1689
1680
|
}
|
|
@@ -1695,6 +1686,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1695
1686
|
const series = this.configuration.series[seriesIndex];
|
|
1696
1687
|
const functionToCall = series[functionName];
|
|
1697
1688
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1689
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1698
1690
|
functionToCall.apply(series, args);
|
|
1699
1691
|
}
|
|
1700
1692
|
}
|
|
@@ -1731,6 +1723,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1731
1723
|
const axis = axes[axisIndex];
|
|
1732
1724
|
const functionToCall = axis[functionName];
|
|
1733
1725
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1726
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1734
1727
|
functionToCall.apply(axis, args);
|
|
1735
1728
|
}
|
|
1736
1729
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2023 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
|
|
7
12
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-chart-series.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-chart-series.js';
|