1e41f4b71Sopenharmony_ci# chart
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci>  **NOTE**
4e41f4b71Sopenharmony_ci>
5e41f4b71Sopenharmony_ci>  This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciThe **\<chart>** component displays line charts, gauge charts, and bar charts.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Required Permissions
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciNone
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci## Child Components
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciNot supported
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## Attributes
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-components-common-attributes.md), the following attributes are supported.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci| Name                            | Type                                      | Default Value | Mandatory  | Description                                      |
24e41f4b71Sopenharmony_ci| ------------------------------ | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
25e41f4b71Sopenharmony_ci| type                           | string                                   | line | No   | Chart type. Dynamic modification is not supported. Available values include:<br>- **bar**: bar chart<br>- **line**: line chart<br>- **gauge**: gauge chart<br>- **progress**<sup>5+</sup>: circle chart of progresses<br>- **loading**<sup>5+</sup>: circle chart of loading processes<br>- **rainbow**<sup>5+</sup>: circle chart of proportions|
26e41f4b71Sopenharmony_ci| options                        | ChartOptions                             | -    | No   | Chart parameters. You must set parameters for bar charts and line charts. Parameter settings for gauge charts do not take effect. You can set the minimum value, maximum value, scale, and line width of the x-axis or y-axis, whether to display the x-axis and y-axis, and whether the line is smooth. Dynamic modification is not supported.|
27e41f4b71Sopenharmony_ci| datasets                       | Array&lt;ChartDataset&gt;                | -    | No   | Data sets. You must set data sets for bar charts and line charts. Data sets for a gauge chart do not take effect. You can set multiple datasets and their background colors.|
28e41f4b71Sopenharmony_ci| segments<sup>5+</sup>          | DataSegment \| Array&lt;DataSegment&gt; | -    | No   | Data structures used by **progress**, **loading**, and **rainbow** charts.<br>**DataSegment** is available for **progress** and **loading** charts.<br>**Array&lt;DataSegment&gt;** is available for **rainbow** charts. A maximum of nine **DataSegment**s are supported in the array.|
29e41f4b71Sopenharmony_ci| effects<sup>5+</sup>           | boolean                                  | true | No   | Whether to enable the effects for **progress** and **rainbow** charts.                      |
30e41f4b71Sopenharmony_ci| animationduration<sup>6+</sup> | number                                   | 3000 | No   | Animation duration for expanding a **rainbow** chart, in milliseconds.                  |
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**Table 1** ChartOptions
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci| Name    | Type         | Default Value | Mandatory  | Description                                      |
35e41f4b71Sopenharmony_ci| ------ | ----------- | ---- | ---- | ---------------------------------------- |
36e41f4b71Sopenharmony_ci| xAxis  | ChartAxis   | -    | Yes   | X-axis parameters. You can set the minimum value, maximum value, and scale of the x-axis, and whether to display the x-axis.         |
37e41f4b71Sopenharmony_ci| yAxis  | ChartAxis   | -    | Yes   | Y-axis parameters. You can set the minimum value, maximum value, and scale of the y-axis, and whether to display the y-axis.         |
38e41f4b71Sopenharmony_ci| series | ChartSeries | -    | No   | Data sequence parameters. Only line charts support this attribute.<br>- Line style, such as the line width and whether the line is smooth.<br>- Style and size of the white point at the start of the line.|
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci**Table 2** ChartDataset
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci| Name         | Type                                      | Default Value     | Mandatory  | Description                    |
43e41f4b71Sopenharmony_ci| ----------- | ---------------------------------------- | -------- | ---- | ---------------------- |
44e41f4b71Sopenharmony_ci| strokeColor | &lt;color&gt;                            | \#ff6384 | No   | Stroke color. Only line charts support this attribute.         |
45e41f4b71Sopenharmony_ci| fillColor   | &lt;color&gt;                            | \#ff6384 | No   | Fill color.<br>For line charts, the value indicates the gradient color to fill.|
46e41f4b71Sopenharmony_ci| data        | Array&lt;number&gt; \| Array&lt;Point&gt;<sup>5+</sup> | -        | Yes   | Data of the drawn line or bar.          |
47e41f4b71Sopenharmony_ci| gradient    | boolean                                  | false    | No   | Whether to display the gradient color. Only line charts support this attribute.   |
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**Table 3** ChartAxis
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci| Name      | Type           | Default Value     | Mandatory  | Description                                      |
52e41f4b71Sopenharmony_ci| -------- | ------------- | -------- | ---- | ---------------------------------------- |
53e41f4b71Sopenharmony_ci| min      | number        | 0        | No   | Minimum value of the axis. Only line charts support negative numbers.                         |
54e41f4b71Sopenharmony_ci| max      | number        | 100      | No   | Maximum value of the axis. Only line charts support negative numbers.                         |
55e41f4b71Sopenharmony_ci| axisTick | number        | 10       | No   | Number of scales displayed on the axis. The value ranges from 1 to 20. The display effect depends on the calculation result of Number of pixels occupied by the image width/(**max** – **min**).<br>In the bar chart, the number of bars in each group of data is the same as the number of scales, and the bars are displayed at the scales.|
56e41f4b71Sopenharmony_ci| display  | boolean       | false    | No   | Whether to display the axis.                                  |
57e41f4b71Sopenharmony_ci| color    | &lt;color&gt; | \#c0c0c0 | No   | Axis color.                                    |
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci**Table 4** ChartSeries
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci| Name         | Type            | Default Value | Mandatory  | Description                  |
62e41f4b71Sopenharmony_ci| ----------- | -------------- | ---- | ---- | -------------------- |
63e41f4b71Sopenharmony_ci| lineStyle   | ChartLineStyle | -    | No   | Line style, such as the line width and whether the line is smooth.     |
64e41f4b71Sopenharmony_ci| headPoint   | PointStyle     | -    | No   | Style and size of the white point at the start of the line.     |
65e41f4b71Sopenharmony_ci| topPoint    | PointStyle     | -    | No   | Style and size of the top point.          |
66e41f4b71Sopenharmony_ci| bottomPoint | PointStyle     | -    | No   | Style and size of the bottom point.          |
67e41f4b71Sopenharmony_ci| loop        | ChartLoop      | -    | No   | Whether to start drawing again when the screen is looped.|
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci**Table 5** ChartLineStyle
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci| Name    | Type            | Default Value  | Mandatory  | Description   |
72e41f4b71Sopenharmony_ci| ------ | -------------- | ----- | ---- | ----- |
73e41f4b71Sopenharmony_ci| width  | &lt;length&gt; | 1px   | No   | Line width.|
74e41f4b71Sopenharmony_ci| smooth | boolean        | false | No   | Whether the line is smooth.|
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**Table 6** PointStyle
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci| Name         | Type            | Default Value     | Mandatory  | Description                                      |
79e41f4b71Sopenharmony_ci| ----------- | -------------- | -------- | ---- | ---------------------------------------- |
80e41f4b71Sopenharmony_ci| shape       | string         | circle   | No   | Shape of the highlight point. Available values are as follows:<br>- circle<br>- square<br>- triangle|
81e41f4b71Sopenharmony_ci| size        | &lt;length&gt; | 5px      | No   | Size of the highlight point.                                 |
82e41f4b71Sopenharmony_ci| strokeWidth | &lt;length&gt; | 1px      | No   | Stroke width.                                    |
83e41f4b71Sopenharmony_ci| strokeColor | &lt;color&gt;  | \#ff0000 | No   | Stroke color.                                   |
84e41f4b71Sopenharmony_ci| fillColor   | &lt;color&gt;  | \#ff0000 | No   | Fill color.                                   |
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci**Table 7** ChartLoop
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci| Name      | Type            | Default Value  | Mandatory  | Description                                      |
89e41f4b71Sopenharmony_ci| -------- | -------------- | ----- | ---- | ---------------------------------------- |
90e41f4b71Sopenharmony_ci| margin   | &lt;length&gt; | 1     | No   | Number of erased points (horizontal distance between the latest drawn point and the earliest point). You are not advised to use **margin** together with **topPoint**, **bottomPoint**, or **headPoint** for mini-, small- and standard-system devices. If you do so, there is a possibility that the point is in the erase area and invisible.|
91e41f4b71Sopenharmony_ci| gradient | boolean        | false | No   | Whether to perform gradient erase.                               |
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci**Table 8** Point<sup>5+</sup>
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci| Name          | Type           | Default Value     | Mandatory  | Description                                      |
96e41f4b71Sopenharmony_ci| ------------ | ------------- | -------- | ---- | ---------------------------------------- |
97e41f4b71Sopenharmony_ci| value        | number        | 0        | Yes   | Y coordinate of the point to draw.                             |
98e41f4b71Sopenharmony_ci| pointStyle   | PointStyle    | -        | No   | Style of the point.                           |
99e41f4b71Sopenharmony_ci| description  | string        | -        | No   | Description text of the point.                             |
100e41f4b71Sopenharmony_ci| textLocation | string        | -        | No   | Position of the description text relative to the point. Available values are as follows: **top**: above the point<br>**bottom**: below the point<br>**none**: not displayed|
101e41f4b71Sopenharmony_ci| textColor    | &lt;color&gt; | \#000000 | No   | Color of the description text.                              |
102e41f4b71Sopenharmony_ci| lineDash     | string        | solid    | No   | Dashed line pattern. You can set the dash length and space length between the dashes. - **"dashed, 5, 5"**: dashed line with each dash in 5 px and a 5 px space between each two dashes. Default value **"solid"** indicates a solid line.|
103e41f4b71Sopenharmony_ci| lineColor    | &lt;color&gt; | \#000000 | No   | Line color. If this attribute is not set, the value of **strokeColor** is used.  |
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci**Table 9** DataSegment<sup>5+</sup>
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci| Name        | Type    | Default Value | Mandatory  | Description                                      |
108e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ---- | ---------------------------------------- |
109e41f4b71Sopenharmony_ci| startColor | Color  | -    | No   | Color of the start position. If this attribute is set, **endColor** must be set. If this attribute is not set, the default color array preset in the system is used. For details about the color values, see the next table.|
110e41f4b71Sopenharmony_ci| endColor   | Color  | -    | No   | Color of the end position. If this attribute is set, **startColor** must be set.<br>If this attribute is not set, the default color array preset in the system is used.|
111e41f4b71Sopenharmony_ci| value      | number | 0    | Yes   | Percentage for the data segment. The maximum value is **100**.                        |
112e41f4b71Sopenharmony_ci| name       | string | -    | No   | Name of the data segment.                                |
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci| Data Segment | Light Mode                       | Dark Mode                       |
115e41f4b71Sopenharmony_ci| ---- | --------------------------- | --------------------------- |
116e41f4b71Sopenharmony_ci| 0    | Start color: \#f7ce00; end color: \#f99b11| Start color: \#d1a738; end color: \#eb933d|
117e41f4b71Sopenharmony_ci| 1    | Start color: \#f76223; end color: \#f2400a| Start color: \#e67d50; end color: \#d9542b|
118e41f4b71Sopenharmony_ci| 2    | Start color: \#f772ac; end color: \#e65392| Start color: \#d5749e; end color: \#d6568d|
119e41f4b71Sopenharmony_ci| 3    | Start color: \#a575eb; end color: \#a12df7| Start color: \#9973d1; end color: \#5552d9|
120e41f4b71Sopenharmony_ci| 4    | Start color: \#7b79f7; end color: \#4b48f7| Start color: \#7977d9; end color: \#f99b11|
121e41f4b71Sopenharmony_ci| 5    | Start color: \#4b8af3; end color: \#007dff| Start color: \#4c81d9; end color: \#217bd9|
122e41f4b71Sopenharmony_ci| 6    | Start color: \#73c1e6; end color: \#4fb4e3| Start color: \#5ea6d1; end color: \#4895c2|
123e41f4b71Sopenharmony_ci| 7    | Start color: \#a5d61d; end color: \#69d14f| Start color: \#91c23a; end color: \#70ba5d|
124e41f4b71Sopenharmony_ci| 8    | Start color: \#a2a2b0; end color: \#8e8e93| Start color: \#8c8c99; end color: \#6b6b76|
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ciFor the **gauge** charts, the following attributes are also supported.
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci| Name     | Type    | Default Value | Mandatory  | Description                    |
129e41f4b71Sopenharmony_ci| ------- | ------ | ---- | ---- | ---------------------- |
130e41f4b71Sopenharmony_ci| percent | number | 0    | No   | Percentage of the current value to the total value. The value ranges from 0 to 100.|
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci## Styles
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ciIn addition to the [universal styles](js-components-common-styles.md), the following styles are supported.
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ci| Name                      | Type            | Default Value                       | Mandatory  | Description                                      |
140e41f4b71Sopenharmony_ci| ------------------------ | -------------- | -------------------------- | ---- | ---------------------------------------- |
141e41f4b71Sopenharmony_ci| stroke-width             | &lt;length&gt; | 32px (**gauge** charts)<br>24px (**rainbow** charts)| No   | Width of the scale bar for **gauge** and **rainbow** charts.                     |
142e41f4b71Sopenharmony_ci| start-angle              | &lt;deg&gt;    | 240 (**gauge** charts)<br>0 (**rainbow** charts)    | No   | Start angle of the scale bar for **gauge** and **rainbow** charts, which starts from zero o'clock. The value ranges from 0 to 360.  |
143e41f4b71Sopenharmony_ci| total-angle              | &lt;deg&gt;    | 240 (**gauge** charts)<br>360 (**rainbow** charts)  | No   | Total length of the scale bar for **gauge** and **rainbow** charts. The value ranges from –360 to 360. A negative number indicates the anticlockwise direction.|
144e41f4b71Sopenharmony_ci| center-x                 | &lt;length&gt; | -                          | No   | Center of the scale bar of the gauge component. This style is supported by the gauge chart only. This style takes precedence over the **position** style in the common styles, and must be used together with **center-y** and **radius**. This style is supported by the gauge chart only.|
145e41f4b71Sopenharmony_ci| center-y                 | &lt;length&gt; | -                          | No   | Center of the scale bar of the gauge component. This style is supported by the gauge chart only. This style takes precedence over the **position** style in the common styles, and must be used together with **center-x** and **radius**. This style is supported by the gauge chart only.|
146e41f4b71Sopenharmony_ci| radius                   | &lt;length&gt; | -                          | No   | Radius of the scale bar of the gauge component. This style is supported by the gauge chart only. This style takes precedence over the **width** and **height** in the common styles, and must be used together with **center-x** and **center-y**. This style is supported by the gauge chart only.|
147e41f4b71Sopenharmony_ci| colors                   | Array          | -                          | No   | Color of each section for the scale bar of the gauge component.<br>For example, **colors: \#ff0000, \#00ff00**. This style is supported by the gauge chart only.|
148e41f4b71Sopenharmony_ci| weights                  | Array          | -                          | No   | Weight of each section for the scale bar of the gauge component.<br>For example, **weights: 2, 2**. This style is supported by the gauge chart only.|
149e41f4b71Sopenharmony_ci| font-family<sup>5+</sup> | Array          | -                          | No   | Font style of the description text. You can use a [custom font](js-components-common-customizing-font.md).|
150e41f4b71Sopenharmony_ci| font-size<sup>5+</sup>   | &lt;length&gt; | -                          | No   | Font size of the description text.                           |
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci## Events
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ciThe [universal events](js-components-common-events.md) are supported.
156e41f4b71Sopenharmony_ci
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci## Methods
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ciIn addition to the [universal methods](js-components-common-methods.md), the following methods are supported.
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci| Name    | Parameter                                      | Description                                      |
163e41f4b71Sopenharmony_ci| ------ | ---------------------------------------- | ---------------------------------------- |
164e41f4b71Sopenharmony_ci| append | {<br>serial: number, <br>data: Array&lt;number&gt;, <br>} | Data is dynamically added to an existing data sequence. The target sequence is specified based on **serial**, which is the subscript of the datasets array and starts from 0. For example, if the value of **serial** is **index**, use **data** to update **datasets[index].data**. Only line charts support this attribute. The value is incremented by 1 based on the horizontal coordinate and is related to the **xAxis min/max** setting.|
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci## Example
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci1. Line chart
169e41f4b71Sopenharmony_ci   ```html
170e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
171e41f4b71Sopenharmony_ci   <div class="container">
172e41f4b71Sopenharmony_ci     <stack class="chart-region">
173e41f4b71Sopenharmony_ci       <image class="chart-background" src="common/background.png"></image>
174e41f4b71Sopenharmony_ci       <chart class="chart-data" type="line" ref="linechart" options="{{lineOps}}" datasets="{{lineData}}"></chart>
175e41f4b71Sopenharmony_ci     </stack>
176e41f4b71Sopenharmony_ci     <button value="Add data" onclick="addData"></button>
177e41f4b71Sopenharmony_ci   </div>
178e41f4b71Sopenharmony_ci   ```
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci   ```css
181e41f4b71Sopenharmony_ci   /* xxx.css */
182e41f4b71Sopenharmony_ci   .container {
183e41f4b71Sopenharmony_ci     flex-direction: column;
184e41f4b71Sopenharmony_ci     justify-content: center;
185e41f4b71Sopenharmony_ci     align-items: center;
186e41f4b71Sopenharmony_ci   }
187e41f4b71Sopenharmony_ci   .chart-region {
188e41f4b71Sopenharmony_ci     height: 400px;
189e41f4b71Sopenharmony_ci     width: 700px;
190e41f4b71Sopenharmony_ci   }
191e41f4b71Sopenharmony_ci   .chart-background {
192e41f4b71Sopenharmony_ci     object-fit: fill;
193e41f4b71Sopenharmony_ci   }
194e41f4b71Sopenharmony_ci   .chart-data {
195e41f4b71Sopenharmony_ci     width: 700px;
196e41f4b71Sopenharmony_ci     height: 600px;
197e41f4b71Sopenharmony_ci   }
198e41f4b71Sopenharmony_ci   button {
199e41f4b71Sopenharmony_ci     width: 100%;
200e41f4b71Sopenharmony_ci     height: 50px;
201e41f4b71Sopenharmony_ci     background-color: #F4F2F1;
202e41f4b71Sopenharmony_ci     text-color: #0C81F3;
203e41f4b71Sopenharmony_ci   }
204e41f4b71Sopenharmony_ci   ```
205e41f4b71Sopenharmony_ci
206e41f4b71Sopenharmony_ci   ```js
207e41f4b71Sopenharmony_ci   // xxx.js
208e41f4b71Sopenharmony_ci   export default {
209e41f4b71Sopenharmony_ci     data: {
210e41f4b71Sopenharmony_ci       lineData: [
211e41f4b71Sopenharmony_ci         {
212e41f4b71Sopenharmony_ci           strokeColor: '#0081ff',
213e41f4b71Sopenharmony_ci           fillColor: '#cce5ff',
214e41f4b71Sopenharmony_ci           data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628, 791, 505, 613, 575, 475, 553, 491, 680, 657, 716],
215e41f4b71Sopenharmony_ci           gradient: true
216e41f4b71Sopenharmony_ci         }
217e41f4b71Sopenharmony_ci       ],
218e41f4b71Sopenharmony_ci       lineOps: {
219e41f4b71Sopenharmony_ci         xAxis: {
220e41f4b71Sopenharmony_ci           min: 0,
221e41f4b71Sopenharmony_ci           max: 20,
222e41f4b71Sopenharmony_ci           display: false
223e41f4b71Sopenharmony_ci         },
224e41f4b71Sopenharmony_ci         yAxis: {
225e41f4b71Sopenharmony_ci           min: 0,
226e41f4b71Sopenharmony_ci           max: 1000,
227e41f4b71Sopenharmony_ci           display: false
228e41f4b71Sopenharmony_ci         },
229e41f4b71Sopenharmony_ci         series: {
230e41f4b71Sopenharmony_ci           lineStyle: {
231e41f4b71Sopenharmony_ci             width: "5px",
232e41f4b71Sopenharmony_ci             smooth: true
233e41f4b71Sopenharmony_ci           },
234e41f4b71Sopenharmony_ci           headPoint: {
235e41f4b71Sopenharmony_ci             shape: "circle",
236e41f4b71Sopenharmony_ci             size: 20,
237e41f4b71Sopenharmony_ci             strokeWidth: 5,
238e41f4b71Sopenharmony_ci             fillColor: '#ffffff',
239e41f4b71Sopenharmony_ci             strokeColor: '#007aff',
240e41f4b71Sopenharmony_ci             display: true
241e41f4b71Sopenharmony_ci           },
242e41f4b71Sopenharmony_ci           loop: {
243e41f4b71Sopenharmony_ci             margin: 2,
244e41f4b71Sopenharmony_ci             gradient: true
245e41f4b71Sopenharmony_ci           }
246e41f4b71Sopenharmony_ci         }
247e41f4b71Sopenharmony_ci       }
248e41f4b71Sopenharmony_ci     },
249e41f4b71Sopenharmony_ci     addData() {
250e41f4b71Sopenharmony_ci       this.$refs.linechart.append({
251e41f4b71Sopenharmony_ci         serial: 0,
252e41f4b71Sopenharmony_ci         data: [Math.floor(Math.random() * 400) + 400]
253e41f4b71Sopenharmony_ci       })
254e41f4b71Sopenharmony_ci     }
255e41f4b71Sopenharmony_ci   }
256e41f4b71Sopenharmony_ci   ```
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci   ![en-us_image_0000001173324843](figures/en-us_image_0000001173324843.png)
259e41f4b71Sopenharmony_ci
260e41f4b71Sopenharmony_ci2. Bar chart
261e41f4b71Sopenharmony_ci   ```html
262e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
263e41f4b71Sopenharmony_ci   <div class="container">
264e41f4b71Sopenharmony_ci     <stack class="data-region">
265e41f4b71Sopenharmony_ci       <image class="data-background" src="common/background.png"></image>
266e41f4b71Sopenharmony_ci       <chart class="data-bar" type="bar" id="bar-chart" options="{{barOps}}" datasets="{{barData}}"></chart>
267e41f4b71Sopenharmony_ci     </stack>
268e41f4b71Sopenharmony_ci   </div>
269e41f4b71Sopenharmony_ci   ```
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci   ```css
272e41f4b71Sopenharmony_ci   /* xxx.css */
273e41f4b71Sopenharmony_ci   .container {
274e41f4b71Sopenharmony_ci     flex-direction: column;
275e41f4b71Sopenharmony_ci     justify-content: center;
276e41f4b71Sopenharmony_ci     align-items: center;
277e41f4b71Sopenharmony_ci   }
278e41f4b71Sopenharmony_ci   .data-region {
279e41f4b71Sopenharmony_ci     height: 400px;
280e41f4b71Sopenharmony_ci     width: 700px;
281e41f4b71Sopenharmony_ci   }
282e41f4b71Sopenharmony_ci   .data-background {
283e41f4b71Sopenharmony_ci     object-fit: fill;
284e41f4b71Sopenharmony_ci   }
285e41f4b71Sopenharmony_ci   .data-bar {
286e41f4b71Sopenharmony_ci     width: 700px;
287e41f4b71Sopenharmony_ci     height: 400px;
288e41f4b71Sopenharmony_ci   }
289e41f4b71Sopenharmony_ci   ```
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_ci   ```js
292e41f4b71Sopenharmony_ci   // xxx.js
293e41f4b71Sopenharmony_ci   export default {
294e41f4b71Sopenharmony_ci     data: {
295e41f4b71Sopenharmony_ci       barData: [
296e41f4b71Sopenharmony_ci         {
297e41f4b71Sopenharmony_ci           fillColor: '#f07826',
298e41f4b71Sopenharmony_ci           data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628]
299e41f4b71Sopenharmony_ci         },
300e41f4b71Sopenharmony_ci         {
301e41f4b71Sopenharmony_ci           fillColor: '#cce5ff',
302e41f4b71Sopenharmony_ci           data: [535, 776, 615, 444, 694, 785, 677, 609, 562, 410]
303e41f4b71Sopenharmony_ci         },
304e41f4b71Sopenharmony_ci         {
305e41f4b71Sopenharmony_ci           fillColor: '#ff88bb',
306e41f4b71Sopenharmony_ci           data: [673, 500, 574, 483, 702, 583, 437, 506, 693, 657]
307e41f4b71Sopenharmony_ci         },
308e41f4b71Sopenharmony_ci       ],
309e41f4b71Sopenharmony_ci       barOps: {
310e41f4b71Sopenharmony_ci         xAxis: {
311e41f4b71Sopenharmony_ci           min: 0,
312e41f4b71Sopenharmony_ci           max: 20,
313e41f4b71Sopenharmony_ci           display: false,
314e41f4b71Sopenharmony_ci           axisTick: 10
315e41f4b71Sopenharmony_ci         },
316e41f4b71Sopenharmony_ci         yAxis: {
317e41f4b71Sopenharmony_ci           min: 0,
318e41f4b71Sopenharmony_ci           max: 1000,
319e41f4b71Sopenharmony_ci           display: false
320e41f4b71Sopenharmony_ci         }
321e41f4b71Sopenharmony_ci       }
322e41f4b71Sopenharmony_ci     }
323e41f4b71Sopenharmony_ci   }
324e41f4b71Sopenharmony_ci   ```
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ci   ![en-us_image_0000001173164929](figures/en-us_image_0000001173164929.png)
327e41f4b71Sopenharmony_ci
328e41f4b71Sopenharmony_ci3. Gauge chart
329e41f4b71Sopenharmony_ci   ```html
330e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
331e41f4b71Sopenharmony_ci   <div class="container">
332e41f4b71Sopenharmony_ci     <div class="gauge-region">
333e41f4b71Sopenharmony_ci       <chart class="data-gauge" type="gauge" percent = "50"></chart>
334e41f4b71Sopenharmony_ci     </div>
335e41f4b71Sopenharmony_ci   </div>
336e41f4b71Sopenharmony_ci   ```
337e41f4b71Sopenharmony_ci
338e41f4b71Sopenharmony_ci   ```css
339e41f4b71Sopenharmony_ci   /* xxx.css */
340e41f4b71Sopenharmony_ci   .container {
341e41f4b71Sopenharmony_ci     flex-direction: column;
342e41f4b71Sopenharmony_ci     justify-content: center;
343e41f4b71Sopenharmony_ci     align-items: center;
344e41f4b71Sopenharmony_ci   }
345e41f4b71Sopenharmony_ci   .gauge-region {
346e41f4b71Sopenharmony_ci     height: 400px;
347e41f4b71Sopenharmony_ci     width: 400px;
348e41f4b71Sopenharmony_ci   }
349e41f4b71Sopenharmony_ci   .data-gauge {
350e41f4b71Sopenharmony_ci     colors: #83f115, #fd3636, #3bf8ff;
351e41f4b71Sopenharmony_ci     weights: 4, 2, 1;
352e41f4b71Sopenharmony_ci   }
353e41f4b71Sopenharmony_ci   ```
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_ci   ![en-us_image_0000001127125264](figures/en-us_image_0000001127125264.png)
356e41f4b71Sopenharmony_ci
357e41f4b71Sopenharmony_ci4. Circle chart of progresses, loading progresses, or proportions
358e41f4b71Sopenharmony_ci   ```html
359e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
360e41f4b71Sopenharmony_ci   <div class="container">
361e41f4b71Sopenharmony_ci       <text class="text">progress Example</text>
362e41f4b71Sopenharmony_ci       <stack class="chart-region">
363e41f4b71Sopenharmony_ci           <chart class="" type="progress" segments="{{ progressdata }}"></chart>
364e41f4b71Sopenharmony_ci       </stack>
365e41f4b71Sopenharmony_ci       <text class="text">loading Example</text>
366e41f4b71Sopenharmony_ci       <stack class="chart-region">
367e41f4b71Sopenharmony_ci           <chart class="" type="loading" segments="{{ loadingdata }}"></chart>
368e41f4b71Sopenharmony_ci       </stack>
369e41f4b71Sopenharmony_ci       <text class="text">rainbow Example</text>
370e41f4b71Sopenharmony_ci       <stack class="chart-region">
371e41f4b71Sopenharmony_ci           <chart class="" type="rainbow" segments="{{ rainbowdata }}" effects="true" animationduration="5000"></chart>
372e41f4b71Sopenharmony_ci       </stack>
373e41f4b71Sopenharmony_ci   </div>
374e41f4b71Sopenharmony_ci   ```
375e41f4b71Sopenharmony_ci   ```css
376e41f4b71Sopenharmony_ci   /* xxx.css */
377e41f4b71Sopenharmony_ci   .container {
378e41f4b71Sopenharmony_ci       flex-direction: column;
379e41f4b71Sopenharmony_ci       justify-content: center;
380e41f4b71Sopenharmony_ci       align-items: center;
381e41f4b71Sopenharmony_ci   }
382e41f4b71Sopenharmony_ci   .chart-region {
383e41f4b71Sopenharmony_ci       height: 400px;
384e41f4b71Sopenharmony_ci       width: 700px;
385e41f4b71Sopenharmony_ci       margin-top: 10px;
386e41f4b71Sopenharmony_ci   }
387e41f4b71Sopenharmony_ci   .text {
388e41f4b71Sopenharmony_ci       margin-top: 30px;
389e41f4b71Sopenharmony_ci   }
390e41f4b71Sopenharmony_ci   ```
391e41f4b71Sopenharmony_ci   ```js
392e41f4b71Sopenharmony_ci   // xxx.js
393e41f4b71Sopenharmony_ci   export default {
394e41f4b71Sopenharmony_ci      data: {
395e41f4b71Sopenharmony_ci         progressdata: {
396e41f4b71Sopenharmony_ci            value: 50,
397e41f4b71Sopenharmony_ci            name: 'progress'
398e41f4b71Sopenharmony_ci         },
399e41f4b71Sopenharmony_ci         loadingdata: {
400e41f4b71Sopenharmony_ci            startColor: "#ffc0cb",
401e41f4b71Sopenharmony_ci            endColor: "#00bfff",
402e41f4b71Sopenharmony_ci         },
403e41f4b71Sopenharmony_ci         rainbowdata: [
404e41f4b71Sopenharmony_ci            {
405e41f4b71Sopenharmony_ci               value: 50,
406e41f4b71Sopenharmony_ci               name: 'item1'
407e41f4b71Sopenharmony_ci            },
408e41f4b71Sopenharmony_ci            {
409e41f4b71Sopenharmony_ci               value: 10,
410e41f4b71Sopenharmony_ci               name: 'item2'
411e41f4b71Sopenharmony_ci            },
412e41f4b71Sopenharmony_ci            {
413e41f4b71Sopenharmony_ci               value: 20,
414e41f4b71Sopenharmony_ci               name: 'item3'
415e41f4b71Sopenharmony_ci            },
416e41f4b71Sopenharmony_ci            {
417e41f4b71Sopenharmony_ci               value: 10,
418e41f4b71Sopenharmony_ci               name: 'item4'
419e41f4b71Sopenharmony_ci            },
420e41f4b71Sopenharmony_ci            {
421e41f4b71Sopenharmony_ci               value: 10,
422e41f4b71Sopenharmony_ci               name: 'item5'
423e41f4b71Sopenharmony_ci            }
424e41f4b71Sopenharmony_ci         ]
425e41f4b71Sopenharmony_ci      }
426e41f4b71Sopenharmony_ci   }
427e41f4b71Sopenharmony_ci   ```
428e41f4b71Sopenharmony_ci   ![rainbow](figures/rainbow.gif)
429