@vaadin/charts 25.0.0-alpha12 → 25.0.0-alpha14

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": "25.0.0-alpha12",
3
+ "version": "25.0.0-alpha14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,16 +34,16 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@open-wc/dedupe-mixin": "^1.3.0",
37
- "@vaadin/component-base": "25.0.0-alpha12",
38
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha12",
37
+ "@vaadin/component-base": "25.0.0-alpha14",
38
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha14",
39
39
  "highcharts": "9.2.2",
40
40
  "lit": "^3.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@vaadin/chai-plugins": "25.0.0-alpha12",
44
- "@vaadin/test-runner-commands": "25.0.0-alpha12",
43
+ "@vaadin/chai-plugins": "25.0.0-alpha14",
44
+ "@vaadin/test-runner-commands": "25.0.0-alpha14",
45
45
  "@vaadin/testing-helpers": "^2.0.0",
46
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha12",
46
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha14",
47
47
  "sinon": "^18.0.0"
48
48
  },
49
49
  "cvdlName": "vaadin-chart",
@@ -51,5 +51,5 @@
51
51
  "web-types.json",
52
52
  "web-types.lit.json"
53
53
  ],
54
- "gitHead": "e75527348f9ba7c363d068c868b9f030c15b84a1"
54
+ "gitHead": "8ebeeeca4b5b6564eff954d6582d0d6760464e51"
55
55
  }
package/src/helpers.js CHANGED
@@ -57,3 +57,49 @@ export function deepMerge(target, source) {
57
57
 
58
58
  return target;
59
59
  }
60
+
61
+ export function prepareExport(chart) {
62
+ // Guard against another print 'before print' event coming before
63
+ // the 'after print' event.
64
+ if (!chart.tempBodyStyle) {
65
+ let effectiveCss = '';
66
+
67
+ // LitElement uses `adoptedStyleSheets` for adding styles
68
+ if (chart.shadowRoot.adoptedStyleSheets) {
69
+ chart.shadowRoot.adoptedStyleSheets.forEach((sheet) => {
70
+ effectiveCss += `${[...sheet.cssRules].map((rule) => rule.cssText).join('\n')}\n`;
71
+ });
72
+ }
73
+
74
+ // Strip off host selectors that target individual instances
75
+ effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
76
+ const selector = match.substr(6, match.length - 7);
77
+ return chart.matches(selector) ? '' : match;
78
+ });
79
+
80
+ // Zoom out a bit to avoid clipping the chart's edge on paper
81
+ effectiveCss =
82
+ `${effectiveCss}body {` +
83
+ ` -moz-transform: scale(0.9, 0.9);` + // Mozilla
84
+ ` zoom: 0.9;` + // Others
85
+ ` zoom: 90%;` + // Webkit
86
+ `}`;
87
+
88
+ chart.tempBodyStyle = document.createElement('style');
89
+ chart.tempBodyStyle.textContent = effectiveCss;
90
+ document.body.appendChild(chart.tempBodyStyle);
91
+ if (chart.options.chart.styledMode) {
92
+ document.body.setAttribute('styled-mode', '');
93
+ }
94
+ }
95
+ }
96
+
97
+ export function cleanupExport(chart) {
98
+ if (chart.tempBodyStyle) {
99
+ document.body.removeChild(chart.tempBodyStyle);
100
+ delete chart.tempBodyStyle;
101
+ if (chart.options.chart.styledMode) {
102
+ document.body.removeAttribute('styled-mode');
103
+ }
104
+ }
105
+ }
@@ -43,7 +43,7 @@ const tooltipStyles = (scope) => css`
43
43
 
44
44
  ${unsafeCSS(scope)} .highcharts-tooltip-box {
45
45
  stroke-width: 1px;
46
- stroke: var(--vaadin-charts-tooltip-border, var(--vaadin-border-color));
46
+ stroke: var(--vaadin-charts-tooltip-border, var(--vaadin-border-color-subtle));
47
47
  fill: var(--vaadin-charts-tooltip-background, var(--vaadin-background-color));
48
48
  fill-opacity: var(--vaadin-charts-tooltip-background-opacity, 1);
49
49
  }
@@ -51,7 +51,7 @@ const tooltipStyles = (scope) => css`
51
51
  ${unsafeCSS(scope)} .highcharts-tooltip-box .highcharts-label-box {
52
52
  fill: var(--vaadin-charts-tooltip-background, var(--vaadin-background-color));
53
53
  fill-opacity: var(--vaadin-charts-tooltip-background-opacity, 1);
54
- stroke: var(--vaadin-charts-tooltip-border, var(--vaadin-border-color));
54
+ stroke: var(--vaadin-charts-tooltip-border, var(--vaadin-border-color-subtle));
55
55
  }
56
56
 
