@vaadin/vaadin-charts 6.2.4 → 6.3.3
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/README.md +7 -12
- package/package.json +14 -9
- package/src/vaadin-chart-series.js +1 -1
- package/src/vaadin-chart.js +63 -17
- package/theme/vaadin-chart-default-theme.js +13 -0
package/README.md
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
[](https://github.com/vaadin/vaadin-charts/releases)
|
|
3
|
-
[](https://travis-ci.org/vaadin/vaadin-charts)
|
|
4
|
-
[](https://coveralls.io/github/vaadin/vaadin-charts?branch=master)
|
|
5
|
-
[](https://www.webcomponents.org/element/vaadin/vaadin-charts)
|
|
6
|
-
[](https://gitter.im/vaadin/web-components?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
7
|
-
|
|
8
|
-
[](https://vaadin.com/directory/component/vaadinvaadin-element)
|
|
9
|
-
[](https://vaadin.com/directory/component/vaadinvaadin-charts)
|
|
1
|
+
# Vaadin Charts
|
|
10
2
|
|
|
3
|
+
> ⚠️ Starting from Vaadin 20, the source code and issues for this component are migrated to the [`vaadin/web-components`](https://github.com/vaadin/web-components/tree/master/packages/vaadin-charts) monorepository.
|
|
4
|
+
> This repository contains the source code and releases of `<vaadin-chart>` for the Vaadin versions 10 to 19.
|
|
11
5
|
|
|
12
|
-
|
|
6
|
+
[Vaadin Charts](https://vaadin.com/components/vaadin-charts) is a Web Component for creating high quality charts, part of the [Vaadin components](https://vaadin.com/components).
|
|
13
7
|
|
|
14
8
|
[Live Demo ↗](https://vaadin.com/components/vaadin-charts/examples)
|
|
15
9
|
|
|
|
16
10
|
[API documentation ↗](https://vaadin.com/components/vaadin-charts/html-api)
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
[Vaadin
|
|
12
|
+
[](https://www.npmjs.com/package/@vaadin/vaadin-charts)
|
|
13
|
+
[](https://vaadin.com/directory/component/vaadinvaadin-element)
|
|
14
|
+
[](https://discord.gg/PHmkCKC)
|
|
20
15
|
|
|
21
16
|
<!--
|
|
22
17
|
```
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"repository": "vaadin/vaadin-charts",
|
|
11
11
|
"homepage": "https://vaadin.com/charts",
|
|
12
12
|
"name": "@vaadin/vaadin-charts",
|
|
13
|
-
"version": "6.
|
|
13
|
+
"version": "6.3.3",
|
|
14
14
|
"main": "vaadin-chart.js",
|
|
15
15
|
"author": "Vaadin Ltd",
|
|
16
16
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"theme"
|
|
24
24
|
],
|
|
25
25
|
"resolutions": {
|
|
26
|
+
"es-abstract": "1.17.6",
|
|
27
|
+
"@types/doctrine": "0.0.3",
|
|
26
28
|
"inherits": "2.0.3",
|
|
27
29
|
"samsam": "1.1.3",
|
|
28
30
|
"supports-color": "3.1.2",
|
|
@@ -31,25 +33,28 @@
|
|
|
31
33
|
"dependencies": {
|
|
32
34
|
"highcharts": "6.1.4",
|
|
33
35
|
"@polymer/polymer": "^3.0.0",
|
|
34
|
-
"@vaadin/vaadin-themable-mixin": "^1.2
|
|
36
|
+
"@vaadin/vaadin-themable-mixin": "^1.5.2",
|
|
35
37
|
"@vaadin/vaadin-license-checker": "^2.1.0",
|
|
36
|
-
"@vaadin/vaadin-element-mixin": "^2.
|
|
38
|
+
"@vaadin/vaadin-element-mixin": "^2.3.2"
|
|
37
39
|
},
|
|
38
|
-
"
|
|
40
|
+
"scripts": {
|
|
41
|
+
"generate-typings": "gen-typescript-declarations --outDir . --verify"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
39
44
|
"@polymer/iron-component-page": "^4.0.0",
|
|
40
45
|
"@webcomponents/webcomponentsjs": "^2.0.0",
|
|
41
46
|
"wct-browser-legacy": "^1.0.1",
|
|
42
|
-
"@vaadin/vaadin-demo-helpers": "^3.
|
|
43
|
-
"@vaadin/vaadin-grid": "^5.
|
|
47
|
+
"@vaadin/vaadin-demo-helpers": "^3.1.0",
|
|
48
|
+
"@vaadin/vaadin-grid": "^5.6.0",
|
|
44
49
|
"@polymer/app-route": "^3.0.0",
|
|
45
50
|
"@polymer/iron-icon": "^3.0.0",
|
|
46
51
|
"@polymer/iron-icons": "^3.0.0",
|
|
47
52
|
"@polymer/iron-iconset-svg": "^3.0.0",
|
|
48
53
|
"@polymer/iron-pages": "^3.0.0",
|
|
49
54
|
"@polymer/paper-button": "^3.0.0",
|
|
50
|
-
"@vaadin/vaadin-split-layout": "^4.
|
|
55
|
+
"@vaadin/vaadin-split-layout": "^4.2.0",
|
|
51
56
|
"@vaadin/vaadin-icons": "^4.2.0",
|
|
52
|
-
"@vaadin/vaadin-button": "^2.
|
|
53
|
-
"@vaadin/vaadin-ordered-layout": "^1.
|
|
57
|
+
"@vaadin/vaadin-button": "^2.3.0-alpha1",
|
|
58
|
+
"@vaadin/vaadin-ordered-layout": "^1.3.0"
|
|
54
59
|
}
|
|
55
60
|
}
|
|
@@ -58,7 +58,7 @@ import { ChartDeepMerger, ChartElement } from './vaadin-chart.js';
|
|
|
58
58
|
* @polymer
|
|
59
59
|
* @customElement
|
|
60
60
|
* @extends {Polymer.Element}
|
|
61
|
-
* @
|
|
61
|
+
* @extends PolymerElement
|
|
62
62
|
* @demo demo/index.html
|
|
63
63
|
*/
|
|
64
64
|
class ChartSeriesElement extends PolymerElement {
|
package/src/vaadin-chart.js
CHANGED
|
@@ -105,7 +105,7 @@ if (!PolymerElement) {
|
|
|
105
105
|
* ```
|
|
106
106
|
* 1. Install Vaadin Charts
|
|
107
107
|
* ```
|
|
108
|
-
* bower install --save vaadin-charts
|
|
108
|
+
* bower install --save vaadin-charts
|
|
109
109
|
* ```
|
|
110
110
|
* 1. Import `<vaadin-chart>` to your app
|
|
111
111
|
* Edit the file `src/my-app/my-app.html` and add the following snipped before the `<dom-module>` tag
|
|
@@ -133,7 +133,7 @@ if (!PolymerElement) {
|
|
|
133
133
|
* ```
|
|
134
134
|
* 1. Install Vaadin Charts
|
|
135
135
|
* ```
|
|
136
|
-
* npm i @vaadin/vaadin-charts
|
|
136
|
+
* npm i @vaadin/vaadin-charts --save
|
|
137
137
|
* ```
|
|
138
138
|
* 1. Import `<vaadin-chart>` to your app
|
|
139
139
|
* Edit the file `src/my-app/my-app.js` and add the following snipped on the top, after the first `import` declaration
|
|
@@ -315,6 +315,33 @@ if (!PolymerElement) {
|
|
|
315
315
|
* </dom-module>
|
|
316
316
|
* ```
|
|
317
317
|
*
|
|
318
|
+
* ### RTL support
|
|
319
|
+
*
|
|
320
|
+
* `vaadin-charts` as well as [Highcharts](https://www.highcharts.com/) by itself are not adjusting the layout
|
|
321
|
+
* based on the `dir` attribute. In order to make `vaadin-charts` display RTL content properly additional
|
|
322
|
+
* JSON configuration should be used.
|
|
323
|
+
* Each chart should be updated based on the specific needs, but general recommendations are:
|
|
324
|
+
*
|
|
325
|
+
* 1. Set `reversed` to true for xAxis (https://api.highcharts.com/highcharts/xAxis.reversed).
|
|
326
|
+
* 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).
|
|
327
|
+
* 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).
|
|
328
|
+
*
|
|
329
|
+
* Using as a base the project created with in Quick Start and an `additionalOptions` in order to make RTL adjustments:
|
|
330
|
+
*
|
|
331
|
+
* ```html
|
|
332
|
+
* <vaadin-chart title="۱- عنوان نمودار" subtitle="۲- عنوان فرعی نمودار"
|
|
333
|
+
* additional-options='{"title": {"useHTML": true}, "tooltip": {"useHTML": true}, "subtitle": {"useHTML": true},
|
|
334
|
+
* "legend": {"rtl": true}, "yAxis": [{"id": "۴- مقادیر", "title": {"text": "۴- مقادیر", "useHTML": true}}],
|
|
335
|
+
* "xAxis": {"reversed": true}}'>
|
|
336
|
+
* <vaadin-chart-series
|
|
337
|
+
* type= "column"
|
|
338
|
+
* title="۳- عنوان ردیف"
|
|
339
|
+
* unit="۴- مقادیر"
|
|
340
|
+
* values="[10,20,30]">
|
|
341
|
+
* </vaadin-chart-series>
|
|
342
|
+
* </vaadin-chart>
|
|
343
|
+
* ```
|
|
344
|
+
*
|
|
318
345
|
* ### Setting colors
|
|
319
346
|
*
|
|
320
347
|
* Although charts can be styled as described above, there is a simpler way for setting colors.
|
|
@@ -326,7 +353,7 @@ if (!PolymerElement) {
|
|
|
326
353
|
* After one day using Vaadin Charts in a development environment you will see a pop-up that asks you
|
|
327
354
|
* to validate your license by signing in to vaadin.com.
|
|
328
355
|
*
|
|
329
|
-
* @
|
|
356
|
+
* @extends PolymerElement
|
|
330
357
|
* @demo demo/index.html
|
|
331
358
|
*/
|
|
332
359
|
class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
@@ -353,7 +380,7 @@ class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
353
380
|
}
|
|
354
381
|
|
|
355
382
|
static get version() {
|
|
356
|
-
return '6.
|
|
383
|
+
return '6.3.3';
|
|
357
384
|
}
|
|
358
385
|
|
|
359
386
|
static get properties() {
|
|
@@ -1023,11 +1050,13 @@ class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1023
1050
|
this.__setYAxisProps(yAxes, unit, {max: valueMax});
|
|
1024
1051
|
}
|
|
1025
1052
|
|
|
1026
|
-
const seriesConfiguration = this.__updateOrAddSeriesInstance(seriesElement.options, idxOnChildList);
|
|
1053
|
+
const seriesConfiguration = this.__updateOrAddSeriesInstance(seriesElement.options, idxOnChildList, false);
|
|
1027
1054
|
|
|
1028
1055
|
seriesElement.setSeries(seriesConfiguration);
|
|
1029
1056
|
}
|
|
1030
1057
|
this.__removeAxisIfEmpty();
|
|
1058
|
+
|
|
1059
|
+
this.configuration.redraw();
|
|
1031
1060
|
}
|
|
1032
1061
|
|
|
1033
1062
|
__removeSeries(seriesNodes) {
|
|
@@ -1081,6 +1110,21 @@ class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1081
1110
|
} else {
|
|
1082
1111
|
this.configuration = Highcharts.chart(this.$.chart, options);
|
|
1083
1112
|
}
|
|
1113
|
+
|
|
1114
|
+
// Workaround for https://github.com/highcharts/highcharts/issues/9978
|
|
1115
|
+
const elementsToChange = [
|
|
1116
|
+
...Array.from(this.$.chart.getElementsByTagName('h4'))
|
|
1117
|
+
.filter(el => el.style.left === '-9999px'),
|
|
1118
|
+
this.configuration.screenReaderRegion,
|
|
1119
|
+
this.configuration.tabExitAnchor
|
|
1120
|
+
];
|
|
1121
|
+
|
|
1122
|
+
elementsToChange.forEach(el => {
|
|
1123
|
+
if (el && el.style) {
|
|
1124
|
+
el.style.left = '';
|
|
1125
|
+
el.style.top = '-999em';
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1084
1128
|
}
|
|
1085
1129
|
|
|
1086
1130
|
/** @private */
|
|
@@ -1193,20 +1237,22 @@ class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1193
1237
|
return;
|
|
1194
1238
|
}
|
|
1195
1239
|
|
|
1196
|
-
this.configuration.update(this._jsonConfigurationBuffer);
|
|
1240
|
+
this.configuration.update(this._jsonConfigurationBuffer, false);
|
|
1197
1241
|
if (this._jsonConfigurationBuffer.credits) {
|
|
1198
1242
|
this.__updateOrAddCredits(this._jsonConfigurationBuffer.credits);
|
|
1199
1243
|
}
|
|
1200
1244
|
if (this._jsonConfigurationBuffer.xAxis) {
|
|
1201
|
-
this.__updateOrAddAxes(this._jsonConfigurationBuffer.xAxis, true);
|
|
1245
|
+
this.__updateOrAddAxes(this._jsonConfigurationBuffer.xAxis, true, false);
|
|
1202
1246
|
}
|
|
1203
1247
|
if (this._jsonConfigurationBuffer.yAxis) {
|
|
1204
|
-
this.__updateOrAddAxes(this._jsonConfigurationBuffer.yAxis, false);
|
|
1248
|
+
this.__updateOrAddAxes(this._jsonConfigurationBuffer.yAxis, false, false);
|
|
1205
1249
|
}
|
|
1206
1250
|
if (this._jsonConfigurationBuffer.series) {
|
|
1207
|
-
this.__updateOrAddSeries(this._jsonConfigurationBuffer.series);
|
|
1251
|
+
this.__updateOrAddSeries(this._jsonConfigurationBuffer.series, false);
|
|
1208
1252
|
}
|
|
1209
1253
|
this._jsonConfigurationBuffer = null;
|
|
1254
|
+
|
|
1255
|
+
this.configuration.redraw();
|
|
1210
1256
|
});
|
|
1211
1257
|
}
|
|
1212
1258
|
|
|
@@ -1428,7 +1474,7 @@ class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1428
1474
|
}
|
|
1429
1475
|
}
|
|
1430
1476
|
|
|
1431
|
-
__updateOrAddAxes(axes, isX) {
|
|
1477
|
+
__updateOrAddAxes(axes, isX, redraw) {
|
|
1432
1478
|
if (!Array.isArray(axes)) {
|
|
1433
1479
|
axes = [axes];
|
|
1434
1480
|
}
|
|
@@ -1436,28 +1482,28 @@ class ChartElement extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1436
1482
|
for (let i = 0; i < axes.length; i++) {
|
|
1437
1483
|
const axis = axes[i];
|
|
1438
1484
|
if (confAxes[i]) {
|
|
1439
|
-
confAxes[i].update(axis);
|
|
1485
|
+
confAxes[i].update(axis, redraw);
|
|
1440
1486
|
} else {
|
|
1441
|
-
this.configuration.addAxis(axis, isX);
|
|
1487
|
+
this.configuration.addAxis(axis, isX, redraw);
|
|
1442
1488
|
}
|
|
1443
1489
|
}
|
|
1444
1490
|
}
|
|
1445
1491
|
|
|
1446
|
-
__updateOrAddSeries(series) {
|
|
1492
|
+
__updateOrAddSeries(series, redraw) {
|
|
1447
1493
|
if (!Array.isArray(series)) {
|
|
1448
1494
|
throw new Error('The type of jsonConfiguration.series should be Object[]');
|
|
1449
1495
|
}
|
|
1450
1496
|
for (let i = 0; i < series.length; i++) {
|
|
1451
1497
|
const currentSeries = series[i];
|
|
1452
|
-
this.__updateOrAddSeriesInstance(currentSeries, i);
|
|
1498
|
+
this.__updateOrAddSeriesInstance(currentSeries, i, redraw);
|
|
1453
1499
|
}
|
|
1454
1500
|
}
|
|
1455
1501
|
|
|
1456
|
-
__updateOrAddSeriesInstance(seriesOptions, position) {
|
|
1502
|
+
__updateOrAddSeriesInstance(seriesOptions, position, redraw) {
|
|
1457
1503
|
if (this.configuration.series[position]) {
|
|
1458
|
-
this.configuration.series[position].update(seriesOptions);
|
|
1504
|
+
this.configuration.series[position].update(seriesOptions, redraw);
|
|
1459
1505
|
} else {
|
|
1460
|
-
this.configuration.addSeries(seriesOptions);
|
|
1506
|
+
this.configuration.addSeries(seriesOptions, redraw);
|
|
1461
1507
|
}
|
|
1462
1508
|
return this.configuration.series[position];
|
|
1463
1509
|
}
|
|
@@ -857,6 +857,19 @@ text.highcharts-drilldown-data-label,
|
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
|
|
860
|
+
/* RTL styles */
|
|
861
|
+
:host([dir="rtl"]) .highcharts-container {
|
|
862
|
+
text-align: right;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
:host([dir="rtl"]) input.highcharts-range-selector {
|
|
866
|
+
left: auto;
|
|
867
|
+
right: -9em;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
:host([dir="rtl"]) .highcharts-menu {
|
|
871
|
+
box-shadow: -3px 3px 10px #888;
|
|
872
|
+
}
|
|
860
873
|
|
|
861
874
|
|
|
862
875
|
/* stylelint-enable */
|