@fundar/data-chart-telling 1.16.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 (194) hide show
  1. package/CHANGELOG.md +32 -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 +17 -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/markers/area/AreaMarker.svelte +3 -0
  33. package/dist/markers/arrow/ArrowMarker.svelte +9 -5
  34. package/dist/markers/bar/BarMarker.svelte +45 -48
  35. package/dist/markers/bollinger/BollingerMarker.svelte +3 -0
  36. package/dist/markers/box/BoxMarker.svelte +3 -1
  37. package/dist/markers/cell/CellMarker.svelte +11 -7
  38. package/dist/markers/contour/ContourMarker.svelte +3 -0
  39. package/dist/markers/delaunay/DelaunayLinkMarker.svelte +9 -5
  40. package/dist/markers/delaunay/DelaunayMeshMarker.svelte +3 -0
  41. package/dist/markers/density/DensityMarker.svelte +3 -0
  42. package/dist/markers/difference/DifferenceMarker.svelte +3 -0
  43. package/dist/markers/dot/DotMarker.svelte +11 -6
  44. package/dist/markers/geo/GraticuleMarker.svelte +3 -0
  45. package/dist/markers/geo/SphereMarker.svelte +3 -0
  46. package/dist/markers/hover/HoverMarker.svelte +22 -6
  47. package/dist/markers/hull/HullMarker.svelte +3 -0
  48. package/dist/markers/image/ImageMarker.svelte +3 -0
  49. package/dist/markers/line/LineMarker.svelte +3 -0
  50. package/dist/markers/link/LinkMarker.svelte +3 -0
  51. package/dist/markers/raster/RasterMarker.svelte +3 -0
  52. package/dist/markers/rect/RectMarker.svelte +25 -17
  53. package/dist/markers/regression/RegressionMarker.svelte +3 -0
  54. package/dist/markers/rule/RuleMarker.svelte +15 -5
  55. package/dist/markers/text/TextFit.d.ts +44 -0
  56. package/dist/markers/text/TextFit.js +86 -0
  57. package/dist/markers/text/TextMarker.svelte +186 -90
  58. package/dist/markers/text/TextMarker.svelte.d.ts +2 -0
  59. package/dist/markers/tick/TickMarker.svelte +9 -3
  60. package/dist/markers/trail/TrailMarker.svelte +3 -0
  61. package/dist/markers/utils/BoxLabel.d.ts +58 -0
  62. package/dist/markers/utils/BoxLabel.js +175 -0
  63. package/dist/markers/utils/MarkerEvents.d.ts +23 -0
  64. package/dist/markers/utils/MarkerEvents.js +44 -0
  65. package/dist/markers/utils/MarkerLabel.svelte +33 -0
  66. package/dist/markers/utils/MarkerLabel.svelte.d.ts +10 -0
  67. package/dist/markers/utils/RowStroke.d.ts +9 -21
  68. package/dist/markers/utils/RowStroke.js +10 -21
  69. package/dist/markers/utils/RowStyle.d.ts +26 -0
  70. package/dist/markers/utils/RowStyle.js +55 -0
  71. package/dist/markers/vector/VectorMarker.svelte +3 -0
  72. package/dist/markers/voronoi/VoronoiMarker.svelte +9 -5
  73. package/dist/markers/voronoi/VoronoiMeshMarker.svelte +3 -0
  74. package/dist/markers/waffle/WaffleMarker.svelte +9 -5
  75. package/dist/phases/Pipeline.d.ts +3 -1
  76. package/dist/phases/Pipeline.js +1 -0
  77. package/dist/phases/data/DataPhase.js +51 -10
  78. package/dist/phases/hover/HoverPhase.js +9 -1
  79. package/dist/phases/mapping/MappingPhase.js +2 -1
  80. package/dist/phases/markers/MarkerStyles.d.ts +18 -0
  81. package/dist/phases/markers/MarkerStyles.js +111 -0
  82. package/dist/phases/markers/MarkersPhase.d.ts +1 -1
  83. package/dist/phases/markers/MarkersPhase.js +7 -5
  84. package/dist/phases/statistics/StatisticsPhase.js +1 -1
  85. package/dist/phases/transforms/Transforms.js +3 -1
  86. package/dist/phases/transforms/TransformsPhase.js +58 -4
  87. package/dist/phases/transforms/methods/TreemapTransform.d.ts +28 -0
  88. package/dist/phases/transforms/methods/TreemapTransform.js +119 -0
  89. package/dist/plots/correlation/heatmap/defaults.js +2 -2
  90. package/dist/plots/correlation/heatmap/markers.d.ts +0 -8
  91. package/dist/plots/correlation/heatmap/markers.js +8 -35
  92. package/dist/plots/correlation/scatter/markers.d.ts +1 -1
  93. package/dist/plots/correlation/scatter/markers.js +2 -2
  94. package/dist/plots/distribution/histogram/defaults.js +2 -2
  95. package/dist/plots/distribution/histogram/markers.d.ts +1 -10
  96. package/dist/plots/distribution/histogram/markers.js +17 -59
  97. package/dist/plots/distribution/pyramid/defaults.js +3 -3
  98. package/dist/plots/distribution/pyramid/markers.d.ts +0 -10
  99. package/dist/plots/distribution/pyramid/markers.js +13 -64
  100. package/dist/plots/distribution/violin/markers.js +1 -1
  101. package/dist/plots/map/geo/phases/markers.js +3 -2
  102. package/dist/plots/part-of-a-whole/treemap/Plot.svelte +47 -0
  103. package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +26 -0
  104. package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +10 -0
  105. package/dist/plots/part-of-a-whole/treemap/defaults.js +167 -0
  106. package/dist/plots/ranking/bar/defaults.js +2 -2
  107. package/dist/plots/ranking/bar/markers.d.ts +1 -11
  108. package/dist/plots/ranking/bar/markers.js +38 -80
  109. package/dist/plots/ranking/bullet/markers.js +2 -3
  110. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +17 -13
  111. package/dist/types/configuration/styling.d.ts +27 -2
  112. package/dist/types/layout/legend.d.ts +8 -1
  113. package/dist/types/layout/mapping.d.ts +12 -3
  114. package/dist/types/layout/scales.d.ts +6 -0
  115. package/dist/types/layout/tooltip.d.ts +16 -4
  116. package/dist/types/markers/axis/arrow.d.ts +2 -8
  117. package/dist/types/markers/axis/bar.d.ts +4 -8
  118. package/dist/types/markers/axis/cell.d.ts +5 -5
  119. package/dist/types/markers/axis/delaunayLink.d.ts +2 -2
  120. package/dist/types/markers/axis/rect.d.ts +4 -8
  121. package/dist/types/markers/axis/rule.d.ts +2 -16
  122. package/dist/types/markers/axis/tick.d.ts +2 -2
  123. package/dist/types/markers/axis/voronoi.d.ts +2 -2
  124. package/dist/types/markers/axis/waffle.d.ts +4 -3
  125. package/dist/types/markers/basic/dot.d.ts +2 -2
  126. package/dist/types/markers/basic/text.d.ts +56 -14
  127. package/dist/types/markers/channels/commonMarkerConfig.d.ts +4 -1
  128. package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +1 -2
  129. package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +10 -0
  130. package/dist/types/markers/channels/commonMarkerConfigWithLabel.js +1 -0
  131. package/dist/types/markers/channels/commonMarkerEvents.d.ts +17 -0
  132. package/dist/types/markers/channels/commonMarkerEvents.js +13 -0
  133. package/dist/types/markers/geo/contour.d.ts +2 -1
  134. package/dist/types/markers/geo/graticule.d.ts +2 -1
  135. package/dist/types/markers/geo/link.d.ts +2 -1
  136. package/dist/types/markers/geo/sphere.d.ts +2 -1
  137. package/dist/types/markers/geo/vector.d.ts +2 -1
  138. package/dist/types/phases/data/phase.d.ts +5 -0
  139. package/dist/types/phases/hover/phase.d.ts +2 -0
  140. package/dist/types/phases/state.d.ts +7 -0
  141. package/dist/types/phases/statistics/phase.d.ts +2 -1
  142. package/dist/types/phases/transforms/phase.d.ts +11 -0
  143. package/dist/types/plots/constants.d.ts +14 -14
  144. package/dist/types/plots/correlation/heatmap/props.d.ts +3 -3
  145. package/dist/types/plots/correlation/scatter/props.d.ts +3 -3
  146. package/dist/types/plots/data/common.d.ts +19 -6
  147. package/dist/types/plots/data/geo.d.ts +1 -1
  148. package/dist/types/plots/distribution/box/props.d.ts +3 -3
  149. package/dist/types/plots/distribution/density/props.d.ts +3 -11
  150. package/dist/types/plots/distribution/histogram/props.d.ts +3 -11
  151. package/dist/types/plots/distribution/pyramid/props.d.ts +3 -3
  152. package/dist/types/plots/distribution/violin/props.d.ts +3 -3
  153. package/dist/types/plots/evolution/area/props.d.ts +3 -3
  154. package/dist/types/plots/evolution/line/props.d.ts +3 -3
  155. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +19 -0
  156. package/dist/types/plots/part-of-a-whole/treemap/props.js +1 -0
  157. package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +6 -0
  158. package/dist/types/plots/part-of-a-whole/treemap/state.js +1 -0
  159. package/dist/types/plots/props.d.ts +7 -4
  160. package/dist/types/plots/ranking/bar/props.d.ts +3 -3
  161. package/dist/types/plots/ranking/cleveland/props.d.ts +3 -3
  162. package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -3
  163. package/dist/types/plots/ranking/forest/props.d.ts +3 -3
  164. package/dist/types/plots/ranking/lollipop/props.d.ts +3 -3
  165. package/dist/types/plots/styling.d.ts +24 -0
  166. package/dist/types/transforms/index.d.ts +3 -1
  167. package/dist/types/transforms/treemap.d.ts +32 -0
  168. package/dist/types/transforms/treemap.js +5 -0
  169. package/dist/utils/color/ColorTones.d.ts +19 -0
  170. package/dist/utils/color/ColorTones.js +64 -0
  171. package/dist/utils/color/CssColor.d.ts +14 -5
  172. package/dist/utils/color/CssColor.js +69 -27
  173. package/dist/utils/color/index.d.ts +4 -0
  174. package/dist/utils/color/index.js +4 -0
  175. package/dist/utils/grouping.d.ts +18 -1
  176. package/dist/utils/grouping.js +31 -0
  177. package/docs/concepts.md +3 -2
  178. package/docs/legend.md +8 -5
  179. package/docs/markers.md +76 -26
  180. package/docs/plots/part-of-a-whole/treemap.md +69 -0
  181. package/docs/plots/ranking/bar.md +1 -1
  182. package/docs/plots.md +21 -20
  183. package/docs/scales.md +3 -0
  184. package/docs/state.md +1 -1
  185. package/docs/styles-and-segments.md +19 -18
  186. package/docs/theming.md +4 -11
  187. package/docs/tooltip-and-hover.md +1 -1
  188. package/docs/transforms-and-statistics.md +17 -16
  189. package/examples/Treemap.svelte +13 -0
  190. package/examples/datasets/economic-activity.ts +40 -0
  191. package/examples/datasets/index.ts +1 -0
  192. package/llms-full.txt +5 -5
  193. package/llms.txt +2 -0
  194. package/package.json +3 -1
