@d3plus/core 4.9.0 → 4.10.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 (236) hide show
  1. package/es/internal.js +3 -1
  2. package/es/src/charts/BoxWhisker/index.js +73 -4
  3. package/es/src/charts/BoxWhisker/outliers.js +68 -0
  4. package/es/src/charts/BoxWhisker/summary.js +83 -0
  5. package/es/src/charts/BoxWhisker/tooltip.js +122 -0
  6. package/es/src/charts/Bullet/index.js +2 -1
  7. package/es/src/charts/BumpChart/index.js +5 -0
  8. package/es/src/charts/Calendar/index.js +2 -1
  9. package/es/src/charts/Candlestick/aggregate.js +11 -1
  10. package/es/src/charts/Candlestick/index.js +5 -5
  11. package/es/src/charts/Chord/index.js +3 -2
  12. package/es/src/charts/Funnel/index.js +2 -1
  13. package/es/src/charts/Gauge/index.js +2 -1
  14. package/es/src/charts/Geomap/index.js +9 -3
  15. package/es/src/charts/Histogram/index.js +5 -1
  16. package/es/src/charts/Matrix/index.js +3 -2
  17. package/es/src/charts/Network/index.js +9 -4
  18. package/es/src/charts/Pack/index.js +2 -1
  19. package/es/src/charts/Pie/index.js +2 -1
  20. package/es/src/charts/Plot/axisHover.js +180 -0
  21. package/es/src/charts/Plot/axisHoverAnchors.js +174 -0
  22. package/es/src/charts/Plot/axisHoverScene.js +202 -0
  23. package/es/src/charts/Plot/barHitArea.js +81 -0
  24. package/es/src/charts/Plot/barLabelFit.js +123 -0
  25. package/es/src/charts/Plot/barWidth.js +2 -2
  26. package/es/src/charts/Plot/confidenceConfig.js +2 -2
  27. package/es/src/charts/Plot/draw.js +6 -2
  28. package/es/src/charts/Plot/index.js +25 -6
  29. package/es/src/charts/Plot/labelPlacement.js +9 -1
  30. package/es/src/charts/Plot/openDomainEnds.js +2 -5
  31. package/es/src/charts/Plot/pipeline.js +5 -3
  32. package/es/src/charts/Plot/pipelineAxisLayout.js +38 -8
  33. package/es/src/charts/Plot/pipelineDomains.js +7 -3
  34. package/es/src/charts/Plot/pipelineLineLabels.js +1 -1
  35. package/es/src/charts/Plot/plotInit.js +15 -0
  36. package/es/src/charts/Plot/plotZoom.js +15 -6
  37. package/es/src/charts/Plot/shapeDefaults.js +4 -4
  38. package/es/src/charts/Plot/sharedHoverScene.js +50 -31
  39. package/es/src/charts/Plot/sharedTooltip.js +19 -7
  40. package/es/src/charts/Plot/stackHelpers.js +13 -1
  41. package/es/src/charts/Plot/stackShareTooltip.js +9 -4
  42. package/es/src/charts/Plot/stackThreshold.js +154 -0
  43. package/es/src/charts/PolarArea/index.js +3 -2
  44. package/es/src/charts/Priestley/index.js +3 -2
  45. package/es/src/charts/Pyramid/index.js +4 -2
  46. package/es/src/charts/Radar/index.js +3 -2
  47. package/es/src/charts/RadialBar/index.js +2 -1
  48. package/es/src/charts/RadialMatrix/index.js +3 -2
  49. package/es/src/charts/Rings/index.js +5 -3
  50. package/es/src/charts/Sankey/index.js +3 -2
  51. package/es/src/charts/Treemap/applyLayout.js +14 -1
  52. package/es/src/charts/Treemap/emit.js +8 -2
  53. package/es/src/charts/Treemap/emitGroupHeaders.js +104 -0
  54. package/es/src/charts/Treemap/groupHeaders.js +95 -0
  55. package/es/src/charts/Treemap/index.js +15 -2
  56. package/es/src/charts/Treemap/thresholdFunction.js +11 -9
  57. package/es/src/charts/Waffle/index.js +4 -2
  58. package/es/src/charts/Waffle/tooltip.js +6 -2
  59. package/es/src/charts/Waterfall/index.js +4 -2
  60. package/es/src/charts/definition/makeChart.js +12 -5
  61. package/es/src/charts/drawSteps/saveChart.js +176 -0
  62. package/es/src/charts/drawSteps/saveControl.js +148 -0
  63. package/es/src/charts/drawSteps/saveControlMarkup.js +104 -0
  64. package/es/src/charts/drawSteps/tableViewMarkup.js +1 -1
  65. package/es/src/charts/drawSteps/topLeftControls.js +3 -1
  66. package/es/src/charts/drawSteps/topLeftControlsMarkup.js +1 -1
  67. package/es/src/charts/events/click.shape.js +30 -1
  68. package/es/src/charts/events/mouseenter.js +9 -0
  69. package/es/src/charts/events/mousemove.legend.js +3 -0
  70. package/es/src/charts/events/mousemove.shape.js +7 -2
  71. package/es/src/charts/facet/facetConfig.js +2 -2
  72. package/es/src/charts/facet/facetData.js +2 -2
  73. package/es/src/charts/features/axes.js +7 -6
  74. package/es/src/charts/features/axesFinal.js +23 -3
  75. package/es/src/charts/features/axesMeasure.js +54 -2
  76. package/es/src/charts/features/colorScaleBucket.js +17 -0
  77. package/es/src/charts/features/colorScaleHover.js +69 -0
  78. package/es/src/charts/features/features.js +13 -1
  79. package/es/src/charts/features/featuresColorScale.js +44 -4
  80. package/es/src/charts/features/featuresLegend.js +6 -8
  81. package/es/src/charts/features/plotPaint.js +4 -4
  82. package/es/src/charts/features/shapeEmit.js +23 -2
  83. package/es/src/charts/features/shareKey.js +15 -0
  84. package/es/src/charts/features/thresholdMembers.js +71 -0
  85. package/es/src/charts/helpers/densityChart.js +3 -1
  86. package/es/src/charts/helpers/valueTitle.js +6 -3
  87. package/es/src/charts/partition/chartFields.js +4 -3
  88. package/es/src/charts/partition/hierarchy.js +2 -0
  89. package/es/src/charts/pipeline/preDrawData.js +31 -10
  90. package/es/src/charts/pipeline/vizDraw.js +40 -29
  91. package/es/src/charts/pipeline/vizPreDraw.js +24 -15
  92. package/es/src/charts/viz/Viz.js +43 -8
  93. package/es/src/charts/viz/VizBase.js +32 -12
  94. package/es/src/charts/viz/dataPoller.js +52 -0
  95. package/es/src/charts/viz/groupRow.js +35 -0
  96. package/es/src/charts/viz/interactionOpacity.js +19 -5
  97. package/es/src/charts/viz/missingFields.js +122 -0
  98. package/es/src/charts/viz/reportHandlerError.js +10 -0
  99. package/es/src/charts/viz/shapeClassTargets.js +18 -2
  100. package/es/src/charts/viz/simpleHover.js +2 -0
  101. package/es/src/charts/viz/vizClassName.js +31 -0
  102. package/es/src/charts/viz/vizDataPolling.js +167 -0
  103. package/es/src/charts/viz/vizDefaults.js +66 -0
  104. package/es/src/charts/viz/vizFields.js +18 -2
  105. package/es/src/charts/viz/vizRender.js +8 -2
  106. package/es/src/components/Axis/Axis.js +28 -0
  107. package/es/src/components/Axis/axisDefaults.js +3 -1
  108. package/es/src/components/Axis/axisLabelAngle.js +175 -0
  109. package/es/src/components/Axis/axisLabelThinning.js +13 -4
  110. package/es/src/components/Axis/axisLayout.js +86 -19
  111. package/es/src/components/Axis/axisLayoutLabels.js +66 -13
  112. package/es/src/components/Axis/axisLayoutScale.js +3 -0
  113. package/es/src/components/Axis/axisRender.js +38 -9
  114. package/es/src/components/Axis/axisRounding.js +15 -4
  115. package/es/src/components/Axis/axisSlantWrap.js +39 -0
  116. package/es/src/components/Axis/powTicks.js +73 -0
  117. package/es/src/components/ColorScale/ColorScale.js +28 -28
  118. package/es/src/components/ColorScale/bucketBounds.js +35 -0
  119. package/es/src/components/ColorScale/colorScaleHoverMark.js +327 -0
  120. package/es/src/components/ColorScale/colorScaleRender.js +25 -1
  121. package/es/src/components/ColorScale/colorScaleScale.js +15 -9
  122. package/es/src/components/ColorScale/colorScaleType.js +26 -0
  123. package/es/src/components/TextBox.js +2 -0
  124. package/es/src/components/Timeline/Timeline.js +43 -52
  125. package/es/src/components/Timeline/brushSpan.js +78 -0
  126. package/es/src/components/Timeline/timelineConfig.js +7 -0
  127. package/es/src/components/Timeline/timelineRender.js +44 -6
  128. package/es/src/components/Tooltip.js +13 -8
  129. package/es/src/shapes/Box.js +66 -79
  130. package/es/src/shapes/boxOutlierShape.js +19 -0
  131. package/es/src/shapes/boxStats.js +35 -0
  132. package/es/src/shapes/boxStyle.js +78 -0
  133. package/es/src/shapes/boxSummary.js +174 -0
  134. package/es/src/shapes/shapeStandalone.js +2 -0
  135. package/es/src/utils/BaseClass.js +19 -0
  136. package/es/src/utils/className.js +78 -0
  137. package/es/src/utils/configWarnings.js +25 -0
  138. package/es/src/utils/fieldAccessor.js +31 -0
  139. package/es/src/utils/paintComponentScene.js +2 -0
  140. package/package.json +10 -9
  141. package/types/index.d.ts +3 -1
  142. package/types/internal.d.ts +3 -1
  143. package/types/src/charts/BoxWhisker/index.d.ts +3 -1
  144. package/types/src/charts/BoxWhisker/outliers.d.ts +25 -0
  145. package/types/src/charts/BoxWhisker/summary.d.ts +39 -0
  146. package/types/src/charts/BoxWhisker/tooltip.d.ts +36 -0
  147. package/types/src/charts/Candlestick/aggregate.d.ts +6 -0
  148. package/types/src/charts/Plot/axisHover.d.ts +68 -0
  149. package/types/src/charts/Plot/axisHoverAnchors.d.ts +88 -0
  150. package/types/src/charts/Plot/axisHoverScene.d.ts +88 -0
  151. package/types/src/charts/Plot/barHitArea.d.ts +59 -0
  152. package/types/src/charts/Plot/barLabelFit.d.ts +81 -0
  153. package/types/src/charts/Plot/index.d.ts +13 -0
  154. package/types/src/charts/Plot/labelPlacement.d.ts +5 -0
  155. package/types/src/charts/Plot/plotInit.d.ts +9 -2
  156. package/types/src/charts/Plot/plotZoom.d.ts +2 -0
  157. package/types/src/charts/Plot/sharedHoverScene.d.ts +3 -3
  158. package/types/src/charts/Plot/sharedTooltip.d.ts +11 -4
  159. package/types/src/charts/Plot/stackHelpers.d.ts +5 -0
  160. package/types/src/charts/Plot/stackThreshold.d.ts +75 -0
  161. package/types/src/charts/Treemap/emit.d.ts +2 -1
  162. package/types/src/charts/Treemap/emitGroupHeaders.d.ts +16 -0
  163. package/types/src/charts/Treemap/groupHeaders.d.ts +91 -0
  164. package/types/src/charts/Treemap/index.d.ts +2 -0
  165. package/types/src/charts/Treemap/thresholdFunction.d.ts +5 -2
  166. package/types/src/charts/definition/ChartDefinition.d.ts +14 -2
  167. package/types/src/charts/definition/makeChart.d.ts +4 -3
  168. package/types/src/charts/drawSteps/saveChart.d.ts +47 -0
  169. package/types/src/charts/drawSteps/saveControl.d.ts +9 -0
  170. package/types/src/charts/drawSteps/saveControlMarkup.d.ts +44 -0
  171. package/types/src/charts/drawSteps/tableViewMarkup.d.ts +1 -0
  172. package/types/src/charts/drawSteps/topLeftControls.d.ts +1 -1
  173. package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +1 -1
  174. package/types/src/charts/facet/facetData.d.ts +1 -1
  175. package/types/src/charts/features/axesMeasure.d.ts +9 -1
  176. package/types/src/charts/features/colorScaleBucket.d.ts +9 -0
  177. package/types/src/charts/features/colorScaleHover.d.ts +32 -0
  178. package/types/src/charts/features/features.d.ts +8 -0
  179. package/types/src/charts/features/plotPaint.d.ts +2 -0
  180. package/types/src/charts/features/shapeEmit.d.ts +2 -0
  181. package/types/src/charts/features/shareKey.d.ts +9 -0
  182. package/types/src/charts/features/thresholdMembers.d.ts +38 -0
  183. package/types/src/charts/helpers/valueTitle.d.ts +4 -2
  184. package/types/src/charts/pipeline/stages.d.ts +2 -0
  185. package/types/src/charts/pipeline/vizDraw.d.ts +8 -3
  186. package/types/src/charts/pipeline/vizPreDraw.d.ts +3 -2
  187. package/types/src/charts/viz/Viz.d.ts +28 -4
  188. package/types/src/charts/viz/VizBase.d.ts +12 -3
  189. package/types/src/charts/viz/dataPoller.d.ts +28 -0
  190. package/types/src/charts/viz/groupRow.d.ts +24 -0
  191. package/types/src/charts/viz/interactionOpacity.d.ts +3 -1
  192. package/types/src/charts/viz/missingFields.d.ts +57 -0
  193. package/types/src/charts/viz/reportHandlerError.d.ts +7 -0
  194. package/types/src/charts/viz/shapeClassTargets.d.ts +6 -0
  195. package/types/src/charts/viz/simpleHover.d.ts +2 -1
  196. package/types/src/charts/viz/vizClassName.d.ts +23 -0
  197. package/types/src/charts/viz/vizDataPolling.d.ts +48 -0
  198. package/types/src/charts/viz/vizDefaults.d.ts +49 -0
  199. package/types/src/charts/viz/vizFields.d.ts +15 -0
  200. package/types/src/charts/viz/vizTypes.d.ts +33 -1
  201. package/types/src/components/Axis/Axis.d.ts +36 -8
  202. package/types/src/components/Axis/axisLabelAngle.d.ts +110 -0
  203. package/types/src/components/Axis/axisLabelThinning.d.ts +3 -7
  204. package/types/src/components/Axis/axisLayout.d.ts +5 -0
  205. package/types/src/components/Axis/axisLayoutLabels.d.ts +13 -0
  206. package/types/src/components/Axis/axisRounding.d.ts +6 -3
  207. package/types/src/components/Axis/axisSlantWrap.d.ts +22 -0
  208. package/types/src/components/Axis/powTicks.d.ts +29 -0
  209. package/types/src/components/ColorScale/ColorScale.d.ts +13 -0
  210. package/types/src/components/ColorScale/bucketBounds.d.ts +14 -0
  211. package/types/src/components/ColorScale/colorScaleHoverMark.d.ts +86 -0
  212. package/types/src/components/ColorScale/colorScaleScale.d.ts +3 -0
  213. package/types/src/components/ColorScale/colorScaleType.d.ts +17 -0
  214. package/types/src/components/Timeline/brushSpan.d.ts +41 -0
  215. package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
  216. package/types/src/components/Timeline/timelineRender.d.ts +8 -0
  217. package/types/src/components/Tooltip.d.ts +8 -0
  218. package/types/src/shapes/Box.d.ts +1 -8
  219. package/types/src/shapes/boxOutlierShape.d.ts +9 -0
  220. package/types/src/shapes/boxStats.d.ts +19 -0
  221. package/types/src/shapes/boxStyle.d.ts +25 -0
  222. package/types/src/shapes/boxSummary.d.ts +66 -0
  223. package/types/src/shapes/emitLabels.d.ts +1 -1
  224. package/types/src/shapes/shapeConfig.d.ts +42 -4
  225. package/types/src/utils/BaseClass.d.ts +23 -0
  226. package/types/src/utils/D3Scale.d.ts +3 -0
  227. package/types/src/utils/D3plusConfig.d.ts +261 -5
  228. package/types/src/utils/className.d.ts +64 -0
  229. package/types/src/utils/configWarnings.d.ts +21 -2
  230. package/types/src/utils/fieldAccessor.d.ts +24 -0
  231. package/types/src/utils/index.d.ts +1 -1
  232. package/types/src/utils/paintComponentScene.d.ts +3 -1
  233. package/umd/d3plus-core.full.js +6405 -1068
  234. package/umd/d3plus-core.full.min.js +2 -2
  235. package/umd/d3plus-core.js +5328 -1002
  236. package/umd/d3plus-core.min.js +2 -2
