GitHub

Line chart

Lines show how values change across labels, usually over time. Each series is one line.

The chart this block draws
```s-chart
type: line
title: Monthly revenue
---
| Month | Revenue | Costs |
| ----- | ------- | ----- |
| Jan   | 4200    | 3100  |
| Feb   | 5100    | 3300  |
| Mar   | 6300    | 3500  |
| Apr   | 5800    | 3400  |
```

When to use it

Use a line chart for trends: weight by day, visitors by week, savings by month. To show the size of each value as well as the trend, try an area chart.

Options

OptionOn a line chart
type: lineRequired.
titleText above the chart.
x-labelTitle for the label axis along the bottom.
y-labelTitle for the value axis.
stackedtrue adds each line on top of the one before, so the top line is the total.
legendtop, bottom or none. Shown at the top for two or more series.
heightChart height in pixels, 120 to 1200.
colorsOne colour per line.
paletteA palette from settings.
source, x, yDraw from note properties. Line charts suit this best: one point per daily note.

horizontal has no effect on line charts. The value axis fits the data rather than starting at zero, so small changes stay visible.

Gaps

An empty cell leaves a gap in the line instead of dropping to zero. Use this for a missing reading.

The chart this block draws
```s-chart
type: line
title: Visits, with a missing week
---
| Week | Visits |
| ---- | ------ |
| 1    | 820    |
| 2    | 940    |
| 3    |        |
| 4    | 1,120  |
| 5    | 1,260  |
| 6    | 1,180  |
```

Stacked

The chart this block draws
```s-chart
type: line
title: Signups by plan, stacked
stacked: true
legend: bottom
---
| Month | Free | Pro | Team |
| ----- | ---- | --- | ---- |
| Jan   | 120  | 40  | 10   |
| Feb   | 150  | 55  | 14   |
| Mar   | 170  | 70  | 22   |
| Apr   | 210  | 82  | 30   |
```

Long series

With more than 50 rows, the dots on each point are hidden and only the line is drawn. Hover still shows each value.