hd-graph
A chart of any data, not only recorded readings: over time or categories as lines, areas, columns, stacked columns, steps, a scatter or a heatmap; or the shares of a whole as a pie, donut, rose, bar list, treemap, funnel or radar. The data comes from a data setting (source="{{ settings.source }}": a data feed, typed JSON, a text variable or Homey values, kept current) or as JSON in data (data="{{ list | json }}", at most 64 KB). Without paths it finds the numbers itself: a number list, [time, value] pairs, { "name": number } objects, or lists of objects. A list drawn as lines runs along its labels; lines drawn as a pie give each line’s latest value. Colours follow the theme’s chart colours; on e-ink the slices are named instead of coloured. What you put inside it (a donut’s total) is centred on the chart. Part: ::part(middle).
| Attribute | What it is |
|---|---|
variant | What it draws.One of line, area, columns, stacked, step, scatter, heatmap, pie, donut, rose, bars, treemap, funnel, radar. Default line. |
source | A data setting of the widget, as {{ settings.<name> }} (it renders as @data/<name>): the chart follows it as it changes. |
data | The data as JSON instead of a source, e.g. data="{{ settings.rows | json }}" or a text variable’s value. At most 64 KB. |
items | Where the list is in the JSON, as a path: $.rooms, $.data.hours[*]. Without it the JSON itself is the list. |
value | Where each item’s number is, inside the item: kwh, values[1]; @ for the item itself. |
label | Where each item’s name is, inside the item: name; ~ for its key in an object. |
time | Where each item’s time is (an ISO date, or seconds or milliseconds since 1970): makes the chart run over time. |
x | Where each item’s number to run along is, instead of a time (a scatter). |
unit | Shown after the values, e.g. kWh. |
name | The name of a single line, in its tooltip. |
color | A theme colour name (accent, lit, cool, good, warn, danger, text, surface, canvas, chart-1…chart-6) or #rrggbb: whatever a Colour setting gives.One of accent, lit, cool, good, warn, danger, chart-1, chart-2, chart-3, chart-4, chart-5, chart-6. |
smooth | Gently curved lines. |
compact | For a small tile: lines, areas, columns and steps without axes, legend or tooltip, with a dot on the latest value, like hd-sparkline. |
legend | The legend over the chart: with two lines or more (a pie, donut, rose or funnel without names on its slices: always), always, or never.One of auto, show, none. Default auto. |
labels | Names on the slices of a pie, donut, rose or funnel instead of a legend: on e-ink only, always, or never.One of auto, show, none. Default auto. |
percent | Shares as percentages of the whole, rather than the amounts. |
sort | The items of a share of a whole: largest first, smallest first, or as they came.One of none, desc, asc. Default none. |
top | Shows this many items at most; the rest are added up as Other. |
<hd-graph variant="donut" data='{"Kitchen": 3.2, "Living": 5.1, "Office": 1.4}' unit="kWh"></hd-graph>