@vaadin/charts 24.5.0-alpha9 → 24.5.0-rc1

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": "24.5.0-alpha9",
3
+ "version": "24.5.0-rc1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,14 +36,14 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "24.5.0-alpha9",
40
- "@vaadin/vaadin-lumo-styles": "24.5.0-alpha9",
41
- "@vaadin/vaadin-material-styles": "24.5.0-alpha9",
42
- "@vaadin/vaadin-themable-mixin": "24.5.0-alpha9",
39
+ "@vaadin/component-base": "24.5.0-rc1",
40
+ "@vaadin/vaadin-lumo-styles": "24.5.0-rc1",
41
+ "@vaadin/vaadin-material-styles": "24.5.0-rc1",
42
+ "@vaadin/vaadin-themable-mixin": "24.5.0-rc1",
43
43
  "highcharts": "9.2.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@vaadin/chai-plugins": "24.5.0-alpha9",
46
+ "@vaadin/chai-plugins": "24.5.0-rc1",
47
47
  "@vaadin/testing-helpers": "^1.0.0",
48
48
  "sinon": "^18.0.0"
49
49
  },
@@ -52,5 +52,5 @@
52
52
  "web-types.json",
53
53
  "web-types.lit.json"
54
54
  ],
55
- "gitHead": "804744762f3bec0a2247c4bbcbbb204dbcd78bc0"
55
+ "gitHead": "a8ae853ab69d7938cf507843784f1551a2eeb972"
56
56
  }
@@ -33,6 +33,7 @@ import Pointer from 'highcharts/es-modules/Core/Pointer.js';
33
33
  import Highcharts from 'highcharts/es-modules/masters/highstock.src.js';
34
34
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
35
35
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
36
+ import { get } from '@vaadin/component-base/src/path-utils.js';
36
37
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
37
38
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
38
39
  import { inflateFunctions } from './helpers.js';
@@ -488,7 +489,14 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
488
489
  args.forEach((arg) => inflateFunctions(arg));
489
490
  functionToCall.apply(this.configuration, args);
490
491
  if (redrawCharts) {
491
- Highcharts.charts.forEach((c) => c.redraw());
492
+ Highcharts.charts.forEach((c) => {
493
+ // Ignore `undefined` values that are preserved in the array
494
+ // after their corresponding chart instances are destroyed.
495
+ // See https://github.com/vaadin/flow-components/issues/6607
496
+ if (c !== undefined) {
497
+ c.redraw();
498
+ }
499
+ });
492
500
  }
493
501
  }
494
502
  }
@@ -916,9 +924,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
916
924
  return;
917
925
  }
918
926
 
919
- const options = { ...this.options, ...this._jsonConfigurationBuffer };
920
- this._jsonConfigurationBuffer = null;
921
- this.__initChart(options);
927
+ this.__resetChart();
922
928
  this.__addChildObserver();
923
929
  this.__checkTurboMode();
924
930
  });
@@ -1071,11 +1077,24 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1071
1077
  /** @protected */
1072
1078
  disconnectedCallback() {
1073
1079
  super.disconnectedCallback();
1080
+
1081
+ if (this.configuration) {
1082
+ this.configuration.destroy();
1083
+ this.configuration = undefined;
1084
+ }
1085
+
1074
1086
  if (this._childObserver) {
1075
1087
  this._childObserver.disconnect();
1076
1088
  }
1077
1089
  }
1078
1090
 
1091
+ /** @private */
1092
+ __resetChart() {
1093
+ const initialOptions = { ...this.options, ...this._jsonConfigurationBuffer };
1094
+ this.__initChart(initialOptions);
1095
+ this._jsonConfigurationBuffer = null;
1096
+ }
1097
+
1079
1098
  /**
1080
1099
  * Search for axis with given `id`.
1081
1100
  *
@@ -1172,11 +1191,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1172
1191
  }
1173
1192
 
1174
1193
  if (resetConfiguration) {
1175
- const initialOptions = { ...this.options, ...this._jsonConfigurationBuffer };
1176
-
1177
- this.__initChart(initialOptions);
1178
-
1179
- this._jsonConfigurationBuffer = null;
1194
+ this.__resetChart();
1180
1195
  return;
1181
1196
  }
1182
1197
 
@@ -1386,6 +1401,11 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1386
1401
  }, object);
1387
1402
  }
1388
1403
 
1404
+ /** @private */
1405
+ __hasConfigurationBuffer(path) {
1406
+ return get(path, this._jsonConfigurationBuffer) !== undefined;
1407
+ }
1408
+
1389
1409
  /** @private */