57
57
  ${unsafeCSS(scope)} .highcharts-tooltip-header {
@@ -81,6 +81,10 @@ export const chartStyles = css`
81
81
  display: block;
82
82
  width: 100%;
83
83
  overflow: hidden;
84
+ }
85
+
86
+ :host,
87
+ :root {
84
88
  font-size: var(--vaadin-charts-font-size, 0.75rem);
85
89
  line-height: normal;
86
90
 
@@ -116,13 +120,13 @@ export const chartStyles = css`
116
120
  --_secondary-label: var(--vaadin-charts-secondary-label, var(--vaadin-color-subtle));
117
121
  --_disabled-label: var(--vaadin-charts-disabled-label, var(--vaadin-color-disabled));
118
122
  --_point-border: var(--vaadin-charts-point-border, var(--_bg));
119
- --_axis-line: var(--vaadin-charts-axis-line, var(--vaadin-border-color));
123
+ --_axis-line: var(--vaadin-charts-axis-line, var(--vaadin-border-color-subtle));
120
124
  --_axis-title: var(--vaadin-charts-axis-title, var(--_secondary-label));
121
125
  --_axis-label: var(--vaadin-charts-axis-label, var(--_secondary-label));
122
- --_grid-line: var(--vaadin-charts-grid-line, var(--vaadin-border-color));
126
+ --_grid-line: var(--vaadin-charts-grid-line, var(--vaadin-border-color-subtle));
123
127
  --_minor-grid-line: var(
124
128
  --vaadin-charts-minor-grid-line,
125
- color-mix(in srgb, var(--vaadin-border-color) 60%, transparent)
129
+ color-mix(in srgb, var(--vaadin-border-color-subtle) 60%, transparent)
126
130
  );
127
131
  --_data-label: var(--vaadin-charts-data-label, var(--_label));
128
132
  }
@@ -959,7 +963,7 @@ export const chartStyles = css`
959
963
  }
960
964
 
961
965
  :where([styled-mode]) .highcharts-candlestick-series .highcharts-point {
962
- stroke: var(--vaadin-charts-candlestick-line, var(--vaadin-border-color-strong));
966
+ stroke: var(--vaadin-charts-candlestick-line, var(--vaadin-border-color));
963
967
  stroke-width: 1px;
964
968
  }
965
969
 
@@ -1042,7 +1046,7 @@ export const chartStyles = css`
1042
1046
 
1043
1047
  :where([styled-mode]) .highcharts-null-point {
1044
1048
  fill: transparent;
1045
- stroke: var(--vaadin-border-color);
1049
+ stroke: var(--vaadin-border-color-subtle);
1046
1050
  }
1047
1051
 
1048
1052
  /* 3d charts */
@@ -33,7 +33,7 @@ import Highcharts from 'highcharts/es-modules/masters/highstock.src.js';
33
33
  import { get } from '@vaadin/component-base/src/path-utils.js';
34
34
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
35
35
  import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
36
- import { deepMerge, inflateFunctions } from './helpers.js';
36
+ import { cleanupExport, deepMerge, inflateFunctions, prepareExport } from './helpers.js';
37
37
 
38
38
  ['exportChart', 'exportChartLocal', 'getSVG'].forEach((methodName) => {
39
39
  /* eslint-disable @typescript-eslint/no-invalid-this, prefer-arrow-callback */
@@ -1202,55 +1202,12 @@ export const ChartMixin = (superClass) =>
1202
1202
  // Workaround for https://github.com/vaadin/vaadin-charts/issues/389
1203
1203
  // Hook into beforePrint and beforeExport to ensure correct styling
1204
1204
  if (['beforePrint', 'beforeExport'].indexOf(event.type) >= 0) {
1205
- // Guard against another print 'before print' event coming before
1206
- // the 'after print' event.
1207
- if (!self.tempBodyStyle) {
1208
- let effectiveCss = '';
1209
-
1210
- // PolymerElement uses `<style>` tags for adding styles
1211
- [...self.shadowRoot.querySelectorAll('style')].forEach((style) => {
1212
- effectiveCss += style.textContent;
1213
- });
1214
-
1215
- // LitElement uses `adoptedStyleSheets` for adding styles
1216
- if (self.shadowRoot.adoptedStyleSheets) {
1217
- self.shadowRoot.adoptedStyleSheets.forEach((sheet) => {
1218
- effectiveCss += [...sheet.cssRules].map((rule) => rule.cssText).join('\n');
1219
- });
1220
- }
1221
-
1222
- // Strip off host selectors that target individual instances
1223
- effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
1224
- const selector = match.substr(6, match.length - 7);
1225
- return self.matches(selector) ? '' : match;
1226
- });
1227
-
1228
- // Zoom out a bit to avoid clipping the chart's edge on paper
1229
- effectiveCss =
1230
- `${effectiveCss}body {` +
1231
- ` -moz-transform: scale(0.9, 0.9);` + // Mozilla
1232
- ` zoom: 0.9;` + // Others
1233
- ` zoom: 90%;` + // Webkit
1234
- `}`;
1235
-
1236
- self.tempBodyStyle = document.createElement('style');
1237
- self.tempBodyStyle.textContent = effectiveCss;
1238
- document.body.appendChild(self.tempBodyStyle);
1239
- if (self.options.chart.styledMode) {
1240
- document.body.setAttribute('styled-mode', '');
1241
- }
1242
- }
1205
+ prepareExport(self);
1243
1206
  }
1244
1207
 
1245
1208
  // Hook into afterPrint and afterExport to revert changes made before
1246
1209
  if (['afterPrint', 'afterExport'].indexOf(event.type) >= 0) {
1247
- if (self.tempBodyStyle) {
1248
- document.body.removeChild(self.tempBodyStyle);
1249
- delete self.tempBodyStyle;
1250
- if (self.options.chart.styledMode) {
1251
- document.body.removeAttribute('styled-mode');
1252
- }
1253
- }
1210
+ cleanupExport(self);
1254
1211
  }
1255
1212
 
1256
1213
  self.dispatchEvent(new CustomEvent(eventList[key], customEvent));
@@ -19,15 +19,15 @@ export * from './vaadin-chart-series-mixin.js';
19
19
  * To use `<vaadin-chart-series>`, add it inside a `<vaadin-chart>` element:
20
20
  *
