A Khosra Demo

Readings from a rain gauge on a roof

Menu

Charts, Every Kind

Every kind of chart khata draws from a table of numbers — drawn on the server, read without a script, the numbers always beneath.

Contents

One call, chart. Write a table inside it, or name a data file; a bare word in its braces says the kind. The first column names the rows, every later column is a series. Point at a chart to read a row, use the arrow keys once it has the focus, switch a series off in its legend, and sort the table under The numbers — a column or bar chart takes the new order too. A feed gets only the table.

Columns

  • 2025
  • 2026
Rain by month, in millimetres

Source: The roof gauge's log

The numbers
month20252026
Jun310280
Jul420455
Aug365390
Sep240205
Oct95130

Stacked

{column stacked} sets each row’s values on top of one another, so the height is the row’s total.

  • roof
  • garden
  • river bank
Where the month’s rain fell, in millimetres
The numbers
monthroofgardenriver bank
Jun1209070
Jul160150145
Aug140130120
Sep807055

Below zero

A column hangs from zero when its value is below it.

Each month against its ten-year mean, in millimetres
The numbers
monthdifference
Jun−30
Jul35
Aug25
Sep−35
Oct35

Bars

{bar} lays the rows down the side, which suits long names.

Days with rain this season, by station
The numbers
stationdays
The roof gauge61
The garden tin58
The river-bank post64
The school’s weather box49

Lines

From a data file — ::chart{line data=rain x=day y=mm} — its dates read as dates:

Rain, 1–14 June, in millimetres
The numbers
daymm
1 June 20260
2 June 20264.5
3 June 202612
4 June 20269
5 June 202631
6 June 202622.5
7 June 20263
8 June 20260
9 June 20267
10 June 202618
11 June 202644
12 June 202626
13 June 202610
14 June 20262

Several series, with fit so the axis starts near the lowest value rather than at zero:

  • upstream
  • the bridge
  • the ghat
The river at three posts, in metres
The numbers
dayupstreamthe bridgethe ghat
Mon3.102.852.60
Tue3.252.952.70
Wed3.603.202.90
Thu3.553.353.05
Fri3.303.253.10
Sat3.153.052.95
Sun3.052.952.85

Areas

  • morning
  • afternoon
  • night
The week’s rain by part of the day, in millimetres
The numbers
daymorningafternoonnight
Mon284
Tue0129
Wed51511
Thu362
Fri021

Parts of a whole

  • Jun 280
  • Jul 455
  • Aug 390
  • Sep 205
The season’s rain by month
The numbers
monthmm
Jun280
Jul455
Aug390
Sep205

A donut carries the total in its middle:

  • dawn 4.5
  • noon 12
  • dusk 21.5
  • night 9
One July day, by hour of the reading
The numbers
whenmm
dawn4.5
noon12
dusk21.5
night9

Scatter

{scatter} places each row by the number in its first column.

Rain against runoff at the drain, one dot a day
The numbers
rain (mm)runoff (L)
20
512
830
1248
1570
21105
26140
30150

Heat

{heat} is the table itself, each cell shaded by its value.

Hours of rain, by week and day
weekMonTueWedThuFriSatSun
10135200
24687321
3911106432
42100135

In a sentence

A sparkline is word-sized: this week’s readings went 3, 5, 2, 8, 6, 9, 4, and the hours of rain each day 1, 4, 2, 6, 5, 3, 0. The numbers follow for a reader who cannot see the line.

More kinds

Dots and lollipops

{dot} is a dot per value, several series in one row’s column — lighter than bars when there are many rows.

  • 2025
  • 2026
Days with rain, two seasons
The numbers
station20252026
roof5561
garden5258
river bank6664
school4149
bridge5860

{lollipop} puts each dot on a stem from zero:

Rain by month, in millimetres
The numbers
monthmm
Jun280
Jul455
Aug390
Sep205
Oct130

Range

{range} joins a row’s first two values — a low and a high, a before and an after:

  • low
  • high
