# Line chart

> A measure over shoot days on a quiet grid: pages shot, from the production report, against the schedule, dashed. Direct labels at the line ends, a table behind.

Source: https://kwark.space/designSystem/components/line-chart

## Usage

### What it is
A line chart joins values in time order so the shape of change is visible. In Kwark the classic case is the **production report**: pages shot as a running total, day by day, against the pages the stripboard scheduled. The 1st AD and the producer read one thing from it: are we keeping pace with the schedule, and how far off are we.

### When to use
- One or two measures over shoot days, prep weeks or drafts where the shape matters: pages shot, spend against budget, setups per day.
- With a plan to compare against, drawn dashed.

### When not to
- For a writer's words or pages per day. Kwark does not chart the volume of a person's creative work (Decisions 0008, 0036).
- For fewer than four points. Say it in a sentence.
- For parts of a whole. Use a [Bar chart](https://kwark.space/designSystem/components/bar-chart.md) or a [Donut chart](https://kwark.space/designSystem/components/donut-chart.md).

### Anatomy in use
- **Actual** as a 2px coral line; **plan** as a 1.5px dashed line in quiet text. At most two lines.
- **Labels at the line ends**, not in a legend: *Shot 47 6/8*, *Scheduled 104*. The key in the foot names the dash for those who need it.
- **Today** as a hairline with its label, so the gap between the lines reads as "so far".
- Gridlines only at round values (25, 50, 75, 100 pages). Days on the axis.

### Writing
- The reading states the gap plainly, without praise or alarm: *By the end of Day 6, 47 6/8 pages are shot of the 51 scheduled.*
- Units in the reading or the foot; eighths for pages.

**Do:** Shot as a coral line ending at *47 6/8*, the schedule dashed to *104*, today marked.

**Don't:** Five coloured lines, smoothed curves, a legend in a box, and the shortfall in red.

## Style

### Anatomy

1. **Frame**: `.kw-viz` card.
2. **Plot**: 180px tall (140px on a phone), left gutter 32px for gridline labels.
3. **Gridlines**: 1px `--k-line`, labels 12px `--k-text-2`.
4. **Actual**: 2px `--k-chart-coral`, round joins; the last point a 7px dot ringed in the surface.
5. **Plan**: 1.5px `--k-text-2`, dashed 5 4.
6. **End labels**: 12px; the name 600, the value tabular.
7. **Today**: 1px `--k-text` at 40%, label 12px above the plot.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-chart-coral` | #bf5d45 | var(--k-brand-coral) |
| `--k-text` | #0f172a | #e3e3e3 |
| `--k-text-2` | #5b6779 | #9ca3af |
| `--k-line` | #e2e8f0 | rgba(255, 255, 255, .1) |
| `--k-surface` | #ffffff | #1a1a1a |
| `--k-radius-card` | 10px |  |
| `--k-fs-meta` | 12px |  |

### States
| State | Look |
|---|---|
| Before the shoot | Only the plan, with the reading *104 pages scheduled over 12 days* |
| A day with no report yet | The actual line stops at the last reported day; the table says *Not yet* |
| Table | Every day, scheduled and shot, in eighths |

## Code

### React

Use the HTML below with `kwark.css`. The example shows the markup and styling. Supply any application behavior described on this page.

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<figure class="kw-viz">
  <figcaption class="kw-viz__head"><div><p class="kw-viz__title">Pages shot against the schedule</p><p class="kw-viz__reading">By the end of Day 6, 47 6/8 pages are shot of the 51 scheduled. 104 pages over 12 days.</p></div><label class="kw-viz__switch"><input class="kw-visually-hidden" type="checkbox" role="switch" aria-label="Show pages shot and scheduled as a table"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M3 15h18M9 10v10"/></svg><span>Table</span></label></figcaption>
  <div class="kw-viz__plot">
    <div class="kw-line" aria-hidden="true">
      <div class="kw-line__plot">
        <span class="kw-area__grid" style="bottom:22.73%"><i>25</i></span><span class="kw-area__grid" style="bottom:45.45%"><i>50</i></span><span class="kw-area__grid" style="bottom:68.18%"><i>75</i></span><span class="kw-area__grid" style="bottom:90.91%"><i>100</i></span>
        <span class="kw-line__today" style="left:50.00%"><b>Today</b></span>
        <svg viewBox="0 0 12 880" preserveAspectRatio="none"><path class="kw-line__plan" d="M0 880 L1 808 L2 744 L3 672 L4 608 L5 536 L6 472 L7 400 L8 328 L9 264 L10 192 L11 120 L12 48"/><path class="kw-line__shot" d="M0 880 L1 812 L2 752 L3 678 L4 628 L5 560 L6 498"/></svg>
        <span class="kw-line__dot" style="left:50.00%;bottom:43.41%"></span>
        <span class="kw-line__label kw-line__label--shot" style="left:50.00%;bottom:43.41%"><b>Shot</b> 47 6/8</span>
        <span class="kw-line__label kw-line__label--plan" style="left:100%;bottom:94.55%"><b>Scheduled</b> 104</span>
      </div>
      <div class="kw-area__axis"><span style="left:8.33%">Day 1</span><span style="left:25.00%">Day 3</span><span style="left:50.00%">Day 6</span><span style="left:75.00%">Day 9</span><span style="left:100.00%">Day 12</span></div>
    </div>
    <p class="kw-viz__foot" aria-hidden="true"><span class="kw-viz__key" style="--kw-key:var(--k-chart-coral)">Shot, from the production report</span><span class="kw-viz__key kw-viz__key--dash" style="--kw-key:var(--k-text-2)">Scheduled, from the stripboard</span><span>Pages, running total</span></p>
  </div>
  <div class="kw-viz__table"><table><caption>Pages shot and scheduled, running total by shoot day</caption><thead><tr><th scope="col">Shoot day</th><th scope="col" class="num">Scheduled</th><th scope="col" class="num">Shot</th></tr></thead><tbody><tr><th scope="row">Day 1</th><td class="num">9</td><td class="num">8 4/8</td></tr><tr><th scope="row">Day 2</th><td class="num">17</td><td class="num">16</td></tr><tr><th scope="row">Day 3</th><td class="num">26</td><td class="num">25 2/8</td></tr><tr><th scope="row">Day 4</th><td class="num">34</td><td class="num">31 4/8</td></tr><tr><th scope="row">Day 5</th><td class="num">43</td><td class="num">40</td></tr><tr><th scope="row">Day 6</th><td class="num">51</td><td class="num">47 6/8</td></tr><tr><th scope="row">Day 7</th><td class="num">60</td><td class="num">Not yet</td></tr><tr><th scope="row">Day 8</th><td class="num">69</td><td class="num">Not yet</td></tr><tr><th scope="row">Day 9</th><td class="num">77</td><td class="num">Not yet</td></tr><tr><th scope="row">Day 10</th><td class="num">86</td><td class="num">Not yet</td></tr><tr><th scope="row">Day 11</th><td class="num">95</td><td class="num">Not yet</td></tr><tr><th scope="row">Day 12</th><td class="num">104</td><td class="num">Not yet</td></tr></tbody></table></div>
</figure>
```

### Building it
Draw both lines into one viewBox (days by pages) with `preserveAspectRatio="none"` and `vector-effect: non-scaling-stroke`. Labels, the today rule and the end dot are HTML, placed by percentage of the same domain, so the type stays at token sizes on any width.

## Accessibility

### Screen readers
- The drawing is `aria-hidden`; the reading line states the finding; the table lists every day with *Scheduled* and *Shot*.
- Days without a report read *Not yet*, never an empty cell.

### Colour
Plan and actual differ by dash and by label, not only by colour.

## For agents

### Rules

- **Never** chart the volume of a person's creative work.
- **Must** label the lines at their ends; a legend only names the dash.
- **Never** smooth a line between real points.
- **Must** state the unit and the time step.
- **Always** carry a table with the same values.

### AI readiness test

**Task:** Show spend against budget by shoot week for the producer.

**Give the agent:** Line chart, Budget top sheet, Data visualisation.

**Constraint:** Amounts are in INR lakh; Week 4 is not closed.

**A reliable answer:**
- Spend solid coral, budget dashed
- End labels with amounts
- Week 4 marked as not closed in the table
- Reading states the gap without alarm