package/es/internal.js CHANGED
@@ -183,7 +183,7 @@ export { xAxisRounding } from "./src/charts/features/xAxisConfig.js";
183
183
  export { roundedDomain } from "./src/components/Axis/axisRounding.js";
184
184
  export { clipToPlotArea, DOMAIN_CLIP_KEY, isDomainClip, unwrapDomainClips } from "./src/charts/Plot/domainClip.js";
185
185
  // ── Feature modules (legend, colorScale, timeline, title/subtitle/total, …) ──
186
- export { colorScaleFeature, cornerControlsHeight, cornerPlacements, legendFeature, runLayout, subtitleFeature, timelineFeature, titleFeature, totalFeature } from "./src/charts/features/features.js";
186
+ export { colorScaleFeature, cornerControlsHeight, cornerPlacements, legendFeature, runLayout, sideControlsDrop, subtitleFeature, timelineFeature, titleFeature, totalFeature } from "./src/charts/features/features.js";
187
187
  export { legendLabelsWhole } from "./src/charts/features/featuresLegend.js";
188
188
  export { getTopLeftContributions, topLeftControlsFeature, TOP_LEFT_CONTRIBUTORS } from "./src/charts/drawSteps/topLeftControls.js";
189
189
  export { backContribution } from "./src/charts/drawSteps/backControl.js";
