1e41f4b71Sopenharmony_ci# chart
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThe **\<chart>** component displays line charts, gauge charts, and bar charts.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci> **NOTE**
7e41f4b71Sopenharmony_ci>
8e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Child Components
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciNot supported
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Attributes
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-service-widget-common-attributes.md), the following attributes are supported.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci| Name             | Type                              | Default Value| Mandatory| Description                                                        |
20e41f4b71Sopenharmony_ci| ----------------- | ---------------------------------- | ------ | ---- | ------------------------------------------------------------ |
21e41f4b71Sopenharmony_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**: circle chart of progresses<br>- **loading**: circle chart of loading processes<br>- **rainbow**: circle chart of proportions.|
22e41f4b71Sopenharmony_ci| options           | ChartOptions                       | -      | No  | Chart parameters. 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.|
23e41f4b71Sopenharmony_ci| datasets          | Array\<ChartDataset>               | -      | No  | Data sets. Data sets for a gauge chart do not take effect. You can set multiple datasets and their background colors.      |
24e41f4b71Sopenharmony_ci| segments          | DataSegment \| Array\<DataSegment> |        | No  | Data structures used by **progress**, **loading**, and **rainbow** charts.<br>The **DataSegment** type is applicable to **progress** and **loading** charts. The **Array\<DataSegment>** type is applicable to **rainbow** charts. A maximum of nine **DataSegment**s are supported.|
25e41f4b71Sopenharmony_ci| effects           | boolean                            | true   | No  | Whether to enable the effects for **progress** and **rainbow** charts.                        |
26e41f4b71Sopenharmony_ci| animationduration | number                             | 3000   | No  | Animation duration for expanding a **rainbow** chart, in milliseconds.                  |
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci**Table 1** ChartOptions
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci| Name    | Type       | Default Value | Mandatory  | Description                                      |
31e41f4b71Sopenharmony_ci| ------ | --------- | ---- | ---- | ---------------------------------------- |
32e41f4b71Sopenharmony_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.         |
33e41f4b71Sopenharmony_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.         |
34e41f4b71Sopenharmony_ci| series | ChartAxis | -    | No   | Data series. Only line charts support this attribute. Available values include:<br>- Line styles, 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.|
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci**Table 2** ChartDataset
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci| Name         | Type                                      | Default Value     | Mandatory  | Description                  |
39e41f4b71Sopenharmony_ci| ----------- | ---------------------------------------- | -------- | ---- | -------------------- |
40e41f4b71Sopenharmony_ci| strokeColor | &lt;color&gt;                            | \#ff6384 | No   | Line color. Only line charts support this attribute.        |
41e41f4b71Sopenharmony_ci| fillColor   | &lt;color&gt;                            | \#ff6384 | No   | Fill color. For line charts, this attribute indicates a gradient fill color.  |
42e41f4b71Sopenharmony_ci| data        | Array&lt;number&gt; \| Array\<Point&gt; | -        | Yes   | Data of the drawn line or bar.        |
43e41f4b71Sopenharmony_ci| gradient    | boolean                                  | false    | No   | Whether to display the gradient fill color. Only line charts support this attribute.|
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**Table 3** ChartAxis
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci| Name      | Type           | Default Value     | Mandatory  | Description                                      |
48e41f4b71Sopenharmony_ci| -------- | ------------- | -------- | ---- | ---------------------------------------- |
49e41f4b71Sopenharmony_ci| min      | number        | 0        | No   | Minimum value of the axis. Negative numbers are not supported. Only line charts support this attribute.                     |
50e41f4b71Sopenharmony_ci| max      | number        | 100      | No   | Maximum value of the axis. Negative numbers are not supported. Only line charts support this attribute.                     |
51e41f4b71Sopenharmony_ci| axisTick | number        | 10       | No   | Number of scales displayed on the axis.<br>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**). 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.|
52e41f4b71Sopenharmony_ci| display  | boolean       | false    | No   | Whether to display the axis.                                  |
53e41f4b71Sopenharmony_ci| color    | &lt;color&gt; | \#c0c0c0 | No   | Axis color.                                    |
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci**Table 4** ChartSeries
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci| Name         | Type            | Default Value | Mandatory  | Description                  |
58e41f4b71Sopenharmony_ci| ----------- | -------------- | ---- | ---- | -------------------- |
59e41f4b71Sopenharmony_ci| lineStyle   | ChartLineStyle | -    | No   | Line style, such as the line width and whether the line is smooth.     |
60e41f4b71Sopenharmony_ci| headPoint   | PointStyle     | -    | No   | Style and size of the white point at the start of the line.     |
61e41f4b71Sopenharmony_ci| topPoint    | PointStyle     | -    | No   | Style and size of the top point.          |
62e41f4b71Sopenharmony_ci| bottomPoint | PointStyle     | -    | No   | Style and size of the bottom point.          |
63e41f4b71Sopenharmony_ci| loop        | ChartLoop      | -    | No   | Whether to start drawing again when the screen is looped.|
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci **Table 5** ChartLineStyle
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci| Name    | Type            | Default Value  | Mandatory  | Description   |
68e41f4b71Sopenharmony_ci| ------ | -------------- | ----- | ---- | ----- |
69e41f4b71Sopenharmony_ci| width  | &lt;length&gt; | 1px   | No   | Line width.|
70e41f4b71Sopenharmony_ci| smooth | boolean        | false | No   | Whether the line is smooth.|
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci**Table 6** PointStyle
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci| Name         | Type            | Default Value     | Mandatory  | Description                                      |
75e41f4b71Sopenharmony_ci| ----------- | -------------- | -------- | ---- | ---------------------------------------- |
76e41f4b71Sopenharmony_ci| shape       | string         | circle   | No   | Shape of the highlight point. Available values are as follows:<br>- circle<br>- square<br>- triangle|
77e41f4b71Sopenharmony_ci| size        | &lt;length&gt; | 5px      | No   | Size of the highlight point.                                 |
78e41f4b71Sopenharmony_ci| strokeWidth | &lt;length&gt; | 1px      | No   | Stroke width.                                   |
79e41f4b71Sopenharmony_ci| strokeColor | &lt;color&gt;  | \#ff0000 | No   | Stroke color.                                   |
80e41f4b71Sopenharmony_ci| fillColor   | &lt;color&gt;  | \#ff0000 | No   | Fill color.                                   |
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci**Table 7** ChartLoop
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci| Name      | Type            | Default Value  | Mandatory  | Description                                      |
85e41f4b71Sopenharmony_ci| -------- | -------------- | ----- | ---- | ---------------------------------------- |
86e41f4b71Sopenharmony_ci| margin   | &lt;length&gt; | 1     | No   | Number of erased points (horizontal distance between the latest drawn point and the earliest point).<br>You are not advised to use **margin** together with **topPoint**, **bottomPoint**, or **headPoint**. If you do so, there is a possibility that the point is in the erase area and is invisible.|
87e41f4b71Sopenharmony_ci| gradient | boolean        | false | No   | Whether to perform gradient erase.                               |
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci**Table 8** Point
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci| Name          | Type           | Default Value     | Mandatory  | Description                                      |
92e41f4b71Sopenharmony_ci| ------------ | ------------- | -------- | ---- | ---------------------------------------- |
93e41f4b71Sopenharmony_ci| value        | number        | 0        | Yes   | Y coordinate of the point to draw.                             |
94e41f4b71Sopenharmony_ci| pointStyle   | PointStyle    | -        | No   | Style of the point.                           |
95e41f4b71Sopenharmony_ci| description  | string        | -        | No   | Description of the point.                             |
96e41f4b71Sopenharmony_ci| textLocation | string        | -        | No   | Location of the description. Available values are as follows:<br>- **"top"**: The description is above the point.<br>- **"bottom"**: The description is below the point.<br>- **"none"**: The description is not displayed.|
97e41f4b71Sopenharmony_ci| textColor    | &lt;color&gt; | \#000000 | No   | Color of the description text.                              |
98e41f4b71Sopenharmony_ci| lineDash     | string        | solid    | No   | Dashed line pattern. You can set the dash length and space length between the dashes.<br>- **"dashed, 5, 5"**: dashed line with each dash in 5 px and a 5 px space between dashes.<br>- **"solid"**: solid line.|
99e41f4b71Sopenharmony_ci| lineColor    | &lt;color&gt; | \#000000 | No   | Line color. If this attribute is not set, the value of **strokeColor** is used.  |
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci**Table 9** DataSegment
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci| Name        | Type    | Default Value | Mandatory  | Description                                      |
104e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ---- | ---------------------------------------- |
105e41f4b71Sopenharmony_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 following table.|
106e41f4b71Sopenharmony_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.|
107e41f4b71Sopenharmony_ci| value      | number | 0    | Yes   | Percentage for the current data segment. The maximum value is **100**.                        |
108e41f4b71Sopenharmony_ci| name       | string | -    | No   | Name of the data segment.                                |
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci| Data Segment | Light Theme                         | Dark Theme                       |
111e41f4b71Sopenharmony_ci| ---- | --------------------------- | --------------------------- |
112e41f4b71Sopenharmony_ci| 0    | Start color: \#f7ce00; end color: \#f99b11| Start color: \#d1a738; end color: \#eb933d|
113e41f4b71Sopenharmony_ci| 1    | Start color: \#f76223; end color: \#f2400a| Start color: \#e67d50; end color: \#d9542b|
114e41f4b71Sopenharmony_ci| 2    | Start color: \#f772ac; end color: \#e65392| Start color: \#d5749e; end color: \#d6568d|
115e41f4b71Sopenharmony_ci| 3    | Start color: \#a575eb; end color: \#a12df7| Start color: \#9973d1; end color: \#5552d9|
116e41f4b71Sopenharmony_ci| 4    | Start color: \#7b79f7; end color: \#4b48f7| Start color: \#7977d9; end color: \#f99b11|
117e41f4b71Sopenharmony_ci| 5    | Start color: \#4b8af3; end color: \#007dff| Start color: \#4c81d9; end color: \#217bd9|
118e41f4b71Sopenharmony_ci| 6    | Start color: \#73c1e6; end color: \#4fb4e3| Start color: \#5ea6d1; end color: \#4895c2|
119e41f4b71Sopenharmony_ci| 7    | Start color: \#a5d61d; end color: \#69d14f| Start color: \#91c23a; end color: \#70ba5d|
120e41f4b71Sopenharmony_ci| 8    | Start color: \#a2a2b0; end color: \#8e8e93| Start color: \#8c8c99; end color: \#6b6b76|
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ciFor the **gauge** charts, the following attributes are also supported.
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci| Name     | Type    | Default Value | Mandatory  | Description                    |
125e41f4b71Sopenharmony_ci| ------- | ------ | ---- | ---- | ---------------------- |
126e41f4b71Sopenharmony_ci| percent | number | 0    | No   | Percentage of the current value to the total value. The value ranges from 0 to 100.|
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci## Styles
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ciIn addition to the [universal styles](js-service-widget-common-styles.md), the following styles are supported.
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci| Name          | Type            | Default Value                       | Mandatory  | Description                                      |
134e41f4b71Sopenharmony_ci| ------------ | -------------- | -------------------------- | ---- | ---------------------------------------- |
135e41f4b71Sopenharmony_ci| stroke-width | &lt;length&gt; | 32px (**gauge** charts)<br>24px (**rainbow** charts)| No   | Width of the scale bar for **gauge** and **rainbow** charts.                     |
136e41f4b71Sopenharmony_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.  |
137e41f4b71Sopenharmony_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.|
138e41f4b71Sopenharmony_ci| center-x     | &lt;length&gt; | -                          | No   | X-coordinate of the scale bar center position for **gauge** charts. This style takes precedence over the **position** universal style and<br>must be used together with **center-y** and **radius**.|
139e41f4b71Sopenharmony_ci| center-y     | &lt;length&gt; | -                          | No   | Y-coordinate of the scale bar center position for **gauge** charts. This style takes precedence over the **position** universal style and<br>must be used together with **center-x** and **radius**.|
140e41f4b71Sopenharmony_ci| radius       | &lt;length&gt; | -                          | No   | Radius of the scale bar for **gauge** charts. This style takes precedence over the **width** and **height** universal style and<br>must be used together with **center-x** and **center-y**.|
141e41f4b71Sopenharmony_ci| colors       | Array          | -                          | No   | Colors of ranges on the scale bar for **gauge** charts.<br>For example, **colors: \#ff0000, \#00ff00**.|
142e41f4b71Sopenharmony_ci| weights      | Array          | -                          | No   | Weights of ranges on the scale bar for **gauge** charts.<br>For example, **weights: 2, 2**.|
143e41f4b71Sopenharmony_ci| font-family  | Array          | -                          | No   | Font style of the description text. You can use a [custom font](js-service-widget-common-customizing-font.md).|
144e41f4b71Sopenharmony_ci| font-size    | &lt;length&gt; | -                          | No   | Font size of the description text.                           |
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci## Events
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ciThe [universal events](js-service-widget-common-events.md) are supported.
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci## Example
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci1. Line chart
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci   ```html
157e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
158e41f4b71Sopenharmony_ci   <div class="container">
159e41f4b71Sopenharmony_ci     <stack class="chart-region">
160e41f4b71Sopenharmony_ci       <image class="chart-background" src="common/background.png"></image>
161e41f4b71Sopenharmony_ci       <chart class="chart-data" type="line" ref="linechart" options="{{lineOps}}" datasets="{{lineData}}"></chart>
162e41f4b71Sopenharmony_ci     </stack>
163e41f4b71Sopenharmony_ci   </div>
164e41f4b71Sopenharmony_ci   ```
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci
167e41f4b71Sopenharmony_ci   ```css
168e41f4b71Sopenharmony_ci   /* xxx.css */
169e41f4b71Sopenharmony_ci   .container {
170e41f4b71Sopenharmony_ci     flex-direction: column;
171e41f4b71Sopenharmony_ci     justify-content: center;
172e41f4b71Sopenharmony_ci     align-items: center;
173e41f4b71Sopenharmony_ci   }
174e41f4b71Sopenharmony_ci   .chart-region {
175e41f4b71Sopenharmony_ci     height: 400px;
176e41f4b71Sopenharmony_ci     width: 700px;
177e41f4b71Sopenharmony_ci   }
178e41f4b71Sopenharmony_ci   .chart-background {
179e41f4b71Sopenharmony_ci     object-fit: fill;
180e41f4b71Sopenharmony_ci   }
181e41f4b71Sopenharmony_ci   .chart-data {
182e41f4b71Sopenharmony_ci     width: 700px;
183e41f4b71Sopenharmony_ci     height: 600px;
184e41f4b71Sopenharmony_ci   }
185e41f4b71Sopenharmony_ci   ```
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci   ```json
189e41f4b71Sopenharmony_ci   // xxx.json
190e41f4b71Sopenharmony_ci   {
191e41f4b71Sopenharmony_ci     "data": {
192e41f4b71Sopenharmony_ci       "lineData": [
193e41f4b71Sopenharmony_ci         {
194e41f4b71Sopenharmony_ci           "strokeColor": "#0081ff",
195e41f4b71Sopenharmony_ci           "fillColor": "#cce5ff",
196e41f4b71Sopenharmony_ci           "data": [
197e41f4b71Sopenharmony_ci             763,
198e41f4b71Sopenharmony_ci             550,
199e41f4b71Sopenharmony_ci             551,
200e41f4b71Sopenharmony_ci             554,
201e41f4b71Sopenharmony_ci             731,
202e41f4b71Sopenharmony_ci             654,
203e41f4b71Sopenharmony_ci             525,
204e41f4b71Sopenharmony_ci             696,
205e41f4b71Sopenharmony_ci             595,
206e41f4b71Sopenharmony_ci             628,
207e41f4b71Sopenharmony_ci             791,
208e41f4b71Sopenharmony_ci             505,
209e41f4b71Sopenharmony_ci             613,
210e41f4b71Sopenharmony_ci             575,
211e41f4b71Sopenharmony_ci             475,
212e41f4b71Sopenharmony_ci             553,
213e41f4b71Sopenharmony_ci             491,
214e41f4b71Sopenharmony_ci             680,
215e41f4b71Sopenharmony_ci             657,
216e41f4b71Sopenharmony_ci             716
217e41f4b71Sopenharmony_ci           ],
218e41f4b71Sopenharmony_ci           "gradient": true
219e41f4b71Sopenharmony_ci         }
220e41f4b71Sopenharmony_ci       ],
221e41f4b71Sopenharmony_ci       "lineOps": {
222e41f4b71Sopenharmony_ci         "xAxis": {
223e41f4b71Sopenharmony_ci           "min": 0,
224e41f4b71Sopenharmony_ci           "max": 20,
225e41f4b71Sopenharmony_ci           "display": false
226e41f4b71Sopenharmony_ci         },
227e41f4b71Sopenharmony_ci         "yAxis": {
228e41f4b71Sopenharmony_ci           "min": 0,
229e41f4b71Sopenharmony_ci           "max": 1000,
230e41f4b71Sopenharmony_ci           "display": false
231e41f4b71Sopenharmony_ci         },
232e41f4b71Sopenharmony_ci         "series": {
233e41f4b71Sopenharmony_ci           "lineStyle": {
234e41f4b71Sopenharmony_ci             "width": "5px",
235e41f4b71Sopenharmony_ci             "smooth": true
236e41f4b71Sopenharmony_ci           },
237e41f4b71Sopenharmony_ci           "headPoint": {
238e41f4b71Sopenharmony_ci             "shape": "circle",
239e41f4b71Sopenharmony_ci             "size": 20,
240e41f4b71Sopenharmony_ci             "strokeWidth": 5,
241e41f4b71Sopenharmony_ci             "fillColor": "#ffffff",
242e41f4b71Sopenharmony_ci             "strokeColor": "#007aff",
243e41f4b71Sopenharmony_ci             "display": true
244e41f4b71Sopenharmony_ci           },
245e41f4b71Sopenharmony_ci           "loop": {
246e41f4b71Sopenharmony_ci             "margin": 2,
247e41f4b71Sopenharmony_ci             "gradient": true
248e41f4b71Sopenharmony_ci           }
249e41f4b71Sopenharmony_ci         }
250e41f4b71Sopenharmony_ci       }
251e41f4b71Sopenharmony_ci     }
252e41f4b71Sopenharmony_ci   }
253e41f4b71Sopenharmony_ci   ```
254e41f4b71Sopenharmony_ci   **4 x 4 widget**
255e41f4b71Sopenharmony_ci
256e41f4b71Sopenharmony_ci![en-us_image_0000001185652902](figures/en-us_image_0000001185652902.png)
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci2. Bar chart
259e41f4b71Sopenharmony_ci
260e41f4b71Sopenharmony_ci   ```html
261e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
262e41f4b71Sopenharmony_ci   <div class="container">
263e41f4b71Sopenharmony_ci     <stack class="data-region">
264e41f4b71Sopenharmony_ci       <image class="data-background" src="common/background.png"></image>
265e41f4b71Sopenharmony_ci       <chart class="data-bar" type="bar" id="bar-chart" options="{{barOps}}" datasets="{{barData}}"></chart>
266e41f4b71Sopenharmony_ci     </stack>
267e41f4b71Sopenharmony_ci   </div>
268e41f4b71Sopenharmony_ci   ```
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
292e41f4b71Sopenharmony_ci   ```json
293e41f4b71Sopenharmony_ci   {
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   **4 x 4 widget**
326e41f4b71Sopenharmony_ci
327e41f4b71Sopenharmony_ci![barchart](figures/barchart.PNG)
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ci3. Gauge chart
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ci
332e41f4b71Sopenharmony_ci   ```html
333e41f4b71Sopenharmony_ci   <!-- xxx.hml -->
334e41f4b71Sopenharmony_ci   <div class="container">
335e41f4b71Sopenharmony_ci     <div class="gauge-region">
336e41f4b71Sopenharmony_ci       <chart class="data-gauge" type="gauge" percent = "50"></chart>
337e41f4b71Sopenharmony_ci     </div>
338e41f4b71Sopenharmony_ci   </div>
339e41f4b71Sopenharmony_ci   ```
340e41f4b71Sopenharmony_ci
341e41f4b71Sopenharmony_ci
342e41f4b71Sopenharmony_ci   ```css
343e41f4b71Sopenharmony_ci   /* xxx.css */
344e41f4b71Sopenharmony_ci   .container {
345e41f4b71Sopenharmony_ci     flex-direction: column;
346e41f4b71Sopenharmony_ci     justify-content: center;
347e41f4b71Sopenharmony_ci     align-items: center;
348e41f4b71Sopenharmony_ci   }
349e41f4b71Sopenharmony_ci   .gauge-region {
350e41f4b71Sopenharmony_ci     height: 400px;
351e41f4b71Sopenharmony_ci     width: 400px;
352e41f4b71Sopenharmony_ci   }
353e41f4b71Sopenharmony_ci   .data-gauge {
354e41f4b71Sopenharmony_ci     colors: #83f115, #fd3636, #3bf8ff;
355e41f4b71Sopenharmony_ci     weights: 4, 2, 1;
356e41f4b71Sopenharmony_ci   }
357e41f4b71Sopenharmony_ci   ```
358e41f4b71Sopenharmony_ci   **4 x 4 widget**
359e41f4b71Sopenharmony_ci
360e41f4b71Sopenharmony_ci![gauge](figures/gauge.PNG)
361