@vaadin/charts 25.0.0-alpha2 → 25.0.0-alpha21

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.
@@ -9,11 +9,13 @@
9
9
  * license.
10
10
  */
11
11
  import './vaadin-chart-series.js';
12
- import { css, html, LitElement } from 'lit';
12
+ import { html, LitElement } from 'lit';
13
13
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
14
14
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
15
15
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
16
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
16
17
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
18
+ import { chartStyles } from './styles/vaadin-chart-base-styles.js';
17
19
  import { ChartMixin } from './vaadin-chart-mixin.js';
18
20
 
19
21
  /**
@@ -24,89 +26,67 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
24
26
  * There are two ways of configuring your `<vaadin-chart>` element: **HTML API**, **JS API** and **JSON API**.
25
27
  * Note that you can make use of all APIs in your element.
26
28
  *
27
- * #### Configuring your chart using HTML API
29
+ * #### Using HTML API
28
30
  *
29
31
  * `vaadin-chart` has a set of attributes to make it easier for you to customize your chart.
30
32
  *
31
33
  * ```html
32
- * <vaadin-chart title="The chart title" subtitle="The chart subtitle">
33
- * <vaadin-chart-series
34
- * type="column"
35
- * title="The series title"
36
- * values="[10,20,30]">
37
- * </vaadin-chart-series>
38
- * </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>
39
41
  * ```
40
42
  *
41
43
  * > Note that while you can set type for each series individually, for some types, such as `'bar'`, `'gauge'` and `'solidgauge'`, you
42
44
  * > have to set it as the default series type on `<vaadin-chart>` in order to work properly.
43
45
  *
44
- * #### 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:
45
49
  *
46
- * 1. Set an id for the `<vaadin-chart>` in the template
47
- * ```html
48
- * <vaadin-chart id="mychart"></vaadin-chart>
49
- * ```
50
- * 1. Add a function that uses `configuration` property (JS Api) to set chart title, categories and data
51
- * ```js
52
- * initChartWithJSApi() {
53
- * requestAnimationFrame(() => {
54
- * const configuration = this.$.mychart.configuration;
55
- * configuration.setTitle({ text: 'The chart title' });
56
- * // By default there is one X axis, it is referenced by configuration.xAxis[0].
57
- * configuration.xAxis[0].setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
58
- * configuration.addSeries({
59
- * type: 'column',
60
- * 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]
61
- * });
62
- * });
63
- * }
64
- * ```
65
- * 1. Call that function from connectedCallback (when the element is added to a document)
66
50
  * ```js
67
- * connectedCallback() {
68
- * super.connectedCallback();
69
- * this.initChartWithJSApi();
70
- * }
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
+ * });
71
64
  * ```
72
65
  *
73
- * #### Configuring your chart using JS JSON API
66
+ * #### Using JS JSON API
74
67
  *
75
- * 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:
76
69
  *
77
- * 1. Set an id for the `<vaadin-chart>` in the template
78
- * ```html
79
- * <vaadin-chart id="mychart"></vaadin-chart>
80
- * ```
81
- * 1. Add a function that uses `updateConfiguration` method (JS JSON Api) to set chart title, categories and data
82
70
  * ```js
83
- * initChartWithJSJSONApi() {
84
- * this.$.mychart.updateConfiguration({
85
- * title: {
86
- * text: 'The chart title'
87
- * },
88
- * subtitle: {
89
- * text: 'Subtitle'
90
- * },
91
- * xAxis: {
92
- * categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
93
- * },
94
- * series: [{
95
- * type: 'column',
96
- * 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]
97
- * }]
98
- * });
99
- * }
100
- * ```
101
- * 1. Call that function from connectedCallback (when the element is added to a document)
102
- * ```js
103
- * connectedCallback() {
104
- * super.connectedCallback();
105
- * this.initChartWithJSJSONApi();
106
- * }
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
+ * });
107
87
  * ```
108
88
  *
109
- * 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.
110
90
  * Styling properties in the JSON configuration will be ignored. The following section discusses chart styling.
111
91
  *
112
92
  * ### CSS Styling
@@ -135,11 +115,6 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
135
115
  *
136
116
  * For example `--vaadin-charts-color-0` sets the color of the first series on a chart.
137
117
  *
138
- * ### Validating your License
139
- *
140
- * When using Vaadin Charts in a development environment, you will see a pop-up that asks you
141
- * to validate your license by signing in to vaadin.com.
142
- *
143
118
  * @fires {CustomEvent} chart-add-series - Fired when a new series is added.
144
119
  * @fires {CustomEvent} chart-after-export - Fired after a chart is exported.
145
120
  * @fires {CustomEvent} chart-after-print - Fired after a chart is printed.
@@ -152,6 +127,7 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
152
127
  * @fires {CustomEvent} chart-drillupall - Fired after all the drilldown series has been drilled up.
153
128
  * @fires {CustomEvent} chart-redraw - Fired after the chart redraw.
154
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.
155
131
  * @fires {CustomEvent} series-after-animate - Fired when the series has finished its initial animation.
156
132
  * @fires {CustomEvent} series-checkbox-click - Fired when the checkbox next to the series' name in the legend is clicked.
157
133
  * @fires {CustomEvent} series-click - Fired when the series is clicked.
@@ -171,8 +147,8 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
171
147
  * @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
172
148
  * @fires {CustomEvent} point-drop - Fired when the point is dropped.
173
149
  * @fires {CustomEvent} point-drag - Fired while dragging a point.
174
- * @fires {CustomEvent} xaxes-extremes-set - Fired when when the minimum and maximum is set for the X axis.
175
- * @fires {CustomEvent} yaxes-extremes-set - Fired when when the minimum and maximum is set for the Y axis.
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.
176
152
  *
177
153
  * @customElement
178
154
  * @extends HTMLElement
@@ -180,7 +156,7 @@ import { ChartMixin } from './vaadin-chart-mixin.js';
180
156
  * @mixes ThemableMixin
181
157
  * @mixes ElementMixin
182
158
  */
