Prop | Type | Required | Example | Value Range | Description |
---|---|---|---|---|---|
chartType | string | true | - | - | The type of chart to display. Supported types: bar, line, area, scatter, pie, doughnut, radar. |
chartWidth | number | true | - | 200 - 800 | The width of the chart canvas, in pixels. |
chartHeight | number | true | - | 150 - 600 | The height of the chart canvas, in pixels. |
bgColor | string | false | - | - | The background color of the chart, in hex format. |
bgAlpha | number | false | - | 0 - 1 | The transparency level of the chart background. 1 represents full opacity, and 0 represents full transparency. |
showAxis | boolean | false | - | - | Whether to display the chart axes. |
axisColor | string | false | - | - | The color of the chart axes, in hex format. |
axisWidth | number | false | - | 1 - 10 | The width of the chart axes, in pixels. |
showGrid | boolean | false | - | - | Whether to display the chart grid. |
gridColor | string | false | - | - | The color of the chart grid, in hex format. |
gridAlpha | number | false | - | 0 - 1 | The transparency level of the chart grid. 1 represents full opacity, and 0 represents full transparency. |
showLabels | boolean | false | - | - | Whether to display chart labels. |
labelStyle | object | false | - | - | Text style configuration for chart labels. |
labelStyle.fill | string | false | - | - | The font color of chart labels, in hex format. |
labelStyle.fontSize | number | false | - | 8 - 100 | The font size of chart labels, in pixels. |
labelStyle.fontFamily | string | false | - | - | The font family of chart labels. |
labelStyle.fontWeight | string | false | - | - | The font weight of chart labels (e.g., normal, bold). |
labelStyle.stroke | string | false | - | - | The stroke color of chart labels, in hex format. |
labelStyle.strokeThickness | number | false | - | 0 - 10 | The stroke width of chart labels, in pixels. |
labelStyle.dropShadow | boolean | false | - | - | Whether to enable shadow effect for chart labels. |
labelStyle.dropShadowColor | string | false | - | - | The shadow color of chart labels, in hex format. |
labelStyle.dropShadowBlur | number | false | - | 0 - 20 | The blur radius of the label shadow. |
labelStyle.dropShadowDistance | number | false | - | 0 - 20 | The distance of the label shadow from the text. |
labelStyle.dropShadowAngle | number | false | - | 0 - 6.28 | The angle of the label shadow, in radians. |
labelStyle.dropShadowAlpha | number | false | - | 0 - 1 | The opacity of the label shadow. |
linePointStyle | string | false | - | - | The style of data points in line/area charts. Options: filled, hollow. |
lineSmooth | boolean | false | - | - | Whether to smooth the lines in line/area charts. |
lineAreaAlpha | number | false | - | 0 - 1 | The transparency level of the filled area in area charts. |
showLegend | boolean | false | - | - | Whether to display the chart legend. |
legendPosition | string | false | - | - | The position of the legend. Currently supports: bottom. |
legendItemSize | number | false | - | 10 - 30 | The size of legend items, in pixels. |
legendGap | number | false | - | 4 - 20 | The gap between legend items, in pixels. |
showBarBackground | boolean | false | - | - | Whether to display the background of bar charts. |
barBackgroundColor | string | false | - | - | The background color of bars, in hex format. |
barBackgroundAlpha | number | false | - | 0 - 1 | The transparency level of the bar background. |
barOrientation | string | false | - | - | The orientation of bars. Options: vertical, horizontal. |
barCornerRadius | number | false | - | 0 - 20 | The corner radius of bars, in pixels. |
dataSet | array | false | - | - | An array of data sets used to render the chart. Each data set contains a time point (dataTime) and data points (dataPoints). |
The chartType
property determines the visualization style:
The dataSet
is an array of data objects, where each object contains:
Each data point in dataPoints
contains:
The labelStyle
object controls the appearance of chart labels:
For line and area charts, you can configure:
For bar charts, you can configure:
Enable and customize the chart legend:
1{
2 "id": "chart-element-id",
3 "type": "Chart",
4 "start": 0,
5 "duration": 10,
6 "trackIndex": 0,
7 "x": 100,
8 "y": 100,
9 "chartType": "bar",
10 "chartWidth": 800,
11 "chartHeight": 600,
12 "bgColor": "#ffffff",
13 "bgAlpha": 1,
14 "showAxis": true,
15 "axisColor": "#000000",
16 "axisWidth": 2,
17 "showGrid": true,
18 "gridColor": "#cccccc",
19 "gridAlpha": 0.5,
20 "showLabels": true,
21 "labelStyle": {
22 "fill": "#333333",
23 "fontSize": 12,
24 "fontFamily": "Arial",
25 "fontWeight": "normal",
26 "stroke": "#000000",
27 "strokeThickness": 0,
28 "dropShadow": false,
29 "dropShadowColor": "#000000",
30 "dropShadowBlur": 4,
31 "dropShadowDistance": 3,
32 "dropShadowAngle": 1.2,
33 "dropShadowAlpha": 1
34 },
35 "showLegend": true,
36 "legendPosition": "bottom",
37 "legendItemSize": 14,
38 "legendGap": 8,
39 "barOrientation": "vertical",
40 "barCornerRadius": 4,
41 "showBarBackground": false,
42 "barBackgroundColor": "#eeeeee",
43 "barBackgroundAlpha": 0.4,
44 "dataSet": [
45 {
46 "dataTime": 0,
47 "dataPoints": [
48 { "id": "1", "label": "A", "value": 10, "color": "#ff6384" },
49 { "id": "2", "label": "B", "value": 20, "color": "#36a2eb" },
50 { "id": "3", "label": "C", "value": 15, "color": "#ffce56" }
51 ]
52 },
53 {
54 "dataTime": 5,
55 "dataPoints": [
56 { "id": "1", "label": "A", "value": 25, "color": "#ff6384" },
57 { "id": "2", "label": "B", "value": 18, "color": "#36a2eb" },
58 { "id": "3", "label": "C", "value": 22, "color": "#ffce56" }
59 ]
60 }
61 ]
62}
63