@vaadin/charts 23.5.7 → 23.5.9
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/package.json +6 -6
- package/src/vaadin-chart-series.js +7 -7
- package/src/vaadin-chart.js +101 -60
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/charts",
|
|
3
|
-
"version": "23.5.
|
|
3
|
+
"version": "23.5.9",
|
|
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": "~23.5.
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "~23.5.
|
|
41
|
-
"@vaadin/vaadin-material-styles": "~23.5.
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "~23.5.
|
|
39
|
+
"@vaadin/component-base": "~23.5.9",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "~23.5.9",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "~23.5.9",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "~23.5.9",
|
|
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": "42b9cb7f53bf56753c61d7373c76081ba46bff38"
|
|
56
56
|
}
|
|
@@ -310,7 +310,7 @@ class ChartSeries extends PolymerElement {
|
|
|
310
310
|
|
|
311
311
|
/** @private */
|
|
312
312
|
__valueMinObserver(valueMin, series) {
|
|
313
|
-
if (valueMin === undefined || series
|
|
313
|
+
if (valueMin === undefined || series == null) {
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -319,7 +319,7 @@ class ChartSeries extends PolymerElement {
|
|
|
319
319
|
|
|
320
320
|
/** @private */
|
|
321
321
|
__valueMaxObserver(valueMax, series) {
|
|
322
|
-
if (valueMax === undefined || series
|
|
322
|
+
if (valueMax === undefined || series == null) {
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
325
|
|
|
@@ -335,7 +335,7 @@ class ChartSeries extends PolymerElement {
|
|
|
335
335
|
|
|
336
336
|
/** @private */
|
|
337
337
|
__titleObserver(title, series) {
|
|
338
|
-
if (title === undefined || series
|
|
338
|
+
if (title === undefined || series == null) {
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
341
|
series.update({ name: title });
|
|
@@ -343,7 +343,7 @@ class ChartSeries extends PolymerElement {
|
|
|
343
343
|
|
|
344
344
|
/** @private */
|
|
345
345
|
__stackObserver(stack, series) {
|
|
346
|
-
if (stack === undefined || series
|
|
346
|
+
if (stack === undefined || series == null) {
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
349
|
series.update({ stack });
|
|
@@ -351,7 +351,7 @@ class ChartSeries extends PolymerElement {
|
|
|
351
351
|
|
|
352
352
|
/** @private */
|
|
353
353
|
__neckPositionObserver(neckPosition, series) {
|
|
354
|
-
if (neckPosition === undefined || series
|
|
354
|
+
if (neckPosition === undefined || series == null) {
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
357
|
|
|
@@ -360,7 +360,7 @@ class ChartSeries extends PolymerElement {
|
|
|
360
360
|
|
|
361
361
|
/** @private */
|
|
362
362
|
__neckWidthObserver(neckWidth, series) {
|
|
363
|
-
if (neckWidth === undefined || series
|
|
363
|
+
if (neckWidth === undefined || series == null) {
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
366
|
|
|
@@ -404,7 +404,7 @@ class ChartSeries extends PolymerElement {
|
|
|
404
404
|
|
|
405
405
|
/** @private */
|
|
406
406
|
__markersObserver(markers, series) {
|
|
407
|
-
if (markers === undefined || series
|
|
407
|
+
if (markers === undefined || series == null) {
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
410
|
|
package/src/vaadin-chart.js
CHANGED
|
@@ -57,6 +57,16 @@ export function deepMerge(target, source) {
|
|
|
57
57
|
return target;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Convenience method for reading a value from a path.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} path
|
|
64
|
+
* @param {object} object
|
|
65
|
+
*/
|
|
66
|
+
function get(path, object) {
|
|
67
|
+
return path.split('.').reduce((obj, property) => (obj ? obj[property] : undefined), object);
|
|
68
|
+
}
|
|
69
|
+
|
|
60
70
|
['exportChart', 'exportChartLocal', 'getSVG'].forEach((methodName) => {
|
|
61
71
|
/* eslint-disable no-invalid-this, prefer-arrow-callback */
|
|
62
72
|
Highcharts.wrap(Highcharts.Chart.prototype, methodName, function (proceed, ...args) {
|
|
@@ -297,18 +307,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
297
307
|
return 'vaadin-chart';
|
|
298
308
|
}
|
|
299
309
|
|
|
300
|
-
/** @private */
|
|
301
|
-
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
302
|
-
const functionToCall = Highcharts[functionName];
|
|
303
|
-
if (functionToCall && typeof functionToCall === 'function') {
|
|
304
|
-
args.forEach((arg) => inflateFunctions(arg));
|
|
305
|
-
functionToCall.apply(this.configuration, args);
|
|
306
|
-
if (redrawCharts) {
|
|
307
|
-
Highcharts.charts.forEach((c) => c.redraw());
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
310
|
static get properties() {
|
|
313
311
|
return {
|
|
314
312
|
/**
|
|
@@ -506,6 +504,25 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
506
504
|
];
|
|
507
505
|
}
|
|
508
506
|
|
|
507
|
+
/** @private */
|
|
508
|
+
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
509
|
+
const functionToCall = Highcharts[functionName];
|
|
510
|
+
if (functionToCall && typeof functionToCall === 'function') {
|
|
511
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
512
|
+
functionToCall.apply(this.configuration, args);
|
|
513
|
+
if (redrawCharts) {
|
|
514
|
+
Highcharts.charts.forEach((c) => {
|
|
515
|
+
// Ignore `undefined` values that are preserved in the array
|
|
516
|
+
// after their corresponding chart instances are destroyed.
|
|
517
|
+
// See https://github.com/vaadin/flow-components/issues/6607
|
|
518
|
+
if (c !== undefined) {
|
|
519
|
+
c.redraw();
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
509
526
|
constructor() {
|
|
510
527
|
super();
|
|
511
528
|
|
|
@@ -537,33 +554,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
537
554
|
};
|
|
538
555
|
}
|
|
539
556
|
|
|
540
|
-
/** @protected */
|
|
541
|
-
connectedCallback() {
|
|
542
|
-
super.connectedCallback();
|
|
543
|
-
this.__updateStyles();
|
|
544
|
-
beforeNextRender(this, () => {
|
|
545
|
-
// Detect if the chart had already been initialized. This might happen in
|
|
546
|
-
// environments where the chart is lazily attached (e.g Grid).
|
|
547
|
-
if (this.configuration) {
|
|
548
|
-
this.__reflow();
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
const options = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
553
|
-
this._jsonConfigurationBuffer = null;
|
|
554
|
-
this.__initChart(options);
|
|
555
|
-
this.__addChildObserver();
|
|
556
|
-
this.__checkTurboMode();
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/** @protected */
|
|
561
|
-
ready() {
|
|
562
|
-
super.ready();
|
|
563
|
-
|
|
564
|
-
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
565
|
-
}
|
|
566
|
-
|
|
567
557
|
/**
|
|
568
558
|
* @return {!Options}
|
|
569
559
|
*/
|
|
@@ -946,6 +936,31 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
946
936
|
};
|
|
947
937
|
}
|
|
948
938
|
|
|
939
|
+
/** @protected */
|
|
940
|
+
connectedCallback() {
|
|
941
|
+
super.connectedCallback();
|
|
942
|
+
this.__updateStyles();
|
|
943
|
+
beforeNextRender(this, () => {
|
|
944
|
+
// Detect if the chart had already been initialized. This might happen in
|
|
945
|
+
// environments where the chart is lazily attached (e.g Grid).
|
|
946
|
+
if (this.configuration) {
|
|
947
|
+
this.__reflow();
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
this.__resetChart();
|
|
952
|
+
this.__addChildObserver();
|
|
953
|
+
this.__checkTurboMode();
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/** @protected */
|
|
958
|
+
ready() {
|
|
959
|
+
super.ready();
|
|
960
|
+
|
|
961
|
+
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
962
|
+
}
|
|
963
|
+
|
|
949
964
|
/**
|
|
950
965
|
* Implements resize callback from `ResizeMixin`
|
|
951
966
|
* to reflow when the chart element is resized.
|
|
@@ -1086,9 +1101,34 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1086
1101
|
/** @protected */
|
|
1087
1102
|
disconnectedCallback() {
|
|
1088
1103
|
super.disconnectedCallback();
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1104
|
+
|
|
1105
|
+
queueMicrotask(() => {
|
|
1106
|
+
if (this.isConnected) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
if (this.configuration) {
|
|
1111
|
+
this.configuration.destroy();
|
|
1112
|
+
this.configuration = undefined;
|
|
1113
|
+
|
|
1114
|
+
// Reset series objects to avoid errors while detached
|
|
1115
|
+
const seriesNodes = Array.from(this.childNodes).filter(this.__filterSeriesNodes);
|
|
1116
|
+
seriesNodes.forEach((series) => {
|
|
1117
|
+
series.setSeries(null);
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
if (this._childObserver) {
|
|
1122
|
+
this._childObserver.disconnect();
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/** @private */
|
|
1128
|
+
__resetChart() {
|
|
1129
|
+
const initialOptions = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
1130
|
+
this.__initChart(initialOptions);
|
|
1131
|
+
this._jsonConfigurationBuffer = null;
|
|
1092
1132
|
}
|
|
1093
1133
|
|
|
1094
1134
|
/**
|
|
@@ -1187,11 +1227,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1187
1227
|
}
|
|
1188
1228
|
|
|
1189
1229
|
if (resetConfiguration) {
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
this.__initChart(initialOptions);
|
|
1193
|
-
|
|
1194
|
-
this._jsonConfigurationBuffer = null;
|
|
1230
|
+
this.__resetChart();
|
|
1195
1231
|
return;
|
|
1196
1232
|
}
|
|
1197
1233
|
|
|
@@ -1400,6 +1436,11 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1400
1436
|
}, object);
|
|
1401
1437
|
}
|
|
1402
1438
|
|
|
1439
|
+
/** @private */
|
|
1440
|
+
__hasConfigurationBuffer(path) {
|
|
1441
|
+
return get(path, this._jsonConfigurationBuffer) !== undefined;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1403
1444
|
/** @private */
|
|
1404
1445
|
__updateOrAddCredits(credits) {
|
|
1405
1446
|
if (this.configuration.credits) {
|
|
@@ -1448,7 +1489,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1448
1489
|
|
|
1449
1490
|
/** @private */
|
|
1450
1491
|
__updateCategories(categories, config) {
|
|
1451
|
-
if (categories === undefined || !config) {
|
|
1492
|
+
if (categories === undefined || !config || this.__hasConfigurationBuffer('xAxis.categories')) {
|
|
1452
1493
|
return;
|
|
1453
1494
|
}
|
|
1454
1495
|
|
|
@@ -1457,7 +1498,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1457
1498
|
|
|
1458
1499
|
/** @private */
|
|
1459
1500
|
__updateCategoryMax(max, config) {
|
|
1460
|
-
if (max === undefined || !config) {
|
|
1501
|
+
if (max === undefined || !config || this.__hasConfigurationBuffer('xAxis.max')) {
|
|
1461
1502
|
return;
|
|
1462
1503
|
}
|
|
1463
1504
|
|
|
@@ -1471,7 +1512,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1471
1512
|
|
|
1472
1513
|
/** @private */
|
|
1473
1514
|
__updateCategoryMin(min, config) {
|
|
1474
|
-
if (min === undefined || !config) {
|
|
1515
|
+
if (min === undefined || !config || this.__hasConfigurationBuffer('xAxis.min')) {
|
|
1475
1516
|
return;
|
|
1476
1517
|
}
|
|
1477
1518
|
|
|
@@ -1506,7 +1547,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1506
1547
|
|
|
1507
1548
|
/** @private */
|
|
1508
1549
|
__updateCategoryPosition(categoryPosition, config) {
|
|
1509
|
-
if (categoryPosition === undefined || !config) {
|
|
1550
|
+
if (categoryPosition === undefined || !config || this.__hasConfigurationBuffer('chart.inverted')) {
|
|
1510
1551
|
return;
|
|
1511
1552
|
}
|
|
1512
1553
|
|
|
@@ -1532,7 +1573,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1532
1573
|
|
|
1533
1574
|
/** @private */
|
|
1534
1575
|
__hideLegend(noLegend, config) {
|
|
1535
|
-
if (noLegend === undefined || !config) {
|
|
1576
|
+
if (noLegend === undefined || !config || this.__hasConfigurationBuffer('legend')) {
|
|
1536
1577
|
return;
|
|
1537
1578
|
}
|
|
1538
1579
|
|
|
@@ -1545,7 +1586,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1545
1586
|
|
|
1546
1587
|
/** @private */
|
|
1547
1588
|
__updateTitle(title, config) {
|
|
1548
|
-
if (title === undefined || !config) {
|
|
1589
|
+
if (title === undefined || !config || this.__hasConfigurationBuffer('title')) {
|
|
1549
1590
|
return;
|
|
1550
1591
|
}
|
|
1551
1592
|
|
|
@@ -1556,7 +1597,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1556
1597
|
|
|
1557
1598
|
/** @private */
|
|
1558
1599
|
__tooltipObserver(tooltip, config) {
|
|
1559
|
-
if (tooltip === undefined || !config) {
|
|
1600
|
+
if (tooltip === undefined || !config || this.__hasConfigurationBuffer('tooltip')) {
|
|
1560
1601
|
return;
|
|
1561
1602
|
}
|
|
1562
1603
|
|
|
@@ -1565,7 +1606,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1565
1606
|
|
|
1566
1607
|
/** @private */
|
|
1567
1608
|
__updateType(type, config) {
|
|
1568
|
-
if (type === undefined || !config) {
|
|
1609
|
+
if (type === undefined || !config || this.__hasConfigurationBuffer('chart.type')) {
|
|
1569
1610
|
return;
|
|
1570
1611
|
}
|
|
1571
1612
|
|
|
@@ -1578,7 +1619,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1578
1619
|
|
|
1579
1620
|
/** @private */
|
|
1580
1621
|
__updateSubtitle(subtitle, config) {
|
|
1581
|
-
if (subtitle === undefined || !config) {
|
|
1622
|
+
if (subtitle === undefined || !config || this.__hasConfigurationBuffer('subtitle')) {
|
|
1582
1623
|
return;
|
|
1583
1624
|
}
|
|
1584
1625
|
|
|
@@ -1609,7 +1650,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1609
1650
|
|
|
1610
1651
|
/** @private */
|
|
1611
1652
|
__stackingObserver(stacking, config) {
|
|
1612
|
-
if (stacking === undefined || !config) {
|
|
1653
|
+
if (stacking === undefined || !config || this.__hasConfigurationBuffer('plotOptions.series.stacking')) {
|
|
1613
1654
|
return;
|
|
1614
1655
|
}
|
|
1615
1656
|
|
|
@@ -1627,7 +1668,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1627
1668
|
|
|
1628
1669
|
/** @private */
|
|
1629
1670
|
__chart3dObserver(chart3d, config) {
|
|
1630
|
-
if (chart3d === undefined || !config) {
|
|
1671
|
+
if (chart3d === undefined || !config || this.__hasConfigurationBuffer('chart.options3d')) {
|
|
1631
1672
|
return;
|
|
1632
1673
|
}
|
|
1633
1674
|
|
|
@@ -1654,7 +1695,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1654
1695
|
|
|
1655
1696
|
/** @private */
|
|
1656
1697
|
__polarObserver(polar, config) {
|
|
1657
|
-
if (polar === undefined || !config) {
|
|
1698
|
+
if (polar === undefined || !config || this.__hasConfigurationBuffer('chart.polar')) {
|
|
1658
1699
|
return;
|
|
1659
1700
|
}
|
|
1660
1701
|
|
|
@@ -1665,7 +1706,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1665
1706
|
|
|
1666
1707
|
/** @private */
|
|
1667
1708
|
__emptyTextObserver(emptyText, config) {
|
|
1668
|
-
if (emptyText === undefined || !config) {
|
|
1709
|
+
if (emptyText === undefined || !config || this.__hasConfigurationBuffer('lang.noData')) {
|
|
1669
1710
|
return;
|
|
1670
1711
|
}
|
|
1671
1712
|
|
package/web-types.json
CHANGED