21
21
  * ```html
22
- * <vaadin-chart>
23
- * <vaadin-chart-series></vaadin-chart-series>
24
- * </vaadin-chart>
22
+ * <vaadin-chart>
23
+ * <vaadin-chart-series></vaadin-chart-series>
24
+ * </vaadin-chart>
25
25
  * ```
26
26
  *
27
27
  * `<vaadin-chart-series>` accepts `values` as an array attribute, so you can add it to your element definition:
28
28
  *
29
29
  * ```html
30
- * <vaadin-chart-series values="[10,20,30,40,50]"></vaadin-chart-series>
30
+ * <vaadin-chart-series values="[10, 20, 30, 40, 50]"></vaadin-chart-series>
31
31
  * ```
32
32
  *
33
33
  * which will add a new line series, where each value will be a data point.
@@ -40,18 +40,18 @@ export * from './vaadin-chart-series-mixin.js';
40
40
  * To create a new series, call `document.createElement('vaadin-chart-series')` and append it to your `<vaadin-chart>`:
41
41
  *
42
42
  * ```js
43
- * const chart = \* a <vaadin-chart> reference *\
44
- * const newSeries = document.createElement('vaadin-chart-series');
45
- * newSeries.values = [10,20,30,40,50];
46
- * chart.appendChild(newSeries);
43
+ * const chart = document.querySelector('vaadin-chart');
44
+ * const newSeries = document.createElement('vaadin-chart-series');
45
+ * newSeries.values = [10, 20, 30, 40, 50];
46
+ * chart.appendChild(newSeries);
47
47
  * ```
48
48
  *
49
49
  * In order to remove it, you should use the series to be removed as a reference for the `#removeChild()` call:
50
50
  *
51
51
  * ```js
52
- * const chart = \* a <vaadin-chart> reference *\
53
- * const seriesToBeRemoved = \* a <vaadin-chart-series> reference to remove*\
54
- * chart.removeChild(seriesToBeRemoved);
52
+ * const chart = document.querySelector('vaadin-chart');
53
+ * const seriesToBeRemoved = chart.querySelector('vaadin-chart-series');
54
+ * chart.removeChild(seriesToBeRemoved);
55
55
  * ```
56
56
  */
57
57
  declare class ChartSeries extends ChartSeriesMixin(HTMLElement) {}
@@ -21,15 +21,15 @@ import { ChartSeriesMixin } from './vaadin-chart-series-mixin.js';
21
21
  * To use `<vaadin-chart-series>`, add it inside a `<vaadin-chart>` element:
22
22
  *
23
23
  * ```html
24
- * <vaadin-chart>
25
- * <vaadin-chart-series></vaadin-chart-series>
26
- * </vaadin-chart>
24
+ * <vaadin-chart>
25
+ * <vaadin-chart-series></vaadin-chart-series>
26
+ * </vaadin-chart>
27
27
  * ```
28
28
  *
29
29
  * `<vaadin-chart-series>` accepts `values` as an array attribute, so you can add it to your element definition:
30
30
  *
31
31
  * ```html
32
- * <vaadin-chart-series values="[10,20,30,40,50]"></vaadin-chart-series>
32
+ * <vaadin-chart-series values="[10, 20, 30, 40, 50]"></vaadin-chart-series>
33
33
  * ```
34
34
  *
35
35
  * which will add a new line series, where each value will be a data point.
@@ -42,18 +42,18 @@ import { ChartSeriesMixin } from './vaadin-chart-series-mixin.js';
42
42
  * To create a new series, call `document.createElement('vaadin-chart-series')` and append it to your `<vaadin-chart>`:
43
43
  *
44
44
  * ```js
45
- * const chart = \* a <vaadin-chart> reference *\
46
- * const newSeries = document.createElement('vaadin-chart-series');
47
- * newSeries.values = [10,20,30,40,50];
48
- * chart.appendChild(newSeries);
45
+ * const chart = document.querySelector('vaadin-chart');
46
+ * const newSeries = document.createElement('vaadin-chart-series');
47
+ * newSeries.values = [10, 20, 30, 40, 50];
48
+ * chart.appendChild(newSeries);
49
49
  * ```
50
50
  *
51
51
  * In order to remove it, you should use the series to be removed as a reference for the `#removeChild()` call:
52
52
  *
53
53
  * ```js
54
- * const chart = \* a <vaadin-chart> reference *\
55
- * const seriesToBeRemoved = \* a <vaadin-chart-series> reference to remove*\
56
- * chart.removeChild(seriesToBeRemoved);
54
+ * const chart = document.querySelector('vaadin-chart');
55
+ * const seriesToBeRemoved = chart.querySelector('vaadin-chart-series');
56
+ * chart.removeChild(seriesToBeRemoved);
57
57
  * ```
58
58
  *
59
59
  * @customElement
@@ -21,89 +21,67 @@ export * from './vaadin-chart-mixin.js';
21
21
  * There are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.
22
22
  * Note that you can make use of all APIs in your element.
23
23
  *
24
- * #### Configuring your chart using HTML API
24
+ * #### Using HTML API
25
25
  *
26
26
  * `vaadin-chart` has a set of attributes to make it easier for you to customize your chart.
27
27
  *
28
28
  * ```html
29
- * <vaadin-chart title="The chart title" subtitle="The chart subtitle">
30
- * <vaadin-chart-series
31
- * type="column"
32
- * title="The series title"
33
- * values="[10,20,30]">
34
- * </vaadin-chart-series>
35
- * </vaadin-chart>
29
+ * <vaadin-chart title="The chart title" subtitle="The chart subtitle">
30
+ * <vaadin-chart-series
31
+ * type="column"
32
+ * title="The series title"
33
+ * values="[10, 20, 30]"
34
+ * ></vaadin-chart-series>
35
+ * </vaadin-chart>
36
36
  * ```
