@fundar/data-chart-telling 1.17.0 → 1.18.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 (205) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/configuration/config.svelte.js +3 -2
  3. package/dist/index.d.ts +7 -2
  4. package/dist/index.js +2 -0
  5. package/dist/layout/geometry/GeometryLayout.svelte +188 -54
  6. package/dist/layout/hover/HoverDefaults.d.ts +52 -0
  7. package/dist/layout/hover/HoverDefaults.js +96 -0
  8. package/dist/layout/hover/HoverLayers.d.ts +35 -0
  9. package/dist/layout/hover/HoverLayers.js +122 -0
  10. package/dist/layout/hover/HoverSettings.d.ts +1 -3
  11. package/dist/layout/hover/HoverSettings.js +3 -2
  12. package/dist/layout/hover/HoverShapes.d.ts +44 -0
  13. package/dist/layout/hover/HoverShapes.js +103 -0
  14. package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
  15. package/dist/layout/hover/PlotHover.svelte.js +54 -1
  16. package/dist/layout/legend/LegendState.svelte.d.ts +2 -0
  17. package/dist/layout/legend/LegendState.svelte.js +5 -0
  18. package/dist/layout/plot/Core.svelte +2 -2
  19. package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
  20. package/dist/layout/plot/PublicPlotContext.js +8 -0
  21. package/dist/layout/styles/ValueLabels.d.ts +12 -4
  22. package/dist/layout/styles/ValueLabels.js +22 -13
  23. package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -9
  24. package/dist/layout/tooltip/TooltipState.svelte.js +28 -29
  25. package/dist/markers/MarkerKinds.d.ts +5 -0
  26. package/dist/markers/MarkerKinds.js +1 -0
  27. package/dist/markers/band/BandMarker.svelte +74 -0
  28. package/dist/markers/band/BandMarker.svelte.d.ts +7 -0
  29. package/dist/markers/band/Bands.d.ts +16 -0
  30. package/dist/markers/band/Bands.js +48 -0
  31. package/dist/markers/bar/BarMarker.svelte +23 -66
  32. package/dist/markers/hover/HoverMarker.svelte +7 -265
  33. package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
  34. package/dist/markers/utils/PointPixel.d.ts +37 -0
  35. package/dist/markers/utils/PointPixel.js +44 -0
  36. package/dist/phases/Pipeline.d.ts +7 -7
  37. package/dist/phases/Pipeline.js +12 -9
  38. package/dist/phases/context/ContextPhase.d.ts +22 -0
  39. package/dist/phases/context/ContextPhase.js +23 -0
  40. package/dist/phases/context/RowContext.d.ts +35 -0
  41. package/dist/phases/context/RowContext.js +95 -0
  42. package/dist/phases/data/DataPhase.d.ts +4 -4
  43. package/dist/phases/data/DataPhase.js +7 -7
  44. package/dist/phases/hover/HoverPhase.d.ts +6 -7
  45. package/dist/phases/hover/HoverPhase.js +28 -23
  46. package/dist/phases/mapping/MappingPhase.d.ts +4 -4
  47. package/dist/phases/mapping/MappingPhase.js +2 -2
  48. package/dist/phases/markers/MarkerStyles.d.ts +8 -0
  49. package/dist/phases/markers/MarkerStyles.js +15 -0
  50. package/dist/phases/markers/MarkersPhase.d.ts +4 -4
  51. package/dist/phases/markers/MarkersPhase.js +4 -4
  52. package/dist/phases/scales/ScalesPhase.d.ts +4 -4
  53. package/dist/phases/scales/ScalesPhase.js +4 -4
  54. package/dist/phases/sharedScales/SharedScalesPhase.d.ts +2 -2
  55. package/dist/phases/sharedScales/SharedScalesPhase.js +2 -2
  56. package/dist/phases/statistics/MarkerGrouping.d.ts +0 -9
  57. package/dist/phases/statistics/MarkerGrouping.js +0 -16
  58. package/dist/phases/styles/StylesPhase.d.ts +3 -3
  59. package/dist/phases/styles/StylesPhase.js +2 -2
  60. package/dist/phases/tooltip/TooltipPhase.d.ts +4 -4
  61. package/dist/phases/tooltip/TooltipPhase.js +10 -7
  62. package/dist/phases/transforms/TransformsPhase.d.ts +3 -3
  63. package/dist/phases/transforms/TransformsPhase.js +2 -2
  64. package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
  65. package/dist/plots/correlation/heatmap/defaults.js +21 -6
  66. package/dist/plots/correlation/heatmap/markers.d.ts +2 -2
  67. package/dist/plots/correlation/heatmap/markers.js +4 -3
  68. package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
  69. package/dist/plots/correlation/scatter/defaults.js +9 -3
  70. package/dist/plots/correlation/scatter/markers.d.ts +2 -2
  71. package/dist/plots/correlation/scatter/markers.js +4 -3
  72. package/dist/plots/distribution/box/BoxSummaries.d.ts +17 -8
  73. package/dist/plots/distribution/box/BoxSummaries.js +90 -40
  74. package/dist/plots/distribution/box/defaults.d.ts +2 -2
  75. package/dist/plots/distribution/box/defaults.js +9 -6
  76. package/dist/plots/distribution/box/markers.d.ts +2 -2
  77. package/dist/plots/distribution/box/markers.js +3 -3
  78. package/dist/plots/distribution/density/defaults.d.ts +2 -2
  79. package/dist/plots/distribution/density/defaults.js +17 -1
  80. package/dist/plots/distribution/density/markers.d.ts +2 -2
  81. package/dist/plots/distribution/density/markers.js +4 -4
  82. package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
  83. package/dist/plots/distribution/histogram/defaults.js +20 -25
  84. package/dist/plots/distribution/histogram/markers.d.ts +2 -2
  85. package/dist/plots/distribution/histogram/markers.js +5 -4
  86. package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
  87. package/dist/plots/distribution/pyramid/defaults.js +4 -1
  88. package/dist/plots/distribution/pyramid/markers.d.ts +2 -2
  89. package/dist/plots/distribution/pyramid/markers.js +4 -3
  90. package/dist/plots/distribution/violin/defaults.d.ts +2 -2
  91. package/dist/plots/distribution/violin/defaults.js +9 -7
  92. package/dist/plots/distribution/violin/markers.d.ts +2 -2
  93. package/dist/plots/distribution/violin/markers.js +3 -3
  94. package/dist/plots/evolution/area/defaults.d.ts +2 -2
  95. package/dist/plots/evolution/area/defaults.js +1 -1
  96. package/dist/plots/evolution/area/markers.d.ts +2 -2
  97. package/dist/plots/evolution/area/markers.js +4 -4
  98. package/dist/plots/evolution/line/defaults.d.ts +2 -2
  99. package/dist/plots/evolution/line/defaults.js +1 -1
  100. package/dist/plots/evolution/line/markers.d.ts +2 -2
  101. package/dist/plots/evolution/line/markers.js +3 -3
  102. package/dist/plots/evolution/slope/defaults.d.ts +2 -2
  103. package/dist/plots/evolution/slope/defaults.js +8 -4
  104. package/dist/plots/evolution/slope/markers.d.ts +2 -2
  105. package/dist/plots/evolution/slope/markers.js +3 -3
  106. package/dist/plots/evolution/sparkline/defaults.d.ts +2 -2
  107. package/dist/plots/evolution/sparkline/defaults.js +5 -2
  108. package/dist/plots/evolution/sparkline/markers.d.ts +2 -2
  109. package/dist/plots/evolution/sparkline/markers.js +3 -3
  110. package/dist/plots/map/geo/Core.svelte +3 -3
  111. package/dist/plots/map/geo/defaults.d.ts +2 -2
  112. package/dist/plots/map/geo/phases/data.d.ts +1 -1
  113. package/dist/plots/map/geo/phases/data.js +1 -1
  114. package/dist/plots/map/geo/phases/hover.d.ts +2 -2
  115. package/dist/plots/map/geo/phases/hover.js +3 -3
  116. package/dist/plots/map/geo/phases/markers.d.ts +2 -2
  117. package/dist/plots/map/geo/phases/markers.js +3 -3
  118. package/dist/plots/map/geo/phases/scales.d.ts +2 -2
  119. package/dist/plots/map/geo/phases/scales.js +2 -2
  120. package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +2 -2
  121. package/dist/plots/part-of-a-whole/treemap/defaults.js +37 -21
  122. package/dist/plots/ranking/bar/defaults.d.ts +2 -2
  123. package/dist/plots/ranking/bar/defaults.js +13 -7
  124. package/dist/plots/ranking/bar/markers.d.ts +3 -3
  125. package/dist/plots/ranking/bar/markers.js +8 -7
  126. package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
  127. package/dist/plots/ranking/bullet/defaults.js +4 -4
  128. package/dist/plots/ranking/bullet/markers.d.ts +3 -3
  129. package/dist/plots/ranking/bullet/markers.js +9 -9
  130. package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +3 -3
  131. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +11 -10
  132. package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
  133. package/dist/plots/ranking/cleveland/defaults.js +7 -4
  134. package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
  135. package/dist/plots/ranking/forest/defaults.d.ts +2 -2
  136. package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
  137. package/dist/types/configuration/styling.d.ts +4 -0
  138. package/dist/types/layout/context.d.ts +21 -0
  139. package/dist/types/layout/context.js +1 -0
  140. package/dist/types/layout/hover.d.ts +3 -0
  141. package/dist/types/layout/styles/values.d.ts +8 -2
  142. package/dist/types/layout/tooltip.d.ts +5 -10
  143. package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
  144. package/dist/types/markers/axis/band.d.ts +24 -0
  145. package/dist/types/markers/axis/band.js +1 -0
  146. package/dist/types/markers/axis/bar.d.ts +2 -2
  147. package/dist/types/markers/axis/hover.d.ts +60 -15
  148. package/dist/types/markers/channels/commonMarkerConfig.d.ts +6 -2
  149. package/dist/types/markers/common.d.ts +1 -0
  150. package/dist/types/markers/common.js +1 -0
  151. package/dist/types/phases/context/phase.d.ts +7 -0
  152. package/dist/types/phases/context/phase.js +1 -0
  153. package/dist/types/phases/data/phase.d.ts +2 -2
  154. package/dist/types/phases/hover/phase.d.ts +10 -7
  155. package/dist/types/phases/index.d.ts +2 -1
  156. package/dist/types/phases/kind.d.ts +11 -8
  157. package/dist/types/phases/mapping/phase.d.ts +2 -2
  158. package/dist/types/phases/markers/phase.d.ts +3 -3
  159. package/dist/types/phases/scales/phase.d.ts +4 -4
  160. package/dist/types/phases/stage.d.ts +3 -3
  161. package/dist/types/phases/state.d.ts +1 -1
  162. package/dist/types/phases/styles/phase.d.ts +3 -2
  163. package/dist/types/phases/transforms/phase.d.ts +2 -2
  164. package/dist/types/plots/constants.d.ts +3 -5
  165. package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
  166. package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
  167. package/dist/types/plots/distribution/box/props.d.ts +23 -1
  168. package/dist/types/plots/distribution/box/state.d.ts +6 -17
  169. package/dist/types/plots/distribution/density/state.d.ts +2 -2
  170. package/dist/types/plots/distribution/histogram/props.d.ts +14 -1
  171. package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
  172. package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
  173. package/dist/types/plots/distribution/violin/props.d.ts +2 -1
  174. package/dist/types/plots/distribution/violin/state.d.ts +2 -2
  175. package/dist/types/plots/evolution/area/state.d.ts +2 -2
  176. package/dist/types/plots/evolution/line/state.d.ts +2 -2
  177. package/dist/types/plots/evolution/slope/state.d.ts +2 -2
  178. package/dist/types/plots/evolution/sparkline/state.d.ts +2 -2
  179. package/dist/types/plots/map/geo/state.d.ts +1 -1
  180. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +14 -4
  181. package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +2 -2
  182. package/dist/types/plots/props.d.ts +3 -0
  183. package/dist/types/plots/ranking/bar/state.d.ts +2 -2
  184. package/dist/types/plots/ranking/bullet/state.d.ts +2 -2
  185. package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
  186. package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
  187. package/dist/types/plots/ranking/forest/state.d.ts +2 -2
  188. package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
  189. package/docs/markers.md +34 -2
  190. package/docs/plots/evolution/line.md +1 -1
  191. package/docs/plots/evolution/slope.md +1 -1
  192. package/docs/plots/part-of-a-whole/treemap.md +36 -2
  193. package/docs/plots/ranking/bar.md +1 -0
  194. package/docs/plots/ranking/cleveland.md +1 -1
  195. package/docs/state.md +33 -0
  196. package/docs/styles-and-segments.md +2 -2
  197. package/docs/theming.md +2 -1
  198. package/docs/tooltip-and-hover.md +81 -3
  199. package/examples/LineDates.svelte +1 -1
  200. package/examples/ResponsiveLine.svelte +3 -1
  201. package/examples/TreemapHover.svelte +25 -0
  202. package/examples/ValueLabels.svelte +1 -1
  203. package/llms-full.txt +8 -6
  204. package/llms.txt +2 -1
  205. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { DensityPlotState, DensityPlotCtx } from '../../../types/plots/distribution/density/state';
