@vaadin/charts 24.7.0-alpha6 → 24.7.0-alpha8
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 +11 -8
- package/src/helpers.js +20 -0
- package/src/vaadin-chart-mixin.d.ts +439 -0
- package/src/vaadin-chart-mixin.js +1698 -0
- package/src/vaadin-chart-series-mixin.d.ts +136 -0
- package/src/vaadin-chart-series-mixin.js +412 -0
- package/src/vaadin-chart-series.d.ts +3 -120
- package/src/vaadin-chart-series.js +3 -383
- package/src/vaadin-chart.d.ts +3 -423
- package/src/vaadin-chart.js +4 -1679
- package/src/vaadin-lit-chart-series.d.ts +11 -0
- package/src/vaadin-lit-chart-series.js +33 -0
- package/src/vaadin-lit-chart.d.ts +11 -0
- package/src/vaadin-lit-chart.js +61 -0
- package/theme/lumo/vaadin-lit-chart.d.ts +2 -0
- package/theme/lumo/vaadin-lit-chart.js +2 -0
- package/theme/material/vaadin-lit-chart.d.ts +2 -0
- package/theme/material/vaadin-lit-chart.js +2 -0
- package/vaadin-lit-chart-series.d.ts +1 -0
- package/vaadin-lit-chart-series.js +1 -0
- package/vaadin-lit-chart.d.ts +1 -0
- package/vaadin-lit-chart.js +2 -0
- package/web-types.json +228 -228
- package/web-types.lit.json +85 -85
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
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.
|
|
10
|
+
*/
|
|
11
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
12
|
+
import type { GanttPointOptionsObject, PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
|
|
13
|
+
|
|
14
|
+
export type ChartSeriesMarkers = 'auto' | 'hidden' | 'shown';
|
|
15
|
+
|
|
16
|
+
export interface ChartSeriesConfig {
|
|
17
|
+
data?: ChartSeriesValues;
|
|
18
|
+
marker?: { enabled: boolean | null };
|
|
19
|
+
name?: string;
|
|
20
|
+
neckWidth?: number | string;
|
|
21
|
+
neckHeight?: number | string;
|
|
22
|
+
stack?: number | string;
|
|
23
|
+
type?: string;
|
|
24
|
+
yAxis?: string;
|
|
25
|
+
yAxisValueMin?: number;
|
|
26
|
+
yAxisValueMax?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ChartSeriesOptions = ChartSeriesConfig & SeriesOptionsType;
|
|
30
|
+
|
|
31
|
+
export type ChartSeriesValues = Array<number[] | PointOptionsObject | GanttPointOptionsObject | number>;
|
|
32
|
+
|
|
33
|
+
export declare function ChartSeriesMixin<T extends Constructor<HTMLElement>>(
|
|
34
|
+
base: T,
|
|
35
|
+
): Constructor<ChartSeriesMixinClass> & T;
|
|
36
|
+
|
|
37
|
+
export declare class ChartSeriesMixinClass {
|
|
38
|
+
/**
|
|
39
|
+
* Object with the configured options defined and used to create a series.
|
|
40
|
+
*/
|
|
41
|
+
readonly options: ChartSeriesOptions;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* An array of data used by the series.
|
|
45
|
+
* Format depends on the chart type and can be:
|
|
46
|
+
* - An array of numerical values `[y0, y1, y2, y3,...]`
|
|
47
|
+
* - An array of arrays with 2 values (`x`, `y`) `[ [x0, y0], [x1, y1], [x2, y2], ... ]`
|
|
48
|
+
* - An array of objects, each one describing one point `[ {x: x0, y: y0, name: 'Point0', color: '#FF0000'}, {...}, ...]`
|
|
49
|
+
*
|
|
50
|
+
* See more in [API Site](https://api.highcharts.com/highcharts/series)
|
|
51
|
+
*
|
|
52
|
+
* Note that you should always use [Polymer API](https://www.polymer-project.org/2.0/docs/devguide/model-data#array-mutation)
|
|
53
|
+
* to mutate the values array in order to make the component aware of the
|
|
54
|
+
* change and be able to synchronize it.
|
|
55
|
+
*/
|
|
56
|
+
values: ChartSeriesValues | null;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Value-axis minimum-value.
|
|
60
|
+
* Sets the value to a series bound by 'unit' property.
|
|
61
|
+
* Otherwise sets the value to the first series.
|
|
62
|
+
* Undefined by default (determined from data).
|
|
63
|
+
* @attr {number} value-min
|
|
64
|
+
*/
|
|
65
|
+
valueMin: number | null | undefined;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Value-axis maximum-value.
|
|
69
|
+
* See the 'valueMin'
|
|
70
|
+
* @attr {number} value-max
|
|
71
|
+
*/
|
|
72
|
+
valueMax: number | null | undefined;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A string with the type of the series.
|
|
76
|
+
* Defaults to `'line'` in case no type is set for the chart.
|
|
77
|
+
* Note that `'bar'`, `'gauge'` and `'solidgauge'` should be set as default series type on `<vaadin-chart>`.
|
|
78
|
+
*/
|
|
79
|
+
type: string | null | undefined;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The name of the series as shown in the legend, tooltip etc.
|
|
83
|
+
*/
|
|
84
|
+
title: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Shows/hides data-point markers for line-like series.
|
|
88
|
+
* Acceptable input are:
|
|
89
|
+
* - `shown`: markers are always visible
|
|
90
|
+
* - `hidden`: markers are always hidden
|
|
91
|
+
* - `auto`: markers are visible for widespread data and hidden, when data is dense *(default)*
|
|
92
|
+
*/
|
|
93
|
+
markers: ChartSeriesMarkers | null | undefined;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Used to connect the series to an axis; if multiple series have the same `unit`, they will share axis.
|
|
97
|
+
* Displayed as a title for the axis.
|
|
98
|
+
* If no unit is defined, then series will be connected to the first axis.
|
|
99
|
+
*/
|
|
100
|
+
unit: string | null | undefined;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Used to group series in a different stacks.
|
|
104
|
+
* "stacking" property should be specified either for each series or in plotOptions.
|
|
105
|
+
* It is recommended to place series in a single stack, when they belong to the same yAxis.
|
|
106
|
+
*/
|
|
107
|
+
stack: number | string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The height of the neck, the lower part of the funnel.
|
|
111
|
+
* A number defines pixel width, a percentage string defines a percentage of the plot area height. Defaults to 30%.
|
|
112
|
+
* Note that this property only applies for "funnel" charts.
|
|
113
|
+
* @attr {number | string} neck-position
|
|
114
|
+
*/
|
|
115
|
+
neckPosition: number | string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The width of the neck, the lower part of the funnel.
|
|
119
|
+
* A number defines pixel width, a percentage string defines a percentage of the plot area width. Defaults to 30%.
|
|
120
|
+
* Note that this property only applies for "funnel" charts.
|
|
121
|
+
* @attr {number | string} neck-width
|
|
122
|
+
*/
|
|
123
|
+
neckWidth: number | string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Represents additional JSON configuration.
|
|
127
|
+
*/
|
|
128
|
+
additionalOptions: SeriesOptionsType | null | undefined;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Method to attach a series object of type `Highcharts.Series`.
|
|
132
|
+
*
|
|
133
|
+
* @param series Object of type `Highcharts.Series`
|
|
134
|
+
*/
|
|
135
|
+
setSeries(series: Series): void;
|
|
136
|
+
}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
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.
|
|
10
|
+
*/
|
|
11
|
+
import { deepMerge } from './helpers.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @polymerMixin
|
|
15
|
+
*/
|
|
16
|
+
export const ChartSeriesMixin = (superClass) =>
|
|
17
|
+
class extends superClass {
|
|
18
|
+
static get properties() {
|
|
19
|
+
return {
|
|
20
|
+
/**
|
|
21
|
+
* An array of data used by the series.
|
|
22
|
+
* Format depends on the chart type and can be:
|
|
23
|
+
* - An array of numerical values `[y0, y1, y2, y3,...]`
|
|
24
|
+
* - An array of arrays with 2 values (`x`, `y`) `[ [x0, y0], [x1, y1], [x2, y2], ... ]`
|
|
25
|
+
* - An array of objects, each one describing one point `[ {x: x0, y: y0, name: 'Point0', color: '#FF0000'}, {...}, ...]`
|
|
26
|
+
*
|
|
27
|
+
* See more in [API Site](https://api.highcharts.com/highcharts/series)
|
|
28
|
+
*
|
|
29
|
+
* Note that you should always use [Polymer API](https://www.polymer-project.org/2.0/docs/devguide/model-data#array-mutation)
|
|
30
|
+
* to mutate the values array in order to make the component aware of the
|
|
31
|
+
* change and be able to synchronize it.
|
|
32
|
+
* @type {ChartSeriesValues}
|
|
33
|
+
*/
|
|
34
|
+
values: {
|
|
35
|
+
type: Array,
|
|
36
|
+
value: () => [],
|
|
37
|
+
sync: true,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Value-axis minimum-value.
|
|
42
|
+
* Sets the value to a series bound by 'unit' property.
|
|
43
|
+
* Otherwise sets the value to the first series.
|
|
44
|
+
* Undefined by default (determined from data).
|
|
45
|
+
* @attr {number} value-min
|
|
46
|
+
*/
|
|
47
|
+
valueMin: {
|
|
48
|
+
type: Number,
|
|
49
|
+
reflectToAttribute: true,
|
|
50
|
+
sync: true,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Value-axis maximum-value.
|
|
55
|
+
* See the 'valueMin'
|
|
56
|
+
* @attr {number} value-max
|
|
57
|
+
*/
|
|
58
|
+
valueMax: {
|
|
59
|
+
type: Number,
|
|
60
|
+
reflectToAttribute: true,
|
|
61
|
+
sync: true,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A string with the type of the series.
|
|
66
|
+
* Defaults to `'line'` in case no type is set for the chart.
|
|
67
|
+
* Note that `'bar'`, `'gauge'` and `'solidgauge'` should be set as default series type on `<vaadin-chart>`.
|
|
68
|
+
*/
|
|
69
|
+
type: {
|
|
70
|
+
type: String,
|
|
71
|
+
reflectToAttribute: true,
|
|
72
|
+
sync: true,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The name of the series as shown in the legend, tooltip etc.
|
|
77
|
+
* @type {string}
|
|
78
|
+
*/
|
|
79
|
+
title: {
|
|
80
|
+
type: String,
|
|
81
|
+
reflectToAttribute: true,
|
|
82
|
+
sync: true,
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Shows/hides data-point markers for line-like series.
|
|
87
|
+
* Acceptable input are:
|
|
88
|
+
* - `shown`: markers are always visible
|
|
89
|
+
* - `hidden`: markers are always hidden
|
|
90
|
+
* - `auto`: markers are visible for widespread data and hidden, when data is dense *(default)*
|
|
91
|
+
* @type {ChartSeriesMarkers | undefined}
|
|
92
|
+
*/
|
|
93
|
+
markers: {
|
|
94
|
+
type: String,
|
|
95
|
+
reflectToAttribute: true,
|
|
96
|
+
sync: true,
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Used to connect the series to an axis; if multiple series have the same `unit`, they will share axis.
|
|
101
|
+
* Displayed as a title for the axis.
|
|
102
|
+
* If no unit is defined, then series will be connected to the first axis.
|
|
103
|
+
*/
|
|
104
|
+
unit: {
|
|
105
|
+
type: String,
|
|
106
|
+
reflectToAttribute: true,
|
|
107
|
+
sync: true,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Used to group series in a different stacks.
|
|
112
|
+
* "stacking" property should be specified either for each series or in plotOptions.
|
|
113
|
+
* It is recommended to place series in a single stack, when they belong to the same yAxis.
|
|
114
|
+
* @type {number | string}
|
|
115
|
+
*/
|
|
116
|
+
stack: {
|
|
117
|
+
type: String,
|
|
118
|
+
reflectToAttribute: true,
|
|
119
|
+
sync: true,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The height of the neck, the lower part of the funnel.
|
|
124
|
+
* A number defines pixel width, a percentage string defines a percentage of the plot area height. Defaults to 30%.
|
|
125
|
+
* Note that this property only applies for "funnel" charts.
|
|
126
|
+
* @attr {number | string} neck-position
|
|
127
|
+
* @type {number | string}
|
|
128
|
+
*/
|
|
129
|
+
neckPosition: {
|
|
130
|
+
type: String,
|
|
131
|
+
reflectToAttribute: true,
|
|
132
|
+
sync: true,
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The width of the neck, the lower part of the funnel.
|
|
137
|
+
* A number defines pixel width, a percentage string defines a percentage of the plot area width. Defaults to 30%.
|
|
138
|
+
* Note that this property only applies for "funnel" charts.
|
|
139
|
+
* @attr {number | string} neck-width
|
|
140
|
+
* @type {number | string}
|
|
141
|
+
*/
|
|
142
|
+
neckWidth: {
|
|
143
|
+
type: String,
|
|
144
|
+
reflectToAttribute: true,
|
|
145
|
+
sync: true,
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Object with the configured options defined and used to create a series.
|
|
150
|
+
* @type {!ChartSeriesOptions}
|
|
151
|
+
* @readonly
|
|
152
|
+
*/
|
|
153
|
+
options: {
|
|
154
|
+
type: Object,
|
|
155
|
+
sync: true,
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Represents additional JSON configuration.
|
|
160
|
+
* @type {SeriesOptionsType | undefined}
|
|
161
|
+
*/
|
|
162
|
+
additionalOptions: {
|
|
163
|
+
type: Object,
|
|
164
|
+
reflectToAttribute: true,
|
|
165
|
+
sync: true,
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @type {!Series | undefined}
|
|
170
|
+
* @protected
|
|
171
|
+
*/
|
|
172
|
+
_series: {
|
|
173
|
+
type: Object,
|
|
174
|
+
sync: true,
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static get observers() {
|
|
180
|
+
return [
|
|
181
|
+
'__additionalOptionsObserver(additionalOptions, _series)',
|
|
182
|
+
'__markersObserver(markers, _series)',
|
|
183
|
+
'__neckPositionObserver(neckPosition, _series)',
|
|
184
|
+
'__neckWidthObserver(neckWidth, _series)',
|
|
185
|
+
'__stackObserver(stack, _series)',
|
|
186
|
+
'__titleObserver(title, _series)',
|
|
187
|
+
'__typeObserver(type, _series)',
|
|
188
|
+
'__unitObserver(unit, valueMin, valueMax, _series)',
|
|
189
|
+
'__valueMinObserver(valueMin, _series)',
|
|
190
|
+
'__valueMaxObserver(valueMax, _series)',
|
|
191
|
+
'__valuesObserver(values, _series)',
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
get options() {
|
|
196
|
+
const options = deepMerge({}, this.additionalOptions);
|
|
197
|
+
|
|
198
|
+
if (this.type) {
|
|
199
|
+
options.type = this.type;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (this.title) {
|
|
203
|
+
options.name = this.title;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (this.values) {
|
|
207
|
+
options.data = this.values;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (this.markers) {
|
|
211
|
+
if (!this.__isMarkersValid()) {
|
|
212
|
+
this.markers = 'auto';
|
|
213
|
+
}
|
|
214
|
+
options.marker = this.__markersConfiguration;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (this.unit) {
|
|
218
|
+
options.yAxis = this.unit;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (this.stack) {
|
|
222
|
+
options.stack = this.stack;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (isFinite(this.valueMin)) {
|
|
226
|
+
options.yAxisValueMin = this.valueMin;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (isFinite(this.valueMax)) {
|
|
230
|
+
options.yAxisValueMax = this.valueMax;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (this.neckWidth) {
|
|
234
|
+
options.neckWidth = this.neckWidth;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (this.neckPosition) {
|
|
238
|
+
options.neckHeight = this.neckPosition;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return options;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** @private */
|
|
245
|
+
get __markersConfiguration() {
|
|
246
|
+
const config = {};
|
|
247
|
+
switch (this.markers) {
|
|
248
|
+
case 'shown':
|
|
249
|
+
config.enabled = true;
|
|
250
|
+
break;
|
|
251
|
+
case 'hidden':
|
|
252
|
+
config.enabled = false;
|
|
253
|
+
break;
|
|
254
|
+
case 'auto':
|
|
255
|
+
default:
|
|
256
|
+
config.enabled = null;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return config;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Method to attach a series object of type `Highcharts.Series`.
|
|
265
|
+
* @param {!Series} series Object of type `Highcharts.Series`
|
|
266
|
+
*/
|
|
267
|
+
setSeries(series) {
|
|
268
|
+
this._series = series;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** @private */
|
|
272
|
+
__valuesObserver(values, series) {
|
|
273
|
+
if (series) {
|
|
274
|
+
series.setData(values);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** @private */
|
|
279
|
+
__additionalOptionsObserver(additionalOptions, series) {
|
|
280
|
+
if (series && additionalOptions) {
|
|
281
|
+
series.update(additionalOptions);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** @private */
|
|
286
|
+
__updateAxis(series, value, key) {
|
|
287
|
+
if (!isFinite(value)) {
|
|
288
|
+
this.__showWarn(`value-${key}`, 'Numbers or null');
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (series && series.yAxis) {
|
|
293
|
+
series.yAxis.update({ [key]: value });
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** @private */
|
|
298
|
+
__valueMinObserver(valueMin, series) {
|
|
299
|
+
if (valueMin === undefined || series == null) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
this.__updateAxis(series, valueMin, 'min');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** @private */
|
|
307
|
+
__valueMaxObserver(valueMax, series) {
|
|
308
|
+
if (valueMax === undefined || series == null) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
this.__updateAxis(series, valueMax, 'max');
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** @private */
|
|
316
|
+
__typeObserver(type, series) {
|
|
317
|
+
if (type && series) {
|
|
318
|
+
series.update({ type });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** @private */
|
|
323
|
+
__titleObserver(title, series) {
|
|
324
|
+
if (title === undefined || series == null) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
series.update({ name: title });
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** @private */
|
|
331
|
+
__stackObserver(stack, series) {
|
|
332
|
+
if (stack === undefined || series == null) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
series.update({ stack });
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** @private */
|
|
339
|
+
__neckPositionObserver(neckPosition, series) {
|
|
340
|
+
if (neckPosition === undefined || series == null) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
series.update({ neckHeight: neckPosition });
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** @private */
|
|
348
|
+
__neckWidthObserver(neckWidth, series) {
|
|
349
|
+
if (neckWidth === undefined || series == null) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
series.update({ neckWidth });
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** @private */
|
|
357
|
+
__unitObserver(unit, valueMin, valueMax, series) {
|
|
358
|
+
if (series && unit !== this.__oldUnit) {
|
|
359
|
+
const Chart = customElements.get('vaadin-chart');
|
|
360
|
+
this.__oldUnit = unit;
|
|
361
|
+
|
|
362
|
+
const parent = this.parentNode instanceof Chart && this.parentNode;
|
|
363
|
+
if (parent && parent instanceof Chart) {
|
|
364
|
+
if (unit && !parent.__getAxis(unit)) {
|
|
365
|
+
const title = { title: { text: unit } };
|
|
366
|
+
parent.__addAxis({ id: unit, axisGenerated: true, ...title });
|
|
367
|
+
}
|
|
368
|
+
series.update({ yAxis: unit || 0 });
|
|
369
|
+
|
|
370
|
+
if (valueMin !== undefined) {
|
|
371
|
+
this.__updateAxis(series, valueMin, 'min');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (valueMax !== undefined) {
|
|
375
|
+
this.__updateAxis(series, valueMax, 'max');
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
parent.__removeAxisIfEmpty();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** @private */
|
|
384
|
+
__isMarkersValid() {
|
|
385
|
+
if (['shown', 'hidden', 'auto'].indexOf(this.markers) === -1) {
|
|
386
|
+
this.__showWarn('markers', '"shown", "hidden" or "auto"');
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** @private */
|
|
393
|
+
__markersObserver(markers, series) {
|
|
394
|
+
if (markers === undefined || series == null) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (!this.__isMarkersValid()) {
|
|
399
|
+
this.markers = 'auto';
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
series.update({
|
|
404
|
+
marker: this.__markersConfiguration,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** @private */
|
|
409
|
+
__showWarn(propertyName, acceptedValues) {
|
|
410
|
+
console.warn(`<vaadin-chart-series> Acceptable values for "${propertyName}" are ${acceptedValues}`);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
@@ -8,26 +8,8 @@
|
|
|
8
8
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
9
|
* license.
|
|
10
10
|
*/
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
export type ChartSeriesMarkers = 'auto' | 'hidden' | 'shown';
|
|
14
|
-
|
|
15
|
-
export interface ChartSeriesConfig {
|
|
16
|
-
data?: ChartSeriesValues;
|
|
17
|
-
marker?: { enabled: boolean | null };
|
|
18
|
-
name?: string;
|
|
19
|
-
neckWidth?: number | string;
|
|
20
|
-
neckHeight?: number | string;
|
|
21
|
-
stack?: number | string;
|
|
22
|
-
type?: string;
|
|
23
|
-
yAxis?: string;
|
|
24
|
-
yAxisValueMin?: number;
|
|
25
|
-
yAxisValueMax?: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type ChartSeriesOptions = ChartSeriesConfig & SeriesOptionsType;
|
|
29
|
-
|
|
30
|
-
export type ChartSeriesValues = Array<number[] | PointOptionsObject | GanttPointOptionsObject | number>;
|
|
11
|
+
import { ChartSeriesMixin } from './vaadin-chart-series-mixin.js';
|
|
12
|
+
export * from './vaadin-chart-series-mixin.js';
|
|
31
13
|
|
|
32
14
|
/**
|
|
33
15
|
* `<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.
|
|
@@ -72,106 +54,7 @@ export type ChartSeriesValues = Array<number[] | PointOptionsObject | GanttPoint
|
|
|
72
54
|
* chart.removeChild(seriesToBeRemoved);
|
|
73
55
|
* ```
|
|
74
56
|
*/
|
|
75
|
-
declare class ChartSeries extends HTMLElement {
|
|
76
|
-
/**
|
|
77
|
-
* Object with the configured options defined and used to create a series.
|
|
78
|
-
*/
|
|
79
|
-
readonly options: ChartSeriesOptions;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* An array of data used by the series.
|
|
83
|
-
* Format depends on the chart type and can be:
|
|
84
|
-
* - An array of numerical values `[y0, y1, y2, y3,...]`
|
|
85
|
-
* - An array of arrays with 2 values (`x`, `y`) `[ [x0, y0], [x1, y1], [x2, y2], ... ]`
|
|
86
|
-
* - An array of objects, each one describing one point `[ {x: x0, y: y0, name: 'Point0', color: '#FF0000'}, {...}, ...]`
|
|
87
|
-
*
|
|
88
|
-
* See more in [API Site](https://api.highcharts.com/highcharts/series)
|
|
89
|
-
*
|
|
90
|
-
* Note that you should always use [Polymer API](https://www.polymer-project.org/2.0/docs/devguide/model-data#array-mutation)
|
|
91
|
-
* to mutate the values array in order to make the component aware of the
|
|
92
|
-
* change and be able to synchronize it.
|
|
93
|
-
*/
|
|
94
|
-
values: ChartSeriesValues | null;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Value-axis minimum-value.
|
|
98
|
-
* Sets the value to a series bound by 'unit' property.
|
|
99
|
-
* Otherwise sets the value to the first series.
|
|
100
|
-
* Undefined by default (determined from data).
|
|
101
|
-
* @attr {number} value-min
|
|
102
|
-
*/
|
|
103
|
-
valueMin: number | null | undefined;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Value-axis maximum-value.
|
|
107
|
-
* See the 'valueMin'
|
|
108
|
-
* @attr {number} value-max
|
|
109
|
-
*/
|
|
110
|
-
valueMax: number | null | undefined;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* A string with the type of the series.
|
|
114
|
-
* Defaults to `'line'` in case no type is set for the chart.
|
|
115
|
-
* Note that `'bar'`, `'gauge'` and `'solidgauge'` should be set as default series type on `<vaadin-chart>`.
|
|
116
|
-
*/
|
|
117
|
-
type: string | null | undefined;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* The name of the series as shown in the legend, tooltip etc.
|
|
121
|
-
*/
|
|
122
|
-
title: string;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Shows/hides data-point markers for line-like series.
|
|
126
|
-
* Acceptable input are:
|
|
127
|
-
* - `shown`: markers are always visible
|
|
128
|
-
* - `hidden`: markers are always hidden
|
|
129
|
-
* - `auto`: markers are visible for widespread data and hidden, when data is dense *(default)*
|
|
130
|
-
*/
|
|
131
|
-
markers: ChartSeriesMarkers | null | undefined;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Used to connect the series to an axis; if multiple series have the same `unit`, they will share axis.
|
|
135
|
-
* Displayed as a title for the axis.
|
|
136
|
-
* If no unit is defined, then series will be connected to the first axis.
|
|
137
|
-
*/
|
|
138
|
-
unit: string | null | undefined;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Used to group series in a different stacks.
|
|
142
|
-
* "stacking" property should be specified either for each series or in plotOptions.
|
|
143
|
-
* It is recommended to place series in a single stack, when they belong to the same yAxis.
|
|
144
|
-
*/
|
|
145
|
-
stack: number | string;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* The height of the neck, the lower part of the funnel.
|
|
149
|
-
* A number defines pixel width, a percentage string defines a percentage of the plot area height. Defaults to 30%.
|
|
150
|
-
* Note that this property only applies for "funnel" charts.
|
|
151
|
-
* @attr {number | string} neck-position
|
|
152
|
-
*/
|
|
153
|
-
neckPosition: number | string;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* The width of the neck, the lower part of the funnel.
|
|
157
|
-
* A number defines pixel width, a percentage string defines a percentage of the plot area width. Defaults to 30%.
|
|
158
|
-
* Note that this property only applies for "funnel" charts.
|
|
159
|
-
* @attr {number | string} neck-width
|
|
160
|
-
*/
|
|
161
|
-
neckWidth: number | string;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Represents additional JSON configuration.
|
|
165
|
-
*/
|
|
166
|
-
additionalOptions: SeriesOptionsType | null | undefined;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Method to attach a series object of type `Highcharts.Series`.
|
|
170
|
-
*
|
|
171
|
-
* @param series Object of type `Highcharts.Series`
|
|
172
|
-
*/
|
|
173
|
-
setSeries(series: Series): void;
|
|
174
|
-
}
|
|
57
|
+
declare class ChartSeries extends ChartSeriesMixin(HTMLElement) {}
|
|
175
58
|
|
|
176
59
|
declare global {
|
|
177
60
|
interface HTMLElementTagNameMap {
|