@vaadin/charts 24.7.0-alpha4 → 24.7.0-alpha6
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 +7 -7
- package/src/vaadin-chart-series.d.ts +2 -2
- package/src/vaadin-chart.d.ts +25 -0
- package/src/vaadin-chart.js +54 -15
- package/theme/vaadin-chart-base-theme.js +6 -0
- package/web-types.json +15 -3
- package/web-types.lit.json +23 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/charts",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-alpha6",
|
|
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.7.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
41
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
39
|
+
"@vaadin/component-base": "24.7.0-alpha6",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha6",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha6",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha6",
|
|
43
43
|
"highcharts": "9.2.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
46
|
+
"@vaadin/chai-plugins": "24.7.0-alpha6",
|
|
47
47
|
"@vaadin/testing-helpers": "^1.1.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": "
|
|
55
|
+
"gitHead": "6255a512997a648da91fed37de4d5000809eaebf"
|
|
56
56
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
9
|
* license.
|
|
10
10
|
*/
|
|
11
|
-
import type { PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
|
|
11
|
+
import type { GanttPointOptionsObject, PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
|
|
12
12
|
|
|
13
13
|
export type ChartSeriesMarkers = 'auto' | 'hidden' | 'shown';
|
|
14
14
|
|
|
@@ -27,7 +27,7 @@ export interface ChartSeriesConfig {
|
|
|
27
27
|
|
|
28
28
|
export type ChartSeriesOptions = ChartSeriesConfig & SeriesOptionsType;
|
|
29
29
|
|
|
30
|
-
export type ChartSeriesValues = Array<number[] | PointOptionsObject | number>;
|
|
30
|
+
export type ChartSeriesValues = Array<number[] | PointOptionsObject | GanttPointOptionsObject | number>;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* `<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.
|
package/src/vaadin-chart.d.ts
CHANGED
|
@@ -166,6 +166,21 @@ export type ChartPointUnselectEvent = CustomEvent<{ point: Point; originalEvent:
|
|
|
166
166
|
*/
|
|
167
167
|
export type ChartPointUpdateEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Fired when starting to drag a point.
|
|
171
|
+
*/
|
|
172
|
+
export type ChartPointDragStartEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Fired when the point is dropped.
|
|
176
|
+
*/
|
|
177
|
+
export type ChartPointDropEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Fired while dragging a point.
|
|
181
|
+
*/
|
|
182
|
+
export type ChartPointDragEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
|
|
183
|
+
|
|
169
184
|
/**
|
|
170
185
|
* Fired when when the minimum and maximum is set for the X axis.
|
|
171
186
|
*/
|
|
@@ -245,6 +260,12 @@ export interface ChartCustomEventMap {
|
|
|
245
260
|
|
|
246
261
|
'point-update': ChartPointUpdateEvent;
|
|
247
262
|
|
|
263
|
+
'point-drag-start': ChartPointDragStartEvent;
|
|
264
|
+
|
|
265
|
+
'point-drop': ChartPointDropEvent;
|
|
266
|
+
|
|
267
|
+
'point-drag': ChartPointDragEvent;
|
|
268
|
+
|
|
248
269
|
'xaxes-extremes-set': ChartXaxesExtremesSetEvent;
|
|
249
270
|
|
|
250
271
|
'yaxes-extremes-set': ChartYaxesExtremesSetEvent;
|
|
@@ -404,6 +425,9 @@ export type ChartEventMap = ChartCustomEventMap & HTMLElementEventMap;
|
|
|
404
425
|
* @fires {CustomEvent} point-select -Fired when the point is selected either programmatically or by clicking on the point.
|
|
405
426
|
* @fires {CustomEvent} point-unselect - Fired when the point is unselected either programmatically or by clicking on the point.
|
|
406
427
|
* @fires {CustomEvent} point-update - Fired when the point is updated programmatically through `.updateConfiguration()` method.
|
|
428
|
+
* @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
|
|
429
|
+
* @fires {CustomEvent} point-drop - Fired when the point is dropped.
|
|
430
|
+
* @fires {CustomEvent} point-drag - Fired while dragging a point.
|
|
407
431
|
* @fires {CustomEvent} xaxes-extremes-set - Fired when when the minimum and maximum is set for the X axis.
|
|
408
432
|
* @fires {CustomEvent} yaxes-extremes-set - Fired when when the minimum and maximum is set for the Y axis.
|
|
409
433
|
*/
|
|
@@ -479,6 +503,7 @@ declare class Chart extends ResizeMixin(ThemableMixin(ElementMixin(HTMLElement))
|
|
|
479
503
|
|
|
480
504
|
/**
|
|
481
505
|
* Specifies whether the chart is a normal chart or a timeline chart.
|
|
506
|
+
* Value of this property is ignored for Gantt charts (type="gantt").
|
|
482
507
|
*/
|
|
483
508
|
timeline: boolean | null | undefined;
|
|
484
509
|
|
package/src/vaadin-chart.js
CHANGED
|
@@ -26,6 +26,8 @@ import 'highcharts/es-modules/masters/modules/timeline.src.js';
|
|
|
26
26
|
import 'highcharts/es-modules/masters/modules/organization.src.js';
|
|
27
27
|
import 'highcharts/es-modules/masters/modules/xrange.src.js';
|
|
28
28
|
import 'highcharts/es-modules/masters/modules/bullet.src.js';
|
|
29
|
+
import 'highcharts/es-modules/masters/modules/gantt.src.js';
|
|
30
|
+
import 'highcharts/es-modules/masters/modules/draggable-points.src.js';
|
|
29
31
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
30
32
|
import { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
31
33
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -249,6 +251,9 @@ Highcharts.setOptions({ lang: { noData: '' } });
|
|
|
249
251
|
* @fires {CustomEvent} point-select -Fired when the point is selected either programmatically or by clicking on the point.
|
|
250
252
|
* @fires {CustomEvent} point-unselect - Fired when the point is unselected either programmatically or by clicking on the point.
|
|
251
253
|
* @fires {CustomEvent} point-update - Fired when the point is updated programmatically through `.updateConfiguration()` method.
|
|
254
|
+
* @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
|
|
255
|
+
* @fires {CustomEvent} point-drop - Fired when the point is dropped.
|
|
256
|
+
* @fires {CustomEvent} point-drag - Fired while dragging a point.
|
|
252
257
|
* @fires {CustomEvent} xaxes-extremes-set - Fired when when the minimum and maximum is set for the X axis.
|
|
253
258
|
* @fires {CustomEvent} yaxes-extremes-set - Fired when when the minimum and maximum is set for the Y axis.
|
|
254
259
|
*
|
|
@@ -379,6 +384,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
379
384
|
|
|
380
385
|
/**
|
|
381
386
|
* Specifies whether the chart is a normal chart or a timeline chart.
|
|
387
|
+
* Value of this property is ignored for Gantt charts (type="gantt").
|
|
382
388
|
*/
|
|
383
389
|
timeline: {
|
|
384
390
|
type: Boolean,
|
|
@@ -883,6 +889,30 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
883
889
|
* @param {Object} point Point object where the event was sent from
|
|
884
890
|
*/
|
|
885
891
|
update: 'point-update',
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Fired when starting to drag a point.
|
|
895
|
+
* @event point-drag-start
|
|
896
|
+
* @param {Object} detail.originalEvent object with details about the event sent
|
|
897
|
+
* @param {Object} point Point object where the event was sent from
|
|
898
|
+
*/
|
|
899
|
+
dragStart: 'point-drag-start',
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Fired when the point is dropped.
|
|
903
|
+
* @event point-drop
|
|
904
|
+
* @param {Object} detail.originalEvent object with details about the event sent
|
|
905
|
+
* @param {Object} point Point object where the event was sent from
|
|
906
|
+
*/
|
|
907
|
+
drop: 'point-drop',
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Fired while dragging a point.
|
|
911
|
+
* @event point-drag
|
|
912
|
+
* @param {Object} detail.originalEvent object with details about the event sent
|
|
913
|
+
* @param {Object} point Point object where the event was sent from
|
|
914
|
+
*/
|
|
915
|
+
drag: 'point-drag',
|
|
886
916
|
};
|
|
887
917
|
}
|
|
888
918
|
|
|
@@ -1061,7 +1091,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1061
1091
|
__initChart(options) {
|
|
1062
1092
|
this.__initEventsListeners(options);
|
|
1063
1093
|
this.__updateStyledMode(options);
|
|
1064
|
-
if (
|
|
1094
|
+
if (options.chart.type === 'gantt') {
|
|
1095
|
+
this.configuration = Highcharts.ganttChart(this.$.chart, options);
|
|
1096
|
+
} else if (this.timeline) {
|
|
1065
1097
|
this.configuration = Highcharts.stockChart(this.$.chart, options);
|
|
1066
1098
|
} else {
|
|
1067
1099
|
this.configuration = Highcharts.chart(this.$.chart, options);
|
|
@@ -1306,11 +1338,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1306
1338
|
/** @private */
|
|
1307
1339
|
__createEventListeners(eventList, configuration, pathToAdd, eventType) {
|
|
1308
1340
|
const eventObject = this.__ensureObjectPath(configuration, pathToAdd);
|
|
1341
|
+
const self = this;
|
|
1309
1342
|
|
|
1310
1343
|
for (let keys = Object.keys(eventList), i = 0; i < keys.length; i++) {
|
|
1311
1344
|
const key = keys[i];
|
|
1312
1345
|
if (!eventObject[key]) {
|
|
1313
|
-
eventObject[key] = (event)
|
|
1346
|
+
eventObject[key] = function (event) {
|
|
1314
1347
|
const customEvent = {
|
|
1315
1348
|
bubbles: false,
|
|
1316
1349
|
composed: true,
|
|
@@ -1320,6 +1353,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1320
1353
|
},
|
|
1321
1354
|
};
|
|
1322
1355
|
|
|
1356
|
+
if (key === 'dragStart') {
|
|
1357
|
+
// for dragStart there is no information about point in the
|
|
1358
|
+
// event object. However, 'this' references the point being dragged
|
|
1359
|
+
customEvent.detail[eventType] = this;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1323
1362
|
if (event.type === 'afterSetExtremes') {
|
|
1324
1363
|
if (event.min == null || event.max == null) {
|
|
1325
1364
|
return;
|
|
@@ -1351,17 +1390,17 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1351
1390
|
if (['beforePrint', 'beforeExport'].indexOf(event.type) >= 0) {
|
|
1352
1391
|
// Guard against another print 'before print' event coming before
|
|
1353
1392
|
// the 'after print' event.
|
|
1354
|
-
if (!
|
|
1393
|
+
if (!self.tempBodyStyle) {
|
|
1355
1394
|
let effectiveCss = '';
|
|
1356
1395
|
|
|
1357
|
-
[...
|
|
1396
|
+
[...self.shadowRoot.querySelectorAll('style')].forEach((style) => {
|
|
1358
1397
|
effectiveCss += style.textContent;
|
|
1359
1398
|
});
|
|
1360
1399
|
|
|
1361
1400
|
// Strip off host selectors that target individual instances
|
|
1362
1401
|
effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
|
|
1363
1402
|
const selector = match.substr(6, match.length - 7);
|
|
1364
|
-
return
|
|
1403
|
+
return self.matches(selector) ? '' : match;
|
|
1365
1404
|
});
|
|
1366
1405
|
|
|
1367
1406
|
// Zoom out a bit to avoid clipping the chart's edge on paper
|
|
@@ -1372,10 +1411,10 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1372
1411
|
` zoom: 90%;` + // Webkit
|
|
1373
1412
|
`}`;
|
|
1374
1413
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
document.body.appendChild(
|
|
1378
|
-
if (
|
|
1414
|
+
self.tempBodyStyle = document.createElement('style');
|
|
1415
|
+
self.tempBodyStyle.textContent = effectiveCss;
|
|
1416
|
+
document.body.appendChild(self.tempBodyStyle);
|
|
1417
|
+
if (self.options.chart.styledMode) {
|
|
1379
1418
|
document.body.setAttribute('styled-mode', '');
|
|
1380
1419
|
}
|
|
1381
1420
|
}
|
|
@@ -1383,18 +1422,18 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1383
1422
|
|
|
1384
1423
|
// Hook into afterPrint and afterExport to revert changes made before
|
|
1385
1424
|
if (['afterPrint', 'afterExport'].indexOf(event.type) >= 0) {
|
|
1386
|
-
if (
|
|
1387
|
-
document.body.removeChild(
|
|
1388
|
-
delete
|
|
1389
|
-
if (
|
|
1425
|
+
if (self.tempBodyStyle) {
|
|
1426
|
+
document.body.removeChild(self.tempBodyStyle);
|
|
1427
|
+
delete self.tempBodyStyle;
|
|
1428
|
+
if (self.options.chart.styledMode) {
|
|
1390
1429
|
document.body.removeAttribute('styled-mode');
|
|
1391
1430
|
}
|
|
1392
1431
|
}
|
|
1393
1432
|
}
|
|
1394
1433
|
|
|
1395
|
-
|
|
1434
|
+
self.dispatchEvent(new CustomEvent(eventList[key], customEvent));
|
|
1396
1435
|
|
|
1397
|
-
if (event.type === 'legendItemClick' &&
|
|
1436
|
+
if (event.type === 'legendItemClick' && self._visibilityTogglingDisabled) {
|
|
1398
1437
|
return false;
|
|
1399
1438
|
}
|
|
1400
1439
|
};
|
|
@@ -1030,6 +1030,12 @@ const chartBaseTheme = css`
|
|
|
1030
1030
|
stroke-width: 1px;
|
|
1031
1031
|
}
|
|
1032
1032
|
|
|
1033
|
+
/* Workaround for https://github.com/highcharts/highcharts/issues/22490 */
|
|
1034
|
+
:where([styled-mode]) .highcharts-gantt-series .highcharts-partfill-overlay {
|
|
1035
|
+
fill: hsla(0, 0%, 0%, 0.3);
|
|
1036
|
+
stroke: hsla(0, 0%, 0%, 0.3);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1033
1039
|
/* RTL styles */
|
|
1034
1040
|
:host([dir='rtl']) :where([styled-mode]) .highcharts-container {
|
|
1035
1041
|
text-align: right;
|
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.7.0-
|
|
4
|
+
"version": "24.7.0-alpha6",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"name": "timeline",
|
|
68
|
-
"description": "Specifies whether the chart is a normal chart or a timeline chart.",
|
|
68
|
+
"description": "Specifies whether the chart is a normal chart or a timeline chart.\nValue of this property is ignored for Gantt charts (type=\"gantt\").",
|
|
69
69
|
"value": {
|
|
70
70
|
"type": [
|
|
71
71
|
"boolean",
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
"name": "timeline",
|
|
238
|
-
"description": "Specifies whether the chart is a normal chart or a timeline chart.",
|
|
238
|
+
"description": "Specifies whether the chart is a normal chart or a timeline chart.\nValue of this property is ignored for Gantt charts (type=\"gantt\").",
|
|
239
239
|
"value": {
|
|
240
240
|
"type": [
|
|
241
241
|
"boolean",
|
|
@@ -380,6 +380,18 @@
|
|
|
380
380
|
"name": "point-click",
|
|
381
381
|
"description": "Fired when the point is clicked."
|
|
382
382
|
},
|
|
383
|
+
{
|
|
384
|
+
"name": "point-drag",
|
|
385
|
+
"description": "Fired while dragging a point."
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "point-drag-start",
|
|
389
|
+
"description": "Fired when starting to drag a point."
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"name": "point-drop",
|
|
393
|
+
"description": "Fired when the point is dropped."
|
|
394
|
+
},
|
|
383
395
|
{
|
|
384
396
|
"name": "point-legend-item-click",
|
|
385
397
|
"description": "Fired when the legend item belonging to the point is clicked."
|
package/web-types.lit.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.7.0-
|
|
4
|
+
"version": "24.7.0-alpha6",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"name": "?timeline",
|
|
31
|
-
"description": "Specifies whether the chart is a normal chart or a timeline chart.",
|
|
31
|
+
"description": "Specifies whether the chart is a normal chart or a timeline chart.\nValue of this property is ignored for Gantt charts (type=\"gantt\").",
|
|
32
32
|
"value": {
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
@@ -222,6 +222,27 @@
|
|
|
222
222
|
"kind": "expression"
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
|
+
{
|
|
226
|
+
"name": "@point-drag",
|
|
227
|
+
"description": "Fired while dragging a point.",
|
|
228
|
+
"value": {
|
|
229
|
+
"kind": "expression"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "@point-drag-start",
|
|
234
|
+
"description": "Fired when starting to drag a point.",
|
|
235
|
+
"value": {
|
|
236
|
+
"kind": "expression"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"name": "@point-drop",
|
|
241
|
+
"description": "Fired when the point is dropped.",
|
|
242
|
+
"value": {
|
|
243
|
+
"kind": "expression"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
225
246
|
{
|
|
226
247
|
"name": "@point-legend-item-click",
|
|
227
248
|
"description": "Fired when the legend item belonging to the point is clicked.",
|