1
+ import type { DensityPlotState, DensityPlotEnv } from '../../../types/plots/distribution/density/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * DensityPlot's "markers" phase: one `area` - or `line`, by `styles.mark` - per
@@ -6,4 +6,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
6
6
  * its series. The markers the "statistics" phase already put in `state.markers`
7
7
  * come after.
8
8
  */
9
- export declare function buildMarks<TData extends Record<string, unknown>>(state: DensityPlotState<TData>, ctx: DensityPlotCtx): AxisBasedMarkersConfig[];
9
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: DensityPlotState<TData>, env: DensityPlotEnv): AxisBasedMarkersConfig[];
@@ -5,15 +5,15 @@ import { Transforms } from '../../../phases/transforms/Transforms';
5
5
  * its series. The markers the "statistics" phase already put in `state.markers`
6
6
  * come after.
7
7
  */
8
- export function buildMarks(state, ctx) {
8
+ export function buildMarks(state, env) {
9
9
  const { channels, options, transforms } = state.processedData;
10
- const { cfg } = ctx;
10
+ const { cfg } = env;
11
11
  const styles = state.styles;
12
12
  const asLine = styles?.mark === 'line';
13
13
  return (state.processedGroups ?? []).flatMap((group) => {
14
14
  const name = group.series.name;
15
- const disabledFill = ctx.interaction?.fillFor(name);
16
- const disabledStroke = ctx.interaction?.strokeFor(name);
15
+ const disabledFill = env.interaction?.fillFor(name);
16
+ const disabledStroke = env.interaction?.strokeFor(name);
17
17
  return group.visualSegments.map((seg) => {
18
18
  const color = seg.styles.fill ?? state.colorForSeries(name);
19
19
  const style = asLine
@@ -1,9 +1,9 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { HistogramPlotState, HistogramPlotCtx } from '../../../types/plots/distribution/histogram/state';
2
+ import type { HistogramPlotState, HistogramPlotEnv } from '../../../types/plots/distribution/histogram/state';
3
3
  /**
4
4
  * HistogramPlot on the shared pipeline: series read one position channel -
5
5
  * `x`, or `y` for a horizontal histogram - binned by the plot's transforms
6
6
  * merged over the default bin of that axis, bars from a zero baseline, and its
7
7
  * own markers. Its plot defaults to: hover along the binned axis.
8
8
  */
9
- export declare function buildHistogramDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<HistogramPlotState<TData>, HistogramPlotCtx>;
9
+ export declare function buildHistogramDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<HistogramPlotState<TData>, HistogramPlotEnv>;
@@ -1,5 +1,5 @@
1
1
  import { buildMarks } from './markers';
2
- import { SERIES_KEY } from '../../../phases/transforms/TransformsPhase';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
3
3
  import { resolveAccessor } from '../../../utils/accessors';
4
4
  import { PlotAxes } from '../../../phases/data/PlotAxes';
5
5
  /** One processed channel's value on a row - `undefined` for a channel the transforms didn't set. */
@@ -40,7 +40,23 @@ export function buildHistogramDefaults() {
40
40
  }
41
41
  },
42
42
  transforms: {
43
- transforms: (state, ctx) => mergeBin(state.transforms ?? [], ctx.cfg, state.axes?.isHorizontal ?? false)
43
+ transforms: (state, env) => mergeBin(state.transforms ?? [], env.cfg, state.axes?.isHorizontal ?? false)
44
+ },
45
+ // A bin's count and the edges it spans, for its label, its tooltip and its hover.
46
+ context: (state) => {
47
+ const { channels } = state.processedData;
48
+ const value = PlotAxes.valueOf(state);
49
+ const binned = PlotAxes.other(value);
50
+ const [count, from, to] = [
51
+ channels[value],
52
+ channels[`${binned}1`],
53
+ channels[`${binned}2`]
54
+ ].map(readChannel);
55
+ return ((row) => ({
56
+ count: Number(count(row)),
57
+ from: Number(from(row)),
58
+ to: Number(to(row))
59
+ }));
44
60
  },
45
61
  scales: { zero: ['value'] },
46
62
  styles: {
@@ -65,29 +81,8 @@ export function buildHistogramDefaults() {
65
81
  },
66
82
  markers: { marks: buildMarks },
67
83
  hover: {
68
- // A hovered bin is labelled with its count, and reads as its row plus its count,
69
- // the edges it spans and its series.
70
- label: (state) => {
71
- const count = readChannel(state.processedData.channels[PlotAxes.valueOf(state)]);
72
- return ((row) => String(Number(count(row))));
73
- },
74
- row: (state) => {
75
- const { channels } = state.processedData;
76
- const value = PlotAxes.valueOf(state);
77
- const binned = PlotAxes.other(value);
78
- const [count, from, to] = [
79
- channels[value],
80
- channels[`${binned}1`],
81
- channels[`${binned}2`]
82
- ].map(readChannel);
83
- return ((row) => ({
84
- ...row,
85
- count: Number(count(row)),
86
- from: Number(from(row)),
87
- to: Number(to(row)),
88
- group: row[SERIES_KEY]
89
- }));
90
- }
84
+ // The hovered bin's span behind its bar, the whole height of the plot: a bin is no band of a category.
85
+ marker: (state) => HoverDefaults.behindSpan(PlotAxes.other(PlotAxes.valueOf(state)), 'from', 'to')
91
86
  }
92
87
  };
93
88
  }
@@ -1,4 +1,4 @@
1
- import type { HistogramPlotState, HistogramPlotCtx } from '../../../types/plots/distribution/histogram/state';
1
+ import type { HistogramPlotState, HistogramPlotEnv } from '../../../types/plots/distribution/histogram/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * HistogramPlot's "markers" phase: one `rect` per visual segment of each
@@ -6,4 +6,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
6
6
  * the "statistics" phase already put in `state.markers` come after, and its
7
7
  * value labels last.
8
8
  */
9
- export declare function buildMarks<TData extends Record<string, unknown>>(state: HistogramPlotState<TData>, ctx: HistogramPlotCtx): AxisBasedMarkersConfig[];
9
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: HistogramPlotState<TData>, env: HistogramPlotEnv): AxisBasedMarkersConfig[];
@@ -9,9 +9,9 @@ import { PlotAxes } from '../../../phases/data/PlotAxes';
9
9
  * the "statistics" phase already put in `state.markers` come after, and its
10
10
  * value labels last.
11
11
  */
12
- export function buildMarks(state, ctx) {
12
+ export function buildMarks(state, env) {
13
13
  const { channels, options, transforms } = state.processedData;
14
- const fillOpacity = ctx.cfg.histogram.fillOpacity;
14
+ const fillOpacity = env.cfg.histogram.fillOpacity;
15
15
  // Each bin writes its own count, along its bar: past its top (`'outside'`), against an edge, at its tip or its
16
16
  // base - upward, or rightward on a horizontal histogram. A bin with nothing in it writes nothing.
17
17
  const labels = state.valueLabels?.show ? state.valueLabels : undefined;
@@ -23,18 +23,19 @@ export function buildMarks(state, ctx) {
23
23
  const bottomOf = read(channels[`${value}1`]) ?? (() => 0);
24
24
  const countRead = read(channels[value]);
25
25
  const countOf = (d) => countRead ? Number(countRead(d)) : Number(position[value](d)) - Number(bottomOf(d));
26
- const labelFor = (name) => labels?.shapeLabel(ctx, (d) => (countOf(d) > 0 ? labels.format(countOf(d), name, d) : ''), {
26
+ const labelFor = (name) => labels?.shapeLabel(env, (d) => (countOf(d) > 0 ? labels.format(countOf(d), d, name) : ''), {
27
27
  fill: 'currentColor',
28
28
  ...ValueLabels.boxAnchor(labels.anchor, { isHorizontal: value === 'x' })
29
29
  });
30
30
  const rects = (state.processedGroups ?? []).flatMap((group) => {
31
- const disabled = ctx.interaction?.fillFor(group.series.name);
31
+ const disabled = env.interaction?.fillFor(group.series.name);
32
32
  // A stroke the segment sets is not a reason to lose the series' fill, as the marker would take it for the color.
33
33
  const color = state.colorForSeries(group.series.name);
34
34
  return group.visualSegments.map((seg) => Transforms.finish({
35
35
  type: 'rect',
36
36
  series: group.series.name,
37
37
  data: seg.data,
38
+ hover: 'style',
38
39
  ...(labels ? { label: labelFor(group.series.name) } : {}),
39
40
  ...channels,
40
41
  ...options,
@@ -1,5 +1,5 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { PyramidPlotState, PyramidPlotCtx } from '../../../types/plots/distribution/pyramid/state';
2
+ import type { PyramidPlotState, PyramidPlotEnv } from '../../../types/plots/distribution/pyramid/state';
3
3
  /**
4
4
  * PyramidPlot on the shared pipeline. Its `x`/`y` are the visual axes: the one
5
5
  * holding categories (read off the values by the "data" phase) runs the bars,
@@ -10,4 +10,4 @@ import type { PyramidPlotState, PyramidPlotCtx } from '../../../types/plots/dist
10
10
  * category and magnitude.
11
11
  * Its plot defaults to: hover along the category axis; the tween is of the magnitude, keyed by category and side.
12
12
  */
13
- export declare function buildPyramidDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<PyramidPlotState<TData>, PyramidPlotCtx>;
13
+ export declare function buildPyramidDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<PyramidPlotState<TData>, PyramidPlotEnv>;
@@ -1,4 +1,5 @@
1
1
  import { ProcessedPositions } from '../../../phases/transforms/ProcessedPositions';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
3
  import { PlotAxes } from '../../../phases/data/PlotAxes';
3
4
  import { buildMarks } from './markers';
4
5
  import { ValueLabels } from '../../../layout/styles/ValueLabels';
@@ -55,7 +56,7 @@ export function buildPyramidDefaults() {
55
56
  const offset = labels.offset(axis);
56
57
  return labels.extremes(state.resolvedSeries ?? [], axis).map(({ series, value }) => {
57
58
  const left = series.side === 'left';
58
- const text = labels.format(Math.abs(value), series.name);
59
+ const text = labels.format(Math.abs(value), undefined, series.name);
59
60
  return isHorizontal
60
61
  ? labels.edgeBox(text, { x: left ? 'before' : 'after', y: 'middle' }, { x: left ? -offset : offset }, [left ? 'left' : 'right'])
61
62
  : labels.edgeBox(text, { x: 'middle', y: left ? 'after' : 'before' }, { y: left ? offset : -offset }, [left ? 'bottom' : 'top']);
@@ -65,6 +66,8 @@ export function buildPyramidDefaults() {
65
66
  },
66
67
  markers: { marks: buildMarks },
67
68
  hover: {
69
+ // The hovered age group's band behind its bars, across both sides.
70
+ marker: (state) => HoverDefaults.behindBand(PlotAxes.other(PlotAxes.valueOf(state))),
68
71
  // A bar sits at its signed magnitude - below or left of the baseline on the first
69
72
  // side - and its category, and reads as its magnitude.
70
73
  position: (state) => {
@@ -1,4 +1,4 @@
1
- import type { PyramidPlotState, PyramidPlotCtx } from '../../../types/plots/distribution/pyramid/state';
1
+ import type { PyramidPlotState, PyramidPlotEnv } from '../../../types/plots/distribution/pyramid/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * PyramidPlot's "markers" phase: one `role: 'segment'` bar per visual
@@ -8,4 +8,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
8
8
  * `state.markers`. Emits no `role: 'hitArea'` markers - PyramidPlot's hover
9
9
  * matches nearest points rather than hit-testing category bands.
10
10
  */
11
- export declare function buildMarks<TData extends Record<string, unknown>>(state: PyramidPlotState<TData>, ctx: PyramidPlotCtx): AxisBasedMarkersConfig[];
11
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: PyramidPlotState<TData>, env: PyramidPlotEnv): AxisBasedMarkersConfig[];
@@ -16,7 +16,7 @@ function signFor(s, magnitude) {
16
16
  * `state.markers`. Emits no `role: 'hitArea'` markers - PyramidPlot's hover
17
17
  * matches nearest points rather than hit-testing category bands.
18
18
  */
19
- export function buildMarks(state, ctx) {
19
+ export function buildMarks(state, env) {
20
20
  const { groupedSeries, gapFillMaps } = state;
21
21
  const gapDefaults = getConfiguration().pyramid.gap;
22
22
  const categoryAxis = PlotAxes.categoryOf(state);
@@ -47,7 +47,7 @@ export function buildMarks(state, ctx) {
47
47
  // practice, just not provably so to TypeScript here.
48
48
  const category = group.series[categoryAxis];
49
49
  const defaultColor = state.colorForSeries(group.series.name);
50
- const disabledFill = ctx.interaction?.fillFor(group.series.name);
50
+ const disabledFill = env.interaction?.fillFor(group.series.name);
51
51
  const processed = processedGroups.get(seriesIdOf(group.series));
52
52
  const processedCategory = processed?.series[categoryAxis];
53
53
  const getMagnitude = resolveAccessor((processed?.series[valueAxis] ?? group.series[valueAxis]));
@@ -60,11 +60,12 @@ export function buildMarks(state, ctx) {
60
60
  type: 'bar',
61
61
  role: 'segment',
62
62
  data: realData,
63
+ hover: 'style',
63
64
  ...span(processedCategory, signed),
64
65
  // Each bar writes its own magnitude, on its side of the baseline.
65
66
  ...(labels
66
67
  ? {
67
- label: labels.shapeLabel(ctx, (d) => labels.format(Math.abs(Number(getMagnitude(d))), group.series.name, d), { fill: 'currentColor', ...anchorOf(group.series.side) })
68
+ label: labels.shapeLabel(env, (d) => labels.format(Math.abs(Number(getMagnitude(d))), d, group.series.name), { fill: 'currentColor', ...anchorOf(group.series.side) })
68
69
  }
69
70
  : {}),
70
71
  styles: {
@@ -1,5 +1,5 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { ViolinPlotState, ViolinPlotCtx } from '../../../types/plots/distribution/violin/state';
2
+ import type { ViolinPlotState, ViolinPlotEnv } from '../../../types/plots/distribution/violin/state';
3
3
  /**
4
4
  * ViolinPlot on the shared pipeline: one violin per category of each series
5
5
  * along one category axis - `x`, or `y` for horizontal violins - in the order
@@ -7,4 +7,4 @@ import type { ViolinPlotState, ViolinPlotCtx } from '../../../types/plots/distri
7
7
  * fits the values, without reaching for zero. Its plot defaults to: hover
8
8
  * along the category axis, over one summary per violin, read as a box plot's.
9
9
  */
10
- export declare function buildViolinDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<ViolinPlotState<TData>, ViolinPlotCtx>;
10
+ export declare function buildViolinDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<ViolinPlotState<TData>, ViolinPlotEnv>;
@@ -1,9 +1,9 @@
1
1
  import { buildMarks } from './markers';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
3
  import { BoxSummaries } from '../box/BoxSummaries';
3
4
  import { PlotAxes } from '../../../phases/data/PlotAxes';
4
5
  import { ProcessedPositions } from '../../../phases/transforms/ProcessedPositions';
5
6
  import { NiceTicks } from '../../../layout/scales/NiceTicks';
6
- import { TooltipState } from '../../../layout/tooltip/TooltipState.svelte';
7
7
  /**
8
8
  * The value axis fit to the values the violins are drawn from, when the author leaves it unpinned: no svelteplot mark reads them, so nothing else sets its domain.
9
9
  */
@@ -43,20 +43,22 @@ export function buildViolinDefaults() {
43
43
  scales: {
44
44
  bandOrder: 'data',
45
45
  fit: (state) => fitValueDomain(state),
46
- defaults: (_state, ctx) => ({
46
+ defaults: (_state, env) => ({
47
47
  category: {
48
- paddingInner: ctx.cfg.violin.paddingInner,
49
- paddingOuter: ctx.cfg.violin.paddingOuter
48
+ paddingInner: env.cfg.violin.paddingInner,
49
+ paddingOuter: env.cfg.violin.paddingOuter
50
50
  }
51
51
  })
52
52
  },
53
+ // Each value's box: its quartiles and whiskers, worked out once for its tooltip and hover to read.
54
+ context: (state) => BoxSummaries.context(state),
53
55
  markers: { marks: buildMarks },
54
56
  hover: {
57
+ // The hovered category's band behind its shape.
58
+ marker: (state) => HoverDefaults.behindBand(PlotAxes.other(PlotAxes.valueOf(state))),
55
59
  rows: BoxSummaries.of,
56
60
  position: BoxSummaries.position,
57
- label: () => ((row) => String(row.median)),
58
- format: (state) => BoxSummaries.format(state),
59
- sort: () => TooltipState.descending((row) => row.median)
61
+ format: (state) => BoxSummaries.format(state)
60
62
  }
61
63
  };
62
64
  }
@@ -1,4 +1,4 @@
1
- import type { ViolinPlotState, ViolinPlotCtx } from '../../../types/plots/distribution/violin/state';
1
+ import type { ViolinPlotState, ViolinPlotEnv } from '../../../types/plots/distribution/violin/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * ViolinPlot's "markers" phase: one `violin` - and a narrow `box` over it - per visual
@@ -7,4 +7,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
7
7
  * by side. The markers the "statistics" phase already put in `state.markers`
8
8
  * come after, so they render on top.
9
9
  */
10
- export declare function buildMarks<TData extends Record<string, unknown>>(state: ViolinPlotState<TData>, ctx: ViolinPlotCtx): AxisBasedMarkersConfig[];
10
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: ViolinPlotState<TData>, env: ViolinPlotEnv): AxisBasedMarkersConfig[];
@@ -8,11 +8,11 @@ import { ViolinProfiles } from '../../../markers/violin/ViolinProfiles';
8
8
  * by side. The markers the "statistics" phase already put in `state.markers`
9
9
  * come after, so they render on top.
10
10
  */
11
- export function buildMarks(state, ctx) {
11
+ export function buildMarks(state, env) {
12
12
  const processed = state.processedData;
13
13
  if (!processed)
14
14
  return [];
15
- const { cfg } = ctx;
15
+ const { cfg } = env;
16
16
  const styles = state.styles;
17
17
  const { channels } = processed;
18
18
  const groups = state.processedGroups ?? [];
@@ -32,7 +32,7 @@ export function buildMarks(state, ctx) {
32
32
  const ink = 'currentColor';
33
33
  const violins = groups.flatMap((group, index) => {
34
34
  const name = group.series.name;
35
- const disabled = ctx.interaction?.fillFor(name);
35
+ const disabled = env.interaction?.fillFor(name);
36
36
  return group.visualSegments.map((seg) => ({
37
37
  type: 'violin',
38
38
  series: name,
@@ -1,4 +1,4 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { AreaPlotState, AreaPlotCtx } from '../../../types/plots/evolution/area/state';
2
+ import type { AreaPlotState, AreaPlotEnv } from '../../../types/plots/evolution/area/state';
3
3
  /** AreaPlot on the shared pipeline: areas from a zero baseline, author markers taking the plot's `x`/`y`, and its own markers. Its plot defaults to: hover along x, cumulative timeline tweening `y` per series. */
4
- export declare function buildAreaDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<AreaPlotState<TData>, AreaPlotCtx>;
4
+ export declare function buildAreaDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<AreaPlotState<TData>, AreaPlotEnv>;
@@ -12,7 +12,7 @@ export function buildAreaDefaults() {
12
12
  styles: {
13
13
  values: {
14
14
  anchor: 'start',
15
- format: (v, name, number) => `${name} - ${number(v)}`,
15
+ format: (v, number, context) => `${context.series} - ${number(v)}`,
16
16
  reach: (labels, state) => labels.reachAtSeriesEnds(state)
17
17
  }
18
18
  },
@@ -1,4 +1,4 @@
1
- import type { AreaPlotState, AreaPlotCtx } from '../../../types/plots/evolution/area/state';
1
+ import type { AreaPlotState, AreaPlotEnv } from '../../../types/plots/evolution/area/state';
2
2
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
3
3
  /**
4
4
  * AreaPlot's "markers" phase: one `area` per visual segment of each series,
@@ -11,4 +11,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
11
11
  * another series' value label, dims its own areas' fill to
12
12
  * `legend.disabledOpacity`, in place, so a stack keeps its full extent.
13
13
  */
14
- export declare function buildMarks<TData extends Record<string, unknown>>(state: AreaPlotState<TData>, ctx: AreaPlotCtx): AxisBasedMarkersConfig[];
14
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: AreaPlotState<TData>, env: AreaPlotEnv): AxisBasedMarkersConfig[];
@@ -10,17 +10,17 @@ import { Transforms } from '../../../phases/transforms/Transforms';
10
10
  * another series' value label, dims its own areas' fill to
11
11
  * `legend.disabledOpacity`, in place, so a stack keeps its full extent.
12
12
  */
13
- export function buildMarks(state, ctx) {
13
+ export function buildMarks(state, env) {
14
14
  const { resolvedSeries = [] } = state;
15
15
  const { channels, options, transforms } = state.processedData;
16
- const { cfg } = ctx;
16
+ const { cfg } = env;
17
17
  // A fill opacity per series name, for the dim: a legend-off series fades to
18
18
  // the legend's disabled opacity, every other one keeps the area default.
19
19
  const fillOpacityOf = (name) => {
20
- const off = ctx.interaction?.dimmed(name);
20
+ const off = env.interaction?.dimmed(name);
21
21
  return off ? (off.opacity ?? cfg.legend.disabledOpacity) : cfg.area.fillOpacity;
22
22
  };
23
- const dimmed = resolvedSeries.some((s) => ctx.interaction?.dimmed(s.name));
23
+ const dimmed = resolvedSeries.some((s) => env.interaction?.dimmed(s.name));
24
24
  const opacityScale = {
25
25
  range: Object.fromEntries(resolvedSeries.map((s) => [s.name, fillOpacityOf(s.name)]))
26
26
  };
@@ -1,4 +1,4 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { LinePlotState, LinePlotCtx } from '../../../types/plots/evolution/line/state';
2
+ import type { LinePlotState, LinePlotEnv } from '../../../types/plots/evolution/line/state';
3
3
  /** LinePlot on the shared pipeline: continuous segments colored by their stroke, and its own markers. Its plot defaults to: hover along x, cumulative timeline tweening `y` per series. */
4
- export declare function buildLineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LinePlotState<TData>, LinePlotCtx>;
4
+ export declare function buildLineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LinePlotState<TData>, LinePlotEnv>;
@@ -23,7 +23,7 @@ export function buildLineDefaults() {
23
23
  styles: {
24
24
  values: {
25
25
  anchor: 'start',
26
- format: (v, name, number) => `${name} - ${number(v)}`,
26
+ format: (v, number, context) => `${context.series} - ${number(v)}`,
27
27
  reach: (labels, state) => labels.reachAtSeriesEnds(state)
28
28
  }
29
29
  },
@@ -4,7 +4,7 @@ import type { LineSegmentStyle } from '../../../types/plots/segments/common';
4
4
  import type { VisualGroup } from '../../../types/plots/segments/config';
5
5
  import type { StrokeStyle, DotStyle } from '../../../types/plots/styling';
6
6
  import type { LineMarkerConfig, DotMarkerConfig } from '../../../types/markers/common';
7
- import type { LinePlotState, LinePlotCtx } from '../../../types/plots/evolution/line/state';
7
+ import type { LinePlotState, LinePlotEnv } from '../../../types/plots/evolution/line/state';
8
8
  import type { CurveName } from '../../../types/layout/styles/curve';
9
9
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
10
10
  /**
@@ -49,4 +49,4 @@ export declare function buildGapMarkers<TData extends Record<string, unknown>>(a
49
49
  * whatever the "statistics" phase already put in `state.markers` - and its
50
50
  * value labels on top of everything.
51
51
  */
52
- export declare function buildMarks<TData extends Record<string, unknown>>(state: LinePlotState<TData>, ctx: LinePlotCtx): AxisBasedMarkersConfig[];
52
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: LinePlotState<TData>, env: LinePlotEnv): AxisBasedMarkersConfig[];
@@ -178,10 +178,10 @@ export function buildGapMarkers(args) {
178
178
  * whatever the "statistics" phase already put in `state.markers` - and its
179
179
  * value labels on top of everything.
180
180
  */
181
- export function buildMarks(state, ctx) {
181
+ export function buildMarks(state, env) {
182
182
  const { colorForSeries, gaps } = state;
183
- const disabledStrokeFor = (name) => ctx.interaction?.strokeFor(name);
184
- const disabledDotsFor = (name) => ctx.interaction?.dotsFor(name);
183
+ const disabledStrokeFor = (name) => env.interaction?.strokeFor(name);
184
+ const disabledDotsFor = (name) => env.interaction?.dotsFor(name);
185
185
  const groups = state.processedGroups ?? [];
186
186
  const lineMarkers = buildLineMarkers({
187
187
  groupedSeries: groups,
@@ -1,8 +1,8 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { SlopePlotState, SlopePlotCtx } from '../../../types/plots/evolution/slope/state';
2
+ import type { SlopePlotState, SlopePlotEnv } from '../../../types/plots/evolution/slope/state';
3
3
  /**
4
4
  * SlopePlot on the shared pipeline: a LinePlot over a category axis of a few
5
5
  * positions - two, for a slope - with a dot on every point and its first and
6
6
  * last labelled, each before or after it.
7
7
  */
8
- export declare function buildSlopeDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SlopePlotState<TData>, SlopePlotCtx>;
8
+ export declare function buildSlopeDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SlopePlotState<TData>, SlopePlotEnv>;
@@ -1,4 +1,6 @@
1
1
  import { buildMarks, buildValueLabels } from './markers';
2
+ import { PlotAxes } from '../../../phases/data/PlotAxes';
3
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
4
  import { ValueLabels } from '../../../layout/styles/ValueLabels';
3
5
  import { buildLineDefaults } from '../line/defaults';
4
6
  /**
@@ -15,17 +17,19 @@ export function buildSlopeDefaults() {
15
17
  scales: {
16
18
  bandOrder: 'data',
17
19
  // The labels give the values, so the value axis stays out of their way.
18
- defaults: (_state, ctx) => ({
19
- category: { type: 'point', padding: ctx.cfg.slope.padding },
20
+ defaults: (_state, env) => ({
21
+ category: { type: 'point', padding: env.cfg.slope.padding },
20
22
  value: { axisDisplay: 'none' }
21
23
  })
22
24
  },
23
25
  styles: {
24
26
  values: {
25
27
  anchor: 'start',
26
- format: (v, name, number) => `${name} - ${number(v)}`
28
+ format: (v, number, context) => `${context.series} - ${number(v)}`
27
29
  }
28
30
  },
29
- markers: { marks: buildMarks, valueLabels: buildValueLabels }
31
+ markers: { marks: buildMarks, valueLabels: buildValueLabels },
32
+ // Only two positions: a rule along the value axis at the hovered point says more than one across them.
33
+ hover: { ...line.hover, marker: (state) => HoverDefaults.valueRule(PlotAxes.valueOf(state)) }
30
34
  };
31
35
  }
@@ -1,12 +1,12 @@
1
1
  import type { ValueLabels } from '../../../layout/styles/ValueLabels';
2
2
  import type { EdgeBox } from '../../../types/layout/box';
3
3
  import type { AxisBasedMarkersConfig, TextMarkerConfig } from '../../../types/markers/common';
4
- import type { SlopePlotState, SlopePlotCtx } from '../../../types/plots/evolution/slope/state';
4
+ import type { SlopePlotState, SlopePlotEnv } from '../../../types/plots/evolution/slope/state';
5
5
  /**
6
6
  * SlopePlot's "markers" phase: each series' line, with a dot on every point
7
7
  * (a slope has few), over the rows the "transforms" phase left.
8
8
  */
9
- export declare function buildMarks<TData extends Record<string, unknown>>(state: SlopePlotState<TData>, ctx: SlopePlotCtx): AxisBasedMarkersConfig[];
9
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: SlopePlotState<TData>, env: SlopePlotEnv): AxisBasedMarkersConfig[];
10
10
  /**
11
11
  * SlopePlot's value labels: the series' first points labelled before them and
12
12
  * its last ones after, each end spread apart where its labels would overlap.
@@ -11,7 +11,7 @@ const keyOf = (value) => (value instanceof Date ? value.getTime() : value);
11
11
  * SlopePlot's "markers" phase: each series' line, with a dot on every point
12
12
  * (a slope has few), over the rows the "transforms" phase left.
13
13
  */
14
- export function buildMarks(state, ctx) {
14
+ export function buildMarks(state, env) {
15
15
  const { slope } = getConfiguration();
16
16
  const groups = (state.processedGroups ?? []).map((group) => ({
17
17
  ...group,
@@ -27,8 +27,8 @@ export function buildMarks(state, ctx) {
27
27
  return buildLineMarkers({
28
28
  groupedSeries: groups,
29
29
  colorFor: state.colorForSeries,
30
- disabledStrokeFor: (name) => ctx.interaction?.strokeFor(name),
31
- disabledDotsFor: (name) => ctx.interaction?.dotsFor(name),
30
+ disabledStrokeFor: (name) => env.interaction?.strokeFor(name),
31
+ disabledDotsFor: (name) => env.interaction?.dotsFor(name),
32
32
  curve: state.styles?.curve
33
33
  });
34
34
  }
@@ -1,7 +1,7 @@
1
1
  import type { AxisPlotDefaults } from '../../../types/phases';
2
- import type { SparklinePlotState, SparklinePlotCtx } from '../../../types/plots/evolution/sparkline/state';
2
+ import type { SparklinePlotState, SparklinePlotEnv } from '../../../types/plots/evolution/sparkline/state';
3
3
  /**
4
4
  * SparklinePlot on the shared pipeline: a LinePlot with its axes left out, a
5
5
  * thin line, and a dot and value on the last point of each series.
6
6
  */
7
- export declare function buildSparklineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SparklinePlotState<TData>, SparklinePlotCtx>;
7
+ export declare function buildSparklineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SparklinePlotState<TData>, SparklinePlotEnv>;
@@ -1,4 +1,5 @@
1
1
  import { buildMarks } from './markers';
2
+ import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
2
3
  import { ValueLabels } from '../../../layout/styles/ValueLabels';
3
4
  import { buildLineDefaults } from '../line/defaults';
4
5
  /**
@@ -15,9 +16,11 @@ export function buildSparklineDefaults() {
15
16
  values: {
16
17
  ...line.styles?.values,
17
18
  show: true,
18
- format: (value, _name, number) => number(value)
19
+ format: (value, number) => number(value)
19
20
  }
20
21
  },
21
- markers: { marks: buildMarks, valueLabels: line.markers.valueLabels }
22
+ markers: { marks: buildMarks, valueLabels: line.markers.valueLabels },
23
+ // Small and bare: a dot on the hovered point, and nothing else.
24
+ hover: { ...line.hover, marker: () => ({ back: [], front: [HoverDefaults.dot()] }) }
22
25
  };
23
26
  }
@@ -1,7 +1,7 @@
1
1
  import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
2
- import type { SparklinePlotState, SparklinePlotCtx } from '../../../types/plots/evolution/sparkline/state';
2
+ import type { SparklinePlotState, SparklinePlotEnv } from '../../../types/plots/evolution/sparkline/state';
3
3
  /**
4
4
  * SparklinePlot's "markers" phase: each series' line, thin, and a dot on its
5
5
  * last point with a value.
6
6
  */
7
- export declare function buildMarks<TData extends Record<string, unknown>>(state: SparklinePlotState<TData>, ctx: SparklinePlotCtx): AxisBasedMarkersConfig[];
7
+ export declare function buildMarks<TData extends Record<string, unknown>>(state: SparklinePlotState<TData>, env: SparklinePlotEnv): AxisBasedMarkersConfig[];
@@ -6,10 +6,10 @@ import { isGapValue } from '../../utils/gaps';
6
6
  * SparklinePlot's "markers" phase: each series' line, thin, and a dot on its
7
7
  * last point with a value.
8
8
  */
9
- export function buildMarks(state, ctx) {
9
+ export function buildMarks(state, env) {
10
10
  const { sparkline } = getConfiguration();
11
11
  const groups = state.processedGroups ?? [];
12
- const disabledDotsFor = (name) => ctx.interaction?.dotsFor(name);
12
+ const disabledDotsFor = (name) => env.interaction?.dotsFor(name);
13
13
  const lines = buildLineMarkers({
14
14
  groupedSeries: groups.map((group) => ({
15
15
  ...group,
@@ -22,7 +22,7 @@ export function buildMarks(state, ctx) {
22
22
  }))
23
23
  })),
24
24
  colorFor: state.colorForSeries,
25
- disabledStrokeFor: (name) => ctx.interaction?.strokeFor(name),
25
+ disabledStrokeFor: (name) => env.interaction?.strokeFor(name),
26
26
  disabledDotsFor,
27
27
  curve: state.styles?.curve
28
28
  });
@@ -7,7 +7,7 @@
7
7
  import BasePlotLayout from '../../../layout/base/BasePlotLayout.svelte';
8
8
  import type { GeoPlotCoreProps } from '../../../types/plots/map/geo/props';
9
9
  import type { CoordinatesConfig } from '../../../types/layout/coordinates';
10
- import type { GeoPlotState, GeoPlotCtx } from '../../../types/plots/map/geo/state';
10
+ import type { GeoPlotState, GeoPlotEnv } from '../../../types/plots/map/geo/state';
11
11
 
12
12
  /**
13
13
  * A map from GeoJSON or TopoJSON. `segments` styles features by id,
@@ -76,7 +76,7 @@
76
76
  y: { domain: [90, -90] }
77
77
  });
78
78
 
79
- const ctx = $derived<GeoPlotCtx<TProps>>({
79
+ const env = $derived<GeoPlotEnv<TProps>>({
80
80
  cfg,
81
81
  range,
82
82
  fill: styles.fill,
@@ -103,7 +103,7 @@
103
103
  height,
104
104
  margins
105
105
  },
106
- ctx
106
+ env
107
107
  ) as GeoPlotState<TProps>
108
108
  );
109
109