183
- class Chart extends ChartMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
159
+ class Chart extends ChartMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
184
160
  static get is() {
185
161
  return 'vaadin-chart';
186
162
  }
@@ -190,23 +166,21 @@ class Chart extends ChartMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElemen
190
166
  }
191
167
 
192
168
  static get styles() {
193
- return css`
194
- :host {
195
- display: block;
196
- width: 100%;
197
- overflow: hidden;
198
- }
169
+ return chartStyles;
170
+ }
199
171
 
200
- :host([hidden]) {
201
- display: none !important;
202
- }
203
- `;
172
+ static get lumoInjector() {
173
+ return {
174
+ includeBaseStyles: true,
175
+ };
204
176
  }
205
177
 
206
178
  /** @protected */
207
179
  render() {
208
180
  return html`
209
- <div id="chart"></div>
181
+ <div id="wrapper" style="height: 100%; width: 100%;">
182
+ <div id="chart" style="height: 100%; width: 100%;"></div>
183
+ </div>
210
184
  <slot id="slot"></slot>
211
185
  `;
212
186
  }
package/vaadin-chart.js CHANGED
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-chart.js';
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-alpha2",
4
+ "version": "25.0.0-alpha21",
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.\n\n### Validating your License\n\nWhen using Vaadin Charts in a development environment, you will see a pop-up that asks you\nto validate your license by signing in to vaadin.com.",
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-alpha21/#/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-alpha21/#/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 when the minimum and maximum is set for the x axis."
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 when the minimum and maximum is set for the y axis."
692
+ "description": "Fired when the minimum and maximum is set for the y axis."
689
693
  }
690
694
  ]
691
695
  }
@@ -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-alpha2",
4
+ "version": "25.0.0-alpha21",
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.\n\n### Validating your License\n\nWhen using Vaadin Charts in a development environment, you will see a pop-up that asks you\nto validate your license by signing in to vaadin.com.",
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-alpha21/#/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-alpha21/#/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 when the minimum and maximum is set for the x axis.",
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 when the minimum and maximum is set for the y axis.",
451
+ "description": "Fired when the minimum and maximum is set for the y axis.",
445
452
  "value": {
446
453
  "kind": "expression"
447
454
  }
