@vaadin/charts 25.0.0-alpha8 → 25.0.0-beta1
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 +9 -10
- package/src/helpers.js +46 -0
- package/src/styles/vaadin-chart-base-styles.js +1402 -0
- package/src/vaadin-chart-mixin.d.ts +9 -2
- package/src/vaadin-chart-mixin.js +131 -73
- package/src/vaadin-chart-series.d.ts +11 -11
- package/src/vaadin-chart-series.js +11 -11
- package/src/vaadin-chart.d.ts +46 -72
- package/src/vaadin-chart.js +50 -74
- package/vaadin-chart.js +1 -1
- package/web-types.json +9 -5
- package/web-types.lit.json +12 -5
- package/src/styles/vaadin-chart-core-styles.js +0 -1063
- package/theme/lumo/vaadin-chart-styles.d.ts +0 -5
- package/theme/lumo/vaadin-chart-styles.js +0 -96
- package/theme/lumo/vaadin-chart.d.ts +0 -2
- package/theme/lumo/vaadin-chart.js +0 -2
- /package/src/styles/{vaadin-chart-core-styles.d.ts → vaadin-chart-base-styles.d.ts} +0 -0
package/src/vaadin-chart.js
CHANGED
|
@@ -15,7 +15,7 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
|
15
15
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
16
16
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
17
17
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
18
|
-
import { chartStyles } from './styles/vaadin-chart-
|
|
18
|
+
import { chartStyles } from './styles/vaadin-chart-base-styles.js';
|
|
19
19
|
import { ChartMixin } from './vaadin-chart-mixin.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -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
|
-
* ####
|
|
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
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
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
|
-
* ####
|
|
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
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
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
|
-
* ####
|
|
66
|
+
* #### Using JS JSON API
|
|
76
67
|
*
|
|
77
|
-
*
|
|
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
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
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
|
-
*
|
|
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
|
|
@@ -137,11 +115,6 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
|
|
|
137
115
|
*
|
|
138
116
|
* For example `--vaadin-charts-color-0` sets the color of the first series on a chart.
|
|
139
117
|
*
|
|
140
|
-
* ### Validating your License
|
|
141
|
-
*
|
|
142
|
-
* When using Vaadin Charts in a development environment, you will see a pop-up that asks you
|
|
143
|
-
* to validate your license by signing in to vaadin.com.
|
|
144
|
-
*
|
|
145
118
|
* @fires {CustomEvent} chart-add-series - Fired when a new series is added.
|
|
146
119
|
* @fires {CustomEvent} chart-after-export - Fired after a chart is exported.
|
|
147
120
|
* @fires {CustomEvent} chart-after-print - Fired after a chart is printed.
|
|
@@ -154,6 +127,7 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
|
|
|
154
127
|
* @fires {CustomEvent} chart-drillupall - Fired after all the drilldown series has been drilled up.
|
|
155
128
|
* @fires {CustomEvent} chart-redraw - Fired after the chart redraw.
|
|
156
129
|
* @fires {CustomEvent} chart-selection - Fired when an area of the chart has been selected.
|
|
130
|
+
* @fires {CustomEvent} chart-end-resize - Fired when the chart finishes resizing.
|
|
157
131
|
* @fires {CustomEvent} series-after-animate - Fired when the series has finished its initial animation.
|
|
158
132
|
* @fires {CustomEvent} series-checkbox-click - Fired when the checkbox next to the series' name in the legend is clicked.
|
|
159
133
|
* @fires {CustomEvent} series-click - Fired when the series is clicked.
|
|
@@ -173,8 +147,8 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
|
|
|
173
147
|
* @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
|
|
174
148
|
* @fires {CustomEvent} point-drop - Fired when the point is dropped.
|
|
175
149
|
* @fires {CustomEvent} point-drag - Fired while dragging a point.
|
|
176
|
-
* @fires {CustomEvent} xaxes-extremes-set - Fired when
|
|
177
|
-
* @fires {CustomEvent} yaxes-extremes-set - Fired when
|
|
150
|
+
* @fires {CustomEvent} xaxes-extremes-set - Fired when the minimum and maximum is set for the X axis.
|
|
151
|
+
* @fires {CustomEvent} yaxes-extremes-set - Fired when the minimum and maximum is set for the Y axis.
|
|
178
152
|
*
|
|
179
153
|
* @customElement
|
|
180
154
|
* @extends HTMLElement
|
|
@@ -204,7 +178,9 @@ class Chart extends ChartMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjec
|
|
|
204
178
|
/** @protected */
|
|
205
179
|
render() {
|
|
206
180
|
return html`
|
|
207
|
-
<div id="
|
|
181
|
+
<div id="wrapper" style="height: 100%; width: 100%;">
|
|
182
|
+
<div id="chart" style="height: 100%; width: 100%;"></div>
|
|
183
|
+
</div>
|
|
208
184
|
<slot id="slot"></slot>
|
|
209
185
|
`;
|
|
210
186
|
}
|
package/vaadin-chart.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-chart.js';
|
|
2
2
|
export * from './src/vaadin-chart.js';
|
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-
|
|
4
|
+
"version": "25.0.0-beta1",
|
|
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
|
|
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####
|
|
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-beta1/#/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-beta1/#/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",
|
|
@@ -591,6 +591,10 @@
|
|
|
591
591
|
"name": "chart-drillupall",
|
|
592
592
|
"description": "Fired after all the series has been drilled up if chart has multiple drilldown series."
|
|
593
593
|
},
|
|
594
|
+
{
|
|
595
|
+
"name": "chart-end-resize",
|
|
596
|
+
"description": "Fired when the chart finishes resizing."
|
|
597
|
+
},
|
|
594
598
|
{
|
|
595
599
|
"name": "chart-load",
|
|
596
600
|
"description": "Fired when the chart is finished loading."
|
|
@@ -681,11 +685,11 @@
|
|
|
681
685
|
},
|
|
682
686
|
{
|
|
683
687
|
"name": "xaxes-extremes-set",
|
|
684
|
-
"description": "Fired when
|
|
688
|
+
"description": "Fired when the minimum and maximum is set for the x axis."
|
|
685
689
|
},
|
|
686
690
|
{
|
|
687
691
|
"name": "yaxes-extremes-set",
|
|
688
|
-
"description": "Fired when
|
|
692
|
+
"description": "Fired when the minimum and maximum is set for the y axis."
|
|
689
693
|
}
|
|
690
694
|
]
|
|
691
695
|
}
|
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": "25.0.0-
|
|
4
|
+
"version": "25.0.0-beta1",
|
|
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
|
|
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####
|
|
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-beta1/#/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-beta1/#/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
|
{
|
|
@@ -278,6 +278,13 @@
|
|
|
278
278
|
"kind": "expression"
|
|
279
279
|
}
|
|
280
280
|
},
|
|
281
|
+
{
|
|
282
|
+
"name": "@chart-end-resize",
|
|
283
|
+
"description": "Fired when the chart finishes resizing.",
|
|
284
|
+
"value": {
|
|
285
|
+
"kind": "expression"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
281
288
|
{
|
|
282
289
|
"name": "@chart-load",
|
|
283
290
|
"description": "Fired when the chart is finished loading.",
|
|
@@ -434,14 +441,14 @@
|
|
|
434
441
|
},
|
|
435
442
|
{
|
|
436
443
|
"name": "@xaxes-extremes-set",
|
|
437
|
-
"description": "Fired when
|
|
444
|
+
"description": "Fired when the minimum and maximum is set for the x axis.",
|
|
438
445
|
"value": {
|
|
439
446
|
"kind": "expression"
|
|
440
447
|
}
|
|
441
448
|
},
|
|
442
449
|
{
|
|
443
450
|
"name": "@yaxes-extremes-set",
|
|
444
|
-
"description": "Fired when
|
|
451
|
+
"description": "Fired when the minimum and maximum is set for the y axis.",
|
|
445
452
|
"value": {
|
|
446
453
|
"kind": "expression"
|
|
447
454
|
}
|