Components
Charts
Charts use Plotly with the Divan look: colours from the tokens, the page’s font, no gridlines, no axis lines, no shadows. Anything Plotly cannot draw, like a custom diagram, uses d3 with the same tokens.
Over time
Page views per day
Supporters and new sign-ups
- Supporters
- New sign-ups
The best day is turquoise. Example numbers.
Ranked lists
Visitors by country
- Iran: 69%
- Germany: 11%
- Canada: 9%
- United States: 7%
- United Kingdom: 5%
Supporters by round
- Round 1
- Round 2
- Round 3
Sentiment
- Very negative 8
- Negative 22
- Neutral 58
- Positive 80
- Very positive 32
PositiveNeutralNegative Top: messages per day. Bottom: the day's average mood, from −1 to +1. Faded dots are days with fewer than 3 messages.
A blue-to-orange scale that stays readable with colour blindness.
Rules
- Plotly first. Use d3 only for what Plotly cannot draw (custom diagrams, flows), with the same tokens.
- Series colours in order: copper, turquoise, lapis, saffron, lavender (chart-1 to chart-5). Never more than three series in one chart.
- No gridlines, no axis lines, no shadows, faint tick labels, a legend only when there is more than one series.
- On right-to-left pages the time axis runs from the right and the value axis sits on the right, by itself.
- Plotly loads only in the browser and only where a chart is; until then a skeleton holds its place.
- Give every chart a label that says what it shows; put the numbers in a list or table when they matter.
Code
Chart · Plotly chart with the Divan template, loaded only in the browser.
import Chart from '#lib/components/charts/Chart.svelte';
<Chart
data={[{ type: 'bar', x: days, y: views, name: 'Views' }]}
layout={{ yaxis: { title: { text: 'Views' } } }}
label="Page views per day"
/>