@vaadin/charts 24.0.0-alpha1 → 24.0.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.
- 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 +7 -2
- package/src/vaadin-chart.js +64 -73
- 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-alpha10",
|
|
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-alpha10",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha10",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha10",
|
|
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": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
|
|
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';
|
package/src/vaadin-chart.js
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 'highcharts/es-modules/masters/highstock.src.js';
|
|
7
12
|
import 'highcharts/es-modules/masters/modules/accessibility.src.js';
|
|
@@ -27,6 +32,7 @@ import Highcharts from 'highcharts/es-modules/masters/highstock.src.js';
|
|
|
27
32
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
28
33
|
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
29
34
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
35
|
+
import { inflateFunctions } from './helpers.js';
|
|
30
36
|
import { ChartSeries } from './vaadin-chart-series.js';
|
|
31
37
|
|
|
32
38
|
/** @private */
|
|
@@ -268,17 +274,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
268
274
|
return 'vaadin-chart';
|
|
269
275
|
}
|
|
270
276
|
|
|
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
277
|
static get properties() {
|
|
283
278
|
return {
|
|
284
279
|
/**
|
|
@@ -476,6 +471,18 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
476
471
|
];
|
|
477
472
|
}
|
|
478
473
|
|
|
474
|
+
/** @private */
|
|
475
|
+
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
476
|
+
const functionToCall = Highcharts[functionName];
|
|
477
|
+
if (functionToCall && typeof functionToCall === 'function') {
|
|
478
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
479
|
+
functionToCall.apply(this.configuration, args);
|
|
480
|
+
if (redrawCharts) {
|
|
481
|
+
Highcharts.charts.forEach((c) => c.redraw());
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
479
486
|
constructor() {
|
|
480
487
|
super();
|
|
481
488
|
|
|
@@ -507,33 +514,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
507
514
|
};
|
|
508
515
|
}
|
|
509
516
|
|
|
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
517
|
/**
|
|
538
518
|
* @return {!Options}
|
|
539
519
|
*/
|
|
@@ -542,12 +522,10 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
542
522
|
deepMerge(options, this.additionalOptions);
|
|
543
523
|
|
|
544
524
|
if (this.type) {
|
|
545
|
-
options.chart = options.chart || {};
|
|
546
525
|
options.chart.type = this.type;
|
|
547
526
|
}
|
|
548
527
|
|
|
549
528
|
if (this.polar) {
|
|
550
|
-
options.chart = options.chart || {};
|
|
551
529
|
options.chart.polar = true;
|
|
552
530
|
}
|
|
553
531
|
|
|
@@ -572,7 +550,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
572
550
|
}
|
|
573
551
|
|
|
574
552
|
if (this.categories) {
|
|
575
|
-
options.xAxis = options.xAxis || {};
|
|
576
553
|
if (Array.isArray(options.xAxis)) {
|
|
577
554
|
// Set categories on first X axis
|
|
578
555
|
options.xAxis[0].categories = this.categories;
|
|
@@ -582,7 +559,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
582
559
|
}
|
|
583
560
|
|
|
584
561
|
if (isFinite(this.categoryMin)) {
|
|
585
|
-
options.xAxis = options.xAxis || {};
|
|
586
562
|
if (Array.isArray(options.xAxis)) {
|
|
587
563
|
// Set category-min on first X axis
|
|
588
564
|
options.xAxis[0].min = this.categoryMin;
|
|
@@ -592,7 +568,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
592
568
|
}
|
|
593
569
|
|
|
594
570
|
if (isFinite(this.categoryMax)) {
|
|
595
|
-
options.xAxis = options.xAxis || {};
|
|
596
571
|
if (Array.isArray(options.xAxis)) {
|
|
597
572
|
// Set category-max on first x axis
|
|
598
573
|
options.xAxis[0].max = this.categoryMax;
|
|
@@ -608,13 +583,13 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
608
583
|
}
|
|
609
584
|
|
|
610
585
|
if (this.emptyText) {
|
|
611
|
-
|
|
586
|
+
if (!options.lang) {
|
|
587
|
+
options.lang = {};
|
|
588
|
+
}
|
|
612
589
|
options.lang.noData = this.emptyText;
|
|
613
590
|
}
|
|
614
591
|
|
|
615
592
|
if (this.categoryPosition) {
|
|
616
|
-
options.chart = options.chart || {};
|
|
617
|
-
|
|
618
593
|
options.chart.inverted = this.__shouldInvert();
|
|
619
594
|
|
|
620
595
|
if (Array.isArray(options.xAxis)) {
|
|
@@ -627,14 +602,16 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
627
602
|
}
|
|
628
603
|
|
|
629
604
|
if (this.stacking) {
|
|
630
|
-
|
|
631
|
-
|
|
605
|
+
if (!options.plotOptions) {
|
|
606
|
+
options.plotOptions = {};
|
|
607
|
+
}
|
|
608
|
+
if (!options.plotOptions.series) {
|
|
609
|
+
options.plotOptions.series = {};
|
|
610
|
+
}
|
|
632
611
|
options.plotOptions.series.stacking = this.stacking;
|
|
633
612
|
}
|
|
634
613
|
|
|
635
614
|
if (this.chart3d) {
|
|
636
|
-
options.chart = options.chart || {};
|
|
637
|
-
|
|
638
615
|
options.chart.options3d = { ...this._baseChart3d, ...options.chart.options3d };
|
|
639
616
|
}
|
|
640
617
|
|
|
@@ -916,6 +893,33 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
916
893
|
};
|
|
917
894
|
}
|
|
918
895
|
|
|
896
|
+
/** @protected */
|
|
897
|
+
connectedCallback() {
|
|
898
|
+
super.connectedCallback();
|
|
899
|
+
this.__updateStyles();
|
|
900
|
+
beforeNextRender(this, () => {
|
|
901
|
+
// Detect if the chart had already been initialized. This might happen in
|
|
902
|
+
// environments where the chart is lazily attached (e.g Grid).
|
|
903
|
+
if (this.configuration) {
|
|
904
|
+
this.__reflow();
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
const options = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
909
|
+
this._jsonConfigurationBuffer = null;
|
|
910
|
+
this.__initChart(options);
|
|
911
|
+
this.__addChildObserver();
|
|
912
|
+
this.__checkTurboMode();
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/** @protected */
|
|
917
|
+
ready() {
|
|
918
|
+
super.ready();
|
|
919
|
+
|
|
920
|
+
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
921
|
+
}
|
|
922
|
+
|
|
919
923
|
/**
|
|
920
924
|
* Implements resize callback from `ResizeMixin`
|
|
921
925
|
* to reflow when the chart element is resized.
|
|
@@ -1148,7 +1152,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1148
1152
|
}
|
|
1149
1153
|
|
|
1150
1154
|
const configCopy = deepMerge({}, jsonConfiguration);
|
|
1151
|
-
|
|
1155
|
+
inflateFunctions(configCopy);
|
|
1152
1156
|
this._jsonConfigurationBuffer = this.__makeConfigurationBuffer(this._jsonConfigurationBuffer, configCopy);
|
|
1153
1157
|
|
|
1154
1158
|
beforeNextRender(this, () => {
|
|
@@ -1214,24 +1218,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1214
1218
|
delete configuration[entry];
|
|
1215
1219
|
}
|
|
1216
1220
|
|
|
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
1221
|
/** @private */
|
|
1236
1222
|
__initEventsListeners(configuration) {
|
|
1237
1223
|
this.__initChartEventsListeners(configuration);
|
|
@@ -1332,7 +1318,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1332
1318
|
}
|
|
1333
1319
|
|
|
1334
1320
|
// Strip off host selectors that target individual instances
|
|
1335
|
-
effectiveCss = effectiveCss.replace(/:host\(.+?\)/
|
|
1321
|
+
effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
|
|
1336
1322
|
const selector = match.substr(6, match.length - 7);
|
|
1337
1323
|
return this.matches(selector) ? '' : match;
|
|
1338
1324
|
});
|
|
@@ -1383,7 +1369,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1383
1369
|
|
|
1384
1370
|
path = path.split('.');
|
|
1385
1371
|
return path.reduce((obj, key) => {
|
|
1386
|
-
|
|
1372
|
+
if (!obj[key]) {
|
|
1373
|
+
obj[key] = {};
|
|
1374
|
+
}
|
|
1387
1375
|
return obj[key];
|
|
1388
1376
|
}, object);
|
|
1389
1377
|
}
|
|
@@ -1684,6 +1672,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1684
1672
|
if (this.configuration) {
|
|
1685
1673
|
const functionToCall = this.configuration[functionName];
|
|
1686
1674
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1675
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1687
1676
|
functionToCall.apply(this.configuration, args);
|
|
1688
1677
|
}
|
|
1689
1678
|
}
|
|
@@ -1695,6 +1684,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1695
1684
|
const series = this.configuration.series[seriesIndex];
|
|
1696
1685
|
const functionToCall = series[functionName];
|
|
1697
1686
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1687
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1698
1688
|
functionToCall.apply(series, args);
|
|
1699
1689
|
}
|
|
1700
1690
|
}
|
|
@@ -1731,6 +1721,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1731
1721
|
const axis = axes[axisIndex];
|
|
1732
1722
|
const functionToCall = axis[functionName];
|
|
1733
1723
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1724
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1734
1725
|
functionToCall.apply(axis, args);
|
|
1735
1726
|
}
|
|
1736
1727
|
}
|
|
@@ -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';
|