@@ -1,9 +1,9 @@
1
- import type { FontStyle, StrokeStyle } from '../../plots/styling';
1
+ import type { FontStyle, StrokeStyle, PerRow } from '../../plots/styling';
2
2
  import type { CommonMarkerConfig } from '../channels/commonMarkerConfig';
3
3
  import type { CommonMarkerConfigWithRowOffset } from '../channels/commonMarkerConfigWithRowOffset';
4
4
  import type { Margins } from '../../../layout/margins/Margins';
5
5
  import type { BandSlice } from '../../layout/hover';
6
- import type { TextAnchor } from '../../plots/constants';
6
+ import type { LabelAnchor, TextAnchor } from '../../plots/constants';
7
7
  import type { NumberDisplay } from '../../layout/numbers';
8
8
  /**
9
9
  * Spreads labels that would overlap apart vertically, all reaching out to one
@@ -24,7 +24,35 @@ export type TextDeclutterConfig = {
24
24
  /** The connectors' stroke. Unset opacity follows each label's own `fillOpacity`. */
25
25
  connector?: StrokeStyle;
26
26
  };
27
- /** A text label per row (svelteplot's `Text`), usable on any plot kind. */
27
+ /** Where a row's `x1`, `x2`, `y1` and `y2` are: a field of the rows, the symbol a transform keyed it by, or a function of the row. */
28
+ type FitChannel = string | symbol | ((d: any) => unknown);
29
+ /**
30
+ * What a label is fitted to: the rectangle its row spans, from `x1` to `x2` along the x axis and from `y1` to `y2`
31
+ * along the y - a tile of a `treemap` transform, say. A label too big for it is written smaller, down to
32
+ * `minFontSize`; at that size, broken into as many lines as the box holds and cut short with an ellipsis; and
33
+ * when almost none of it would show, as its `fallback`. A label with no room for even that is left out.
34
+ */
35
+ export type TextFitConfig = {
36
+ /** The edges of a box of your own. A marker that draws a shape for each label gives its own, and these are left out. */
37
+ x1?: FitChannel;
38
+ x2?: FitChannel;
39
+ y1?: FitChannel;
40
+ y2?: FitChannel;
41
+ /** Pixels left free inside each edge of the box. Defaults to the configuration's `text.label.padding`, `4`. */
42
+ padding?: number;
43
+ /** The smallest size a label is written at, in px. Defaults to the configuration's `text.label.minFontSize`, `8`. */
44
+ minFontSize?: number;
45
+ /** The fewest letters worth writing when a text is cut short; under them the `fallback` is written. Defaults to the configuration's `text.label.minLetters`, `3`. */
46
+ minLetters?: number;
47
+ /** What to write when the text does not fit, cut short or not - a value alone, say; a number is written as the marker's `decimals` and the rest ask. */
48
+ fallback?: string | number | ((d: any) => string | number);
49
+ };
50
+ /** The text styles that can be a function of the row. */
51
+ type TextRowStyleKey = 'fill' | 'stroke' | 'strokeWidth' | 'fontWeight' | 'fontStyle';
52
+ /** The text styles that can be a function of the row. */
53
+ type TextRowStyle = Pick<FontStyle, TextRowStyleKey> & {
54
+ fillOpacity?: number;
55
+ };
28
56
  export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
