@vaadin/charts 23.2.16 → 23.2.17
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/LICENSE +248 -1105
- package/README.md +2 -2
- package/package.json +8 -8
- package/src/vaadin-chart-series.d.ts +3 -8
- package/src/vaadin-chart-series.js +71 -76
- package/src/vaadin-chart.d.ts +20 -9
- package/src/vaadin-chart.js +78 -67
- package/theme/vaadin-chart-base-theme.js +2 -7
- package/web-types.json +229 -229
- package/web-types.lit.json +86 -86
- package/vaadin-chart-series.d.ts +0 -1
- package/vaadin-chart-series.js +0 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ A feature-rich interactive charting library providing multiple different chart t
|
|
|
24
24
|
</vaadin-chart>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/
|
|
27
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/charts/screenshot.png" width="530" alt="Screenshot of vaadin-chart">](https://vaadin.com/docs/latest/components/charts)
|
|
28
28
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
|
@@ -46,7 +46,7 @@ Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overvi
|
|
|
46
46
|
|
|
47
47
|
## License
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Commercial Vaadin Developer License 4.0 (CVDLv4). For license terms, see LICENSE.txt.
|
|
50
50
|
|
|
51
51
|
Vaadin collects usage statistics at development time to improve this product.
|
|
52
52
|
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/charts",
|
|
3
|
-
"version": "23.2.
|
|
3
|
+
"version": "23.2.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "vaadin-charts",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
|
+
"cvdlName": "vaadin-chart",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "https://github.com/vaadin/web-components.git",
|
|
@@ -36,21 +37,20 @@
|
|
|
36
37
|
],
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "~23.2.
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "~23.2.
|
|
41
|
-
"@vaadin/vaadin-material-styles": "~23.2.
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "~23.2.
|
|
40
|
+
"@vaadin/component-base": "~23.2.17",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "~23.2.17",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "~23.2.17",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "~23.2.17",
|
|
43
44
|
"highcharts": "9.2.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
47
|
-
"@vaadin/testing-helpers": "^0.
|
|
48
|
+
"@vaadin/testing-helpers": "^0.3.2",
|
|
48
49
|
"sinon": "^13.0.2"
|
|
49
50
|
},
|
|
50
|
-
"cvdlName": "vaadin-chart",
|
|
51
51
|
"web-types": [
|
|
52
52
|
"web-types.json",
|
|
53
53
|
"web-types.lit.json"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "60bf51d55e8b93a30536ebb4966248ba256c9b5d"
|
|
56
56
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
5
|
-
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
-
* license.
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
10
5
|
*/
|
|
11
6
|
import type { PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
|
|
12
7
|
|
|
@@ -131,7 +126,7 @@ declare class ChartSeries extends HTMLElement {
|
|
|
131
126
|
markers: ChartSeriesMarkers | null | undefined;
|
|
132
127
|
|
|
133
128
|
/**
|
|
134
|
-
* Used to connect the series to an axis; if multiple series have the same
|
|
129
|
+
* Used to connect the series to an axis; if multiple series have the same “unit”, they will share axis.
|
|
135
130
|
* Displayed as a title for the axis.
|
|
136
131
|
* If no unit is defined, then series will be connected to the first axis.
|
|
137
132
|
*/
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
5
|
-
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
-
* license.
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
10
5
|
*/
|
|
11
6
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
12
7
|
import { Chart, deepMerge } from './vaadin-chart.js';
|
|
@@ -61,6 +56,55 @@ class ChartSeries extends PolymerElement {
|
|
|
61
56
|
return 'vaadin-chart-series';
|
|
62
57
|
}
|
|
63
58
|
|
|
59
|
+
get options() {
|
|
60
|
+
const options = deepMerge({}, this.additionalOptions);
|
|
61
|
+
|
|
62
|
+
if (this.type) {
|
|
63
|
+
options.type = this.type;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.title) {
|
|
67
|
+
options.name = this.title;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (this.values) {
|
|
71
|
+
options.data = this.values;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (this.markers) {
|
|
75
|
+
if (!this.__isMarkersValid()) {
|
|
76
|
+
this.markers = 'auto';
|
|
77
|
+
}
|
|
78
|
+
options.marker = this.__markersConfiguration;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.unit) {
|
|
82
|
+
options.yAxis = this.unit;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.stack) {
|
|
86
|
+
options.stack = this.stack;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (isFinite(this.valueMin)) {
|
|
90
|
+
options.yAxisValueMin = this.valueMin;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (isFinite(this.valueMax)) {
|
|
94
|
+
options.yAxisValueMax = this.valueMax;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.neckWidth) {
|
|
98
|
+
options.neckWidth = this.neckWidth;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (this.neckPosition) {
|
|
102
|
+
options.neckHeight = this.neckPosition;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return options;
|
|
106
|
+
}
|
|
107
|
+
|
|
64
108
|
static get properties() {
|
|
65
109
|
return {
|
|
66
110
|
/**
|
|
@@ -137,7 +181,7 @@ class ChartSeries extends PolymerElement {
|
|
|
137
181
|
},
|
|
138
182
|
|
|
139
183
|
/**
|
|
140
|
-
* Used to connect the series to an axis; if multiple series have the same
|
|
184
|
+
* Used to connect the series to an axis; if multiple series have the same “unit”, they will share axis.
|
|
141
185
|
* Displayed as a title for the axis.
|
|
142
186
|
* If no unit is defined, then series will be connected to the first axis.
|
|
143
187
|
*/
|
|
@@ -225,74 +269,6 @@ class ChartSeries extends PolymerElement {
|
|
|
225
269
|
];
|
|
226
270
|
}
|
|
227
271
|
|
|
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
|
-
|
|
296
272
|
/**
|
|
297
273
|
* Method to attach a series object of type `Highcharts.Series`.
|
|
298
274
|
* @param {!Series} series Object of type `Highcharts.Series`
|
|
@@ -437,6 +413,25 @@ class ChartSeries extends PolymerElement {
|
|
|
437
413
|
});
|
|
438
414
|
}
|
|
439
415
|
|
|
416
|
+
/** @private */
|
|
417
|
+
get __markersConfiguration() {
|
|
418
|
+
const config = {};
|
|
419
|
+
switch (this.markers) {
|
|
420
|
+
case 'shown':
|
|
421
|
+
config.enabled = true;
|
|
422
|
+
break;
|
|
423
|
+
case 'hidden':
|
|
424
|
+
config.enabled = false;
|
|
425
|
+
break;
|
|
426
|
+
case 'auto':
|
|
427
|
+
default:
|
|
428
|
+
config.enabled = null;
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return config;
|
|
433
|
+
}
|
|
434
|
+
|
|
440
435
|
/** @private */
|
|
441
436
|
__showWarn(propertyName, acceptedValues) {
|
|
442
437
|
console.warn(`<vaadin-chart-series> Acceptable values for "${propertyName}" are ${acceptedValues}`);
|
package/src/vaadin-chart.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
5
|
-
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
-
* license.
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
10
5
|
*/
|
|
11
6
|
import type { Axis, Chart as HighchartsChart, ExtremesObject, Options, Point, Series } from 'highcharts';
|
|
12
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -364,6 +359,22 @@ export type ChartEventMap = ChartCustomEventMap & HTMLElementEventMap;
|
|
|
364
359
|
* 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).
|
|
365
360
|
* 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).
|
|
366
361
|
*
|
|
362
|
+
* Using as a base the project created with in Quick Start and an `additionalOptions` in order to make RTL adjustments:
|
|
363
|
+
*
|
|
364
|
+
* ```html
|
|
365
|
+
* <vaadin-chart title="۱- عنوان نمودار" subtitle="۲- عنوان فرعی نمودار"
|
|
366
|
+
* additional-options='{"title": {"useHTML": true}, "tooltip": {"useHTML": true}, "subtitle": {"useHTML": true},
|
|
367
|
+
* "legend": {"rtl": true}, "yAxis": [{"id": "۴- مقادیر", "title": {"text": "۴- مقادیر", "useHTML": true}}],
|
|
368
|
+
* "xAxis": {"reversed": true}}'>
|
|
369
|
+
* <vaadin-chart-series
|
|
370
|
+
* type= "column"
|
|
371
|
+
* title="۳- عنوان ردیف"
|
|
372
|
+
* unit="۴- مقادیر"
|
|
373
|
+
* values="[10,20,30]">
|
|
374
|
+
* </vaadin-chart-series>
|
|
375
|
+
* </vaadin-chart>
|
|
376
|
+
* ```
|
|
377
|
+
*
|
|
367
378
|
* ### Setting colors
|
|
368
379
|
*
|
|
369
380
|
* Although charts can be styled as described above, there is a simpler way for setting colors.
|
|
@@ -539,12 +550,12 @@ declare class Chart extends ResizeMixin(ThemableMixin(ElementMixin(HTMLElement))
|
|
|
539
550
|
*
|
|
540
551
|
* @param {!Options} jsonConfiguration Object chart configuration. Most important properties are:
|
|
541
552
|
*
|
|
542
|
-
* - annotations `Object[]` custom labels or shapes that can be tied to points, axis coordinates or chart pixel coordinates.
|
|
543
|
-
* Detailed API for annotations object is available in [API Site](http://api.highcharts.com/highcharts/annotations)
|
|
544
553
|
* - chart `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
545
554
|
* Detailed API for chart object is available in [API Site](http://api.highcharts.com/highcharts/chart)
|
|
546
555
|
* - credits `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
547
556
|
* Detailed API for credits object is available in [API Site](http://api.highcharts.com/highcharts/credits)
|
|
557
|
+
* - labels `Object[]` with HTML labels that can be positioned anywhere in the chart area
|
|
558
|
+
* Detailed API for labels object is available in [API Site](http://api.highcharts.com/highcharts/labels)
|
|
548
559
|
* - plotOptions `Object` wrapper for config objects for each series type.
|
|
549
560
|
* Detailed API for plotOptions object is available in [API Site](http://api.highcharts.com/highcharts/plotOptions)
|
|
550
561
|
* - series `Object[]` the actual series to append to the chart.
|
package/src/vaadin-chart.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
5
|
-
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
-
* license.
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
10
5
|
*/
|
|
11
6
|
import 'highcharts/es-modules/masters/highstock.src.js';
|
|
12
7
|
import 'highcharts/es-modules/masters/modules/accessibility.src.js';
|
|
13
|
-
import 'highcharts/es-modules/masters/modules/annotations.src.js';
|
|
14
8
|
import 'highcharts/es-modules/masters/highcharts-more.src.js';
|
|
15
9
|
import 'highcharts/es-modules/masters/highcharts-3d.src.js';
|
|
16
10
|
import 'highcharts/es-modules/masters/modules/data.src.js';
|
|
@@ -58,7 +52,7 @@ export function deepMerge(target, source) {
|
|
|
58
52
|
}
|
|
59
53
|
|
|
60
54
|
['exportChart', 'exportChartLocal', 'getSVG'].forEach((methodName) => {
|
|
61
|
-
/* eslint-disable
|
|
55
|
+
/* eslint-disable no-invalid-this, prefer-arrow-callback */
|
|
62
56
|
Highcharts.wrap(Highcharts.Chart.prototype, methodName, function (proceed, ...args) {
|
|
63
57
|
Highcharts.fireEvent(this, 'beforeExport');
|
|
64
58
|
const result = proceed.apply(this, args);
|
|
@@ -184,6 +178,22 @@ Highcharts.setOptions({ lang: { noData: '' } });
|
|
|
184
178
|
* 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).
|
|
185
179
|
* 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).
|
|
186
180
|
*
|
|
181
|
+
* Using as a base the project created with in Quick Start and an `additionalOptions` in order to make RTL adjustments:
|
|
182
|
+
*
|
|
183
|
+
* ```html
|
|
184
|
+
* <vaadin-chart title="۱- عنوان نمودار" subtitle="۲- عنوان فرعی نمودار"
|
|
185
|
+
* additional-options='{"title": {"useHTML": true}, "tooltip": {"useHTML": true}, "subtitle": {"useHTML": true},
|
|
186
|
+
* "legend": {"rtl": true}, "yAxis": [{"id": "۴- مقادیر", "title": {"text": "۴- مقادیر", "useHTML": true}}],
|
|
187
|
+
* "xAxis": {"reversed": true}}'>
|
|
188
|
+
* <vaadin-chart-series
|
|
189
|
+
* type= "column"
|
|
190
|
+
* title="۳- عنوان ردیف"
|
|
191
|
+
* unit="۴- مقادیر"
|
|
192
|
+
* values="[10,20,30]">
|
|
193
|
+
* </vaadin-chart-series>
|
|
194
|
+
* </vaadin-chart>
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
187
197
|
* ### Setting colors
|
|
188
198
|
*
|
|
189
199
|
* Although charts can be styled as described above, there is a simpler way for setting colors.
|
|
@@ -259,6 +269,18 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
259
269
|
return 'vaadin-chart';
|
|
260
270
|
}
|
|
261
271
|
|
|
272
|
+
/** @private */
|
|
273
|
+
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
274
|
+
const functionToCall = Highcharts[functionName];
|
|
275
|
+
if (functionToCall && typeof functionToCall === 'function') {
|
|
276
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
277
|
+
functionToCall.apply(this.configuration, args);
|
|
278
|
+
if (redrawCharts) {
|
|
279
|
+
Highcharts.charts.forEach((c) => c.redraw());
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
262
284
|
static get properties() {
|
|
263
285
|
return {
|
|
264
286
|
/**
|
|
@@ -456,23 +478,10 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
456
478
|
];
|
|
457
479
|
}
|
|
458
480
|
|
|
459
|
-
/** @private */
|
|
460
|
-
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
461
|
-
const functionToCall = Highcharts[functionName];
|
|
462
|
-
if (functionToCall && typeof functionToCall === 'function') {
|
|
463
|
-
args.forEach((arg) => inflateFunctions(arg));
|
|
464
|
-
functionToCall.apply(this.configuration, args);
|
|
465
|
-
if (redrawCharts) {
|
|
466
|
-
Highcharts.charts.forEach((c) => c.redraw());
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
481
|
constructor() {
|
|
472
482
|
super();
|
|
473
483
|
|
|
474
484
|
this._baseConfig = {
|
|
475
|
-
annotations: [],
|
|
476
485
|
chart: {
|
|
477
486
|
styledMode: true,
|
|
478
487
|
},
|
|
@@ -500,6 +509,33 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
500
509
|
};
|
|
501
510
|
}
|
|
502
511
|
|
|
512
|
+
/** @protected */
|
|
513
|
+
connectedCallback() {
|
|
514
|
+
super.connectedCallback();
|
|
515
|
+
this.__updateStyles();
|
|
516
|
+
beforeNextRender(this, () => {
|
|
517
|
+
// Detect if the chart had already been initialized. This might happen in
|
|
518
|
+
// environments where the chart is lazily attached (e.g Grid).
|
|
519
|
+
if (this.configuration) {
|
|
520
|
+
this.__reflow();
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const options = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
525
|
+
this._jsonConfigurationBuffer = null;
|
|
526
|
+
this.__initChart(options);
|
|
527
|
+
this.__addChildObserver();
|
|
528
|
+
this.__checkTurboMode();
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** @protected */
|
|
533
|
+
ready() {
|
|
534
|
+
super.ready();
|
|
535
|
+
|
|
536
|
+
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
537
|
+
}
|
|
538
|
+
|
|
503
539
|
/**
|
|
504
540
|
* @return {!Options}
|
|
505
541
|
*/
|
|
@@ -508,10 +544,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
508
544
|
deepMerge(options, this.additionalOptions);
|
|
509
545
|
|
|
510
546
|
if (this.type) {
|
|
547
|
+
options.chart = options.chart || {};
|
|
511
548
|
options.chart.type = this.type;
|
|
512
549
|
}
|
|
513
550
|
|
|
514
551
|
if (this.polar) {
|
|
552
|
+
options.chart = options.chart || {};
|
|
515
553
|
options.chart.polar = true;
|
|
516
554
|
}
|
|
517
555
|
|
|
@@ -536,6 +574,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
536
574
|
}
|
|
537
575
|
|
|
538
576
|
if (this.categories) {
|
|
577
|
+
options.xAxis = options.xAxis || {};
|
|
539
578
|
if (Array.isArray(options.xAxis)) {
|
|
540
579
|
// Set categories on first X axis
|
|
541
580
|
options.xAxis[0].categories = this.categories;
|
|
@@ -545,6 +584,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
545
584
|
}
|
|
546
585
|
|
|
547
586
|
if (isFinite(this.categoryMin)) {
|
|
587
|
+
options.xAxis = options.xAxis || {};
|
|
548
588
|
if (Array.isArray(options.xAxis)) {
|
|
549
589
|
// Set category-min on first X axis
|
|
550
590
|
options.xAxis[0].min = this.categoryMin;
|
|
@@ -554,6 +594,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
554
594
|
}
|
|
555
595
|
|
|
556
596
|
if (isFinite(this.categoryMax)) {
|
|
597
|
+
options.xAxis = options.xAxis || {};
|
|
557
598
|
if (Array.isArray(options.xAxis)) {
|
|
558
599
|
// Set category-max on first x axis
|
|
559
600
|
options.xAxis[0].max = this.categoryMax;
|
|
@@ -569,13 +610,13 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
569
610
|
}
|
|
570
611
|
|
|
571
612
|
if (this.emptyText) {
|
|
572
|
-
|
|
573
|
-
options.lang = {};
|
|
574
|
-
}
|
|
613
|
+
options.lang = options.lang || {};
|
|
575
614
|
options.lang.noData = this.emptyText;
|
|
576
615
|
}
|
|
577
616
|
|
|
578
617
|
if (this.categoryPosition) {
|
|
618
|
+
options.chart = options.chart || {};
|
|
619
|
+
|
|
579
620
|
options.chart.inverted = this.__shouldInvert();
|
|
580
621
|
|
|
581
622
|
if (Array.isArray(options.xAxis)) {
|
|
@@ -588,16 +629,14 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
588
629
|
}
|
|
589
630
|
|
|
590
631
|
if (this.stacking) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
if (!options.plotOptions.series) {
|
|
595
|
-
options.plotOptions.series = {};
|
|
596
|
-
}
|
|
632
|
+
options.plotOptions = options.plotOptions || {};
|
|
633
|
+
options.plotOptions.series = options.plotOptions.series || {};
|
|
597
634
|
options.plotOptions.series.stacking = this.stacking;
|
|
598
635
|
}
|
|
599
636
|
|
|
600
637
|
if (this.chart3d) {
|
|
638
|
+
options.chart = options.chart || {};
|
|
639
|
+
|
|
601
640
|
options.chart.options3d = { ...this._baseChart3d, ...options.chart.options3d };
|
|
602
641
|
}
|
|
603
642
|
|
|
@@ -879,33 +918,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
879
918
|
};
|
|
880
919
|
}
|
|
881
920
|
|
|
882
|
-
/** @protected */
|
|
883
|
-
connectedCallback() {
|
|
884
|
-
super.connectedCallback();
|
|
885
|
-
this.__updateStyles();
|
|
886
|
-
beforeNextRender(this, () => {
|
|
887
|
-
// Detect if the chart had already been initialized. This might happen in
|
|
888
|
-
// environments where the chart is lazily attached (e.g Grid).
|
|
889
|
-
if (this.configuration) {
|
|
890
|
-
this.__reflow();
|
|
891
|
-
return;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
const options = { ...this.options, ...this._jsonConfigurationBuffer };
|
|
895
|
-
this._jsonConfigurationBuffer = null;
|
|
896
|
-
this.__initChart(options);
|
|
897
|
-
this.__addChildObserver();
|
|
898
|
-
this.__checkTurboMode();
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
/** @protected */
|
|
903
|
-
ready() {
|
|
904
|
-
super.ready();
|
|
905
|
-
|
|
906
|
-
this.addEventListener('chart-redraw', this.__onRedraw.bind(this));
|
|
907
|
-
}
|
|
908
|
-
|
|
909
921
|
/**
|
|
910
922
|
* Implements resize callback from `ResizeMixin`
|
|
911
923
|
* to reflow when the chart element is resized.
|
|
@@ -1106,12 +1118,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1106
1118
|
*
|
|
1107
1119
|
* @param {!Options} jsonConfiguration Object chart configuration. Most important properties are:
|
|
1108
1120
|
*
|
|
1109
|
-
* - annotations `Object[]` custom labels or shapes that can be tied to points, axis coordinates or chart pixel coordinates.
|
|
1110
|
-
* Detailed API for annotations object is available in [API Site](http://api.highcharts.com/highcharts/annotations)
|
|
1111
1121
|
* - chart `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
1112
1122
|
* Detailed API for chart object is available in [API Site](http://api.highcharts.com/highcharts/chart)
|
|
1113
1123
|
* - credits `Object` with options regarding the chart area and plot area as well as general chart options.
|
|
1114
1124
|
* Detailed API for credits object is available in [API Site](http://api.highcharts.com/highcharts/credits)
|
|
1125
|
+
* - labels `Object[]` with HTML labels that can be positioned anywhere in the chart area
|
|
1126
|
+
* Detailed API for labels object is available in [API Site](http://api.highcharts.com/highcharts/labels)
|
|
1115
1127
|
* - plotOptions `Object` wrapper for config objects for each series type.
|
|
1116
1128
|
* Detailed API for plotOptions object is available in [API Site](http://api.highcharts.com/highcharts/plotOptions)
|
|
1117
1129
|
* - series `Object[]` the actual series to append to the chart.
|
|
@@ -1298,12 +1310,13 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1298
1310
|
if (!this.tempBodyStyle) {
|
|
1299
1311
|
let effectiveCss = '';
|
|
1300
1312
|
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1313
|
+
const shadowStyles = this.shadowRoot.querySelectorAll('style');
|
|
1314
|
+
for (let i = 0; i < shadowStyles.length; i++) {
|
|
1315
|
+
effectiveCss += shadowStyles[i].textContent;
|
|
1316
|
+
}
|
|
1304
1317
|
|
|
1305
1318
|
// Strip off host selectors that target individual instances
|
|
1306
|
-
effectiveCss = effectiveCss.replace(/:host\(.+?\)/
|
|
1319
|
+
effectiveCss = effectiveCss.replace(/:host\(.+?\)/g, (match) => {
|
|
1307
1320
|
const selector = match.substr(6, match.length - 7);
|
|
1308
1321
|
return this.matches(selector) ? '' : match;
|
|
1309
1322
|
});
|
|
@@ -1354,9 +1367,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1354
1367
|
|
|
1355
1368
|
path = path.split('.');
|
|
1356
1369
|
return path.reduce((obj, key) => {
|
|
1357
|
-
|
|
1358
|
-
obj[key] = {};
|
|
1359
|
-
}
|
|
1370
|
+
obj[key] = obj[key] || {};
|
|
1360
1371
|
return obj[key];
|
|
1361
1372
|
}, object);
|
|
1362
1373
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
5
|
-
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
-
* license.
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
10
5
|
*/
|
|
11
6
|
|
|
12
7
|
/**
|