@@ -1,6 +0,0 @@
1
- import '../vaadin-chart-base-theme.js';
2
- import '@vaadin/vaadin-lumo-styles/color.js';
3
- import '@vaadin/vaadin-lumo-styles/typography.js';
4
- declare const chartColors: import("lit").CSSResult;
5
- declare const chartTheme: import("lit").CSSResult;
6
- export { chartColors, chartTheme };
@@ -1,97 +0,0 @@
1
- import '../vaadin-chart-base-theme.js';
2
- import '@vaadin/vaadin-lumo-styles/color.js';
3
- import '@vaadin/vaadin-lumo-styles/typography.js';
4
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
5
-
6
- const chartColors = css`
7
- :host {
8
- --vaadin-charts-color-0: #5ac2f7;
9
- --vaadin-charts-color-1: #1676f3;
10
- --vaadin-charts-color-2: #ff7d94;
11
- --vaadin-charts-color-3: #c5164e;
12
- --vaadin-charts-color-4: #15c15d;
13
- --vaadin-charts-color-5: #0e8151;
14
- --vaadin-charts-color-6: #c18ed2;
15
- --vaadin-charts-color-7: #9233b3;
16
- --vaadin-charts-color-8: #fda253;
17
- --vaadin-charts-color-9: #e24932;
18
- --vaadin-charts-color-positive: var(--vaadin-charts-color-4, #15c15d);
19
- --vaadin-charts-color-negative: var(--vaadin-charts-color-9, #e24932);
20
- }
21
-
22
- :host([theme~='gradient']) {
23
- --vaadin-charts-color-0: #1676f3;
24
- --vaadin-charts-color-1: #13bbf0;
25
- --vaadin-charts-color-2: #1ee;
26
- --vaadin-charts-color-3: #0cd9bf;
27
- --vaadin-charts-color-4: #06be81;
28
- --vaadin-charts-color-5: #00a344;
29
- --vaadin-charts-color-6: #41c639;
30
- --vaadin-charts-color-7: #8aed2c;
31
- --vaadin-charts-color-8: #c0e632;
32
- --vaadin-charts-color-9: #f6db3a;
33
- --vaadin-charts-color-positive: var(--vaadin-charts-color-6);
34
- --vaadin-charts-color-negative: var(--vaadin-charts-color-1);
35
- }
36
-
37
- :host([theme~='monotone']) {
38
- --vaadin-charts-color-0: #1676f3;
39
- --vaadin-charts-color-1: #4795f5;
40
- --vaadin-charts-color-2: #71b0f7;
41
- --vaadin-charts-color-3: #a0cef9;
42
- --vaadin-charts-color-4: #bce0fa;
43
- --vaadin-charts-color-5: #a8d8ed;
44
- --vaadin-charts-color-6: #7fc3dd;
45
- --vaadin-charts-color-7: #54adcc;
46
- --vaadin-charts-color-8: #2b99bc;
47
- --vaadin-charts-color-9: #0284ac;
48
- --vaadin-charts-color-positive: var(--vaadin-charts-color-3);
49
- --vaadin-charts-color-negative: var(--vaadin-charts-color-9);
50
- }
51
-
52
- :host([theme~='classic']) {
53
- --vaadin-charts-color-0: #7cb5ec;
54
- --vaadin-charts-color-1: #434348;
55
- --vaadin-charts-color-2: #90ed7d;
56
- --vaadin-charts-color-3: #f7a35c;
57
- --vaadin-charts-color-4: #8085e9;
58
- --vaadin-charts-color-5: #f15c80;
59
- --vaadin-charts-color-6: #e4d354;
60
- --vaadin-charts-color-7: #2b908f;
61
- --vaadin-charts-color-8: #f45b5b;
62
- --vaadin-charts-color-9: #91e8e1;
63
- }
64
- `;
65
-
66
- const chartTheme = css`
67
- :host {
68
- --vaadin-charts-background: var(--lumo-base-color);
69
- --vaadin-charts-title-label: var(--lumo-header-text-color);
70
- --vaadin-charts-axis-title: var(--lumo-secondary-text-color);
71
- --vaadin-charts-axis-label: var(--lumo-secondary-text-color);
72
- --vaadin-charts-data-label: var(--lumo-body-text-color);
73
- --vaadin-charts-secondary-label: var(--lumo-secondary-text-color);
74
- --vaadin-charts-axis-line: var(--lumo-contrast-5pct);
75
- --vaadin-charts-grid-line: var(--lumo-contrast-20pct);
76
- --vaadin-charts-disabled-label: var(--lumo-disabled-text-color);
77
- --vaadin-charts-contrast: var(--lumo-contrast);
78
- --vaadin-charts-contrast-5pct: var(--lumo-contrast-5pct);
79
- --vaadin-charts-contrast-10pct: var(--lumo-contrast-10pct);
80
- --vaadin-charts-contrast-20pct: var(--lumo-contrast-20pct);
81
- --vaadin-charts-contrast-60pct: var(--lumo-contrast-60pct);
82
- --vaadin-charts-tooltip-background: var(--lumo-base-color);
83
- --vaadin-charts-tooltip-border-color: inherit;
84
- --vaadin-charts-button-label: var(--lumo-primary-text-color);
85
- --vaadin-charts-button-background: var(--lumo-contrast-5pct);
86
- --vaadin-charts-button-hover-background: var(--lumo-primary-color-10pct);
87
- --vaadin-charts-button-active-label: var(--lumo-primary-contrast-color);
88
- --vaadin-charts-button-active-background: var(--lumo-primary-color);
89
- --vaadin-charts-xaxis-line-width: 0;
90
- --vaadin-charts-tooltip-background-opacity: 1;
91
- font-family: var(--lumo-font-family);
92
- }
93
- `;
94
-
95
- registerStyles('vaadin-chart', [chartColors, chartTheme], { moduleId: 'lumo-chart' });
96
-
97
- export { chartColors, chartTheme };
@@ -1,2 +0,0 @@
1
- import './vaadin-chart-styles.js';
2
- import '../../src/vaadin-chart.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-chart-styles.js';
2
- import '../../src/vaadin-chart.js';