@@ -196,6 +196,8 @@ export { backgroundImageNode, backgroundImageNodes } from "./src/charts/features
196
196
  export { INSET_PRIORITY, insetBackground, insetComponentOffset, insetFrame, insetOrient, insetPlacementFor, insetStyle, isInsetPending } from "./src/charts/features/insetState.js";
197
197
  export { tableViewContribution } from "./src/charts/drawSteps/tableViewControl.js";
198
198
  export { searchContribution } from "./src/charts/drawSteps/searchControls.js";
199
+ export { saveContribution } from "./src/charts/drawSteps/saveControl.js";
200
+ export { canvasTooCoarse, resolveSaveConfig, saveChart, saveFilename, saveFormats, savePixelRatio, svgForSave } from "./src/charts/drawSteps/saveChart.js";
199
201
  export { broadcastLegend, broadcastLink, linkAs, linkKeys, linkedColorDefaults, linkMembers, linkPredicate, linkValues, registerLink, resolveLink, unregisterLink } from "./src/charts/viz/linkGroup.js";
200
202
  export { forEachSceneRow, MARK_TYPES } from "./src/charts/viz/sceneRows.js";
201
203
  // ── Small multiples (`facet` / `facetConfig`) ────────────────────────────────
@@ -1,14 +1,80 @@
1
1
  /**
2
2
  BoxWhisker — Plot with `discrete: "x"`, `shape: "Box"`, plus a
3
- tooltip-title accessor that walks through `__d3plus__` wrappers.
4
- */ import constant from "../../utils/constant.js";
3
+ tooltip-title accessor that walks through `__d3plus__` wrappers. Boxes
4
+ summarize each category's rows, or come from each row's own statistics
5
+ (see `summary.ts`).
6
+ */ import { toStatAccessor } from "../../shapes/boxSummary.js";
7
+ import constant from "../../utils/constant.js";
5
8
  import { makeChart } from "../definition/makeChart.js";
