# Charts · Divan

> Charts use Plotly with the Divan template; anything Plotly cannot draw (custom diagrams, flows) uses d3. Both take their colours from the tokens.

Part of Divan, the DivanWorks design system. Web page: https://brand.divanworks.com/charts · All topics: https://brand.divanworks.com/llms.txt

## Rules

- Import { Chart } from "#lib/components/charts/Chart.svelte" and pass Plotly traces; the Divan layout (fonts, colours, no gridlines, no borders) is applied for you.
- Series colours in order: primary (copper), success (turquoise), then muted-foreground. Never more than three series in one chart.
- No chart junk: no gridlines, no axis lines, no shadows, faint tick labels, no legend when one series.
- Charts load Plotly only in the browser and only where used, behind a Skeleton.
- Charts and numbers read left to right in Persian too: time runs to the right, the scale stands on the left, a drawing is never mirrored. Only the words are in the page’s language (Persian labels, digits and calendar); a signed number is isolated left to right (fmtFor’s signed and delta, ltrIsolate).
- Custom diagrams: d3 inside a component, colours from var(--color-*).

## Components

### Chart

Plotly chart with the Divan template, loaded only in the browser.

```ts
import Chart from '#lib/components/charts/Chart.svelte';
```

```svelte
<Chart
	data={[{ type: 'bar', x: days, y: views, name: 'Views' }]}
	layout={{ yaxis: { title: { text: 'Views' } } }}
	label="Page views per day"
/>
```
