|
| 1 | +--- |
| 2 | +rows: |
| 3 | + - component: chart |
| 4 | + title: CPU temperature |
| 5 | + type: line |
| 6 | + time: true |
| 7 | + ytitle: °C |
| 8 | + ymax: 100 |
| 9 | + color: azure |
| 10 | + marker: 4 |
| 11 | + - yline: 70 |
| 12 | + label: target |
| 13 | + color: green |
| 14 | + - yline: 90 |
| 15 | + yline_end: 100 |
| 16 | + label: throttling |
| 17 | + color: red |
| 18 | + - x: '2024-05-01T08:00:00Z' |
| 19 | + y: 52 |
| 20 | + - x: '2024-05-01T09:00:00Z' |
| 21 | + y: 58 |
| 22 | + - x: '2024-05-01T10:00:00Z' |
| 23 | + y: 71 |
| 24 | + - x: '2024-05-01T11:00:00Z' |
| 25 | + y: 83 |
| 26 | + - x: '2024-05-01T12:00:00Z' |
| 27 | + y: 94 |
| 28 | + - x: '2024-05-01T13:00:00Z' |
| 29 | + y: 76 |
| 30 | + - x: '2024-05-01T14:00:00Z' |
| 31 | + y: 63 |
| 32 | +--- |
| 33 | + |
| 34 | +## Reference lines |
| 35 | + |
| 36 | +A row with a `yline` is not plotted as a data point, but drawn as a line across |
| 37 | +the whole chart, at that value of the y axis. Use it for the limit that the data |
| 38 | +should be read against: a disk quota, an alarm threshold, a service level |
| 39 | +objective. Add `yline_end` to make it a band instead of a line. |
| 40 | + |
| 41 | +Reference lines are rows, so they come from a query like everything else, |
| 42 | +and a chart can have as many of them as the query returns: |
| 43 | + |
| 44 | +```sql |
| 45 | +select 'chart' as component, 'CPU temperature' as title, true as time, 100 as ymax; |
| 46 | +select celsius as yline, name as label, color as color from thresholds; |
| 47 | +select measured_at as x, celsius as y from readings order by measured_at; |
| 48 | +``` |
| 49 | + |
| 50 | +They are drawn as annotations rather than as an extra series, so they are not |
| 51 | +added to the total of a `stacked` chart, and are not filled in an `area` chart. |
| 52 | + |
| 53 | +A line outside of the y axis is not drawn, and does not stretch the axis to fit, |
| 54 | +so set `ymax` when the limit is above the data. |
0 commit comments