Line Chart
Trace changes across a reporting period.
- Shipped
- Planned
Inspect a point or use the arrow keys
View chart data
| Category | Shipped | Planned |
|---|---|---|
| Mon | 32 | 35 |
| Tue | 39 | 41 |
| Wed | 33 | 32 |
| Thu | 46 | 48 |
| Fri | 56 | 52 |
| Sat | 38 | 36 |
| Sun | 40 | 42 |
HTML
<div class="rl-report-period"><form hx-get="/demo/insights/chart" hx-target="next .rl-plot" hx-swap="outerHTML" hx-sync="this:replace"><label>Reporting period <select name="period" class="rl-select"><option value="week">Full week</option><option value="recent">Last three days</option></select></label><button class="rl-button" type="submit">Apply</button></form><div class="rl-insight-status" data-rl-report-status role="status"></div><figure class="rl-plot" data-rl-chart="line">
<figcaption><strong>Dispatch pace</strong><span>Monday to Sunday</span></figcaption>
<ul class="rl-plot-legend" aria-label="Series"><li><i class="rl-plot-tone-0" aria-hidden="true"></i>Shipped</li><li><i class="rl-plot-tone-1" aria-hidden="true"></i>Planned</li></ul>
<svg viewBox="0 0 495 188" role="group" aria-label="Dispatch pace"><desc>Use the arrow keys to explore values. Open the data table for all values.</desc><line class="rl-plot-grid" x1="42" x2="480" y1="155" y2="155"/><text class="rl-plot-axis" x="35" y="159" text-anchor="end">0</text><line class="rl-plot-grid" x1="42" x2="480" y1="85.5" y2="85.5"/><text class="rl-plot-axis" x="35" y="89.5" text-anchor="end">28</text><line class="rl-plot-grid" x1="42" x2="480" y1="16" y2="16"/><text class="rl-plot-axis" x="35" y="20" text-anchor="end">56</text><text class="rl-plot-axis" x="73.29" y="179" text-anchor="middle">Mon</text><text class="rl-plot-axis" x="135.86" y="179" text-anchor="middle">Tue</text><text class="rl-plot-axis" x="198.43" y="179" text-anchor="middle">Wed</text><text class="rl-plot-axis" x="261" y="179" text-anchor="middle">Thu</text><text class="rl-plot-axis" x="323.57" y="179" text-anchor="middle">Fri</text><text class="rl-plot-axis" x="386.14" y="179" text-anchor="middle">Sat</text><text class="rl-plot-axis" x="448.71" y="179" text-anchor="middle">Sun</text><polyline class="rl-plot-line rl-plot-tone-0" points="73.29,75.57 135.86,58.2 198.43,73.09 261,40.82 323.57,16 386.14,60.68 448.71,55.71"/><polyline class="rl-plot-line rl-plot-tone-1" points="73.29,68.13 135.86,53.23 198.43,75.57 261,35.86 323.57,25.93 386.14,65.64 448.71,50.75"/><g class="rl-plot-point rl-plot-tone-0" tabindex="0" role="img" aria-label="Mon · Shipped: 32" data-rl-series="0" data-rl-plot-value="Mon · Shipped: 32"><circle cx="73.29" cy="75.57" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="73.29" cy="75.57" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-0" tabindex="-1" role="img" aria-label="Tue · Shipped: 39" data-rl-series="0" data-rl-plot-value="Tue · Shipped: 39"><circle cx="135.86" cy="58.2" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="135.86" cy="58.2" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-0" tabindex="-1" role="img" aria-label="Wed · Shipped: 33" data-rl-series="0" data-rl-plot-value="Wed · Shipped: 33"><circle cx="198.43" cy="73.09" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="198.43" cy="73.09" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-0" tabindex="-1" role="img" aria-label="Thu · Shipped: 46" data-rl-series="0" data-rl-plot-value="Thu · Shipped: 46"><circle cx="261" cy="40.82" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="261" cy="40.82" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-0" tabindex="-1" role="img" aria-label="Fri · Shipped: 56" data-rl-series="0" data-rl-plot-value="Fri · Shipped: 56"><circle cx="323.57" cy="16" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="323.57" cy="16" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-0" tabindex="-1" role="img" aria-label="Sat · Shipped: 38" data-rl-series="0" data-rl-plot-value="Sat · Shipped: 38"><circle cx="386.14" cy="60.68" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="386.14" cy="60.68" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-0" tabindex="-1" role="img" aria-label="Sun · Shipped: 40" data-rl-series="0" data-rl-plot-value="Sun · Shipped: 40"><circle cx="448.71" cy="55.71" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="448.71" cy="55.71" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Mon · Planned: 35" data-rl-series="1" data-rl-plot-value="Mon · Planned: 35"><circle cx="73.29" cy="68.13" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="73.29" cy="68.13" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Tue · Planned: 41" data-rl-series="1" data-rl-plot-value="Tue · Planned: 41"><circle cx="135.86" cy="53.23" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="135.86" cy="53.23" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Wed · Planned: 32" data-rl-series="1" data-rl-plot-value="Wed · Planned: 32"><circle cx="198.43" cy="75.57" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="198.43" cy="75.57" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Thu · Planned: 48" data-rl-series="1" data-rl-plot-value="Thu · Planned: 48"><circle cx="261" cy="35.86" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="261" cy="35.86" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Fri · Planned: 52" data-rl-series="1" data-rl-plot-value="Fri · Planned: 52"><circle cx="323.57" cy="25.93" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="323.57" cy="25.93" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Sat · Planned: 36" data-rl-series="1" data-rl-plot-value="Sat · Planned: 36"><circle cx="386.14" cy="65.64" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="386.14" cy="65.64" r="3.8"/></g><g class="rl-plot-point rl-plot-tone-1" tabindex="-1" role="img" aria-label="Sun · Planned: 42" data-rl-series="1" data-rl-plot-value="Sun · Planned: 42"><circle cx="448.71" cy="50.75" r="9" fill="transparent"/><circle class="rl-plot-dot" cx="448.71" cy="50.75" r="3.8"/></g></svg>
<span class="rl-plot-tooltip" data-rl-plot-tooltip aria-hidden="true" hidden></span>
<div class="rl-plot-readout" data-rl-plot-readout>Inspect a point or use the arrow keys</div>
<details class="rl-plot-data"><summary>View chart data</summary><div><table class="rl-table"><caption>Dispatch pace</caption><thead><tr><th scope="col">Category</th><th scope="col">Shipped</th><th scope="col">Planned</th></tr></thead>
<tbody><tr><th scope="row">Mon</th><td>32</td><td>35</td></tr><tr><th scope="row">Tue</th><td>39</td><td>41</td></tr><tr><th scope="row">Wed</th><td>33</td><td>32</td></tr><tr><th scope="row">Thu</th><td>46</td><td>48</td></tr><tr><th scope="row">Fri</th><td>56</td><td>52</td></tr><tr><th scope="row">Sat</th><td>38</td><td>36</td></tr><tr><th scope="row">Sun</th><td>40</td><td>42</td></tr></tbody></table></div></details>
</figure></div>HTTP exchange
Use the preview to see the request and the HTML your server returns.The SVG and data table share one dataset. Tab into the chart once. Arrow left and right inspect categories. Arrow up and down change series. The next Tab reaches the data table. The optional insight-charts.mjs helper renders this HTML on your server.
Use in your app
Copy these tags into your page head once. Serve the files at the paths shown, then add the example’s template to your page.
Page assets
<link rel="stylesheet" href="/mero.css">
<link rel="stylesheet" href="/mero-insights.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>
<script defer src="/mero-insights.js"></script>Point the HTMX attributes at your own HTML endpoints. Use the live preview’s HTTP exchange to inspect the request and response.
Optional server helper · insight-charts.mjs ↓
Download library and examples ↓