29
57
  type: 'text';
30
58
  /**
@@ -33,15 +61,17 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
33
61
  * `decimals`, `prefix`, `suffix` and `signDisplay`, over the configuration's `numbers`.
34
62
  */
35
63
  text: string | number | ((d: any) => string | number);
36
- styles?: FontStyle;
64
+ /**
65
+ * How the labels are drawn. `fill`, `fillOpacity`, `stroke`, `strokeWidth`, `fontWeight` and `fontStyle` can each be a function of the row;
66
+ * the rest place and measure the labels, so they are the same for all of them.
67
+ */
68
+ styles?: PerRow<TextRowStyle> & Omit<FontStyle, TextRowStyleKey>;
37
69
  /** Which side of its point the text sits on: a value, or a function of the row. Wins over `styles.textAnchor`. */
38
70
  textAnchor?: TextAnchor | ((d: any) => TextAnchor);
39
- /** Per-row fill, over `styles.fill`. */
40
- fill?: string | ((d: any) => string | undefined);
41
- /** Per-row fill opacity. */
42
- fillOpacity?: number | ((d: any) => number | undefined);
43
71
  /** Spreads overlapping labels apart - see {@link TextDeclutterConfig}. `true` takes every default. */
44
72
  declutter?: boolean | TextDeclutterConfig;
73
+ /** Writes each label to fit its box - see {@link TextFitConfig}. `true` takes every default. */
74
+ fit?: boolean | TextFitConfig;
45
75
  /**
46
76
  * Flips each label to the other side of its point (or nudges a centred one
47
77
  * back in) where its text would cross the plot's edge. `styles.textAnchor`/
@@ -51,16 +81,28 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
51
81
  /** The slice of its category band each label sits in (a grouped bar's series); it is drawn off the band's middle, whatever the band's width. */