6
9
  import Plot from "../Plot/index.js";
10
+ import { boxAxisValues, boxWhiskerBuffer, boxWhiskerEmit, precomputedBoxes } from "./summary.js";
11
+ import { boxAxisRows } from "./outliers.js";
12
+ import { boxTooltipRows } from "./tooltip.js";
7
13
  export const boxWhiskerDef = {
8
14
  name: "BoxWhisker",
9
15
  paintDriven: true,
16
+ setup: (viz)=>{
17
+ viz._buffer = {
18
+ ...viz._buffer,
19
+ Box: boxWhiskerBuffer
20
+ };
21
+ viz._plotShapeEmitters = {
22
+ Box: boxWhiskerEmit
23
+ };
24
+ viz._plotAxisValues = (rows, axis)=>boxAxisValues(viz, rows, axis);
25
+ viz._plotAxisRows = (rows, axis)=>boxAxisRows(viz, rows, axis);
26
+ },
10
27
  ctx: {},
11
28
  fields: [
29
+ /**
30
+ Accessor or data key for each summary row's upper whisker end. See
31
+ `boxMedian`.
32
+ */ {
33
+ key: "boxMax",
34
+ coerce: toStatAccessor
35
+ },
36
+ /**
37
+ Accessor or data key for each summary row's median. Setting it,
38
+ `boxMin`, `boxQ1`, `boxQ3`, or `boxMax` draws boxes from statistics
39
+ you already have: each row is one box (placed by its `x`, or `y` when
40
+ `discrete` is `"y"`) drawn from those values, with nothing computed
41
+ and `whiskerMode` unused. All five are needed (a warning names any
42
+ left unset), and a row whose values aren't all numbers draws no box.
43
+ The value axis spans every row's statistics and outliers, and the
44
+ tooltip lists them.
45
+ */ {
46
+ key: "boxMedian",
47
+ coerce: toStatAccessor
48
+ },
49
+ /**
50
+ Accessor or data key for each summary row's lower whisker end. See
51
+ `boxMedian`.
52
+ */ {
53
+ key: "boxMin",
54
+ coerce: toStatAccessor
55
+ },
56
+ /**
57
+ Accessor or data key for each summary row's outliers, an array of
58
+ values drawn as points past the whiskers. Used only with the other
59
+ box statistics; see `boxMedian`.
60
+ */ {
61
+ key: "boxOutliers",
62
+ coerce: toStatAccessor
63
+ },
64
+ /**
65
+ Accessor or data key for each summary row's lower quartile, where its
66
+ box starts. See `boxMedian`.
67
+ */ {
68
+ key: "boxQ1",
69
+ coerce: toStatAccessor
70
+ },
71
+ /**
72
+ Accessor or data key for each summary row's upper quartile, where its
73
+ box ends. See `boxMedian`.
74
+ */ {
75
+ key: "boxQ3",
76
+ coerce: toStatAccessor
77
+ },
12
78
  {
13
79
  key: "discrete",
14
80
  default: "x"
@@ -35,9 +101,12 @@ export const boxWhiskerDef = {
35
101
  }
36
102
  const labelFn = viz.schema.label;
37
103
  if (labelFn) return labelFn(d, i);
38
- const l = viz._ids(d, i).slice(0, viz._drawDepth);
104
+ // A summary row is a box itself, not one of its observations.
105
+ const depth = viz._drawDepth + (precomputedBoxes(viz) ? 1 : 0);
106
+ const l = viz._ids(d, i).slice(0, depth);
39
107
  return l[l.length - 1];
40
- }
108
+ },
109
+ tbody: (d, i)=>boxTooltipRows(viz, d, i)
41
110
  })
42
111
  }
43
112
  ]
@@ -0,0 +1,68 @@
1
+ /**
2
+ BoxWhisker's hidden outliers: a Box whose `outlier` setting is `false`
3
+ draws no point past its whiskers, so the value axis leaves those values
4
+ out and reaches only as far as the whisker ends.
5
+ */ import { groups } from "d3-array";
6
+ import { drawsOutlier } from "../../shapes/boxOutlierShape.js";
7
+ import { boxStats } from "../../shapes/boxStats.js";
8
+ import { hasBoxStats } from "../../shapes/boxSummary.js";
9
+ import { shapeConfigFor } from "../features/emitHelpers.js";
10
+ import { chartWhiskerMode } from "./tooltip.js";
11
+ /** The axis a box's statistics run along: the one that isn't discrete. */ export const boxValueAxis = (viz)=>viz.schema.discrete === "y" ? "x" : "y";
12
+ /**
13
+ The `outlier` setting of BoxWhisker's boxes (`shapeConfig.Box.outlier`),
14
+ as an accessor of a plotted row; null when every outlier draws a point.
15
+ */ export function chartOutlierShape(viz) {
16
+ const config = shapeConfigFor(viz, "Box");
17
+ const value = config.outlier;
18
+ if (typeof value === "function") return value;
19
+ return value === undefined || drawsOutlier(value) ? null : ()=>value;
20
+ }
21
+ /** Whether each plotted row's box draws its outliers. */ export function drawsRowOutliers(viz) {
22
+ const shape = chartOutlierShape(viz);
23
+ return (row)=>!shape || drawsOutlier(shape(row, row.i));
24
+ }
25
+ /** A plotted row's value on `axis` as a number: NaN unless a number or Date. */ const valueOn = (row, axis)=>{
26
+ const v = row[axis];
27
+ return typeof v === "number" || v instanceof Date ? +v : NaN;
28
+ };
29
+ /** The rows of each computed box: by category, within its facet panel. */ function boxGroups(viz, rows) {
30
+ const discrete = viz.schema.discrete;
31
+ const facet = typeof viz.schema.facet === "function" ? viz.schema.facet : undefined;
32
+ const key = (d)=>facet ? `${d[discrete]}\u0000${facet(d.data, d.i)}` : `${d[discrete]}`;
33
+ return groups(rows, key).map(([, members])=>members);
34
+ }
35
+ /**
36
+ One computed box's rows on `axis`, without the outliers it draws no point
37
+ for. When it hides any, its whisker ends join as rows, so the axis still
38
+ reaches them.
39
+ */ function visibleRows(viz, members, axis, shape) {
40
+ const values = members.map((d)=>valueOn(d, axis)).filter(Number.isFinite).sort((a, b)=>a - b);
41
+ if (!values.length) return members;
42
+ const { lowerLimit, upperLimit } = boxStats(values, chartWhiskerMode(viz));
43
+ const kept = members.filter((d)=>{
44
+ const v = valueOn(d, axis);
45
+ const outside = v < lowerLimit || v > upperLimit;
46
+ return !outside || drawsOutlier(shape(d, d.i));
47
+ });
48
+ if (kept.length === members.length) return members;
49
+ const date = members[0][axis] instanceof Date;
50
+ const ends = [
51
+ lowerLimit,
52
+ upperLimit
53
+ ].filter((v)=>Number.isFinite(v)).map((v)=>({
54
+ ...members[0],
55
+ [axis]: date ? new Date(v) : v
56
+ }));
57
+ return kept.concat(ends);
58
+ }
59
+ /**
60
+ The rows that place `axis` (see `_plotAxisRows`): on the value axis of
61
+ boxes computed from observations, each box's rows without the outliers
62
+ its `outlier` setting hides, plus its whisker ends; otherwise `rows`.
63
+ */ export function boxAxisRows(viz, rows, axis) {
64
+ if (hasBoxStats(viz.schema) || axis.charAt(0) !== boxValueAxis(viz)) return rows;
65
+ const shape = chartOutlierShape(viz);
66
+ if (!shape) return rows;
67
+ return boxGroups(viz, rows).flatMap((members)=>visibleRows(viz, members, axis, shape));
68
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ BoxWhisker's precomputed boxes: with `boxMin`, `boxQ1`, `boxMedian`,
3
+ `boxQ3`, and `boxMax` set, each row is one box drawn from its own
4
+ statistics. These hooks place those statistics on the value axis, pad
5
+ the axis around them, and hand them to the Box shape in pixels.
6
+ */ import { boxStatKeys, boxSummaryValues, hasBoxStats } from "../../shapes/boxSummary.js";
7
+ import { genericEmit } from "../features/shapeEmit.js";
8
+ import boxBuffer from "../plotBuffers/Box.js";
9
+ import { boxAxisRows, boxValueAxis, drawsRowOutliers } from "./outliers.js";
10
+ import { noteDrawnBoxes } from "./tooltip.js";
11
+ /** Whether the chart draws its boxes from precomputed statistics. */ export const precomputedBoxes = (viz)=>hasBoxStats(viz.schema);
12
+ /**
13
+ Every statistic value each plotted row places on the value axis: its
14
+ outliers too, unless its `outlier` setting draws no point.
15
+ */ function rowValues(viz) {
16
+ const outliers = drawsRowOutliers(viz);
17
+ return (row)=>boxSummaryValues(viz.schema, row.data, row.i, outliers(row));
18
+ }
19
+ /**
20
+ The values precomputed boxes add to `axis` (see `_plotAxisValues`): each
21
+ row's statistics and drawn outliers, on the value axis only.
22
+ */ export function boxAxisValues(viz, rows, axis) {
23
+ if (!precomputedBoxes(viz) || axis !== boxValueAxis(viz)) return [];
24
+ return rows.flatMap(rowValues(viz));
25
+ }
26
+ /**
27
+ BoxWhisker's axis buffer: Box's own, which pads the value axis past each
28
+ row's value. A precomputed box spans its statistics, so each row is
29
+ buffered at every one of them; a computed box, at the rows that place
30
+ the axis (see `boxAxisRows`).
31
+ */ export function boxWhiskerBuffer(args) {
32
+ const buffer = boxBuffer;
33
+ const plot = this;
34
+ const key = boxValueAxis(this);
35
+ if (!precomputedBoxes(this)) {
36
+ const data = boxAxisRows(this, args.data, args.x2 ? `${key}2` : key);
37
+ return buffer.call(plot, {
38
+ ...args,
39
+ data
40
+ });
41
+ }
42
+ if (args.x2) return buffer.call(plot, args);
43
+ const values = rowValues(this);
44
+ const data = args.data.flatMap((row)=>values(row).map((v)=>({
45
+ ...row,
46
+ [key]: v
47
+ })));
48
+ return buffer.call(plot, {
49
+ ...args,
50
+ data
51
+ });
52
+ }
53
+ /** A statistic accessor of the source row, read through `scale` into pixels. */ function inPixels(fn, scale) {
54
+ const px = (v)=>typeof v === "number" || v instanceof Date ? scale(v) : NaN;
55
+ return (d)=>{
56
+ const v = fn(d.data, d.i);
57
+ return Array.isArray(v) ? v.map(px) : px(v);
58
+ };
59
+ }
60
+ /**
61
+ Draws Box rows: precomputed boxes take their statistics in pixels on the
62
+ value axis; otherwise Plot's own Box path, noting each box it draws for
63
+ the tooltip.
64
+ */ export const boxWhiskerEmit = (ctx, key)=>{
65
+ const { viz } = ctx;
66
+ if (!precomputedBoxes(viz)) return noteDrawnBoxes(genericEmit(ctx, key));
67
+ const scale = boxValueAxis(viz) === "y" ? ctx.y : ctx.x;
68
+ const stats = {};
69
+ for (const stat of [
70
+ ...boxStatKeys,
71
+ "boxOutliers"
72
+ ]){
73
+ const fn = viz.schema[stat];
74
+ if (typeof fn === "function") stats[stat] = inPixels(fn, scale);
75
+ }
76
+ return genericEmit({
77
+ ...ctx,
78
+ shapeConfig: {
79
+ ...ctx.shapeConfig,
80
+ ...stats
81
+ }
82
+ }, key);
83
+ };
@@ -0,0 +1,122 @@
1
+ /**
2
+ BoxWhisker's tooltip rows: a box lists its whisker ends, quartiles, and
3
+ median, largest first. A precomputed box reads them from its summary row;
4
+ a box computed from observations recomputes them in data units from the
5
+ observations it drew.
6
+ */ import { formatAbbreviate } from "@d3plus/format";
7
+ import { boxStats, whiskerPair } from "../../shapes/boxStats.js";
8
+ import { hasBoxStats, readBoxSummary } from "../../shapes/boxSummary.js";
9
+ /** Each drawn box record, by the source row its tooltip receives. */ const drawnBoxes = new WeakMap();
10
+ /** A datum's source row and its index, through Plot's and Box's wrappers. */ export function sourceRow(d, i) {
11
+ while(d.__d3plus__ && d.data){
12
+ i = d.i;
13
+ d = d.data;
14
+ }
15
+ return [
16
+ d,
17
+ i
18
+ ];
19
+ }
20
+ /**
21
+ Notes the box record behind each Box part in `nodes`, keyed by the source
22
+ row a tooltip on that box receives, and returns `nodes`.
23
+ */ export function noteDrawnBoxes(nodes) {
24
+ const walk = (list)=>{
25
+ for (const node of list){
26
+ if (node.type === "group") walk(node.children);
27
+ for (const owner of node.owners || [])if (owner.shapeType === "Box" && owner.datum) drawnBoxes.set(sourceRow(owner.datum, owner.index)[0], owner.datum);
28
+ }
29
+ };
30
+ walk(nodes);
31
+ return nodes;
32
+ }
33
+ /** The `whiskerMode` BoxWhisker's boxes draw with. */ export function chartWhiskerMode(viz) {
34
+ const config = viz.schema.shapeConfig || {};
35
+ const box = config.Box || {};
36
+ const mode = box.whiskerMode ?? config.whiskerMode;
37
+ return mode === undefined ? [
38
+ "tukey",
39
+ "tukey"
40
+ ] : whiskerPair(mode);
41
+ }
42
+ /**
43
+ A drawn box's statistics in data units, from the observations it
44
+ summarizes; null when `row` isn't a drawn box.
45
+ */ export function drawnBoxStats(viz, row) {
46
+ const box = drawnBoxes.get(row);
47
+ if (!box) return null;
48
+ const vertical = box.orient === "vertical";
49
+ const values = box.values.map((d)=>{
50
+ const v = vertical ? d.y2 ?? d.y : d.x2 ?? d.x;
51
+ return typeof v === "number" || v instanceof Date ? +v : NaN;
52
+ }).filter(Number.isFinite).sort((a, b)=>a - b);
53
+ return values.length ? boxStats(values, chartWhiskerMode(viz)) : null;
54
+ }
55
+ /**
56
+ The tooltip rows of a box. A precomputed box lists its given statistics.
57
+ A computed box lists its whisker ends as Maximum and Minimum when its
58
+ `whiskerMode` reaches the extreme values (`"extent"`), and as Upper and
59
+ Lower Whisker otherwise, since a Tukey or quantile whisker can stop short
60
+ of (or past) the data's extremes. Anything else, such as an outlier,
61
+ lists nothing.
62
+ */ export function boxTooltipRows(viz, d, i) {
63
+ if (!d) return [];
64
+ const fmt = (n)=>n === undefined ? "" : formatAbbreviate(n, viz.schema.locale);
65
+ const t = (str)=>viz.schema.translate(str);
66
+ const [row, index] = sourceRow(d, i);
67
+ if (hasBoxStats(viz.schema)) {
68
+ const s = readBoxSummary(viz.schema, row, index);
69
+ if (!s) return [];
70
+ return [
71
+ [
72
+ t("Maximum"),
73
+ fmt(s.max)
74
+ ],
75
+ [
76
+ t("Upper Quartile"),
77
+ fmt(s.q3)
78
+ ],
79
+ [
80
+ t("Median"),
81
+ fmt(s.median)
82
+ ],
83
+ [
84
+ t("Lower Quartile"),
85
+ fmt(s.q1)
86
+ ],
87
+ [
88
+ t("Minimum"),
89
+ fmt(s.min)
90
+ ]
91
+ ];
92
+ }
93
+ const s = drawnBoxStats(viz, row);
94
+ if (!s) return [];
95
+ const mode = chartWhiskerMode(viz);
96
+ const rows = [
97
+ [
98
+ mode[1] === "extent" ? "Maximum" : "Upper Whisker",
99
+ s.upperLimit
100
+ ],
101
+ [
102
+ "Upper Quartile",
103
+ s.third
104
+ ],
105
+ [
106
+ "Median",
107
+ s.median
108
+ ],
109
+ [
110
+ "Lower Quartile",
111
+ s.first
112
+ ],
113
+ [
114
+ mode[0] === "extent" ? "Minimum" : "Lower Whisker",
115
+ s.lowerLimit
116
+ ]
117
+ ];
118
+ return rows.filter(([, v])=>v !== undefined).map(([label, v])=>[
119
+ t(label),
120
+ fmt(v)
121
+ ]);
122
+ }
@@ -11,6 +11,7 @@
11
11
  - `emit.ts` — the scene nodes of each bullet.
12
12
  */ import { formatAbbreviate } from "@d3plus/format";
13
13
  import accessor from "../../utils/accessor.js";
14
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
14
15
  import constant from "../../utils/constant.js";
15
16
  import { makeChart } from "../definition/makeChart.js";
16
17
  import { applyBulletLayout, bulletExtents, bulletKey, rowNumber } from "./applyLayout.js";
@@ -22,7 +23,7 @@ import { bulletEmit } from "./emit.js";
22
23
  accessor, a number becomes a constant, and anything else turns it off.
23
24
  */ export function rowAccessor(v) {
24
25
  if (typeof v === "function") return v;
25
- if (typeof v === "string") return accessor(v);
26
+ if (typeof v === "string") return fieldAccessor(v);
26
27
  if (typeof v === "number") return constant(v);
27
28
  return false;
28
29
  }
@@ -37,6 +37,11 @@ export const bumpChartDef = {
37
37
  },
38
38
  ctx: {},
39
39
  fields: [
40
+ // The y axes label each rank with a series, so only the x axis is badged.
41
+ {
42
+ key: "axisHover",
43
+ default: "x"
44
+ },
40
45
  {
41
46
  key: "discrete",
42
47
  default: "x"
@@ -13,6 +13,7 @@
13
13
  - `calendarInset.ts` — the region chrome may be placed inside.
14
14
  */ import { formatAbbreviate } from "@d3plus/format";
15
15
  import accessor from "../../utils/accessor.js";
16
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
16
17
  import { makeChart } from "../definition/makeChart.js";
17
18
  import { applyCalendarLayout, calendarDateFormat, rowDate, rowsExtent } from "./applyLayout.js";
18
19
  import { calendarDayKey, dateExtent } from "./calendarDates.js";
@@ -61,7 +62,7 @@ export const calendarDef = {
61
62
  */ {
62
63
  key: "date",
63
64
  default: defaultCalendarDate,
64
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
65
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
65
66
  },
66
67
  /**
67
68
  The fill of days without a value: days missing from the data, and rows
@@ -14,6 +14,7 @@
14
14
  @module
15
15
  */ import { merge } from "@d3plus/data";
16
16
  import accessor from "../../utils/accessor.js";
17
+ import { fieldAccessor as namedFieldAccessor } from "../../utils/fieldAccessor.js";
17
18
  import constant from "../../utils/constant.js";
18
19
  import { finiteValue } from "./ohlc.js";
19
20
  /** The value fields Candlestick aggregates when rows merge. */ export const VALUE_FIELDS = [
@@ -32,10 +33,19 @@ import { finiteValue } from "./ohlc.js";
32
33
  */ export function keyedAccessor(value) {
33
34
  if (typeof value === "function") return value;
34
35
  if (typeof value !== "string") return constant(value);
35
- const fn = accessor(value);
36
+ const fn = namedFieldAccessor(value);
36
37
  accessorKeys.set(fn, value);
37
38
  return fn;
38
39
  }
40
+ /**
41
+ A value field's default accessor: reads `key` and remembers it as
42
+ `keyedAccessor` does, without naming a field of the user's.
43
+ @param key The data key to read.
44
+ */ export function defaultKeyedAccessor(key) {
45
+ const fn = accessor(key);
46
+ accessorKeys.set(fn, key);
47
+ return fn;
48
+ }
39
49
  /**
40
50
  Remembers that `fn` reads the data key `key`.
41
51
  @param fn The accessor.
@@ -9,7 +9,7 @@ import constant from "../../utils/constant.js";
9
9
  import { makeChart } from "../definition/makeChart.js";
10
10
  import { columnHighlight } from "../Plot/columnHighlight.js";
11
11
  import Plot from "../Plot/index.js";
12
- import { fieldAccessor, installAggregation, keyedAccessor, rememberKey, syncChartAggs } from "./aggregate.js";
12
+ import { defaultKeyedAccessor, fieldAccessor, installAggregation, keyedAccessor, rememberKey, syncChartAggs } from "./aggregate.js";
13
13
  import { candlestickBuffer } from "./buffer.js";
14
14
  import { CANDLESTICK_SHAPE, emitCandlesticks } from "./emit.js";
15
15
  import { bandAxisDefaults, periodDate } from "./periods.js";
@@ -120,7 +120,7 @@ export const candlestickDef = {
120
120
  */ {
121
121
  key: "open",
122
122
  coerce: keyedAccessor,
123
- default: "open"
123
+ factory: ()=>defaultKeyedAccessor("open")
124
124
  },
125
125
  /**
126
126
  Accessor (or data key) for each period's highest value. Defaults to
@@ -129,7 +129,7 @@ export const candlestickDef = {
129
129
  */ {
130
130
  key: "high",
131
131
  coerce: keyedAccessor,
132
- default: "high"
132
+ factory: ()=>defaultKeyedAccessor("high")
133
133
  },
134
134
  /**
135
135
  Accessor (or data key) for each period's lowest value. Defaults to
@@ -138,7 +138,7 @@ export const candlestickDef = {
138
138
  */ {
139
139
  key: "low",
140
140
  coerce: keyedAccessor,
141
- default: "low"
141
+ factory: ()=>defaultKeyedAccessor("low")
142
142
  },
143
143
  /**
144
144
  Accessor (or data key) for each period's closing value. Defaults to
@@ -148,7 +148,7 @@ export const candlestickDef = {
148
148
  */ {
149
149
  key: "close",
150
150
  coerce: keyedAccessor,
151
- default: "close"
151
+ factory: ()=>defaultKeyedAccessor("close")
152
152
  },
153
153
  /**
154
154
  Accessor (or data key) for each period's traded volume. Off by
@@ -11,6 +11,7 @@
11
11
  - `emit.ts` — ribbon Paths + arc Paths + rotated group labels.
12
12
  */ import { addToQueue } from "@d3plus/data";
13
13
  import accessor from "../../utils/accessor.js";
14
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
14
15
  import constant from "../../utils/constant.js";
15
16
  import { centerChartTransform } from "../features/chartGeometry.js";
16
17
  import { makeChart } from "../definition/makeChart.js";
@@ -96,11 +97,11 @@ export const chordDef = {
96
97
  return this.schema.nodes;
97
98
  };
98
99
  v.nodeId = function(_) {
99
- return arguments.length ? (this.schema.nodeId = typeof _ === "function" ? _ : accessor(_), this) : this.schema.nodeId;
100
+ return arguments.length ? (this.schema.nodeId = typeof _ === "function" ? _ : fieldAccessor(_), this) : this.schema.nodeId;
100
101
  };
101
102
  v.value = function(_) {
102
103
  if (!arguments.length) return this.schema.value;
103
- this.schema.value = typeof _ === "function" ? _ : accessor(_);
104
+ this.schema.value = typeof _ === "function" ? _ : fieldAccessor(_);
104
105
  return this;
105
106
  };
106
107
  v.hover = simpleHover;
@@ -11,6 +11,7 @@
11
11
  - `labelNodes.ts` — stage label text nodes.
12
12
  */ import { formatAbbreviate } from "@d3plus/format";
13
13
  import accessor from "../../utils/accessor.js";
14
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
14
15
  import constant from "../../utils/constant.js";
15
16
  import { makeChart } from "../definition/makeChart.js";
16
17
  import { sceneInsetRegion } from "../pipeline/insetPlacement.js";
@@ -129,7 +130,7 @@ export const funnelDef = {
129
130
  */ {
130
131
  key: "value",
131
132
  default: accessor("value"),
132
- coerce: (v)=>typeof v === "function" ? v : typeof v === "string" ? accessor(v) : constant(v)
133
+ coerce: (v)=>typeof v === "function" ? v : typeof v === "string" ? fieldAccessor(v) : constant(v)
133
134
  },
134
135
  /**
135
136
  Formats each stage's value in its label and tooltip, as
@@ -10,6 +10,7 @@
10
10
  - `emit.ts` — the dial plus one indicator per row.
11
11
  */ import { formatAbbreviate } from "@d3plus/format";
12
12
  import accessor from "../../utils/accessor.js";
13
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
13
14
  import constant from "../../utils/constant.js";
14
15
  import { makeChart } from "../definition/makeChart.js";
15
16
  import { chartBackground } from "../viz/backgroundInk.js";
@@ -124,7 +125,7 @@ export const gaugeDef = {
124
125
  */ {
125
126
  key: "value",
126
127
  default: accessor("value"),
127
- coerce: (v)=>typeof v === "function" ? v : typeof v === "string" ? accessor(v) : constant(v)
128
+ coerce: (v)=>typeof v === "function" ? v : typeof v === "string" ? fieldAccessor(v) : constant(v)
128
129
  },
129
130
  /**
130
131
  Formats the value shown under the hub and in each tooltip, as
@@ -306,9 +306,13 @@ function findAttribution(url) {
306
306
  return arguments.length ? (this.schema.topojsonFill = typeof _ === "function" ? _ : constant(_), this) : this.schema.topojsonFill;
307
307
  };
308
308
  /**
309
- Hides topojson features: a single feature id to remove, an array of ids, or
310
- a filter function that keeps the features it returns true for. Defaults to
311
- hiding Antarctica (id `"010"`).
309
+ Limits which topojson features are drawn: a single feature id or an array
310
+ of ids keeps only those features, and a filter function keeps the
311
+ features it returns true for. To draw only the areas that have data,
312
+ filter on the ids in your data (e.g.
313
+ `const ids = new Set(data.map(d => d.id));` then
314
+ `f => ids.has(f.id)`). Defaults to a filter that hides Antarctica (id
315
+ `"010"`).
312
316
  @type {string | string[] | ((feature: object) => boolean)}
313
317
  */ v.topojsonFilter = function(_) {
314
318
  if (arguments.length) {
@@ -355,6 +359,8 @@ export const geomapDef = {
355
359
  },
356
360
  emit: geomapEmit,
357
361
  insetRegion: sceneInsetRegion,
362
+ // A row without a coordinate point draws as its topojson Path.
363
+ colorScaleShape: (viz, d, i)=>viz.schema.point(d, i) instanceof Array ? viz.schema.shape(d, i) : "Path",
358
364
  // Clip the geography to the map rectangle — the same box as the ocean rect and
359
365
  // the imperative inner <svg> viewport — so projected paths and points can't
360
366
  // spill past it (e.g. under the legend/timeline) when a `fitObject`/zoom pushes
@@ -8,6 +8,7 @@ import { facetKey, toFacetValue } from "../facet/facetData.js";
8
8
  import { makeChart } from "../definition/makeChart.js";
9
9
  import { computeTimeFilter } from "../pipeline/preDrawData.js";
10
10
  import Plot from "../Plot/index.js";
11
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
11
12
  import { autoTitle, keyedAccessor, valueKeyOf } from "../helpers/valueTitle.js";
12
13
  import binData from "./binData.js";
13
14
  const yTitles = {
@@ -41,6 +42,7 @@ const yTitles = {
41
42
  */ function binBeforePreDraw(viz) {
42
43
  const state = viz.ctx.histogram;
43
44
  if (viz._data !== state.bins) state.raw = viz._data;
45
+ viz._sourceData = state.raw;
44
46
  const timeFilter = drawnTimeFilter(viz, state.raw);
45
47
  const filter = viz.schema.filter;
46
48
  const period = timeFilter ? state.raw.filter(timeFilter) : state.raw;
@@ -83,6 +85,8 @@ const yTitles = {
83
85
  export const histogramDef = {
84
86
  name: "Histogram",
85
87
  paintDriven: true,
88
+ // Its stacks are bins, not series, so `threshold` folds nothing.
89
+ thresholdFunction: (_viz, data)=>data,
86
90
  defaults: {
87
91
  groupPadding: 1
88
92
  },
@@ -226,7 +230,7 @@ export const histogramDef = {
226
230
  */ {
227
231
  key: "value",
228
232
  default: keyedAccessor("value"),
229
- coerce: (v)=>typeof v === "string" ? keyedAccessor(v) : typeof v === "function" ? v : constant(v)
233
+ coerce: (v)=>typeof v === "string" ? fieldAccessor(v) : typeof v === "function" ? v : constant(v)
230
234
  }
231
235
  ]
232
236
  };
@@ -5,6 +5,7 @@
5
5
  - `applyLayout.ts` — `TransformStage` that runs the row+column axes.
6
6
  - `emit.ts` — Rect cells positioned by the stashed scales.
7
7
  */ import accessor from "../../utils/accessor.js";
8
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
8
9
  import { Axis } from "../../components/index.js";
9
10
  import { colorScaleBucketOf } from "../features/colorScaleBucket.js";
10
11
  import { getProp } from "../../utils/index.js";
@@ -68,7 +69,7 @@ export const matrixDef = {
68
69
  */ {
69
70
  key: "column",
70
71
  default: accessor("column"),
71
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
72
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
72
73
  },
73
74
  /**
74
75
  The row each data point falls in: a key present in every data point,
@@ -78,7 +79,7 @@ export const matrixDef = {
78
79
  */ {
79
80
  key: "row",
80
81
  default: accessor("row"),
81
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
82
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
82
83
  },
83
84
  /**
84
85
  A manual list of column values to draw, in place of the unique