The river at the bridge, the day’s low and high, in metres
The numbers
daylowhigh
Mon2.622.95
Tue2.703.18
Wed2.953.52
Thu3.103.48
Fri2.983.21

Slope

{slope} draws each row as a line from its first value to its second — who rose and who fell between two seasons:

Days with rain, 2025 to 2026
The numbers
station20252026
roof5561
garden5258
river bank6664
school4149

Small multiples

{multiples} draws a line or area chart’s series apart, one small chart each, all on one axis — easier to read than lines that cross:

upstream

the bridge

the ghat

The river at three posts, in metres
The numbers
dayupstreamthe bridgethe ghat
Mon3.102.852.60
Tue3.252.952.70
Wed3.603.202.90
Thu3.553.353.05
Fri3.303.253.10
Sat3.153.052.95
Sun3.052.952.85

Parts of each whole

{column percent} stacks each row’s values as parts of that row’s own total, so rows of different sizes compare by share:

  • roof
  • garden
  • river bank
Where each month’s rain fell, by share
The numbers
monthroofgardenriver bank
Jun1209070
Jul160150145
Aug140130120
Sep807055

Waterfall

{waterfall} steps each row from the running total before it, rises and falls in two colours, and ends on the net:

The water butt over July, in litres
The numbers
whatlitres
first storm120
the garden−45
the kitchen−30
second storm160
a leak−20
the garden again−60
Net125

Histogram

{histogram} counts one column of readings into ranges — how the values spread, not what each one was. A table of one column is enough:

Thirty mornings at the bridge, in metres
The numbers
levelCount
2.6–2.81
2.8–3.03
3.0–3.23
3.2–3.44
3.4–3.65
3.6–3.85
3.8–4.04
4.0–4.22
4.2–4.41
4.4–4.61
4.6–4.81

Box plot

{box} gives each series its spread: the middle half as a box, the median a line through it, whiskers to the furthest values within reach, the rest as dots.

Ten mornings at three posts, in metres
The numbers
LowQ1MedianQ3High
upstream3.053.163.283.53.6
the bridge2.852.963.083.193.35
the ghat2.62.762.882.953.1

Calendar

{calendar} lays dated rows on a grid of weeks, Monday at the top, a season at a glance — here from data/rain-season.csv:

Rain, June to August, by day
The numbers
daymm
1 June 20269.8
2 June 20260
3 June 20260
4 June 20263.5
5 June 20260
6 June 20260
7 June 20260
8 June 20260
9 June 20260
10 June 20260
11 June 20260
12 June 20260
13 June 202613.3
14 June 202623.8
15 June 20260
16 June 20260
17 June 20260
18 June 20260
19 June 20264.1
20 June 20260
21 June 20260
22 June 20260
23 June 20260
24 June 20260
25 June 20265.8
26 June 20260
27 June 20268.6
28 June 20260
29 June 20260
30 June 20260
1 July 202617.4
2 July 20267.7
3 July 202612.3
4 July 20261.7
5 July 202619.4
6 July 20260
7 July 202634.8
8 July 20267.6
9 July 20260
10 July 202610.2
11 July 20263.6
12 July 20260.7
13 July 20260
14 July 20260
15 July 202613.6
16 July 20269.2
17 July 202630.4
18 July 20260
19 July 20268.9
20 July 20260
21 July 20260
22 July 202611.5
23 July 20260
24 July 202622.5
25 July 20269.1
26 July 20260
27 July 20264.9
28 July 20260.5
29 July 20260
30 July 20260
31 July 202610.4
1 August 20260
2 August 20260
3 August 20269.3
4 August 20260
5 August 20260
6 August 20260
7 August 20260
8 August 20260
9 August 20260
10 August 202634.8
11 August 202616.4
12 August 20260
13 August 20260
14 August 20260
15 August 20260
16 August 20260
17 August 20260
18 August 20260
19 August 20264.3
20 August 20260
21 August 202619.3
22 August 20260
23 August 20260
24 August 20260
25 August 20260
26 August 20260
27 August 202622.1
28 August 202613.6
29 August 20260
30 August 20260
31 August 20260

