@vaadin/charts 23.0.5 → 23.0.6

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/vaadin-chart.js +20 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "23.0.5",
3
+ "version": "23.0.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "^23.0.5",
37
+ "@vaadin/component-base": "^23.0.6",
38
38
  "@vaadin/vaadin-license-checker": "^2.1.0",
39
- "@vaadin/vaadin-themable-mixin": "^23.0.5",
39
+ "@vaadin/vaadin-themable-mixin": "^23.0.6",
40
40
  "highcharts": "9.2.2"
41
41
  },
42
42
  "devDependencies": {
@@ -44,5 +44,5 @@
44
44
  "@vaadin/testing-helpers": "^0.3.2",
45
45
  "sinon": "^9.2.4"
46
46
  },
47
- "gitHead": "4cd2b11eb053d36fba9f0a8128da4e63984753e2"
47
+ "gitHead": "82ca8522e24a63343fb28bcb4c686e55d25c8858"
48
48
  }
@@ -62,6 +62,10 @@ export function deepMerge(target, source) {
62
62
  /* eslint-enable no-invalid-this */
63
63
  });
64
64
 
65
+ // Init Highcharts global language defaults
66
+ // No data message should be empty by default
67
+ Highcharts.setOptions({ lang: { noData: '' } });
68
+
65
69
  /**
66
70
  * `<vaadin-chart>` is a Web Component for creating high quality charts.
67
71
  *
@@ -428,7 +432,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
428
432
  */
429
433
  emptyText: {
430
434
  type: String,
431
- value: ' ',
432
435
  reflectToAttribute: true
433
436
  },
434
437
 
@@ -1032,13 +1035,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1032
1035
  // Best effort to make chart display custom empty-text messages when series are removed.
1033
1036
  // This is needed because Highcharts currently doesn't react. A condition not catered for is
1034
1037
  // when all points are removed from all series without removing any series.
1035
- const isEmpty =
1036
- this.configuration.series.length === 0 ||
1037
- this.configuration.series.map((e) => e.data.length === 0).reduce((e1, e2) => e1 && e2, true);
1038
- if (isEmpty) {
1039
- this.configuration.hideNoData();
1040
- this.configuration.showNoData(this.emptyText);
1041
- }
1038
+ this.__updateNoDataElement(this.configuration);
1042
1039
  }
1043
1040
 
1044
1041
  /** @private */
@@ -1664,8 +1661,21 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1664
1661
  noData: emptyText
1665
1662
  }
1666
1663
  });
1667
- config.hideNoData();
1668
- config.showNoData(emptyText);
1664
+ this.__updateNoDataElement(config);
1665
+ }
1666
+
1667
+ /**
1668
+ * Force the no data text element to become visible if the chart has no data.
1669
+ * This is necessary in cases where Highcharts does not update the element
1670
+ * automatically, for example when setting the language config
1671
+ * @private
1672
+ */
1673
+ __updateNoDataElement(config) {
1674
+ const isEmpty = config.series.every((e) => e.data.length === 0);
1675
+ if (isEmpty) {
1676
+ config.hideNoData();
1677
+ config.showNoData(this.emptyText);
1678
+ }
1669
1679
  }
1670
1680
 
1671
1681
  /** @private */