37
37
  *
38
38
  * > Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you
39
39
  * > have to set it as the default series type on `<vaadin-chart>` in order to work properly.
40
40
  *
41
- * #### Configuring your chart using JS API
41
+ * #### Using JS API
42
+ *
43
+ * Use [`configuration`](#/elements/vaadin-chart#property-configuration) property to set chart title, categories and data:
42
44
  *
43
- * 1. Set an id for the `<vaadin-chart>` in the template
44
- * ```html
45
- * <vaadin-chart id="mychart"></vaadin-chart>
46
- * ```
47
- * 1. Add a function that uses `configuration` property (JS Api) to set chart title, categories and data
48
- * ```js
49
- * initChartWithJSApi() {
50
- * requestAnimationFrame(() => {
51
- * const configuration = this.$.mychart.configuration;
52
- * configuration.setTitle({ text: 'The chart title' });
53
- * // By default there is one X axis, it is referenced by configuration.xAxis[0].
54
- * configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
55
- * configuration.addSeries({
56
- * type: 'column',
57
- * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
58
- * });
59
- * });
60
- * }
61
- * ```
62
- * 1. Call that function from connectedCallback (when the element is added to a document)
63
45
  * ```js
64
- * connectedCallback() {
65
- * super.connectedCallback();
66
- * this.initChartWithJSApi();
67
- * }
46
+ * const chart = document.querySelector('vaadin-chart');
47
+ *
48
+ * // Wait for default configuration to be ready
49
+ * requestAnimationFrame(() => {
50
+ * const configuration = chart.configuration;
51
+ * configuration.setTitle({ text: 'The chart title' });
52
+ * // By default there is one X axis, it is referenced by configuration.xAxis[0].
53
+ * configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
54
+ * configuration.addSeries({
55
+ * type: 'column',
56
+ * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
57
+ * });
58
+ * });
68
59
  * ```
69
60
  *
70
- * #### Configuring your chart using JS JSON API
61
+ * #### Using JS JSON API
71
62
  *
72
- * JS JSON API is a simple alternative to the JS API.
63
+ * Use [`updateConfiguration`](#/elements/vaadin-chart#method-updateConfiguration) method to set chart title, categories and data:
73
64
  *
74
- * 1. Set an id for the `<vaadin-chart>` in the template
75
- * ```html
76
- * <vaadin-chart id="mychart"></vaadin-chart>
77
- * ```
78
- * 1. Add a function that uses `updateConfiguration` method (JS JSON Api) to set chart title, categories and data
79
- * ```js
80
- * initChartWithJSJSONApi() {
81
- * this.$.mychart.updateConfiguration({
82
- * title: {
83
- * text: 'The chart title'
84
- * },
85
- * subtitle: {
86
- * text: 'Subtitle'
87
- * },
88
- * xAxis: {
89
- * categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
90
- * },
91
- * series: [{
92
- * type: 'column',
93
- * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
94
- * }]
95
- * });
96
- * }
97
- * ```
98
- * 1. Call that function from connectedCallback (when the element is added to a document)
99
65
  * ```js
100
- * connectedCallback() {
101
- * super.connectedCallback();
102
- * this.initChartWithJSJSONApi();
103
- * }
66
+ * const chart = document.querySelector('vaadin-chart');
67
+ * chart.updateConfiguration({
68
+ * title: {
69
+ * text: 'The chart title'
70
+ * },
71
+ * subtitle: {
72
+ * text: 'Subtitle'
73
+ * },
74
+ * xAxis: {
75
+ * categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
76
+ * },
77
+ * series: [{
78
+ * type: 'column',
79
+ * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
80
+ * }]
81
+ * });
104
82
  * ```
105
83
  *
106
- * It should be noted that chart style customization cannot be done via the JS or JSON API.
84
+ * **Note:** chart style customization cannot be done via the JS or JSON API.
107
85
  * Styling properties in the JSON configuration will be ignored. The following section discusses chart styling.
108
86
  *
109
87
  * ### CSS Styling
@@ -26,89 +26,67 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
26
26
  * There are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.
27
27
  * Note that you can make use of all APIs in your element.
28
28
  *
29
- * #### Configuring your chart using HTML API
29
+ * #### Using HTML API
30
30
  *
31
31
  * `vaadin-chart` has a set of attributes to make it easier for you to customize your chart.
32
32
  *
33
33
  * ```html
34
- * <vaadin-chart title="The chart title" subtitle="The chart subtitle">
35
- * <vaadin-chart-series
36
- * type="column"
37
- * title="The series title"
38
- * values="[10,20,30]">
39
- * </vaadin-chart-series>
40
- * </vaadin-chart>
34
+ * <vaadin-chart title="The chart title" subtitle="The chart subtitle">
35
+ * <vaadin-chart-series
36
+ * type="column"
37
+ * title="The series title"
38
+ * values="[10, 20, 30]"
39
+ * ></vaadin-chart-series>
40
+ * </vaadin-chart>
41
41
  * ```
42
42
  *
43
43
  * > Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you
44
44
  * > have to set it as the default series type on `<vaadin-chart>` in order to work properly.
45
45
  *
46
- * #### Configuring your chart using JS API
46
+ * #### Using JS API
47
+ *
48
+ * Use [`configuration`](#/elements/vaadin-chart#property-configuration) property to set chart title, categories and data:
47
49
  *
48
- * 1. Set an id for the `<vaadin-chart>` in the template
49
- * ```html
50
- * <vaadin-chart id="mychart"></vaadin-chart>
51
- * ```
52
- * 1. Add a function that uses `configuration` property (JS Api) to set chart title, categories and data
53
- * ```js
54
- * initChartWithJSApi() {
55
- * requestAnimationFrame(() => {
56
- * const configuration = this.$.mychart.configuration;
57
- * configuration.setTitle({ text: 'The chart title' });
58
- * // By default there is one X axis, it is referenced by configuration.xAxis[0].
59
- * configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
60
- * configuration.addSeries({
61
- * type: 'column',
62
- * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
63
- * });
64
- * });
65
- * }
66
- * ```
67
- * 1. Call that function from connectedCallback (when the element is added to a document)
68
50
  * ```js
69
- * connectedCallback() {
70
- * super.connectedCallback();
71
- * this.initChartWithJSApi();
72
- * }
51
+ * const chart = document.querySelector('vaadin-chart');
52
+ *
53
+ * // Wait for default configuration to be ready
54
+ * requestAnimationFrame(() => {
55
+ * const configuration = chart.configuration;
56
+ * configuration.setTitle({ text: 'The chart title' });
57
+ * // By default there is one X axis, it is referenced by configuration.xAxis[0].
58
+ * configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
59
+ * configuration.addSeries({
60
+ * type: 'column',
61
+ * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
62
+ * });
63
+ * });
73
64
  * ```
74
65
  *
75
- * #### Configuring your chart using JS JSON API
66
+ * #### Using JS JSON API
76
67
  *
77
- * JS JSON API is a simple alternative to the JS API.
68
+ * Use [`updateConfiguration`](#/elements/vaadin-chart#method-updateConfiguration) method to set chart title, categories and data:
78
69
  *
79
- * 1. Set an id for the `<vaadin-chart>` in the template
80
- * ```html
81
- * <vaadin-chart id="mychart"></vaadin-chart>
82
- * ```
83
- * 1. Add a function that uses `updateConfiguration` method (JS JSON Api) to set chart title, categories and data
84
- * ```js
85
- * initChartWithJSJSONApi() {
86
- * this.$.mychart.updateConfiguration({
87
- * title: {
88
- * text: 'The chart title'
89
- * },
90
- * subtitle: {
91
- * text: 'Subtitle'
92
- * },
93
- * xAxis: {
94
- * categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
95
- * },
96
- * series: [{
97
- * type: 'column',
98
- * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
99
- * }]
100
- * });
101
- * }
102
- * ```
103
- * 1. Call that function from connectedCallback (when the element is added to a document)
104
70
  * ```js
105
- * connectedCallback() {
106
- * super.connectedCallback();
107
- * this.initChartWithJSJSONApi();
108
- * }
71
+ * const chart = document.querySelector('vaadin-chart');
72
+ * chart.updateConfiguration({
73
+ * title: {
74
+ * text: 'The chart title'
75
+ * },
76
+ * subtitle: {
77
+ * text: 'Subtitle'
78
+ * },
79
+ * xAxis: {
80
+ * categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
81
+ * },
82
+ * series: [{
83
+ * type: 'column',
84
+ * data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
85
+ * }]
86
+ * });
109
87
  * ```
110
88
  *
111
- * It should be noted that chart style customization cannot be done via the JS or JSON API.
89
+ * **Note:** chart style customization cannot be done via the JS or JSON API.
112
90
  * Styling properties in the JSON configuration will be ignored. The following section discusses chart styling.
113
91
  *
114
92
  * ### CSS Styling
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "25.0.0-alpha12",
4
+ "version": "25.0.0-alpha14",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-chart-series",
11
- "description": "`<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.\n\n### Basic use\n\nTo use `<vaadin-chart-series>`, add it inside a `<vaadin-chart>` element:\n\n```html\n <vaadin-chart>\n <vaadin-chart-series></vaadin-chart-series>\n </vaadin-chart>\n```\n\n`<vaadin-chart-series>` accepts `values` as an array attribute, so you can add it to your element definition:\n\n```html\n <vaadin-chart-series values=\"[10,20,30,40,50]\"></vaadin-chart-series>\n```\n\nwhich will add a new line series, where each value will be a data point.\nLook for the Properties session to see all available attributes.\n\n### Dynamically adding and removing series\n\nYou are also able to add and remove series by using DOM API.\n\nTo create a new series, call `document.createElement('vaadin-chart-series')` and append it to your `<vaadin-chart>`:\n\n```js\n const chart = \\* a <vaadin-chart> reference *\\\n const newSeries = document.createElement('vaadin-chart-series');\n newSeries.values = [10,20,30,40,50];\n chart.appendChild(newSeries);\n```\n\nIn order to remove it, you should use the series to be removed as a reference for the `#removeChild()` call:\n\n```js\n const chart = \\* a <vaadin-chart> reference *\\\n const seriesToBeRemoved = \\* a <vaadin-chart-series> reference to remove*\\\n chart.removeChild(seriesToBeRemoved);\n```",
11
+ "description": "`<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.\n\n### Basic use\n\nTo use `<vaadin-chart-series>`, add it inside a `<vaadin-chart>` element:\n\n```html\n<vaadin-chart>\n <vaadin-chart-series></vaadin-chart-series>\n</vaadin-chart>\n```\n\n`<vaadin-chart-series>` accepts `values` as an array attribute, so you can add it to your element definition:\n\n```html\n<vaadin-chart-series values=\"[10, 20, 30, 40, 50]\"></vaadin-chart-series>\n```\n\nwhich will add a new line series, where each value will be a data point.\nLook for the Properties session to see all available attributes.\n\n### Dynamically adding and removing series\n\nYou are also able to add and remove series by using DOM API.\n\nTo create a new series, call `document.createElement('vaadin-chart-series')` and append it to your `<vaadin-chart>`:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\nconst newSeries = document.createElement('vaadin-chart-series');\nnewSeries.values = [10, 20, 30, 40, 50];\nchart.appendChild(newSeries);\n```\n\nIn order to remove it, you should use the series to be removed as a reference for the `#removeChild()` call:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\nconst seriesToBeRemoved = chart.querySelector('vaadin-chart-series');\nchart.removeChild(seriesToBeRemoved);\n```",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "value-min",
@@ -235,7 +235,7 @@
235
235
  },
236
236
  {
237
237
  "name": "vaadin-chart",
238
- "description": "`<vaadin-chart>` is a Web Component for creating high quality charts.\n\n### Basic use\n\nThere are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.\nNote that you can make use of all APIs in your element.\n\n#### Configuring your chart using HTML API\n\n`vaadin-chart` has a set of attributes to make it easier for you to customize your chart.\n\n```html\n <vaadin-chart title=\"The chart title\" subtitle=\"The chart subtitle\">\n <vaadin-chart-series\n type=\"column\"\n title=\"The series title\"\n values=\"[10,20,30]\">\n </vaadin-chart-series>\n </vaadin-chart>\n```\n\n> Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you\n> have to set it as the default series type on `<vaadin-chart>` in order to work properly.\n\n#### Configuring your chart using JS API\n\n1. Set an id for the `<vaadin-chart>` in the template\n```html\n <vaadin-chart id=\"mychart\"></vaadin-chart>\n```\n1. Add a function that uses `configuration` property (JS Api) to set chart title, categories and data\n```js\ninitChartWithJSApi() {\n requestAnimationFrame(() => {\n const configuration = this.$.mychart.configuration;\n configuration.setTitle({ text: 'The chart title' });\n // By default there is one X axis, it is referenced by configuration.xAxis[0].\n configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);\n configuration.addSeries({\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n });\n });\n}\n```\n1. Call that function from connectedCallback (when the element is added to a document)\n```js\nconnectedCallback() {\n super.connectedCallback();\n this.initChartWithJSApi();\n}\n```\n\n#### Configuring your chart using JS JSON API\n\nJS JSON API is a simple alternative to the JS API.\n\n1. Set an id for the `<vaadin-chart>` in the template\n```html\n <vaadin-chart id=\"mychart\"></vaadin-chart>\n```\n1. Add a function that uses `updateConfiguration` method (JS JSON Api) to set chart title, categories and data\n```js\ninitChartWithJSJSONApi() {\n this.$.mychart.updateConfiguration({\n title: {\n text: 'The chart title'\n },\n subtitle: {\n text: 'Subtitle'\n },\n xAxis: {\n categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n },\n series: [{\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n }]\n });\n}\n```\n1. Call that function from connectedCallback (when the element is added to a document)\n```js\nconnectedCallback() {\n super.connectedCallback();\n this.initChartWithJSJSONApi();\n}\n```\n\nIt should be noted that chart style customization cannot be done via the JS or JSON API.\nStyling properties in the JSON configuration will be ignored. The following section discusses chart styling.\n\n### CSS Styling\n\nChart appearance is primarily controlled by CSS style rules.\nA comprehensive list of the supported style classes can be found at\nhttps://www.highcharts.com/docs/chart-design-and-style/style-by-css\n\nSee also the [Chart Styling](https://vaadin.com/docs/latest/components/charts/css-styling) documentation.\n\n### RTL support\n\n`vaadin-charts` as well as [Highcharts](https://www.highcharts.com/) by itself are not adjusting the layout\nbased on the `dir` attribute. In order to make `vaadin-charts` display RTL content properly additional\nJSON configuration should be used.\nEach chart should be updated based on the specific needs, but general recommendations are:\n\n 1. Set `reversed` to true for xAxis (https://api.highcharts.com/highcharts/xAxis.reversed).\n 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).\n 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).\n\n### Setting colors\n\nAlthough charts can be styled as described above, there is a simpler way for setting colors.\nColors can be set using CSS custom properties `--vaadin-charts-color-{n}` (where `n` goes from `0 - 9`).\n\nFor example `--vaadin-charts-color-0` sets the color of the first series on a chart.",
238
+ "description": "`<vaadin-chart>` is a Web Component for creating high quality charts.\n\n### Basic use\n\nThere are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.\nNote that you can make use of all APIs in your element.\n\n#### Using HTML API\n\n`vaadin-chart` has a set of attributes to make it easier for you to customize your chart.\n\n```html\n<vaadin-chart title=\"The chart title\" subtitle=\"The chart subtitle\">\n <vaadin-chart-series\n type=\"column\"\n title=\"The series title\"\n values=\"[10, 20, 30]\"\n ></vaadin-chart-series>\n</vaadin-chart>\n```\n\n> Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you\n> have to set it as the default series type on `<vaadin-chart>` in order to work properly.\n\n#### Using JS API\n\nUse [`configuration`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha14/#/elements/vaadin-chart#property-configuration) property to set chart title, categories and data:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\n\n// Wait for default configuration to be ready\nrequestAnimationFrame(() => {\n const configuration = chart.configuration;\n configuration.setTitle({ text: 'The chart title' });\n // By default there is one X axis, it is referenced by configuration.xAxis[0].\n configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);\n configuration.addSeries({\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n });\n});\n```\n\n#### Using JS JSON API\n\nUse [`updateConfiguration`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha14/#/elements/vaadin-chart#method-updateConfiguration) method to set chart title, categories and data:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\nchart.updateConfiguration({\n title: {\n text: 'The chart title'\n },\n subtitle: {\n text: 'Subtitle'\n },\n xAxis: {\n categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n },\n series: [{\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n }]\n});\n```\n\n**Note:** chart style customization cannot be done via the JS or JSON API.\nStyling properties in the JSON configuration will be ignored. The following section discusses chart styling.\n\n### CSS Styling\n\nChart appearance is primarily controlled by CSS style rules.\nA comprehensive list of the supported style classes can be found at\nhttps://www.highcharts.com/docs/chart-design-and-style/style-by-css\n\nSee also the [Chart Styling](https://vaadin.com/docs/latest/components/charts/css-styling) documentation.\n\n### RTL support\n\n`vaadin-charts` as well as [Highcharts](https://www.highcharts.com/) by itself are not adjusting the layout\nbased on the `dir` attribute. In order to make `vaadin-charts` display RTL content properly additional\nJSON configuration should be used.\nEach chart should be updated based on the specific needs, but general recommendations are:\n\n 1. Set `reversed` to true for xAxis (https://api.highcharts.com/highcharts/xAxis.reversed).\n 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).\n 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).\n\n### Setting colors\n\nAlthough charts can be styled as described above, there is a simpler way for setting colors.\nColors can be set using CSS custom properties `--vaadin-charts-color-{n}` (where `n` goes from `0 - 9`).\n\nFor example `--vaadin-charts-color-0` sets the color of the first series on a chart.",
239
239
  "attributes": [
240
240
  {
241
241
  "name": "category-max",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "25.0.0-alpha12",
4
+ "version": "25.0.0-alpha14",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-chart-series",
19
- "description": "`<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.\n\n### Basic use\n\nTo use `<vaadin-chart-series>`, add it inside a `<vaadin-chart>` element:\n\n```html\n <vaadin-chart>\n <vaadin-chart-series></vaadin-chart-series>\n </vaadin-chart>\n```\n\n`<vaadin-chart-series>` accepts `values` as an array attribute, so you can add it to your element definition:\n\n```html\n <vaadin-chart-series values=\"[10,20,30,40,50]\"></vaadin-chart-series>\n```\n\nwhich will add a new line series, where each value will be a data point.\nLook for the Properties session to see all available attributes.\n\n### Dynamically adding and removing series\n\nYou are also able to add and remove series by using DOM API.\n\nTo create a new series, call `document.createElement('vaadin-chart-series')` and append it to your `<vaadin-chart>`:\n\n```js\n const chart = \\* a <vaadin-chart> reference *\\\n const newSeries = document.createElement('vaadin-chart-series');\n newSeries.values = [10,20,30,40,50];\n chart.appendChild(newSeries);\n```\n\nIn order to remove it, you should use the series to be removed as a reference for the `#removeChild()` call:\n\n```js\n const chart = \\* a <vaadin-chart> reference *\\\n const seriesToBeRemoved = \\* a <vaadin-chart-series> reference to remove*\\\n chart.removeChild(seriesToBeRemoved);\n```",
19
+ "description": "`<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.\n\n### Basic use\n\nTo use `<vaadin-chart-series>`, add it inside a `<vaadin-chart>` element:\n\n```html\n<vaadin-chart>\n <vaadin-chart-series></vaadin-chart-series>\n</vaadin-chart>\n```\n\n`<vaadin-chart-series>` accepts `values` as an array attribute, so you can add it to your element definition:\n\n```html\n<vaadin-chart-series values=\"[10, 20, 30, 40, 50]\"></vaadin-chart-series>\n```\n\nwhich will add a new line series, where each value will be a data point.\nLook for the Properties session to see all available attributes.\n\n### Dynamically adding and removing series\n\nYou are also able to add and remove series by using DOM API.\n\nTo create a new series, call `document.createElement('vaadin-chart-series')` and append it to your `<vaadin-chart>`:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\nconst newSeries = document.createElement('vaadin-chart-series');\nnewSeries.values = [10, 20, 30, 40, 50];\nchart.appendChild(newSeries);\n```\n\nIn order to remove it, you should use the series to be removed as a reference for the `#removeChild()` call:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\nconst seriesToBeRemoved = chart.querySelector('vaadin-chart-series');\nchart.removeChild(seriesToBeRemoved);\n```",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -100,7 +100,7 @@
100
100
  },
101
101
  {
102
102
  "name": "vaadin-chart",
103
- "description": "`<vaadin-chart>` is a Web Component for creating high quality charts.\n\n### Basic use\n\nThere are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.\nNote that you can make use of all APIs in your element.\n\n#### Configuring your chart using HTML API\n\n`vaadin-chart` has a set of attributes to make it easier for you to customize your chart.\n\n```html\n <vaadin-chart title=\"The chart title\" subtitle=\"The chart subtitle\">\n <vaadin-chart-series\n type=\"column\"\n title=\"The series title\"\n values=\"[10,20,30]\">\n </vaadin-chart-series>\n </vaadin-chart>\n```\n\n> Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you\n> have to set it as the default series type on `<vaadin-chart>` in order to work properly.\n\n#### Configuring your chart using JS API\n\n1. Set an id for the `<vaadin-chart>` in the template\n```html\n <vaadin-chart id=\"mychart\"></vaadin-chart>\n```\n1. Add a function that uses `configuration` property (JS Api) to set chart title, categories and data\n```js\ninitChartWithJSApi() {\n requestAnimationFrame(() => {\n const configuration = this.$.mychart.configuration;\n configuration.setTitle({ text: 'The chart title' });\n // By default there is one X axis, it is referenced by configuration.xAxis[0].\n configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);\n configuration.addSeries({\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n });\n });\n}\n```\n1. Call that function from connectedCallback (when the element is added to a document)\n```js\nconnectedCallback() {\n super.connectedCallback();\n this.initChartWithJSApi();\n}\n```\n\n#### Configuring your chart using JS JSON API\n\nJS JSON API is a simple alternative to the JS API.\n\n1. Set an id for the `<vaadin-chart>` in the template\n```html\n <vaadin-chart id=\"mychart\"></vaadin-chart>\n```\n1. Add a function that uses `updateConfiguration` method (JS JSON Api) to set chart title, categories and data\n```js\ninitChartWithJSJSONApi() {\n this.$.mychart.updateConfiguration({\n title: {\n text: 'The chart title'\n },\n subtitle: {\n text: 'Subtitle'\n },\n xAxis: {\n categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n },\n series: [{\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n }]\n });\n}\n```\n1. Call that function from connectedCallback (when the element is added to a document)\n```js\nconnectedCallback() {\n super.connectedCallback();\n this.initChartWithJSJSONApi();\n}\n```\n\nIt should be noted that chart style customization cannot be done via the JS or JSON API.\nStyling properties in the JSON configuration will be ignored. The following section discusses chart styling.\n\n### CSS Styling\n\nChart appearance is primarily controlled by CSS style rules.\nA comprehensive list of the supported style classes can be found at\nhttps://www.highcharts.com/docs/chart-design-and-style/style-by-css\n\nSee also the [Chart Styling](https://vaadin.com/docs/latest/components/charts/css-styling) documentation.\n\n### RTL support\n\n`vaadin-charts` as well as [Highcharts](https://www.highcharts.com/) by itself are not adjusting the layout\nbased on the `dir` attribute. In order to make `vaadin-charts` display RTL content properly additional\nJSON configuration should be used.\nEach chart should be updated based on the specific needs, but general recommendations are:\n\n 1. Set `reversed` to true for xAxis (https://api.highcharts.com/highcharts/xAxis.reversed).\n 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).\n 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).\n\n### Setting colors\n\nAlthough charts can be styled as described above, there is a simpler way for setting colors.\nColors can be set using CSS custom properties `--vaadin-charts-color-{n}` (where `n` goes from `0 - 9`).\n\nFor example `--vaadin-charts-color-0` sets the color of the first series on a chart.",
103
+ "description": "`<vaadin-chart>` is a Web Component for creating high quality charts.\n\n### Basic use\n\nThere are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.\nNote that you can make use of all APIs in your element.\n\n#### Using HTML API\n\n`vaadin-chart` has a set of attributes to make it easier for you to customize your chart.\n\n```html\n<vaadin-chart title=\"The chart title\" subtitle=\"The chart subtitle\">\n <vaadin-chart-series\n type=\"column\"\n title=\"The series title\"\n values=\"[10, 20, 30]\"\n ></vaadin-chart-series>\n</vaadin-chart>\n```\n\n> Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you\n> have to set it as the default series type on `<vaadin-chart>` in order to work properly.\n\n#### Using JS API\n\nUse [`configuration`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha14/#/elements/vaadin-chart#property-configuration) property to set chart title, categories and data:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\n\n// Wait for default configuration to be ready\nrequestAnimationFrame(() => {\n const configuration = chart.configuration;\n configuration.setTitle({ text: 'The chart title' });\n // By default there is one X axis, it is referenced by configuration.xAxis[0].\n configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);\n configuration.addSeries({\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n });\n});\n```\n\n#### Using JS JSON API\n\nUse [`updateConfiguration`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha14/#/elements/vaadin-chart#method-updateConfiguration) method to set chart title, categories and data:\n\n```js\nconst chart = document.querySelector('vaadin-chart');\nchart.updateConfiguration({\n title: {\n text: 'The chart title'\n },\n subtitle: {\n text: 'Subtitle'\n },\n xAxis: {\n categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n },\n series: [{\n type: 'column',\n data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]\n }]\n});\n```\n\n**Note:** chart style customization cannot be done via the JS or JSON API.\nStyling properties in the JSON configuration will be ignored. The following section discusses chart styling.\n\n### CSS Styling\n\nChart appearance is primarily controlled by CSS style rules.\nA comprehensive list of the supported style classes can be found at\nhttps://www.highcharts.com/docs/chart-design-and-style/style-by-css\n\nSee also the [Chart Styling](https://vaadin.com/docs/latest/components/charts/css-styling) documentation.\n\n### RTL support\n\n`vaadin-charts` as well as [Highcharts](https://www.highcharts.com/) by itself are not adjusting the layout\nbased on the `dir` attribute. In order to make `vaadin-charts` display RTL content properly additional\nJSON configuration should be used.\nEach chart should be updated based on the specific needs, but general recommendations are:\n\n 1. Set `reversed` to true for xAxis (https://api.highcharts.com/highcharts/xAxis.reversed).\n 2. Set `useHTML` to true for text elements, i.e. `tooltip` (https://api.highcharts.com/highcharts/tooltip.useHTML).\n 3. Set `rtl` to true for `legend` (https://api.highcharts.com/highcharts/legend.rtl).\n\n### Setting colors\n\nAlthough charts can be styled as described above, there is a simpler way for setting colors.\nColors can be set using CSS custom properties `--vaadin-charts-color-{n}` (where `n` goes from `0 - 9`).\n\nFor example `--vaadin-charts-color-0` sets the color of the first series on a chart.",
104
104
  "extension": true,
105
105
  "attributes": [
106
106
  {