52
82
  bandSlice?: BandSlice;
53
83
  /** Where, in the plot's frame, a label sits on an axis it sets no position for: `{ type: 'text', x: 5, frameAnchor: 'top' }` is at the frame's top edge. */
54
- frameAnchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle';
84
+ frameAnchor?: LabelAnchor;
55
85
  /** Grows the plot's margins, on every side the author left open, so the labels fit. */
56
86
  fitMargins?: boolean;
57
87
  /** Reports how far the rendered labels reach past the plot's content box, in pixels, on each side. */
58
- onOverflow?: (overflow: Margins) => void;
59
- /** Fired when the pointer enters a row's label. */
60
- onPointerEnter?: (d: any) => void;
61
- /** Fired when the pointer leaves a row's label. */
62
- onPointerLeave?: (d: any) => void;
88
+ onoverflow?: (overflow: Margins) => void;
63
89
  } & NumberDisplay & CommonMarkerConfig>;
90
+ /** A `text` marker as a shape's `label`: all of it but what the shape sets - its `type`, its rows and the label's position. */
91
+ export type TextLabelConfig = Omit<TextMarkerConfig, 'type' | 'data' | 'x' | 'y' | 'frameAnchor'> & {
92
+ /**
93
+ * Where in its shape the label sits: its `'middle'` (the default), against one of its edges (`'top'`, `'bottom'`,
94
+ * `'left'`, `'right'`) or in one of its corners (`'top-left'`...). The label's `dx` and `dy` move it from there.
95
+ */
96
+ anchor?: LabelAnchor;
97
+ /**
98
+ * Puts a label anchored to an edge beyond that edge, outside the shape, instead of inside it. A label out there is not
99
+ * fitted to the shape, and with `fitMargins` the plot's margins grow to hold it.
100
+ */
101
+ outside?: boolean;
102
+ /** Pixels between the label and the edge it is anchored to. Defaults to the configuration's `text.label.gap`, `4`. */
103
+ gap?: number;
104
+ };
105
+ export type { LabelAnchor };
64
106
  /** Where one decluttered label goes - see `Declutter.buildLanes`. */