1390
1410
  __updateOrAddCredits(credits) {
1391
1411
  if (this.configuration.credits) {
@@ -1434,7 +1454,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1434
1454
 
1435
1455
  /** @private */
1436
1456
  __updateCategories(categories, config) {
1437
- if (categories === undefined || !config) {
1457
+ if (categories === undefined || !config || this.__hasConfigurationBuffer('xAxis.categories')) {
1438
1458
  return;
1439
1459
  }
1440
1460
 
@@ -1443,7 +1463,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1443
1463
 
1444
1464
  /** @private */
1445
1465
  __updateCategoryMax(max, config) {
1446
- if (max === undefined || !config) {
1466
+ if (max === undefined || !config || this.__hasConfigurationBuffer('xAxis.max')) {
1447
1467
  return;
1448
1468
  }
1449
1469
 
@@ -1457,7 +1477,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1457
1477
 
1458
1478
  /** @private */
1459
1479
  __updateCategoryMin(min, config) {
1460
- if (min === undefined || !config) {
1480
+ if (min === undefined || !config || this.__hasConfigurationBuffer('xAxis.min')) {
1461
1481
  return;
1462
1482
  }
1463
1483
 
@@ -1492,7 +1512,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1492
1512
 
1493
1513
  /** @private */
1494
1514
  __updateCategoryPosition(categoryPosition, config) {
1495
- if (categoryPosition === undefined || !config) {
1515
+ if (categoryPosition === undefined || !config || this.__hasConfigurationBuffer('chart.inverted')) {
1496
1516
  return;
1497
1517
  }
1498
1518
 
@@ -1518,7 +1538,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1518
1538
 
1519
1539
  /** @private */
1520
1540
  __hideLegend(noLegend, config) {
1521
- if (noLegend === undefined || !config) {
1541
+ if (noLegend === undefined || !config || this.__hasConfigurationBuffer('legend')) {
1522
1542
  return;
1523
1543
  }
1524
1544
 
@@ -1531,18 +1551,16 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1531
1551
 
1532
1552
  /** @private */
1533
1553
  __updateTitle(title, config) {
1534
- if (title === undefined || !config) {
1554
+ if (title === undefined || !config || this.__hasConfigurationBuffer('title')) {
1535
1555
  return;
1536
1556
  }
1537
1557
 
1538
- if (title && title.length > 0) {
1539
- config.title.update({ text: title });
1540
- }
1558
+ config.title.update({ text: title });
1541
1559
  }
1542
1560
 
1543
1561
  /** @private */
1544
1562
  __tooltipObserver(tooltip, config) {
1545
- if (tooltip === undefined || !config) {
1563
+ if (tooltip === undefined || !config || this.__hasConfigurationBuffer('tooltip')) {
1546
1564
  return;
1547
1565
  }
1548
1566
 
@@ -1551,29 +1569,25 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1551
1569
 
1552
1570
  /** @private */
1553
1571
  __updateType(type, config) {
1554
- if (type === undefined || !config) {
1572
+ if (type === undefined || !config || this.__hasConfigurationBuffer('chart.type')) {
1555
1573
  return;
1556
1574
  }
1557
1575
 
1558
- if (type && type.length > 0) {
1559
- config.update({
1560
- chart: { type },
1561
- });
1562
- }
1576
+ config.update({
1577
+ chart: { type: type || 'line' },
1578
+ });
1563
1579
  }
1564
1580
 
1565
1581
  /** @private */
1566
1582
  __updateSubtitle(subtitle, config) {
1567
- if (subtitle === undefined || !config) {
1583
+ if (subtitle === undefined || !config || this.__hasConfigurationBuffer('subtitle')) {
1568
1584
  return;
1569
1585
  }
1570
1586
 
1571
- if (subtitle && subtitle.length > 0) {
1572
- if (!config.subtitle) {
1573
- config.setSubtitle({ text: subtitle });
1574
- } else {
1575
- config.subtitle.update({ text: subtitle });
1576
- }
1587
+ if (!config.subtitle) {
1588
+ config.setSubtitle({ text: subtitle });
1589
+ } else {
1590
+ config.subtitle.update({ text: subtitle });
1577
1591
  }
1578
1592
  }
1579
1593
 
@@ -1595,7 +1609,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1595
1609
 
1596
1610
  /** @private */
1597
1611
  __stackingObserver(stacking, config) {
1598
- if (stacking === undefined || !config) {
1612
+ if (stacking === undefined || !config || this.__hasConfigurationBuffer('plotOptions.series.stacking')) {
1599
1613
  return;
1600
1614
  }
1601
1615
 
@@ -1613,7 +1627,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1613
1627
 
1614
1628
  /** @private */
1615
1629
  __chart3dObserver(chart3d, config) {
1616
- if (chart3d === undefined || !config) {
1630
+ if (chart3d === undefined || !config || this.__hasConfigurationBuffer('chart.options3d')) {
1617
1631
  return;
1618
1632
  }
1619
1633
 
@@ -1640,7 +1654,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1640
1654
 
1641
1655
  /** @private */
1642
1656
  __polarObserver(polar, config) {
1643
- if (polar === undefined || !config) {
1657
+ if (polar === undefined || !config || this.__hasConfigurationBuffer('chart.polar')) {
1644
1658
  return;
1645
1659
  }
1646
1660
 
@@ -1651,7 +1665,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1651
1665
 
1652
1666
  /** @private */
1653
1667
  __emptyTextObserver(emptyText, config) {
1654
- if (emptyText === undefined || !config) {
1668
+ if (emptyText === undefined || !config || this.__hasConfigurationBuffer('lang.noData')) {
1655
1669
  return;
1656
1670
  }
1657
1671
 
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": "24.5.0-alpha9",
4
+ "version": "24.5.0-rc1",
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": "24.5.0-alpha9",
4
+ "version": "24.5.0-rc1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {