Components
Chart components
Every chart component a card can use, with its properties and an example.
Each component is an object with a type and the properties listed for it. Text and number properties may also hold a {{ }} template or a { "$bind": "…" } object; see Data, state and bindings. Every component also accepts the common properties.
lineChart
A line chart over a list of rows.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
data | any JSON | yes | Rows to plot, usually a binding such as {{data.history}}. | |
x | text | yes | Key of each row used for the horizontal axis. | |
series | list of objects | yes | The series to draw. | |
series[].key | text | yes | Key of each row that holds this series' value. | |
series[].label | text | Name shown in the legend and tooltip. | ||
series[].tone | "1" "2" "3" "4" "5" | Which chart color to use. | ||
height | number | 200 | Height in pixels. | |
legend | boolean | false | Show a legend. | |
curved | boolean | true | Smooth the lines. |
{
"type": "lineChart",
"data": [
{
"day": "Mon",
"visits": 120,
"signups": 8
},
{
"day": "Tue",
"visits": 180,
"signups": 14
},
{
"day": "Wed",
"visits": 150,
"signups": 11
},
{
"day": "Thu",
"visits": 210,
"signups": 19
},
{
"day": "Fri",
"visits": 260,
"signups": 23
}
],
"x": "day",
"series": [
{
"key": "visits",
"label": "Visits"
}
]
}areaChart
A filled area chart over a list of rows.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
data | any JSON | yes | Rows to plot, usually a binding such as {{data.history}}. | |
x | text | yes | Key of each row used for the horizontal axis. | |
series | list of objects | yes | The series to draw. | |
series[].key | text | yes | Key of each row that holds this series' value. | |
series[].label | text | Name shown in the legend and tooltip. | ||
series[].tone | "1" "2" "3" "4" "5" | Which chart color to use. | ||
height | number | 200 | Height in pixels. | |
legend | boolean | false | Show a legend. | |
stacked | boolean | Stack the series. |
{
"type": "areaChart",
"data": [
{
"day": "Mon",
"visits": 120,
"signups": 8
},
{
"day": "Tue",
"visits": 180,
"signups": 14
},
{
"day": "Wed",
"visits": 150,
"signups": 11
},
{
"day": "Thu",
"visits": 210,
"signups": 19
},
{
"day": "Fri",
"visits": 260,
"signups": 23
}
],
"x": "day",
"series": [
{
"key": "visits",
"label": "Visits"
}
]
}barChart
A bar chart over a list of rows.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
data | any JSON | yes | Rows to plot, usually a binding such as {{data.history}}. | |
x | text | yes | Key of each row used for the horizontal axis. | |
series | list of objects | yes | The series to draw. | |
series[].key | text | yes | Key of each row that holds this series' value. | |
series[].label | text | Name shown in the legend and tooltip. | ||
series[].tone | "1" "2" "3" "4" "5" | Which chart color to use. | ||
height | number | 200 | Height in pixels. | |
legend | boolean | false | Show a legend. | |
stacked | boolean | Stack the series. | ||
horizontal | boolean | Draw bars sideways. |
{
"type": "barChart",
"data": [
{
"day": "Mon",
"visits": 120,
"signups": 8
},
{
"day": "Tue",
"visits": 180,
"signups": 14
},
{
"day": "Wed",
"visits": 150,
"signups": 11
},
{
"day": "Thu",
"visits": 210,
"signups": 19
},
{
"day": "Fri",
"visits": 260,
"signups": 23
}
],
"x": "day",
"series": [
{
"key": "visits",
"label": "Visits"
},
{
"key": "signups",
"label": "Signups"
}
]
}pieChart
A donut chart showing parts of a whole.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
data | any JSON | yes | Rows, one per slice. | |
name | text | yes | Key of each row holding the slice name. | |
value | text | yes | Key of each row holding the slice value. | |
height | number | 200 | Height in pixels. | |
legend | boolean | true | Show a legend. |
{
"type": "pieChart",
"data": [
{
"name": "Chrome",
"value": 62
},
{
"name": "Safari",
"value": 24
},
{
"name": "Firefox",
"value": 14
}
],
"name": "name",
"value": "value"
}sparkline
A tiny trend line without axes, for use beside a figure.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
data | any JSON | yes | A list of numbers, or rows when a key is given. | |
key | text | Key of each row holding the value. | ||
height | number | 36 | Height in pixels. | |
tone | "primary" "success" "warning" "danger" | "primary" | Line color. |
{
"type": "sparkline",
"data": [
4,
7,
5,
9,
12,
10,
15
]
}