Treemap

{treemap} cuts one whole into a rectangle a row, its area the row’s share and its shade its value, largest first — for a whole of more parts than a pie can tell apart:

The shelf, by subject, in books
The numbers
subjectbooks
Fiction64
History31
Poetry22
Science18
Art15
Travel12
Cookery9
Weather7
Maps4

Flow

{flow} reads rows of from, to and an amount, and draws where it went: a bar for every name, as tall as what runs through it, and a ribbon for every row, as thick as its amount, always rightward:

Where a month’s money went, in taka
The numbers
from → totaka
Pay → Rent18000
Pay → Food12000
Pay → Savings8000
Pay → Travel4000
Lessons → Savings3000
Food → The market9000
Food → The tea stall3000
Savings → The bank8000
Savings → A new gauge3000

Spans

{spans} lays rows of a name, a beginning and an end along one time axis — a day, 2019-03 or a year, the end read as the last day it names. An empty end runs to now, and its bar is lighter:

Places, and the gauge
The numbers
whatfromto
School in Rajshahi20042013
University20132017-06
The first flat2017-072021-02
This flat2021-03now
The tin on the roof2017-062026-07
The new gauge2026-07now

From elsewhere, and from the site

data= takes an address as well as a file: a CSV, JSON or YAML document another site serves, fetched in the background and kept, refreshed every hour unless expires= says otherwise. The host has to be one the site allows (remote.hosts); until the first copy arrives the chart is empty.

::chart{line fit data=https://raw.githubusercontent.com/datasets/co2-ppm/main/data/co2-annmean-mlo.csv x=Year y=Mean caption="Carbon dioxide at Mauna Loa, yearly mean, ppm" source=datasets/co2-ppm}

And data=site: counts the site itself — publications or words, by year, month, tag or section, narrowed as :count is — so a chart of what has been written here stays true without being edited.

::chart{column data=site:publications by=year caption="Publications a year"}
::chart{bar data=site:publications by=tag caption="Publications by tag"}
::chart{column data=site:words by=section caption="Words by section"}
Publications a year
The numbers
xpublications
20161
20231
202527
2026136
Publications by tag
The numbers
xpublications
journal40
monsoon16
reference16
reading3
Comics2
beginnings2
listening2
20251
essays1
games1
Words by section
The numbers
xwords
pages16693
posts5766
writing2230
densities1494
mocks1405
status676
logs570
listings525
comics370
art145

Placed

A chart sits where a picture can, by the same words in its braces.

  • dawn 4.5
  • noon 12
  • dusk 21.5
  • night 9
July, by part of the day
The numbers
whenmm
dawn4.5
noon12
dusk21.5
night9

{marginal} hangs a chart in the margin beside its paragraph — a donut or a pie suits the narrow strip best. The words keep their measure, and below the width that has a margin the chart comes back into the column, small and centred.

The bridge post, in metres
The numbers
daym
Mon2.85
Tue2.95
Wed3.20
Thu3.35
Fri3.25

{runaround-left} sets it beside the text, drawn shorter, with the words running round it for as long as it lasts. The river rose through the middle of the week and fell back by Friday, which is the whole story the chart tells, so it can sit beside the sentence that tells it rather than interrupting it.

  • 2025
  • 2026
Rain by month, wider than the column with {plate}
The numbers
month20252026
Jun310280
Jul420455
Aug365390
Sep240205
Oct95130

A measure narrows one inside the column — {bar half centred}:

Days with rain, half the column
The numbers
stationdays
roof61
garden58
river bank64

Not a number

A cell that holds no number is a gap, not a zero:

A week with a broken gauge
The numbers
daymm
Mon4
Tue7
Wed—
Thu5
Fri9

khosra · khata 4d8d4c99 · content f6393d22 · 228 publications, 4256671 bytes · built in 1.460642387s