65
107
  export type LabelLane = {
66
108
  /** Vertical shift (px) clearing its neighbours and the content box's edges. */
@@ -3,8 +3,9 @@ import type { AxisValue } from '../../layout/mapping';
3
3
  import type { StatisticConfig } from '../../layout/statistics';
4
4
  import type { MarkerTransform } from '../../transforms';
5
5
  import type { MarkLegend } from '../../layout/legend';
6
+ import type { CommonMarkerEvents } from './commonMarkerEvents';
6
7
  /** Props every marker kind shares: rows, grouping, series scope, position, offset, statistics, transforms. */
7
- export type CommonMarkerConfig = {
8
+ export type CommonMarkerConfig = CommonMarkerEvents & {
8
9
  data?: Record<string, unknown>[];
9
10
  grouping?: string | ((d: any) => unknown);
10
11
  series?: string;
@@ -27,4 +28,6 @@ export type CommonMarkerConfig = {
27
28
  clip?: boolean;
28
29
  /** Names the marker on its plot's automatic legend - see {@link MarkLegend}. `false` keeps a decorative marker out of it, and out of how the plot's series look there. */
29
30
  legend?: MarkLegend | false;
31
+ /** Makes the marker a hit area of the plot's hover: the pointer entering any of its shapes hovers its `data` rows. */
32
+ hover?: boolean;
30
33
  };
@@ -1,6 +1,5 @@
1
1
  import type { CommonMarkerConfig } from './commonMarkerConfig';
2
- /** Common props plus the fill and opacity channels. */
2
+ /** Common props plus the opacity channel. */
3
3
  export type CommonMarkerConfigWithArea = CommonMarkerConfig & {
4
- fill?: (d: any) => string;
5
4
  opacity?: string | ((d: any) => unknown);
6
5
  };
@@ -0,0 +1,10 @@
1
+ import type { TextLabelConfig } from '../basic/text';
2
+ /** The markers that draw a shape per row, which can write a label in each one. */
3
+ export type CommonMarkerConfigWithLabel = {
4
+ /**
5
+ * A label for each shape, written by a `text` marker: every option of one but `type`, `data`, `x` and `y`,
6
+ * which the shape sets. The label is centred on its shape, and fitted to it unless `fit` is `false` - see
7
+ * {@link TextFitConfig}. It never takes the pointer from the shape under it.
8
+ */
9
+ label?: TextLabelConfig;
10
+ };
@@ -0,0 +1,17 @@
1
+ /** The events a mark can be given a handler for, as svelteplot's own marks name them. */
2
+ export declare const MARK_EVENTS: readonly ["onclick", "ondblclick", "oncontextmenu", "onpointerdown", "onpointerup", "onpointerenter", "onpointerleave", "onpointermove", "onmouseenter", "onmouseleave"];
3
+ /** The name of an event a mark takes a handler for. */
4
+ export type MarkEventName = (typeof MARK_EVENTS)[number];
5
+ /**
6
+ * A handler of an event on one of a mark's shapes: the event, the row the shape draws and
7
+ * that row's index - as svelteplot's marks call it.
8
+ */
9
+ export type MarkEventHandler = (event: Event, row: any, index: number) => void;
10
+ /**
11
+ * Handlers a marker passes on to the shapes svelteplot draws for it. svelteplot documents these props on every
12
+ * mark (`BaseMarkProps`), and every marker hands them on; svelteplot's code wires them up on some marks only
13
+ * today (`Rect`, `Bar`, `Cell`, `Area`, `Arrow`, `Dot`, `Trail`, `Vector`, `Geo`, `Line`, `Link`,
14
+ * `DelaunayLink` and `Voronoi`), so on the others they do nothing yet - they will, whenever svelteplot's code
15
+ * catches up.
16
+ */
17
+ export type CommonMarkerEvents = Partial<Record<MarkEventName, MarkEventHandler>>;
@@ -0,0 +1,13 @@
1
+ /** The events a mark can be given a handler for, as svelteplot's own marks name them. */
2
+ export const MARK_EVENTS = [
3
+ 'onclick',
4
+ 'ondblclick',
5
+ 'oncontextmenu',
6
+ 'onpointerdown',
7
+ 'onpointerup',
8
+ 'onpointerenter',
9
+ 'onpointerleave',
10
+ 'onpointermove',
11
+ 'onmouseenter',
12
+ 'onmouseleave'
13
+ ];
@@ -1,10 +1,11 @@
1
+ import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
1
2
  import type { Accessor } from '../../plots/data/common';
2
3
  /**
3
4
  * Marching-squares contours from a scalar field (svelteplot's `Contour`).
4
5
  * Pass `data` with `x`/`y`/`value` to interpolate samples, or omit `data` and
5
6
  * pass `value` as an `(x, y) => number` sampler.
6
7
  */
7
- export type GeoContourMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
8
+ export type GeoContourMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = CommonMarkerEvents & {
8
9
  type: 'contour';
9
10
  data?: TRow[];
10
11
  x?: Accessor<TRow, number>;
@@ -1,6 +1,7 @@
1
+ import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
1
2
  import type { StrokeStyle } from '../../plots/styling';
2
3
  /** Longitude and latitude gridlines (svelteplot's `Graticule`). */
3
- export type GeoGraticuleMarkerConfig = {
4
+ export type GeoGraticuleMarkerConfig = CommonMarkerEvents & {
4
5
  type: 'graticule';
5
6
  step?: number;
6
7
  stepX?: number;
@@ -1,7 +1,8 @@
1
+ import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
1
2
  import type { Accessor } from '../../plots/data/common';
2
3
  import type { StrokeStyle } from '../../plots/styling';
3
4
  /** Lines between point pairs: `curve: 'auto'` traces great-circle arcs, `'linear'` joins their projected positions with a straight line. */
4
- export type GeoLinkMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
5
+ export type GeoLinkMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = CommonMarkerEvents & {
5
6
  type: 'link';
6
7
  data: TRow[];
7
8
  x1: Accessor<TRow, number>;
@@ -1,6 +1,7 @@
1
+ import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
1
2
  import type { StrokeStyle } from '../../plots/styling';
2
3
  /** The outer globe outline (svelteplot's `Sphere`), for orthographic-type projections. */
3
- export type GeoSphereMarkerConfig = {
4
+ export type GeoSphereMarkerConfig = CommonMarkerEvents & {
4
5
  type: 'sphere';
5
6
  styles?: StrokeStyle & {
6
7
  fill?: string;
@@ -1,6 +1,7 @@
1
+ import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
1
2
  import type { Accessor } from '../../plots/data/common';
2
3
  /** Arrows or spikes at points (svelteplot's `Vector`). */
3
- export type GeoVectorMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
4
+ export type GeoVectorMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = CommonMarkerEvents & {
4
5
  type: 'vector';
5
6
  data: TRow[];
6
7
  x: Accessor<TRow, number>;
@@ -24,6 +24,11 @@ export type DataStageOptions<TState, TCtx> = {
24
24
  orderSeries?: (series: Series<any>[], state: TState) => Series<any>[];
25
25
  /** The order colors are assigned in. Defaults to the series' own order. */
26
26
  colorOrder?: (series: Series<any>[]) => Series<any>[];
27
+ /**
28
+ * Whether the kind draws the levels of its `grouping` itself (a treemap's nesting): its series are then
29
+ * the outermost level's values, not every level's together.
30
+ */
31
+ nested?: boolean;
27
32
  /** The plot's own extra "data" output, once the shared one is in place. */
28
33
  extend?: (state: TState, ctx: TCtx) => TState;
29
34
  };
@@ -35,6 +35,8 @@ export type HoverStageOptions<TState, TCtx = unknown> = {
35
35
  hitAreas?: (state: TState, hover: HoverConfig<any>, ctx: TCtx) => {
36
36
  type: string;
37
37
  }[];
38
+ /** What the kind knows of a row beyond its series, which an author's own tooltip `format` gets in its third argument. */
39
+ context?: (state: TState) => (row: never) => object;
38
40
  /** How a pointer event resolves to a candidate. Defaults to the nearest one. */
39
41
  pointMatching?: PointMatchingStrategy;
40
42
  };
@@ -57,6 +57,11 @@ export type AxisPlotState<TData extends Record<string, unknown>, TStyle extends
57
57
  /** What each position channel is, which one holds the categories, and which way the plot runs. */
58
58
  axes?: PlotAxes;
59
59
  resolvedSeries?: TSeries[];
60
+ /** The series the legend took out of the rows, and how (`'omit'` or `'rescale'`): a part of a whole still reads its whole from them. */
61
+ removedSeries?: {
62
+ mode: 'omit' | 'rescale';
63
+ series: TSeries[];
64
+ };
60
65
  seriesGrouping?: Accessor<any, unknown>;
61
66
  /** Every series name, before legend-omitted ones are dropped, so colors stay put. */
62
67
  allSeriesNames?: string[];
@@ -66,6 +71,8 @@ export type AxisPlotState<TData extends Record<string, unknown>, TStyle extends
66
71
  flat?: TRow[];
67
72
  scopedGroups?: ScopedMarkerGroup<TData>[];
68
73
  colorForSeries?: (name: string) => string;
74
+ /** The color of a path of the `grouping` levels, outermost first, while `scales.color.depth` reaches past the outermost (see `ColorTones.hierarchy`). */
75
+ colorForPath?: (path: readonly string[]) => string;
69
76
  /** A discrete mark's gap fills, per series id: the value each missing row is drawn at. */
70
77
  gapFillMaps?: Map<string, Map<TData, DiscreteGapFill<TStyle>>>;
71
78
  channels?: ResolvedChannels<TData>;
@@ -13,7 +13,8 @@ import type { PlotAxes } from '../../../phases/data/PlotAxes';
13
13
  export type StatisticsStageState = Pick<FacetStageState, 'panels'> & {
14
14
  x?: Accessor<any, AxisValue>;
15
15
  y?: Accessor<any, AxisValue>;
16
- grouping?: Accessor<any, unknown>;
16
+ /** The key the "data" phase split the rows into series by, which an author marker inherits. */
17
+ seriesGrouping?: Accessor<any, unknown>;
17
18
  color?: Accessor<any, unknown>;
18
19
  statistics?: StatisticConfig[];
19
20
  authorMarkers?: AxisBasedMarkersConfig[];
@@ -26,6 +26,11 @@ export type ProcessedData = {
26
26
  /** What the shared "transforms" stage reads from and writes to a plot's state. */
27
27
  export type TransformsStageState = {
28
28
  resolvedSeries?: Series<any>[];
29
+ /** The series the legend took out of the rows, and how. */
30
+ removedSeries?: {
31
+ mode: 'omit' | 'rescale';
32
+ series: Series<any>[];
33
+ };
29
34
  /** The style every segment of a series is drawn over, which the processed groups are cut with too. */
30
35
  segmentBase?: (series: string) => any;
31
36
  axes?: PlotAxes;
@@ -49,6 +54,12 @@ export type TransformsStageState = {
49
54
  export type TransformsStageOptions<TState extends TransformsStageState, TCtx> = {
50
55
  /** The transforms to run. Defaults to the plot's own `transforms`. */
51
56
  transforms?: (state: TState, ctx: TCtx) => MarkerTransform[];
57
+ /**
58
+ * Whether a series the legend omits keeps its part of the whole (a treemap's tile): the transforms run over
59
+ * its rows too, so every other part keeps its share and its place, and its own rows are dropped after.
60
+ * Unset, an omitted series is not there for the transforms at all (a stack closes over it).
61
+ */
62
+ keepsOmitted?: boolean;
52
63
  /**
53
64
  * How the processed rows split into `processedGroups`: one group per series
54
65
  * (the default), or `'runs'` of consecutive rows from the same series, in
@@ -1,20 +1,20 @@
1
1
  /**
2
- * Unified positional anchor for value labels across all plot kinds.
3
- *
4
- * - `'outside'` - beyond the tip of the mark (above a vertical bar, to the
5
- * far end of a horizontal bar or line). This is the only value with no
6
- * direct svelteplot equivalent; the plot computes dx/dy internally.
7
- * - `'start'` - at the tip of the mark, just inside (top of a bar, far end
8
- * of a pyramid bar from zero, right of a line's last point).
9
- * - `'middle'` - centred on the mark.
10
- * - `'end'` - at the baseline/zero end of the mark.
2
+ * Where something sits in a box, in a frame or on a shape: its middle, against one of its edges as they are drawn on
3
+ * the page, or in one of its corners. The anchors of a text marker's `frameAnchor`, and of a shape's `label`.
4
+ */
5
+ export type LabelAnchor = 'middle' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
+ /**
7
+ * Where a value label sits on its mark. Two vocabularies share the type, one per family of plots:
11
8
  *
12
- * On a bar plot the anchors read as the bars are drawn, whatever the sign of the value: `'outside'` is
13
- * beyond the tip (left of a horizontal bar below zero, under a vertical one), `'start'` the left end of a
14
- * horizontal bar or the top end of a vertical one, `'end'` the right or bottom end, both inside, and
15
- * `'middle'` the centre.
9
+ * - The plots that label a point or the end of a line (`LinePlot`, `AreaPlot`, `SlopePlot`, `ScatterPlot`...) read
10
+ * the side of the point its text is written on: `'start'` after it (right of a line's last point), `'end'` before
11
+ * it, `'middle'` on it and `'outside'` beyond it.
12
+ * - The plots that label a shape (`BarPlot`, `BulletPlot`, `PyramidPlot`, `HistogramPlot`) read where in it the
13
+ * label is. Inside the shape: a {@link LabelAnchor} - its `'middle'`, an edge as it is drawn on the page
14
+ * (`'top'`, `'left'`...) or a corner (`'top-left'`...) - or, whichever side of zero the value is, the end of the bar
15
+ * away from zero, `'tip'`, or the one at zero, `'base'`. Beyond the tip, outside the shape: `'outside'`.
16
16
  */
17
- export type ValueAnchor = 'outside' | 'start' | 'middle' | 'end';
17
+ export type ValueAnchor = LabelAnchor | 'outside' | 'start' | 'end' | 'tip' | 'base';
18
18
  /**
19
19
  * Shared by two unrelated renderers: a `dot` mark's own point shape
20
20
  * (delegated to svelteplot/d3-shape) and a discrete legend item's own icon
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { CellSegmentStyle } from '../../segments/common';
7
7
  /** `HeatmapPlot`'s public props. */
8
- export type HeatmapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type HeatmapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `HeatmapPlot`'s core draws from. */
10
- export type HeatmapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type HeatmapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, CellSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { ScatterSegmentStyle } from '../../segments/common';
7
7
  /** `ScatterPlot`'s public props. */
8
- export type ScatterPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type ScatterPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `ScatterPlot`'s core draws from. */
10
- export type ScatterPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type ScatterPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, ScatterSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,4 +1,4 @@
1
- import type { AxisValue, AxisChannelName, ChannelAccessors } from '../../layout/mapping';
1
+ import type { AxisValue, AxisChannelName, ChannelAccessors, ChannelName } from '../../layout/mapping';
2
2
  /**
3
3
  * A field key or accessor function. Mirrors the shorthand used across plots
4
4
  * so chart-level encodings (`x`, `y`, `color`, facet, timeline) feel
@@ -27,7 +27,7 @@ export type Series<T extends Record<string, unknown> = Record<string, unknown>>
27
27
  /** The channels a pre-built {@link Series} carries itself, so a plot given `series` takes none of them. */
28
28
  type SeriesChannelName = AxisChannelName | 'color' | 'grouping';
29
29
  /**
30
- * Pre-built series. Mutually exclusive with {@link DataProps} - takes
30
+ * Pre-built series. Mutually exclusive with the data props ({@link DualAxisDataProps}...) - takes
31
31
  * precedence when both could apply. Any channel a series doesn't carry
32
32
  * itself is still a plot-level prop.
33
33
  */
@@ -37,12 +37,25 @@ export type SeriesProps<T extends Record<string, unknown>> = {
37
37
  } & {
38
38
  [K in SeriesChannelName]?: never;
39
39
  } & Omit<ChannelAccessors<T>, SeriesChannelName>;
40
+ /** The channels of `TRequired` as required props. */
41
+ type RequiredChannels<T extends Record<string, unknown>, TRequired extends ChannelName> = Required<Pick<ChannelAccessors<T>, TRequired>>;
40
42
  /**
41
- * Flat rows to group into series, as an alternative to {@link SeriesProps}.
42
- * Takes every channel; `x`/`y` are required.
43
+ * Flat rows to group into series, as an alternative to {@link SeriesProps}, on a plot with no axes (a treemap):
44
+ * every channel but the position ones. `TRequired` names the channels the plot cannot draw without. The base of
45
+ * {@link SingleAxisDataProps} and {@link DualAxisDataProps}.
43
46
  */
44
- export type DataProps<T extends Record<string, unknown>> = {
47
+ export type NonAxisDataProps<T extends Record<string, unknown>, TRequired extends Exclude<ChannelName, AxisChannelName> = never> = {
45
48
  series?: never;
46
49
  data: T[];
47
- } & ChannelAccessors<T> & Required<Pick<ChannelAccessors<T>, AxisChannelName>>;
50
+ x?: never;
51
+ y?: never;
52
+ } & Omit<ChannelAccessors<T>, AxisChannelName> & RequiredChannels<T, TRequired>;
53
+ /** Flat rows on one axis (a histogram): `x`, or `y` alone, besides every other channel. */
54
+ export type SingleAxisDataProps<T extends Record<string, unknown>, TRequired extends Exclude<ChannelName, AxisChannelName> = never> = Omit<NonAxisDataProps<T, TRequired>, AxisChannelName> & ((RequiredChannels<T, 'x'> & {
55
+ y?: never;
56
+ }) | (RequiredChannels<T, 'y'> & {
57
+ x?: never;
58
+ }));
59
+ /** Flat rows on both axes: `x` and `y`, besides every other channel. */
60
+ export type DualAxisDataProps<T extends Record<string, unknown>, TRequired extends Exclude<ChannelName, AxisChannelName> = never> = Omit<NonAxisDataProps<T, TRequired>, AxisChannelName> & RequiredChannels<T, AxisChannelName>;
48
61
  export {};
@@ -25,7 +25,7 @@ export type Topology = {
25
25
  bbox?: number[];
26
26
  };
27
27
  /**
28
- * Data contract for GeoPlot - the geo analog of {@link DataProps}/{@link SeriesProps}
28
+ * Data contract for GeoPlot - the geo analog of {@link DualAxisDataProps}/{@link SeriesProps}
29
29
  * (`$lib/types/plots/data/common`). There's no x/y axis pair for geographic data:
30
30
  * `data` IS the map.
31
31
  */
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
7
  /** `BoxPlot`'s public props. */
8
- export type BoxPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type BoxPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `BoxPlot`'s core draws from. */
10
- export type BoxPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type BoxPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,23 +1,15 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, SingleAxisDataProps } from '../../data/common';
5
5
  import type { CurveAwarePlotStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
- import type { AxisChannelName, ChannelAccessors } from '../../../layout/mapping';
8
- /** Flat rows estimated along one axis: `x` for a vertical curve, or `y` alone for a horizontal one. */
9
- type DensityDataProps<TRow extends Record<string, unknown>> = Omit<DataProps<TRow>, AxisChannelName> & ((Required<Pick<ChannelAccessors<TRow>, 'x'>> & {
10
- y?: never;
11
- }) | (Required<Pick<ChannelAccessors<TRow>, 'y'>> & {
12
- x?: never;
13
- }));
14
7
  /** `styles` of `DensityPlot`: the curve of the estimate, and the mark that draws it. */
15
8
  export type DensityPlotStylesConfig = CurveAwarePlotStylesConfig & {
16
9
  /** The mark drawing each estimate: a filled `'area'` or a `'line'`. Defaults to `'area'`. */
17
10
  mark?: 'area' | 'line';
18
11
  };
19
12
  /** `DensityPlot`'s public props. */
20
- export type DensityPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DensityDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
13
+ export type DensityPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
21
14
  /** What `DensityPlot`'s core draws from. */
22
- export type DensityPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DensityDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
23
- export {};
15
+ export type DensityPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, DensityPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,18 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, SingleAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
- import type { AxisChannelName, ChannelAccessors } from '../../../layout/mapping';
8
- /** Flat rows binned on one axis: `x` for vertical bars, or `y` alone for horizontal ones. A bin's count is its length. */
9
- type HistogramDataProps<TRow extends Record<string, unknown>> = Omit<DataProps<TRow>, AxisChannelName> & ((Required<Pick<ChannelAccessors<TRow>, 'x'>> & {
10
- y?: never;
11
- }) | (Required<Pick<ChannelAccessors<TRow>, 'y'>> & {
12
- x?: never;
13
- }));
14
7
  /** `HistogramPlot`'s public props. */
15
- export type HistogramPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | HistogramDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type HistogramPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
16
9
  /** What `HistogramPlot`'s core draws from. */
17
- export type HistogramPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | HistogramDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
18
- export {};
10
+ export type HistogramPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | SingleAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { GapsAwarePlotStylesConfig } from '../../../layout/styles';
6
6
  import type { BarSegmentStyle } from '../../segments/common';
7
7
  /** `PyramidPlot`'s public props. */
8
- export type PyramidPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type PyramidPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `PyramidPlot`'s core draws from. */
10
- export type PyramidPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type PyramidPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<BarSegmentStyle>, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,7 +1,7 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
7
  import type { DensityKernel } from '../../../transforms/density';
@@ -18,6 +18,6 @@ export type ViolinPlotStylesConfig = AxisBasedStylesConfig & {
18
18
  box?: boolean | number;
19
19
  };
20
20
  /** `ViolinPlot`'s public props. */
21
- export type ViolinPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
21
+ export type ViolinPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
22
22
  /** What `ViolinPlot`'s core draws from. */
23
- export type ViolinPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
23
+ export type ViolinPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, ViolinPlotStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
6
  import type { AreaStyle } from '../../styling';
7
7
  /** `AreaPlot`'s public props. */
8
- export type AreaPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type AreaPlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `AreaPlot`'s core draws from. */
10
- export type AreaPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type AreaPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, AxisBasedStylesConfig, AreaStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -1,10 +1,10 @@
1
1
  import type { BasePlotProps, PlotCoreProps } from '../../props';
2
2
  import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
3
  import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
- import type { SeriesProps, DataProps } from '../../data/common';
4
+ import type { SeriesProps, DualAxisDataProps } from '../../data/common';
5
5
  import type { CurveAwarePlotStylesConfig, GapsAwarePlotStylesConfig } from '../../../layout/styles';
6
6
  import type { LineSegmentStyle } from '../../segments/common';
7
7
  /** `LinePlot`'s public props. */
8
- export type LinePlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
8
+ export type LinePlotProps<TData extends Record<string, unknown>> = BasePlotProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
9
9
  /** What `LinePlot`'s core draws from. */
10
- export type LinePlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
10
+ export type LinePlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<SeriesProps<TData> | DualAxisDataProps<TData>, TData, GapsAwarePlotStylesConfig<LineSegmentStyle> & CurveAwarePlotStylesConfig, LineSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;
@@ -0,0 +1,19 @@
1
+ import type { BasePlotProps, PlotCoreProps } from '../../props';
2
+ import type { AxisBasedScalesConfig } from '../../../layout/scales';
3
+ import type { AxisBasedMarkersConfig } from '../../../markers/common';
4
+ import type { NonAxisDataProps } from '../../data/common';
5
+ import type { AxisBasedStylesConfig } from '../../../layout/styles';
6
+ import type { TooltipContext } from '../../../layout/tooltip';
7
+ import type { BarSegmentStyle } from '../../segments/common';
8
+ /** What a `TreemapPlot` knows of a hovered tile beyond its row, the third argument of `tooltip.format`. */
9
+ export type TreemapTooltipContext = TooltipContext & {
10
+ /** The tile's part of the whole, from `0` to `100`, worked out from the values in whatever unit they are. */
11
+ share: number;
12
+ };
13
+ /**
14
+ * `TreemapPlot`'s public props: flat rows, a tile each, on no axes. `value` is a tile's area, and `grouping` what
15
+ * the tiles nest by (`'sector.branch'`, outermost first), whose outermost level colors them.
16
+ */
17
+ export type TreemapPlotProps<TData extends Record<string, unknown>> = BasePlotProps<NonAxisDataProps<TData, 'value'>, TData, AxisBasedStylesConfig, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>, undefined, TreemapTooltipContext>;
18
+ /** What `TreemapPlot`'s core draws from. */
19
+ export type TreemapPlotCoreProps<TData extends Record<string, unknown>> = PlotCoreProps<NonAxisDataProps<TData, 'value'>, TData, AxisBasedStylesConfig, BarSegmentStyle, AxisBasedMarkersConfig, AxisBasedScalesConfig<TData>>;