@samizdata/create-mozaic 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -8,14 +8,14 @@ description: Build or change a chart in this mozaic analysis project. Use when a
|
|
|
8
8
|
1. **Data.** Find or create the tidy CSV in `data/processed/`. If it does not exist, add a step to
|
|
9
9
|
the analysis script (`analysis/R` or `analysis/py`) that writes it, and run it.
|
|
10
10
|
2. **Form.** Pick the chart from what the data must show: magnitude → bars; change over time →
|
|
11
|
-
lines; parts of a whole → stacked bars (`StackedBarChart`) or a waffle; parts of a whole across groups of different sizes → mosaic (`MosaicChart`); distribution → beeswarm or histogram;
|
|
11
|
+
lines; parts of a whole → stacked bars (`StackedBarChart`) or a waffle; parts of a whole across groups of different sizes → mosaic (`MosaicChart`); distribution → beeswarm or histogram; where a reader's own value sits in published percentiles ("how do you compare?") → `PercentileChart`;
|
|
12
12
|
geography → choropleth; two values per item → dumbbell or slope; one item at two dates → arrow plot (`ArrowChart`), or bars
|
|
13
13
|
with a dot for the earlier date (`BarDotChart`) when the latest value matters most. One number → no chart.
|
|
14
14
|
3. **Files.** Copy `src/charts/example/` to `src/charts/<slug>/`. Edit `data.ts` (import the CSV
|
|
15
15
|
with `?raw`, parse with `csvParse(raw, autoType)`, type the rows), `messages.ts` (title,
|
|
16
16
|
subtitle, alt, notes, source per language) and `Chart.svelte`.
|
|
17
17
|
4. **Compose.** If a recipe in `@samizdata/mozaic/recipes` fits (`BarChart`, `ColumnChart`, `LineChart`,
|
|
18
|
-
`ScatterChart`, `ArrowChart`, `BarDotChart`, `StackedBarChart`, `MosaicChart`), wrap it: pass the data, accessors and strings. A new
|
|
18
|
+
`ScatterChart`, `ArrowChart`, `BarDotChart`, `StackedBarChart`, `MosaicChart`, `PercentileChart`), wrap it: pass the data, accessors and strings. A new
|
|
19
19
|
form that other charts could reuse goes into mozaic as a recipe, not into this project.
|
|
20
20
|
Otherwise use `Chart` / `Header` / `Plot` / `Svg` / marks / guides / `Footer` from mozaic.
|
|
21
21
|
Prefer existing marks (`Bars`, `Line`, `Area`, `Points`, `Rects`, `Text`, `GeoPath`, `Treemap`,
|