@vaadin/charts 23.3.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "23.3.3",
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": "~23.3.3",
40
- "@vaadin/vaadin-lumo-styles": "~23.3.3",
41
- "@vaadin/vaadin-material-styles": "~23.3.3",
42
- "@vaadin/vaadin-themable-mixin": "~23.3.3",
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": "1529ed623e053d28a3c1c66af55ebe402743ddd0"
55
+ "gitHead": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
56
56
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -61,55 +61,6 @@ class ChartSeries extends PolymerElement {
61
61
  return 'vaadin-chart-series';
62
62
  }
63
63
 
64
- get options() {
65
- const options = deepMerge({}, this.additionalOptions);
66
-
67
- if (this.type) {
68
- options.type = this.type;
69
- }
70
-
71
- if (this.title) {
72
- options.name = this.title;
73
- }
74
-
75
- if (this.values) {
76
- options.data = this.values;
77
- }
78
-
79
- if (this.markers) {
80
- if (!this.__isMarkersValid()) {
81
- this.markers = 'auto';
82
- }
83
- options.marker = this.__markersConfiguration;
84
- }
85
-
86
- if (this.unit) {
87
- options.yAxis = this.unit;
88
- }
89
-
90
- if (this.stack) {
91
- options.stack = this.stack;
92
- }
93
-
94
- if (isFinite(this.valueMin)) {
95
- options.yAxisValueMin = this.valueMin;
96
- }
97
-
98
- if (isFinite(this.valueMax)) {
99
- options.yAxisValueMax = this.valueMax;
100
- }
101
-
102
- if (this.neckWidth) {
103
- options.neckWidth = this.neckWidth;
104
- }
105
-
106
- if (this.neckPosition) {
107
- options.neckHeight = this.neckPosition;
108
- }
109
-
110
- return options;
111
- }
112
-
113
64
  static get properties() {
114
65
  return {
115
66
  /**
@@ -274,6 +225,74 @@ class ChartSeries extends PolymerElement {
274
225
  ];
275
226
  }
276
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
+
277
296
  /**
278
297
  * Method to attach a series object of type `Highcharts.Series`.
279
298
  * @param {!Series} series Object of type `Highcharts.Series`
@@ -418,25 +437,6 @@ class ChartSeries extends PolymerElement {
418
437
  });
419
438
  }
420
439
 
421
- /** @private */
422
- get __markersConfiguration() {
423
- const config = {};
424
- switch (this.markers) {
425
- case 'shown':
426
- config.enabled = true;
427
- break;
428
- case 'hidden':
429
- config.enabled = false;
430
- break;
431
- case 'auto':
432
- default:
433
- config.enabled = null;
434
- break;
435
- }
436
-
437
- return config;
438
- }
439
-
440
440
  /** @private */
441
441
  __showWarn(propertyName, acceptedValues) {
442
442
  console.warn(`<vaadin-chart-series> Acceptable values for "${propertyName}" are ${acceptedValues}`);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -274,18 +274,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
274
274
  return 'vaadin-chart';
275
275
  }
276
276
 
277
- /** @private */
278
- static __callHighchartsFunction(functionName, redrawCharts, ...args) {
279
- const functionToCall = Highcharts[functionName];
280
- if (functionToCall && typeof functionToCall === 'function') {
281
- args.forEach((arg) => inflateFunctions(arg));
282
- functionToCall.apply(this.configuration, args);
283
- if (redrawCharts) {
284
- Highcharts.charts.forEach((c) => c.redraw());
285
- }
286
- }
287
- }
288
-
289
277
  static get properties() {
290
278
  return {
291
279
  /**
@@ -483,6 +471,18 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
483
471
  ];
484
472
  }
485
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
+
486
486
  constructor() {
487
487
  super();
488
488
 
@@ -514,33 +514,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
514
514
  };
515
515
  }
516
516
 
517
- /** @protected */
518
- connectedCallback() {
519
- super.connectedCallback();
520
- this.__updateStyles();
521
- beforeNextRender(this, () => {
522
- // Detect if the chart had already been initialized. This might happen in
523
- // environments where the chart is lazily attached (e.g Grid).
524
- if (this.configuration) {
525
- this.__reflow();
526
- return;
527
- }
528
-
529
- const options = { ...this.options, ...this._jsonConfigurationBuffer };
530
- this._jsonConfigurationBuffer = null;
531
- this.__initChart(options);
532
- this.__addChildObserver();
533
- this.__checkTurboMode();
534
- });
535
- }
536
-
537
- /** @protected */
538
- ready() {
539
- super.ready();
540
-
541
- this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
542
- }
543
-
544
517
  /**
545
518
  * @return {!Options}
546
519
  */
@@ -549,12 +522,10 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
549
522
  deepMerge(options, this.additionalOptions);
550
523
 
551
524
  if (this.type) {
552
- options.chart = options.chart || {};
553
525
  options.chart.type = this.type;
554
526
  }
555
527
 
556
528
  if (this.polar) {
557
- options.chart = options.chart || {};
558
529
  options.chart.polar = true;
559
530
  }
560
531
 
@@ -579,7 +550,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
579
550
  }
580
551
 
581
552
  if (this.categories) {
582
- options.xAxis = options.xAxis || {};
583
553
  if (Array.isArray(options.xAxis)) {
584
554
  // Set categories on first X axis
585
555
  options.xAxis[0].categories = this.categories;
@@ -589,7 +559,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
589
559
  }
590
560
 
591
561
  if (isFinite(this.categoryMin)) {
592
- options.xAxis = options.xAxis || {};
593
562
  if (Array.isArray(options.xAxis)) {
594
563
  // Set category-min on first X axis
595
564
  options.xAxis[0].min = this.categoryMin;
@@ -599,7 +568,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
599
568
  }
600
569
 
601
570
  if (isFinite(this.categoryMax)) {
602
- options.xAxis = options.xAxis || {};
603
571
  if (Array.isArray(options.xAxis)) {
604
572
  // Set category-max on first x axis
605
573
  options.xAxis[0].max = this.categoryMax;
@@ -615,13 +583,13 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
615
583
  }
616
584
 
617
585
  if (this.emptyText) {
618
- options.lang = options.lang || {};
586
+ if (!options.lang) {
587
+ options.lang = {};
588
+ }
619
589
  options.lang.noData = this.emptyText;
620
590
  }
621
591
 
622
592
  if (this.categoryPosition) {
623
- options.chart = options.chart || {};
624
-
625
593
  options.chart.inverted = this.__shouldInvert();
626
594
 
627
595
  if (Array.isArray(options.xAxis)) {
@@ -634,14 +602,16 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
634
602
  }
635
603
 
636
604
  if (this.stacking) {
637
- options.plotOptions = options.plotOptions || {};
638
- options.plotOptions.series = options.plotOptions.series || {};
605
+ if (!options.plotOptions) {
606
+ options.plotOptions = {};
607
+ }
608
+ if (!options.plotOptions.series) {
609
+ options.plotOptions.series = {};
610
+ }
639
611
  options.plotOptions.series.stacking = this.stacking;
640
612
  }
641
613
 
642
614
  if (this.chart3d) {
643
- options.chart = options.chart || {};
644
-
645
615
  options.chart.options3d = { ...this._baseChart3d, ...options.chart.options3d };
646
616
  }
647
617
 
@@ -923,6 +893,33 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
923
893
  };
924
894
  }
925
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
+
926
923
  /**
927
924
  * Implements resize callback from `ResizeMixin`
928
925
  * to reflow when the chart element is resized.
@@ -1321,7 +1318,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1321
1318
  }
1322
1319
 
1323
1320
  // Strip off host selectors that target individual instances
1324
- effectiveCss = effectiveCss.replace(/:host\(.+?\)/g, (match) => {
1321
+ effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
1325
1322
  const selector = match.substr(6, match.length - 7);
1326
1323
  return this.matches(selector) ? '' : match;
1327
1324
  });
@@ -1372,7 +1369,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1372
1369
 
1373
1370
  path = path.split('.');
1374
1371
  return path.reduce((obj, key) => {
1375
- obj[key] = obj[key] || {};
1372
+ if (!obj[key]) {
1373
+ obj[key] = {};
1374
+ }
1376
1375
  return obj[key];
1377
1376
  }, object);
1378
1377
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
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.3.3",
4
+ "version": "24.0.0-alpha10",
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.3.3",
4
+ "version": "24.0.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {