@fundar/data-chart-telling 1.15.0 → 1.17.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.
Files changed (197) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/configuration/ConfigVars.svelte +14 -0
  3. package/dist/configuration/ConfigVars.svelte.d.ts +3 -0
  4. package/dist/configuration/config.svelte.d.ts +5 -0
  5. package/dist/configuration/config.svelte.js +18 -4
  6. package/dist/configuration/themes/dark.js +1 -1
  7. package/dist/configuration/themes/editorial.js +1 -1
  8. package/dist/index.d.ts +6 -3
  9. package/dist/index.js +2 -1
  10. package/dist/layout/base/BasePlotLayout.svelte +1 -1
  11. package/dist/layout/figure/Figure.svelte +5 -12
  12. package/dist/layout/figure/FigureChrome.svelte +2 -10
  13. package/dist/layout/geometry/GeometryLayout.svelte +42 -1
  14. package/dist/layout/hover/HoverSettings.d.ts +3 -1
  15. package/dist/layout/hover/HoverSettings.js +4 -2
  16. package/dist/layout/legend/DisabledStyle.d.ts +1 -1
  17. package/dist/layout/legend/DisabledStyle.js +1 -1
  18. package/dist/layout/legend/DiscreteBadgeItem.svelte +1 -1
  19. package/dist/layout/legend/DiscreteSection.svelte +1 -1
  20. package/dist/layout/legend/LegendState.svelte.d.ts +12 -2
  21. package/dist/layout/legend/LegendState.svelte.js +18 -4
  22. package/dist/layout/legend/LegendText.d.ts +4 -1
  23. package/dist/layout/legend/LegendText.js +7 -1
  24. package/dist/layout/margins/PlotMargins.svelte.d.ts +2 -2
  25. package/dist/layout/margins/PlotMargins.svelte.js +2 -2
  26. package/dist/layout/plot/Plot.svelte +4 -2
  27. package/dist/layout/plot/Plot.svelte.d.ts +2 -1
  28. package/dist/layout/scales/ScalesLayout.svelte +1 -1
  29. package/dist/layout/styles/ValueLabels.d.ts +33 -2
  30. package/dist/layout/styles/ValueLabels.js +67 -8
  31. package/dist/layout/timeline/Timeline.svelte +5 -1
  32. package/dist/layout/timeline/TimelineLayout.svelte +4 -1
  33. package/dist/layout/timeline/TimelineSteps.d.ts +6 -2
  34. package/dist/layout/timeline/TimelineSteps.js +9 -3
  35. package/dist/markers/area/AreaMarker.svelte +3 -0
  36. package/dist/markers/arrow/ArrowMarker.svelte +9 -5
  37. package/dist/markers/bar/BarMarker.svelte +45 -48
  38. package/dist/markers/bollinger/BollingerMarker.svelte +3 -0
  39. package/dist/markers/box/BoxMarker.svelte +3 -1
  40. package/dist/markers/cell/CellMarker.svelte +11 -7
  41. package/dist/markers/contour/ContourMarker.svelte +3 -0
  42. package/dist/markers/delaunay/DelaunayLinkMarker.svelte +9 -5
  43. package/dist/markers/delaunay/DelaunayMeshMarker.svelte +3 -0
  44. package/dist/markers/density/DensityMarker.svelte +3 -0
  45. package/dist/markers/difference/DifferenceMarker.svelte +3 -0
  46. package/dist/markers/dot/DotMarker.svelte +11 -6
  47. package/dist/markers/geo/GraticuleMarker.svelte +3 -0
  48. package/dist/markers/geo/SphereMarker.svelte +3 -0
  49. package/dist/markers/hover/HoverMarker.svelte +22 -6
  50. package/dist/markers/hull/HullMarker.svelte +3 -0
  51. package/dist/markers/image/ImageMarker.svelte +3 -0
  52. package/dist/markers/line/LineMarker.svelte +3 -0
  53. package/dist/markers/link/LinkMarker.svelte +3 -0
  54. package/dist/markers/raster/RasterMarker.svelte +3 -0
  55. package/dist/markers/rect/RectMarker.svelte +25 -17
  56. package/dist/markers/regression/RegressionMarker.svelte +3 -0
  57. package/dist/markers/rule/RuleMarker.svelte +15 -5
  58. package/dist/markers/text/TextFit.d.ts +44 -0
  59. package/dist/markers/text/TextFit.js +86 -0
  60. package/dist/markers/text/TextMarker.svelte +186 -90
  61. package/dist/markers/text/TextMarker.svelte.d.ts +2 -0
  62. package/dist/markers/tick/TickMarker.svelte +9 -3
  63. package/dist/markers/trail/TrailMarker.svelte +3 -0
  64. package/dist/markers/utils/BoxLabel.d.ts +58 -0
  65. package/dist/markers/utils/BoxLabel.js +175 -0
  66. package/dist/markers/utils/MarkerEvents.d.ts +23 -0
  67. package/dist/markers/utils/MarkerEvents.js +44 -0
  68. package/dist/markers/utils/MarkerLabel.svelte +33 -0
  69. package/dist/markers/utils/MarkerLabel.svelte.d.ts +10 -0
  70. package/dist/markers/utils/RowStroke.d.ts +9 -21
  71. package/dist/markers/utils/RowStroke.js +10 -21
  72. package/dist/markers/utils/RowStyle.d.ts +26 -0
  73. package/dist/markers/utils/RowStyle.js +55 -0
  74. package/dist/markers/vector/VectorMarker.svelte +3 -0
  75. package/dist/markers/voronoi/VoronoiMarker.svelte +9 -5
  76. package/dist/markers/voronoi/VoronoiMeshMarker.svelte +3 -0
  77. package/dist/markers/waffle/WaffleMarker.svelte +9 -5
  78. package/dist/phases/Pipeline.d.ts +3 -1
  79. package/dist/phases/Pipeline.js +1 -0
  80. package/dist/phases/data/DataPhase.js +51 -10
  81. package/dist/phases/hover/HoverPhase.js +9 -1
  82. package/dist/phases/mapping/MappingPhase.js +2 -1
  83. package/dist/phases/markers/MarkerStyles.d.ts +18 -0
  84. package/dist/phases/markers/MarkerStyles.js +111 -0
  85. package/dist/phases/markers/MarkersPhase.d.ts +1 -1
  86. package/dist/phases/markers/MarkersPhase.js +7 -5
  87. package/dist/phases/statistics/StatisticsPhase.js +1 -1
  88. package/dist/phases/transforms/Transforms.js +3 -1
  89. package/dist/phases/transforms/TransformsPhase.js +58 -4
  90. package/dist/phases/transforms/methods/TreemapTransform.d.ts +28 -0
  91. package/dist/phases/transforms/methods/TreemapTransform.js +119 -0
  92. package/dist/plots/correlation/heatmap/defaults.js +2 -2
  93. package/dist/plots/correlation/heatmap/markers.d.ts +0 -8
  94. package/dist/plots/correlation/heatmap/markers.js +8 -35
  95. package/dist/plots/correlation/scatter/markers.d.ts +1 -1
  96. package/dist/plots/correlation/scatter/markers.js +2 -2
  97. package/dist/plots/distribution/histogram/defaults.js +2 -2
  98. package/dist/plots/distribution/histogram/markers.d.ts +1 -10
  99. package/dist/plots/distribution/histogram/markers.js +17 -59
  100. package/dist/plots/distribution/pyramid/defaults.js +3 -3
  101. package/dist/plots/distribution/pyramid/markers.d.ts +0 -10
  102. package/dist/plots/distribution/pyramid/markers.js +13 -64
  103. package/dist/plots/distribution/violin/markers.js +1 -1
  104. package/dist/plots/map/geo/phases/markers.js +3 -2
  105. package/dist/plots/part-of-a-whole/treemap/Plot.svelte +47 -0
  106. package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +26 -0
  107. package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +10 -0
  108. package/dist/plots/part-of-a-whole/treemap/defaults.js +167 -0
  109. package/dist/plots/ranking/bar/defaults.js +2 -2
  110. package/dist/plots/ranking/bar/markers.d.ts +1 -11
  111. package/dist/plots/ranking/bar/markers.js +38 -80
  112. package/dist/plots/ranking/bullet/markers.js +2 -3
  113. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +17 -13
  114. package/dist/types/configuration/styling.d.ts +33 -2
  115. package/dist/types/layout/legend.d.ts +8 -1
  116. package/dist/types/layout/mapping.d.ts +12 -3
  117. package/dist/types/layout/scales.d.ts +6 -0
  118. package/dist/types/layout/tooltip.d.ts +16 -4
  119. package/dist/types/markers/axis/arrow.d.ts +2 -8
  120. package/dist/types/markers/axis/bar.d.ts +4 -8
  121. package/dist/types/markers/axis/cell.d.ts +5 -5
  122. package/dist/types/markers/axis/delaunayLink.d.ts +2 -2
  123. package/dist/types/markers/axis/rect.d.ts +4 -8
  124. package/dist/types/markers/axis/rule.d.ts +2 -16
  125. package/dist/types/markers/axis/tick.d.ts +2 -2
  126. package/dist/types/markers/axis/voronoi.d.ts +2 -2
  127. package/dist/types/markers/axis/waffle.d.ts +4 -3
  128. package/dist/types/markers/basic/dot.d.ts +2 -2
  129. package/dist/types/markers/basic/text.d.ts +56 -14
  130. package/dist/types/markers/channels/commonMarkerConfig.d.ts +4 -1
  131. package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +1 -2
  132. package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +10 -0
  133. package/dist/types/markers/channels/commonMarkerConfigWithLabel.js +1 -0
  134. package/dist/types/markers/channels/commonMarkerEvents.d.ts +17 -0
  135. package/dist/types/markers/channels/commonMarkerEvents.js +13 -0
  136. package/dist/types/markers/geo/contour.d.ts +2 -1
  137. package/dist/types/markers/geo/graticule.d.ts +2 -1
  138. package/dist/types/markers/geo/link.d.ts +2 -1
  139. package/dist/types/markers/geo/sphere.d.ts +2 -1
  140. package/dist/types/markers/geo/vector.d.ts +2 -1
  141. package/dist/types/phases/data/phase.d.ts +5 -0
  142. package/dist/types/phases/hover/phase.d.ts +2 -0
  143. package/dist/types/phases/state.d.ts +7 -0
  144. package/dist/types/phases/statistics/phase.d.ts +2 -1
  145. package/dist/types/phases/transforms/phase.d.ts +11 -0
  146. package/dist/types/plots/constants.d.ts +14 -14
  147. package/dist/types/plots/correlation/heatmap/props.d.ts +3 -3
  148. package/dist/types/plots/correlation/scatter/props.d.ts +3 -3
  149. package/dist/types/plots/data/common.d.ts +19 -6
  150. package/dist/types/plots/data/geo.d.ts +1 -1
  151. package/dist/types/plots/distribution/box/props.d.ts +3 -3
  152. package/dist/types/plots/distribution/density/props.d.ts +3 -11
  153. package/dist/types/plots/distribution/histogram/props.d.ts +3 -11
  154. package/dist/types/plots/distribution/pyramid/props.d.ts +3 -3
  155. package/dist/types/plots/distribution/violin/props.d.ts +3 -3
  156. package/dist/types/plots/evolution/area/props.d.ts +3 -3
  157. package/dist/types/plots/evolution/line/props.d.ts +3 -3
  158. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +19 -0
  159. package/dist/types/plots/part-of-a-whole/treemap/props.js +1 -0
  160. package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +6 -0
  161. package/dist/types/plots/part-of-a-whole/treemap/state.js +1 -0
  162. package/dist/types/plots/props.d.ts +7 -4
  163. package/dist/types/plots/ranking/bar/props.d.ts +3 -3
  164. package/dist/types/plots/ranking/cleveland/props.d.ts +3 -3
  165. package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -3
  166. package/dist/types/plots/ranking/forest/props.d.ts +3 -3
  167. package/dist/types/plots/ranking/lollipop/props.d.ts +3 -3
  168. package/dist/types/plots/styling.d.ts +24 -0
  169. package/dist/types/transforms/index.d.ts +3 -1
  170. package/dist/types/transforms/treemap.d.ts +32 -0
  171. package/dist/types/transforms/treemap.js +5 -0
  172. package/dist/utils/color/ColorTones.d.ts +19 -0
  173. package/dist/utils/color/ColorTones.js +64 -0
  174. package/dist/utils/color/CssColor.d.ts +14 -5
  175. package/dist/utils/color/CssColor.js +69 -27
  176. package/dist/utils/color/index.d.ts +4 -0
  177. package/dist/utils/color/index.js +4 -0
  178. package/dist/utils/grouping.d.ts +18 -1
  179. package/dist/utils/grouping.js +31 -0
  180. package/docs/concepts.md +3 -2
  181. package/docs/legend.md +8 -5
  182. package/docs/markers.md +76 -26
  183. package/docs/plots/part-of-a-whole/treemap.md +69 -0
  184. package/docs/plots/ranking/bar.md +1 -1
  185. package/docs/plots.md +21 -20
  186. package/docs/scales.md +3 -0
  187. package/docs/state.md +1 -1
  188. package/docs/styles-and-segments.md +19 -18
  189. package/docs/theming.md +5 -12
  190. package/docs/tooltip-and-hover.md +1 -1
  191. package/docs/transforms-and-statistics.md +17 -16
  192. package/examples/Treemap.svelte +13 -0
  193. package/examples/datasets/economic-activity.ts +40 -0
  194. package/examples/datasets/index.ts +1 -0
  195. package/llms-full.txt +5 -5
  196. package/llms.txt +2 -0
  197. package/package.json +3 -1
@@ -0,0 +1,40 @@
1
+ // ── The weight of each branch of activity in a city's gross added value ──────
2
+ // IDECBA, value added at basic prices by branch of activity, Ciudad de Buenos Aires,
3
+ // 2024 (preliminary), in millions of pesos of 2004. A selection of the larger branches.
4
+
5
+ export type ActivityRow = {
6
+ sector: 'Primary' | 'Secondary' | 'Tertiary';
7
+ kind: string;
8
+ branch: string;
9
+ /** Millions of pesos of 2004. */
10
+ value: number;
11
+ };
12
+
13
+ export const ACTIVITY_BRANCHES: ActivityRow[] = [
14
+ { sector: 'Primary', kind: 'Extraction', branch: 'Oil, gas and coal', value: 778 },
15
+ { sector: 'Primary', kind: 'Agriculture', branch: 'Agriculture and livestock', value: 193 },
16
+ { sector: 'Secondary', kind: 'Manufacturing', branch: 'Chemicals', value: 2999 },
17
+ { sector: 'Secondary', kind: 'Manufacturing', branch: 'Food and beverages', value: 2882 },
18
+ { sector: 'Secondary', kind: 'Manufacturing', branch: 'Publishing and printing', value: 1251 },
19
+ { sector: 'Secondary', kind: 'Manufacturing', branch: 'Machinery and equipment', value: 973 },
20
+ { sector: 'Secondary', kind: 'Manufacturing', branch: 'Clothing', value: 814 },
21
+ { sector: 'Secondary', kind: 'Manufacturing', branch: 'Textiles', value: 381 },
22
+ {
23
+ sector: 'Tertiary',
24
+ kind: 'Trade and transport',
25
+ branch: 'Wholesale and retail trade',
26
+ value: 15365
27
+ },
28
+ { sector: 'Tertiary', kind: 'Trade and transport', branch: 'Transport', value: 3707 },
29
+ { sector: 'Tertiary', kind: 'Trade and transport', branch: 'Communications', value: 8210 },
30
+ { sector: 'Tertiary', kind: 'Finance', branch: 'Banking and finance', value: 7857 },
31
+ { sector: 'Tertiary', kind: 'Finance', branch: 'Insurance', value: 3106 },
32
+ { sector: 'Tertiary', kind: 'Public services', branch: 'Public administration', value: 7606 },
33
+ { sector: 'Tertiary', kind: 'Public services', branch: 'Public education', value: 2374 },
34
+ { sector: 'Tertiary', kind: 'Public services', branch: 'Public health', value: 1525 },
35
+ { sector: 'Tertiary', kind: 'Private services', branch: 'Private health', value: 5439 },
36
+ { sector: 'Tertiary', kind: 'Private services', branch: 'Private education', value: 1952 },
37
+ { sector: 'Tertiary', kind: 'Private services', branch: 'Restaurants and bars', value: 2439 },
38
+ { sector: 'Tertiary', kind: 'Real estate', branch: 'Housing', value: 6179 },
39
+ { sector: 'Tertiary', kind: 'Real estate', branch: 'Construction', value: 3905 }
40
+ ];
@@ -5,6 +5,7 @@ export * from './commodity-prices';
5
5
  export * from './countries-over-time';
6
6
  export * from './daily-temperature';
7
7
  export * from './earthquakes';
8
+ export * from './economic-activity';
8
9
  export * from './flight-routes';
9
10
  export * from './height-density';
10
11
  export * from './heights';
package/llms-full.txt CHANGED
@@ -12,7 +12,7 @@ Svelte 5 plot components on top of svelteplot. This file is checked against the
12
12
  ## The mental model
13
13
 
14
14
  - A **plot** is one graph (axes + marks). Titles, subtitle, caption, legend, facets and a timeline are props of the plot itself.
15
- - Plots: `LinePlot AreaPlot BarPlot DensityPlot HistogramPlot BoxPlot ViolinPlot LollipopPlot DumbbellPlot ClevelandPlot ForestPlot BulletPlot SlopePlot SparklinePlot HeatmapPlot PyramidPlot ScatterPlot GeoPlot`.
15
+ - Plots: `LinePlot AreaPlot BarPlot DensityPlot HistogramPlot BoxPlot ViolinPlot LollipopPlot DumbbellPlot ClevelandPlot ForestPlot BulletPlot SlopePlot SparklinePlot TreemapPlot HeatmapPlot PyramidPlot ScatterPlot GeoPlot`.
16
16
  - `PlotComposer` lays several plots out in one figure with shared hover, legend and timeline.
17
17
  - `width` and `height` are pixel numbers on a standalone plot. To fill a container or the window, bind its size (`examples/ResponsiveLine.svelte`) and render the plot once both are > 0.
18
18
 
@@ -43,12 +43,12 @@ Two ways to give data, one per plot:
43
43
  | `segments` | Style ranges of the data (rule 1 below). |
44
44
  | `markers` | Extra marks, an array of `{ type: '...', ... }`. |
45
45
  | `margins` | `{ top, right, bottom, left }`, each a number or `'auto'` (all `'auto'` by default). |
46
- | `tooltip` | `true` or `{ strategy, sync, format, content, series, anchorX, anchorY }`. The text lists matched rows highest value first; a `content` snippet gets them unsorted. |
46
+ | `tooltip` | `true` or `{ strategy, sync, format, content, series, anchorX, anchorY }`; `format(row, number, context)`, `context` holding the row's `series` and what the kind adds (a treemap's `share`). The text lists matched rows highest value first; a `content` snippet gets them unsorted. |
47
47
  | `timeline` | `{ accessor: 'year' }` steps through the rows by a field, drawn as a player bar (default); `type: 'rule'` draws a rule beside the plot instead. The field may hold numbers, `Date`s or date strings (ISO, or any other with `dateFormat: 'DD/MM/YYYY'`); date steps read as dates, and reach `onvalue`, `player.format` and `useFigure().timeline` (`steps`, `value`, `seekValue`) as `Date`s. Other options: `progress` (position, `0`-`1`), `values` (the steps, when not every distinct value), `filterMode` (`'exact'` shows the current step's rows, `'upTo'` every row up to it; `LinePlot` defaults to `'upTo'`), `interpolate` (tween values between steps), `scales` (`'shared'` keeps both axes still across steps, `'free'` refits both to each step, `'free-x'`/`'free-y'` refit one and keep the other still), `onprogress`, `onvalue`, and a rule's `orientation`, `show` and `thickness`. |
48
48
  | `facet` | `{ by: 'field', columns, gap, scales: 'shared'\|'free'\|'free-x'\|'free-y', mode: 'grid'\|'carousel'\|'paginated' }` or `{ rows, cols }`. |
49
- | `transforms` `statistics` | svelteplot transforms / derived summaries. `statistics` is `[{ type, ...options, series?, pooled? }]` (per series by default, `series: ['a']` only those, `pooled: true` all rows at once; a marker's own `.statistics` runs over its own `data`). Types: `regression` (`regressionType`: `'linear'|'quad'|'poly'|'exp'|'log'|'pow'|'loess'`, `order`, `base`, `span`, `confidence`, `styles`), `movingAverage` (`k`, `reduce`, `styles`), `bollinger` (`n`, `k`, `styles`), `density` (`kernel`, `bandwidth`, `styles`), `density2d` (`bandwidth`, `thresholds`, `styles`), `box` (the `box` marker's options), `deviation` (a rule at an estimator and a band around it, along the plot's value axis: `estimator`: `'mean'|'median'|'midrange'`, `spread`: `'stdev'|'mad'`, `k`, `rule` and `band`: styles or `false`, each with an optional `label: true | { text, styles: FontStyle }`, the band's also `edge: 'lower'|'upper'` and `position: 'inside'|'outside'`)|'upper'`). |
49
+ | `transforms` `statistics` | svelteplot transforms / derived summaries. `treemap` is the library's own transform: `{ type: 'treemap', value: 'count', levels: ['island', 'species'], tile: 'squarify', aspect: 1 }` makes a tile per distinct path of `levels` (outermost first), its area the sum of its rows' `value`, and gives a `rect` marker `x1`/`x2`/`y1`/`y2` in the unit square (`x`/`y` at each tile's centre for a `text`). `statistics` is `[{ type, ...options, series?, pooled? }]` (per series by default, `series: ['a']` only those, `pooled: true` all rows at once; a marker's own `.statistics` runs over its own `data`). Types: `regression` (`regressionType`: `'linear'|'quad'|'poly'|'exp'|'log'|'pow'|'loess'`, `order`, `base`, `span`, `confidence`, `styles`), `movingAverage` (`k`, `reduce`, `styles`), `bollinger` (`n`, `k`, `styles`), `density` (`kernel`, `bandwidth`, `styles`), `density2d` (`bandwidth`, `thresholds`, `styles`), `box` (the `box` marker's options), `deviation` (a rule at an estimator and a band around it, along the plot's value axis: `estimator`: `'mean'|'median'|'midrange'`, `spread`: `'stdev'|'mad'`, `k`, `rule` and `band`: styles or `false`, each with an optional `label: true | { text, styles: FontStyle }`, the band's also `edge: 'lower'|'upper'` and `position: 'inside'|'outside'`)|'upper'`). |
50
50
 
51
- Per kind: `BarPlot` x = category, y = value (swap for horizontal bars); `PyramidPlot` mirrors two series around zero; `HeatmapPlot` colors cells by `color`; `HistogramPlot` bins one numeric field; `DensityPlot` smooths one numeric field into a kernel density curve (`styles.mark: 'line'` draws a line instead of an area; a `densityX` transform sets `kernel` and `bandwidth`); `BoxPlot` x = category, y = value, one box per category (its tooltip row is the box summary: `min`, `p25`, `median`, `p75`, `max`, `count`, `outliers`); `ViolinPlot` x = category, y = value (swap for horizontal), the mirrored density of each category's values with a box inside (`styles`: `kernel`, `bandwidth`, `trim`, `scale: 'width'|'shared'`, `box: false | width`; its tooltip row is a box plot's); `LollipopPlot` x = category, y = value, one dot on a stem per category (stems start at zero, or at the nearest end of a pinned domain; `styles.values` labels each dot); `DumbbellPlot` x = category, y = value, `color`/`grouping` names exactly two series, joined by a connector per category (another count warns); `ClevelandPlot` is the same for any number of series, joined from the lowest to the highest (use `grouping` for a numeric series field; `styles.values.select` (`'first'|'last'|'min'|'max'` or a list), `series` and `color: 'series'` choose and color the labelled dots; `styles.connector` sets the connector's `width` (number or `'dots'` for a band), `color` (one, `{ by: 'sign' | 'difference' | 'length' }` or a function), `opacity`, `arrow` (draws the from-to stretch as an arrow), `outside` (the part past the from/to dots), `label` (centered on the from-to stretch) and the `from`/`to` series of its difference); `ForestPlot` x = value, y = category (or swapped), one dot per row on a stem spanning its interval given by `lower`/`upper` fields or an `error` either side (the value axis fits the intervals; `styles.connector.caps` toggles the end ticks, on by default); `BulletPlot` is a bar plot with a `target` (field, function or number: a tick across the band) and `ranges` (upper bounds, each a field, function or number: bands from the baseline, the smallest darkest) drawn around its thin bars (the value axis reaches them); `SlopePlot` x = category (its first and last positions are the two moments), y = value, a line with a dot on every point per series, its first and last labelled before and after it by `styles.values` (the value axis is hidden by default; `scales.y.axisDisplay: 'visible'` shows it); `SparklinePlot` is a small `LinePlot` with no axes and no legend (`legend` and `margins` bring them back), a dot on each series' last point and its value beside it (`styles.values` formats it or turns it off with `show: false`; `facet` makes one per category); `ScatterPlot` takes `r` (size) and `symbol`; `GeoPlot` takes GeoJSON/TopoJSON in `data` and `coordinates` for the projection (`docs/geo.md`).
51
+ Per kind: `BarPlot` x = category, y = value (swap for horizontal bars); `PyramidPlot` mirrors two series around zero; `HeatmapPlot` colors cells by `color`; `HistogramPlot` bins one numeric field; `DensityPlot` smooths one numeric field into a kernel density curve (`styles.mark: 'line'` draws a line instead of an area; a `densityX` transform sets `kernel` and `bandwidth`); `BoxPlot` x = category, y = value, one box per category (its tooltip row is the box summary: `min`, `p25`, `median`, `p75`, `max`, `count`, `outliers`); `ViolinPlot` x = category, y = value (swap for horizontal), the mirrored density of each category's values with a box inside (`styles`: `kernel`, `bandwidth`, `trim`, `scale: 'width'|'shared'`, `box: false | width`; its tooltip row is a box plot's); `LollipopPlot` x = category, y = value, one dot on a stem per category (stems start at zero, or at the nearest end of a pinned domain; `styles.values` labels each dot); `DumbbellPlot` x = category, y = value, `color`/`grouping` names exactly two series, joined by a connector per category (another count warns); `ClevelandPlot` is the same for any number of series, joined from the lowest to the highest (use `grouping` for a numeric series field; `styles.values.select` (`'first'|'last'|'min'|'max'` or a list), `series` and `color: 'series'` choose and color the labelled dots; `styles.connector` sets the connector's `width` (number or `'dots'` for a band), `color` (one, `{ by: 'sign' | 'difference' | 'length' }` or a function), `opacity`, `arrow` (draws the from-to stretch as an arrow), `outside` (the part past the from/to dots), `label` (centered on the from-to stretch) and the `from`/`to` series of its difference); `ForestPlot` x = value, y = category (or swapped), one dot per row on a stem spanning its interval given by `lower`/`upper` fields or an `error` either side (the value axis fits the intervals; `styles.connector.caps` toggles the end ticks, on by default); `BulletPlot` is a bar plot with a `target` (field, function or number: a tick across the band) and `ranges` (upper bounds, each a field, function or number: bands from the baseline, the smallest darkest) drawn around its thin bars (the value axis reaches them); `SlopePlot` x = category (its first and last positions are the two moments), y = value, a line with a dot on every point per series, its first and last labelled before and after it by `styles.values` (the value axis is hidden by default; `scales.y.axisDisplay: 'visible'` shows it); `SparklinePlot` is a small `LinePlot` with no axes and no legend (`legend` and `margins` bring them back), a dot on each series' last point and its value beside it (`styles.values` formats it or turns it off with `show: false`; `facet` makes one per category); `TreemapPlot` takes `value` (a tile's area) and `grouping` (the whole path of a tile, fields joined by dots, outermost first: `'sector.branch'` - the last level names it, rows with one path are one tile, the outermost colors the tiles and the legend); a `treemap` entry in its `transforms` sets `tile` (`'squarify'` default, `'binary'`, `'slice'`, `'dice'`, `'sliceDice'`); its tiles are labelled by `styles.values` with their name over their share of the whole, cut short or reduced to the share alone where they do not fit; its `segments` can be keyed by the path of a tile (`'Tertiary.Finance'`) and `tooltip.format(row, number, context)` gets the tile's row and a `context` with its `series` and `share` (0-100); `ScatterPlot` takes `r` (size) and `symbol`; `GeoPlot` takes GeoJSON/TopoJSON in `data` and `coordinates` for the projection (`docs/geo.md`).
52
52
 
53
53
  ## Switches
54
54
 
@@ -77,7 +77,7 @@ Inside a plot's snippets (`header`, `footer`, tooltip `content`) or any child of
77
77
 
78
78
  - `useFigure()` returns `{ hover, legend, timeline }` for the whole figure.
79
79
  - `usePlot()` returns the same plus `margins`, `scales`, `axes`, `data`, `width`, `height`, `svelteplot` (inside a plot, e.g. a `component` marker).
80
- - `legend.off` (names of hidden series), `legend.isOff(name)`, `legend.toggle(name, action)`, `turnOff`, `turnOn`. `action` is `{ mode: 'dim' | 'hide' | 'omit' }`; `'omit'` removes the series and refits the axes, so the visible domain follows `legend.off`.
80
+ - `legend.off` (names of hidden series), `legend.isOff(name)`, `legend.toggle(name, action)`, `turnOff`, `turnOn`. `action` is `{ mode: 'dim' | 'hide' | 'omit' | 'rescale' }`; `'omit'` removes the series and refits the axes, and `'rescale'` also makes the parts left of a whole (a stack, a treemap) the new 100%, so the visible domain follows `legend.off`.
81
81
  - `timeline.steps`, `value`, `progress`, `playing`, `seek(p)`, `seekValue(v)`, `next()`, `previous()`, `play()`, `pause()`, `toggle()`, `setSpeed()`.
82
82
  - `hover.activeX`, `activeY`, `activeSeries`, `source`.
83
83
 
package/llms.txt CHANGED
@@ -26,6 +26,7 @@ Start with the full guide: it lists the mental model, the props every plot share
26
26
  - [BulletPlot](./docs/plots/ranking/bullet.md)
27
27
  - [SlopePlot](./docs/plots/evolution/slope.md)
28
28
  - [SparklinePlot](./docs/plots/evolution/sparkline.md)
29
+ - [TreemapPlot](./docs/plots/part-of-a-whole/treemap.md)
29
30
  - [ClevelandPlot](./docs/plots/ranking/cleveland.md)
30
31
  - [HeatmapPlot](./docs/plots/correlation/heatmap.md)
31
32
  - [PyramidPlot](./docs/plots/distribution/pyramid.md)
@@ -55,6 +56,7 @@ Start with the full guide: it lists the mental model, the props every plot share
55
56
  - [Timeline rule driven by a slider](./examples/TimelineRule.svelte)
56
57
  - [Facets with a synced tooltip](./examples/Facets.svelte)
57
58
  - [Bars with value labels](./examples/BarValues.svelte)
59
+ - [Treemap: a tile per row, sized by its value and nested by grouping](./examples/Treemap.svelte)
58
60
  - [Custom tooltip card](./examples/CustomTooltip.svelte)
59
61
  - [The smallest plot: rows, fields and a pixel size](./examples/FirstPlot.svelte)
60
62
  - [Line per series over a date axis, with end labels](./examples/LineDates.svelte)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fundar/data-chart-telling",
3
- "version": "1.15.0",
3
+ "version": "1.17.0",
4
4
  "description": "Declarative charts, maps and small multiples for Svelte, built on svelteplot.",
5
5
  "license": "MIT",
6
6
  "author": "Ezequiel Puerta",
@@ -53,6 +53,7 @@
53
53
  "@types/geojson": "^7946.0.16",
54
54
  "d3-array": "^3.2.4",
55
55
  "d3-geo": "^3.1.1",
56
+ "d3-hierarchy": "^3.1.3",
56
57
  "d3-interpolate": "^3.0.1",
57
58
  "d3-scale-chromatic": "^3.1.0",
58
59
  "d3-selection": "^3.0.0",
@@ -81,6 +82,7 @@
81
82
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
82
83
  "@types/d3-array": "^3.2.2",
83
84
  "@types/d3-geo": "^3.1.0",
85
+ "@types/d3-hierarchy": "^3.1.7",
84
86
  "@types/d3-interpolate": "^3.0.4",
85
87
  "@types/d3-scale-chromatic": "^3.1.0",
86
88
  "@types/d3-selection": "^3.0.11",