@vaadin/charts 23.5.6 → 23.5.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "23.5.6",
3
+ "version": "23.5.8",
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.6",
40
- "@vaadin/vaadin-lumo-styles": "~23.5.6",
41
- "@vaadin/vaadin-material-styles": "~23.5.6",
42
- "@vaadin/vaadin-themable-mixin": "~23.5.6",
39
+ "@vaadin/component-base": "~23.5.8",
40
+ "@vaadin/vaadin-lumo-styles": "~23.5.8",
41
+ "@vaadin/vaadin-material-styles": "~23.5.8",
42
+ "@vaadin/vaadin-themable-mixin": "~23.5.8",
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": "8017ec1c49880fcea0819ef306c4fa3c711b0087"
55
+ "gitHead": "084fe61b2028ef2989c82623bff0255b2d62be55"
56
56
  }
@@ -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,11 +1101,24 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1086
1101
  /** @protected */
1087
1102
  disconnectedCallback() {
1088
1103
  super.disconnectedCallback();
1104
+
1105
+ if (this.configuration) {
1106
+ this.configuration.destroy();
1107
+ this.configuration = undefined;
1108
+ }
1109
+
1089
1110
  if (this._childObserver) {
1090
1111
  this._childObserver.disconnect();
1091
1112
  }
1092
1113
  }
1093
1114
 
1115
+ /** @private */
1116
+ __resetChart() {
1117
+ const initialOptions = { ...this.options, ...this._jsonConfigurationBuffer };
1118
+ this.__initChart(initialOptions);
1119
+ this._jsonConfigurationBuffer = null;
1120
+ }
1121
+
1094
1122
  /**
1095
1123
  * Search for axis with given `id`.
1096
1124
  *
@@ -1187,11 +1215,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1187
1215
  }
1188
1216
 
1189
1217
  if (resetConfiguration) {
1190
- const initialOptions = { ...this.options, ...this._jsonConfigurationBuffer };
1191
-
1192
- this.__initChart(initialOptions);
1193
-
1194
- this._jsonConfigurationBuffer = null;
1218
+ this.__resetChart();
1195
1219
  return;
1196
1220
  }
1197
1221
 
@@ -1400,6 +1424,11 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1400
1424
  }, object);
1401
1425
  }
1402
1426
 
1427
+ /** @private */
1428
+ __hasConfigurationBuffer(path) {
1429
+ return get(path, this._jsonConfigurationBuffer) !== undefined;
1430
+ }
1431
+
1403
1432
  /** @private */
1404
1433
  __updateOrAddCredits(credits) {
1405
1434
  if (this.configuration.credits) {
@@ -1448,7 +1477,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1448
1477
 
1449
1478
  /** @private */
1450
1479
  __updateCategories(categories, config) {
1451
- if (categories === undefined || !config) {
1480
+ if (categories === undefined || !config || this.__hasConfigurationBuffer('xAxis.categories')) {
1452
1481
  return;
1453
1482
  }
1454
1483
 
@@ -1457,7 +1486,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1457
1486
 
1458
1487
  /** @private */
1459
1488
  __updateCategoryMax(max, config) {
1460
- if (max === undefined || !config) {
1489
+ if (max === undefined || !config || this.__hasConfigurationBuffer('xAxis.max')) {
1461
1490
  return;
1462
1491
  }
1463
1492
 
@@ -1471,7 +1500,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1471
1500
 
1472
1501
  /** @private */
1473
1502
  __updateCategoryMin(min, config) {
1474
- if (min === undefined || !config) {
1503
+ if (min === undefined || !config || this.__hasConfigurationBuffer('xAxis.min')) {
1475
1504
  return;
1476
1505
  }
1477
1506
 
@@ -1506,7 +1535,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1506
1535
 
1507
1536
  /** @private */
1508
1537
  __updateCategoryPosition(categoryPosition, config) {
1509
- if (categoryPosition === undefined || !config) {
1538
+ if (categoryPosition === undefined || !config || this.__hasConfigurationBuffer('chart.inverted')) {
1510
1539
  return;
1511
1540
  }
1512
1541
 
@@ -1532,7 +1561,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1532
1561
 
1533
1562
  /** @private */
1534
1563
  __hideLegend(noLegend, config) {
1535
- if (noLegend === undefined || !config) {
1564
+ if (noLegend === undefined || !config || this.__hasConfigurationBuffer('legend')) {
1536
1565
  return;
1537
1566
  }
1538
1567
 
@@ -1545,7 +1574,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1545
1574
 
1546
1575
  /** @private */
1547
1576
  __updateTitle(title, config) {
1548
- if (title === undefined || !config) {
1577
+ if (title === undefined || !config || this.__hasConfigurationBuffer('title')) {
1549
1578
  return;
1550
1579
  }
1551
1580
 
@@ -1556,7 +1585,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1556
1585
 
1557
1586
  /** @private */
1558
1587
  __tooltipObserver(tooltip, config) {
1559
- if (tooltip === undefined || !config) {
1588
+ if (tooltip === undefined || !config || this.__hasConfigurationBuffer('tooltip')) {
1560
1589
  return;
1561
1590
  }
1562
1591
 
@@ -1565,7 +1594,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1565
1594
 
1566
1595
  /** @private */
1567
1596
  __updateType(type, config) {
1568
- if (type === undefined || !config) {
1597
+ if (type === undefined || !config || this.__hasConfigurationBuffer('chart.type')) {
1569
1598
  return;
1570
1599
  }
1571
1600
 
@@ -1578,7 +1607,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1578
1607
 
1579
1608
  /** @private */
1580
1609
  __updateSubtitle(subtitle, config) {
1581
- if (subtitle === undefined || !config) {
1610
+ if (subtitle === undefined || !config || this.__hasConfigurationBuffer('subtitle')) {
1582
1611
  return;
1583
1612
  }
1584
1613
 
@@ -1609,7 +1638,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1609
1638
 
1610
1639
  /** @private */
1611
1640
  __stackingObserver(stacking, config) {
1612
- if (stacking === undefined || !config) {
1641
+ if (stacking === undefined || !config || this.__hasConfigurationBuffer('plotOptions.series.stacking')) {
1613
1642
  return;
1614
1643
  }
1615
1644
 
@@ -1627,7 +1656,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1627
1656
 
1628
1657
  /** @private */
1629
1658
  __chart3dObserver(chart3d, config) {
1630
- if (chart3d === undefined || !config) {
1659
+ if (chart3d === undefined || !config || this.__hasConfigurationBuffer('chart.options3d')) {
1631
1660
  return;
1632
1661
  }
1633
1662
 
@@ -1654,7 +1683,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1654
1683
 
1655
1684
  /** @private */
1656
1685
  __polarObserver(polar, config) {
1657
- if (polar === undefined || !config) {
1686
+ if (polar === undefined || !config || this.__hasConfigurationBuffer('chart.polar')) {
1658
1687
  return;
1659
1688
  }
1660
1689
 
@@ -1665,7 +1694,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1665
1694
 
1666
1695
  /** @private */
1667
1696
  __emptyTextObserver(emptyText, config) {
1668
- if (emptyText === undefined || !config) {
1697
+ if (emptyText === undefined || !config || this.__hasConfigurationBuffer('lang.noData')) {
1669
1698
  return;
1670
1699
  }
1671
1700
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "23.5.6",
4
+ "version": "23.5.8",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "23.5.6",
4
+ "version": "23.5.8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {