@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
@@ -16,9 +16,13 @@
16
16
  import { unwrapBreakMasks } from "./plotBreaks.js";
17
17
  import { unwrapDomainClips } from "./domainClip.js";
18
18
  /**
19
- Whether an axis zooms: a linear axis over a continuous scale, or a time
20
- axis. Point (category) axes and log axes don't.
21
- */ const zoomable = (plotScale, configScale)=>configScale === "time" || plotScale === "Linear" && configScale === "linear";
19
+ Whether an axis zooms: a linear or power axis over a continuous scale, or
20
+ a time axis. Point (category) axes and log axes don't.
21
+ */ const zoomable = (plotScale, configScale)=>configScale === "time" || plotScale === "Linear" && [
22
+ "linear",
23
+ "pow",
24
+ "sqrt"
25
+ ].includes(configScale);
22
26
  /** Which of the plot's axes are simple linear or time axes (the zoomable ones). */ function zoomableAxes(pCtx) {
23
27
  const axes = [];
24
28
  if (zoomable(pCtx.xScale, pCtx.xConfigScale)) axes.push("x");
@@ -45,6 +49,7 @@ import { unwrapDomainClips } from "./domainClip.js";
45
49
  const scales = {};
46
50
  const labelSpace = {};
47
51
  const breaks = {};
52
+ const reversed = {};
48
53
  for (const axis of zoomableAxes(pCtx)){
49
54
  const axisInstance = viz[`_${axis}Axis`];
50
55
  const d3Scale = axisInstance?._d3Scale;
@@ -52,6 +57,7 @@ import { unwrapDomainClips } from "./domainClip.js";
52
57
  scales[axis] = d3Scale.copy();
53
58
  labelSpace[axis] = axisInstance?._labelSpace;
54
59
  breaks[axis] = Boolean(axisInstance?._baselineBreak);
60
+ reversed[axis] = Boolean(axisInstance?.schema.reverse);
55
61
  }
56
62
  }
57
63
  // Shape sizes for the automatic `zoomMax` come from the unzoomed paint.
@@ -67,7 +73,8 @@ import { unwrapDomainClips } from "./domainClip.js";
67
73
  },
68
74
  scales,
69
75
  labelSpace,
70
- breaks
76
+ breaks,
77
+ reversed
71
78
  };
72
79
  if (current && (current.k !== 1 || current.x || current.y)) {
73
80
  const zoomed = rescalePlot(viz, current);
@@ -91,9 +98,11 @@ import { unwrapDomainClips } from "./domainClip.js";
91
98
  const shift = vertical ? t.y : t.x;
92
99
  const offset = vertical ? -pCtx.x2Height : 0;
93
100
  const domain = scale.range().map((r)=>scale.invert((r + offset + origin - shift) / t.k - origin - offset));
94
- // Keep the base domain's orientation.
101
+ // Keep the base domain's orientation, handing a reversed axis its
102
+ // domain the way round the axis reverses.
95
103
  const [b0, b1] = scale.domain();
96
- return (+b1 - +b0) * (+domain[1] - +domain[0]) < 0 ? domain.reverse() : domain;
104
+ const flip = (+b1 - +b0) * (+domain[1] - +domain[0]) < 0;
105
+ return flip !== Boolean(base.reversed[axis]) ? domain.reverse() : domain;
97
106
  };
98
107
  const zoomed = {};
99
108
  for (const axis of Object.keys(scales))zoomed[`${axis}Domain`] = rescale(axis);
@@ -13,7 +13,7 @@ import { largestRect } from "@d3plus/math";
13
13
  import { isValidDate } from "../../components/Axis/timeValues.js";
14
14
  import { constant } from "../../utils/index.js";
15
15
  import { outsideBaselineBreak } from "./baselineBreak.js";
16
- import { defaultSize, outside } from "./labelPlacement.js";
16
+ import { defaultSize, growsBack, outside } from "./labelPlacement.js";
17
17
  import { axisValue } from "./sharedTooltip.js";
18
18
  /** Builds the `Area` shape config; `self` is the Plot instance. */ function areaConfig(self) {
19
19
  return {
@@ -88,7 +88,7 @@ import { axisValue } from "./sharedTooltip.js";
88
88
  const other = this.schema.discrete.charAt(0) === "x" ? "y" : "x";
89
89
  const invert = other === "y";
90
90
  const nonDiscrete = this.schema.discrete.replace(this.schema.discrete.charAt(0), other);
91
- const negative = (nonDiscrete === "y" ? this._y : this._x)(d, i) < 0;
91
+ const negative = growsBack(this, nonDiscrete, d, i);
92
92
  const anchor = invert ? "middle" : outside.bind(this)(d, i) ? negative ? "end" : "start" : negative ? "start" : "end";
93
93
  return rtl() ? anchor === "start" ? "end" : anchor === "end" ? "start" : anchor : anchor;
94
94
  },
@@ -96,7 +96,7 @@ import { axisValue } from "./sharedTooltip.js";
96
96
  const other = this.schema.discrete.charAt(0) === "x" ? "y" : "x";
97
97
  const invert = other === "y";
98
98
  const nonDiscrete = this.schema.discrete.replace(this.schema.discrete.charAt(0), other);
99
- const negative = (nonDiscrete === "y" ? this._y : this._x)(d, i) < 0;
99
+ const negative = growsBack(this, nonDiscrete, d, i);
100
100
  return invert ? outside.bind(this)(d, i) ? negative ? "top" : "bottom" : negative ? "bottom" : "top" : "middle";
101
101
  }
102
102
  };
@@ -113,7 +113,7 @@ import { axisValue } from "./sharedTooltip.js";
113
113
  const axis = nonDiscrete === "y" ? this._yAxis : this._xAxis;
114
114
  const range = axis._d3Scale.range();
115
115
  const space = Math.abs(range[1] - range[0]);
116
- const negative = (nonDiscrete === "y" ? this._y : this._x)(d, i) < 0;
116
+ const negative = growsBack(this, nonDiscrete, d, i);
117
117
  if (outside.bind(this)(d, i)) {
118
118
  return {
119
119
  [width]: space - s[width],
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  Scene nodes for Plot's shared tooltip (#779): the transparent hover surface,
3
3
  the crosshair (drawn as a Line annotation), and markers on the hovered Line
4
- points.
4
+ points; and the axis hover's guides and badges (#782).
5
5
  */ import { collectComputed, makeShape } from "../features/emitHelpers.js";
6
6
  import { collectAnnotationGroup, renderPlotAnnotation } from "../features/plotAnnotations.js";
7
7
  import { PLOT_ZOOM_CONTENT_KEY } from "../features/plotPaint.js";
8
8
  import { hasSharedMarks } from "./sharedHover.js";
9
+ import { axisHoverNodes } from "./axisHoverScene.js";
9
10
  import { isDomainClip } from "./domainClip.js";
10
11
  import { withFacetPanel } from "../facet/facetPanel.js";
11
12
  import { prefixKeys } from "../facet/facetScene.js";
@@ -75,34 +76,38 @@ import { prefixKeys } from "../facet/facetScene.js";
75
76
  return !!n.shapeType && !n.interactionGroup && n.interactive !== false && !!datum && datum.id !== undefined;
76
77
  };
77
78
  /**
78
- Places the crosshair behind the first data mark ("back") or after every
79
- mark ("front"), then the markers on top. Returns a fresh array — `nodes` may
80
- be `_chartScene` itself, which must not accumulate per-paint nodes.
81
- */ function layer(nodes, crosshair, markers, side) {
79
+ Places the guides (the crosshair and any axis-hover guides) behind the
80
+ first data mark ("back") or after every mark ("front"), then the markers
81
+ on top. Returns a fresh array — `nodes` may be `_chartScene` itself, which
82
+ must not accumulate per-paint nodes.
83
+ */ function layer(nodes, guides, markers, side) {
82
84
  const out = [
83
85
  ...nodes
84
86
  ];
85
- if (crosshair) {
87
+ if (guides.length) {
86
88
  const first = out.findIndex((n)=>isMark(n) || isDomainClip(n) && n.children.some(isMark));
87
- if (side === "back" && first >= 0) out.splice(first, 0, crosshair);
88
- else out.push(crosshair);
89
+ if (side === "back" && first >= 0) out.splice(first, 0, ...guides);
90
+ else out.push(...guides);
89
91
  }
90
92
  out.push(...markers);
91
93
  return out;
92
94
  }
93
95
  /**
94
- The hover nodes for one chart body's children: with `tooltipShared`, a
95
- transparent hover surface behind the marks, so the SVG backend receives
96
- pointer events over empty plot space; and — while a hover is active — the
97
- crosshair and the hovered Line markers, inside the zoom-clipped plot
98
- content when the chart is zoomable. `key` maps a node key to its key in
99
- this body (small-multiples panels prefix theirs).
100
- */ function decorateBody(viz, nodes, state, key) {
96
+ The hover nodes for one chart body's children: with `tooltipShared` on a
97
+ chart with a discrete axis, a transparent hover surface behind the marks,
98
+ so the SVG backend receives pointer events over empty plot space; and —
99
+ while a hover is active — the crosshair, the hovered Line markers, and the
100
+ axis hover's guides, inside the zoom-clipped plot content when the chart
101
+ is zoomable, with its badges over the axes. `key` maps a node key to its
102
+ key in this body (small-multiples panels prefix theirs).
103
+ */ function decorateBody(viz, nodes, hover, key) {
101
104
  const area = viz._plotArea;
102
105
  if (!area) return nodes;
106
+ const { state, axis } = hover;
107
+ const discrete = viz.schema.discrete === "x" || viz.schema.discrete === "y";
103
108
  // The surface is only needed for shared hovers over empty space; a single
104
109
  // hover (tooltipShared off) needs the pointer on a mark anyway.
105
- const surface = viz.schema.tooltipShared && hasSharedMarks(viz) ? [
110
+ const surface = discrete && viz.schema.tooltipShared && hasSharedMarks(viz) ? [
106
111
  {
107
112
  type: "rect",
108
113
  key: key("plot-hover-surface"),
@@ -114,12 +119,17 @@ import { prefixKeys } from "../facet/facetScene.js";
114
119
  }
115
120
  ] : [];
116
121
  let children = nodes;
117
- if (state) {
118
- const rekey = (n)=>n && prefixKeys([
119
- n
120
- ], key)[0];
121
- const crosshair = rekey(crosshairAnnotation(viz, state));
122
- const markers = prefixKeys(hoverMarkers(viz, state), key);
122
+ const crosshair = state && discrete ? crosshairAnnotation(viz, state) : null;
123
+ const axisNodes = axis ? axisHoverNodes(viz, axis) : null;
124
+ const guides = prefixKeys([
125
+ ...crosshair ? [
126
+ crosshair
127
+ ] : [],
128
+ ...axisNodes ? axisNodes.guides : []
129
+ ], key);
130
+ const markers = prefixKeys(state && discrete ? hoverMarkers(viz, state) : [], key);
131
+ if (guides.length || markers.length) {
132
+ const side = state ? state.layer : "back";
123
133
  const content = children.findIndex((n)=>n.key === key(PLOT_ZOOM_CONTENT_KEY));
124
134
  if (content >= 0) {
125
135
  const group = children[content];
@@ -128,13 +138,15 @@ import { prefixKeys } from "../facet/facetScene.js";
128
138
  ];
129
139
  children[content] = {
130
140
  ...group,
131
- children: layer(group.children || [], crosshair, markers, state.layer)
141
+ children: layer(group.children || [], guides, markers, side)
132
142
  };
133
- } else children = layer(children, crosshair, markers, state.layer);
143
+ } else children = layer(children, guides, markers, side);
134
144
  }
145
+ const badges = axisNodes ? prefixKeys(axisNodes.badges, key) : [];
135
146
  return [
136
147
  ...surface,
137
- ...children
148
+ ...children,
149
+ ...badges
138
150
  ];
139
151
  }
140
152
  /**
@@ -148,7 +160,11 @@ import { prefixKeys } from "../facet/facetScene.js";
148
160
  const body = cells && cells.children && cells.children[0];
149
161
  if (!cells || !body || !body.children) return group;
150
162
  const state = viz._sharedHoverState;
151
- const children = withFacetPanel(viz, panel, ()=>decorateBody(viz, body.children, state && state.panel === panel.key ? state : null, (k)=>`${panel.key}/${k}`));
163
+ const axis = viz._axisHoverState;
164
+ const children = withFacetPanel(viz, panel, ()=>decorateBody(viz, body.children, {
165
+ state: state && state.panel === panel.key ? state : null,
166
+ axis: axis && axis.panel === panel.key ? axis : null
167
+ }, (k)=>`${panel.key}/${k}`));
152
168
  const next = [
153
169
  ...kids
154
170
  ];
@@ -168,12 +184,12 @@ import { prefixKeys } from "../facet/facetScene.js";
168
184
  };
169
185
  }
170
186
  /**
171
- Adds the snapped hover's scene nodes (see `decorateBody`) to the chart
172
- body group (content space, so they track zoom) — to each panel's body
173
- when the chart is drawn as small multiples.
187
+ Adds the hover's scene nodes (see `decorateBody`) to the chart body group
188
+ (content space, so they track zoom) — to each panel's body when the chart
189
+ is drawn as small multiples.
174
190
  */ export function appendSharedHoverNodes(viz, scene) {
175
191
  const discrete = viz.schema.discrete;
176
- if (discrete !== "x" && discrete !== "y") return;
192
+ if (discrete !== "x" && discrete !== "y" && !viz._axisHoverState) return;
177
193
  const cells = scene.root.children.find((n)=>n.key === "viz-chart-cells");
178
194
  const zoom = cells && cells.children && cells.children[0];
179
195
  const body = zoom && zoom.children && zoom.children[0];
@@ -184,5 +200,8 @@ import { prefixKeys } from "../facet/facetScene.js";
184
200
  const panel = panels.find((p)=>p.key === group.key);
185
201
  return panel ? decoratePanel(viz, group, panel) : group;
186
202
  });
187
- } else body.children = decorateBody(viz, body.children, viz._sharedHoverState, (k)=>k);
203
+ } else body.children = decorateBody(viz, body.children, {
204
+ state: viz._sharedHoverState,
205
+ axis: viz._axisHoverState
206
+ }, (k)=>k);
188
207
  }
@@ -7,6 +7,7 @@ import { axisDateLabel, isValidDate, parseTime } from "../../components/Axis/tim
7
7
  import { axisIsYearLike, formatYear } from "../../components/Axis/yearValues.js";
8
8
  import { configPrep } from "../../utils/index.js";
9
9
  import { leadTitleWithSwatch, tooltipSwatch, withSwatch } from "../features/tooltipSwatch.js";
10
+ import { thresholdMemberRows } from "../features/thresholdMembers.js";
10
11
  import { confidenceRows, confidenceSuffix, rangeSuffix } from "./confidenceTooltip.js";
11
12
  const other = (k)=>k === "x" ? "y" : "x";
12
13
  /** An axis's display name: its configured title, else its data key. */ export function axisName(viz, k) {
@@ -134,27 +135,37 @@ const other = (k)=>k === "x" ? "y" : "x";
134
135
  names: hover.rows.map((r)=>r.projected && !all ? `${r.name}${label}` : r.name)
135
136
  };
136
137
  }
138
+ /**
139
+ How many of a threshold bucket's series the shared tooltip lists under
140
+ its row: fewer than a single-mark tooltip, since every other series has
141
+ a row of its own beside them.
142
+ */ export const SHARED_MEMBER_LIMIT = 5;
137
143
  /**
138
144
  The shared tooltip: title from the continuous axis, a header row naming
139
145
  the hovered discrete value, then one `[name, value]` row per series, the
140
146
  name led by a swatch in its series stroke and the value followed by its
141
- `confidence` range. User `tooltipConfig` styles apply first; the shared
142
- title/rows win.
147
+ `confidence` range, and a threshold bucket's series listed under its row.
148
+ User `tooltipConfig` styles apply first; the shared title/rows win.
143
149
  */ export function renderSharedTooltip(viz, hover, event) {
144
150
  const cont = other(hover.axis);
145
151
  const { header, names } = markProjected(viz, hover);
146
152
  prepareTooltip(viz).data([
147
153
  hover.rows[0].datum
148
- ]).config(configPrep.bind(viz)(viz.schema.tooltipConfig)).title(()=>axisName(viz, cont)).thead(header).tbody(hover.rows.map((r, i)=>[
149
- withSwatch(tooltipSwatch(r.color, r.shape), names[i]),
150
- `${axisValue(viz, cont, r.value)}${bounds(viz, cont, r)}`
154
+ ]).config(configPrep.bind(viz)(viz.schema.tooltipConfig)).title(()=>axisName(viz, cont)).thead(header).tbody(hover.rows.flatMap((r, i)=>[
155
+ [
156
+ withSwatch(tooltipSwatch(r.color, r.shape), names[i]),
157
+ `${axisValue(viz, cont, r.value)}${bounds(viz, cont, r)}`
158
+ ],
159
+ // A threshold bucket's series, under its row.
160
+ ...thresholdMemberRows(viz, r.datum, SHARED_MEMBER_LIMIT)
151
161
  ])).footer(false).arrow(false).position(snappedPosition(viz, hover, event)).render();
152
162
  }
153
163
  /**
154
164
  The single-mark tooltip (one series, `tooltipShared(false)`, or a
155
165
  side-by-side bar): the default title (the mark's label, unless
156
166
  `tooltipConfig` sets one), its x and y values, its `confidence` bounds,
157
- then any rows the chart's `tooltipConfig` adds.
167
+ then any rows the chart's `tooltipConfig` adds, and a threshold bucket's
168
+ series.
158
169
  */ export function renderSingleTooltip(viz, hover, event) {
159
170
  const row = hover.rows[0];
160
171
  const deeper = viz._drawDepth < viz.schema.groupBy.length - 1;
@@ -170,6 +181,7 @@ const other = (k)=>k === "x" ? "y" : "x";
170
181
  axisRow(viz, "y", hover)
171
182
  ],
172
183
  ...row.projected ? [] : confidenceRows(viz, row.datum, row.index, (v)=>axisValue(viz, other(hover.axis), v)),
173
- ...Array.isArray(extra) ? extra : []
184
+ ...Array.isArray(extra) ? extra : [],
185
+ ...thresholdMemberRows(viz, row.datum)
174
186
  ]).arrow(false).position(snappedPosition(viz, hover, event)).render();
175
187
  }
@@ -8,6 +8,7 @@
8
8
  pipeline applies: a tagged comparator or an array of series keys.
9
9
  */ import * as d3Shape from "d3-shape";
10
10
  import accessor from "../../utils/accessor.js";
11
+ import { markField } from "../../utils/fieldAccessor.js";
11
12
  /** Marks a comparator as an already-resolved d3plus stack order. */ function tagOrder(fn) {
12
13
  fn.__d3plusStackOrder = true;
13
14
  return fn;
@@ -65,6 +66,16 @@ const asStack = (series)=>series;
65
66
  return d3Shape.stackOrderNone(asStack(series)).sort((a, b)=>order === "ascending" ? totals[a] - totals[b] : totals[b] - totals[a]);
66
67
  });
67
68
  }
69
+ /**
70
+ Wraps a stack order so the series in `last` sit at the top of the stack,
71
+ in the order `order` gives them, above every other series.
72
+ */ export function orderLast(order, last) {
73
+ return (series)=>{
74
+ const ranked = order(series);
75
+ const isLast = (i)=>last.has(series[i].key);
76
+ return ranked.filter((i)=>!isLast(i)).concat(ranked.filter(isLast));
77
+ };
78
+ }
68
79
  /** Named stack orders accepted by `Plot.stackOrder`. */ const NAMED_ORDERS = {
69
80
  ascending: stackOrderTotalAscending,
70
81
  descending: stackOrderTotalDescending,
@@ -90,7 +101,8 @@ const asStack = (series)=>series;
90
101
  if (Array.isArray(input)) return input;
91
102
  if (input && typeof input === "object") {
92
103
  const { value, order } = input;
93
- return stackOrderField(typeof value === "function" ? value : accessor(value), order);
104
+ if (typeof value === "function") return stackOrderField(value, order);
105
+ return markField(stackOrderField(accessor(value), order), value);
94
106
  }
95
107
  if (typeof input === "string") {
96
108
  if (input in NAMED_ORDERS) return NAMED_ORDERS[input];
@@ -3,7 +3,7 @@
3
3
  BarChart), reading the share that `computePlotInitialDomains` stamps on
4
4
  each stacked datum.
5
5
  */ import { formatAbbreviate } from "@d3plus/format";
6
- import { shareOf } from "../features/shareKey.js";
6
+ import { shareOf, shareOfRows, unwrapRow } from "../features/shareKey.js";
7
7
  /**
8
8
  A `tooltipConfig` default whose `tbody` resolves per hover, so the Share
9
9
  row only appears while the chart is stacked.
@@ -11,9 +11,14 @@ import { shareOf } from "../features/shareKey.js";
11
11
  const row = [
12
12
  ()=>viz.schema.translate("Share"),
13
13
  (_d, _i, x)=>{
14
- // A legend swatch aggregates a series across every discrete position,
15
- // so its merged share is an array with no meaningful total.
16
- const share = shareOf(x);
14
+ const row = unwrapRow(x);
15
+ let share = shareOf(row);
16
+ // A legend entry merges a series over every discrete position, so its
17
+ // share is of the whole chart: of every legend row's stacked value.
18
+ if (!Number.isFinite(share)) {
19
+ const value = viz[`_${viz.schema.discrete === "y" ? "x" : "y"}`];
20
+ share = row ? shareOfRows(row, viz._legendData || [], value) : NaN;
21
+ }
17
22
  if (!Number.isFinite(share)) return "";
18
23
  return `${formatAbbreviate(share * 100, viz.schema.locale)}%`;
19
24
  }
@@ -0,0 +1,154 @@
1
+ /**
2
+ `threshold` on stacked Plot charts: the series whose summed value, over
3
+ every position on the discrete axis, is under `threshold` of the chart's
4
+ total fold into one bucket series. Membership is decided once for the
5
+ whole chart, so a series is in the bucket at every position or at none.
6
+ */ import { merge } from "@d3plus/data";
7
+ import { MEMBERS_KEY, thresholdMemberList } from "../features/thresholdMembers.js";
8
+ /** A value's comparison key: arrays by their items, Dates by their time. */ const valueKey = (v)=>Array.isArray(v) ? v.map(valueKey).join("\u0001") : v instanceof Date ? +v : v;
9
+ /**
10
+ The fields that name a series rather than a point on it, merged over the
11
+ bucket's series: every non-numeric field that holds one value along each
12
+ series and is not a row's position. Every bucket row carries them, so the
13
+ bucket keeps one id, label, and color at every position, whichever of
14
+ its series have a row there.
15
+ */ export function seriesIdentity(series, position, aggs) {
16
+ const keys = new Set();
17
+ series.forEach((rows)=>rows.forEach((d)=>Object.keys(d).forEach((k)=>keys.add(k))));
18
+ const identityKeys = Array.from(keys).filter((k)=>series.every((rows)=>{
19
+ let first;
20
+ return rows.every((d, i)=>{
21
+ const v = d[k];
22
+ if (typeof v === "number") return false;
23
+ const key = valueKey(v);
24
+ if (position.some((p)=>valueKey(p(d, i)) === key)) return false;
25
+ if (i === 0) first = key;
26
+ return key === first;
27
+ });
28
+ }));
29
+ const reps = series.filter((rows)=>rows.length).map((rows)=>{
30
+ const rep = {};
31
+ for (const k of identityKeys)rep[k] = rows[0][k];
32
+ return rep;
33
+ });
34
+ return merge(reps, aggs);
35
+ }
36
+ /**
37
+ The bucket for `rows`: the series whose summed absolute `value` is under
38
+ `threshold` of the summed absolute value of every row. Null when the
39
+ threshold is off (0 or not a number) or fewer than two series fall
40
+ under it: a lone small series stays as itself.
41
+ */ export function stackThresholdBucket(rows, inputs) {
42
+ const { aggs, id, position, threshold, value } = inputs;
43
+ const percent = Math.min(1, Math.max(0, +threshold(rows)));
44
+ if (!(percent > 0)) return null;
45
+ const totals = new Map();
46
+ const series = new Map();
47
+ let grand = 0;
48
+ rows.forEach((d, i)=>{
49
+ const key = `${id(d, i)}`;
50
+ const v = Math.abs(+value(d, i)) || 0;
51
+ totals.set(key, (totals.get(key) ?? 0) + v);
52
+ const list = series.get(key);
53
+ if (list) list.push(d);
54
+ else series.set(key, [
55
+ d
56
+ ]);
57
+ grand += v;
58
+ });
59
+ if (!(grand > 0)) return null;
60
+ const members = new Set();
61
+ totals.forEach((total, key)=>{
62
+ if (total < percent * grand) members.add(key);
63
+ });
64
+ if (members.size < 2) return null;
65
+ const identity = seriesIdentity(Array.from(members, (key)=>series.get(key)), position, aggs);
66
+ return {
67
+ members,
68
+ percent,
69
+ identity
70
+ };
71
+ }
72
+ /**
73
+ Replaces the rows of the bucket's series with one bucket row per
74
+ position: their merged values at that position, the bucket's
75
+ series-level fields, the `_isAggregation` / `_threshold` flags the
76
+ threshold label reads, and its series' values there (largest first,
77
+ under `MEMBERS_KEY`). The bucket rows come after every kept row.
78
+ */ export function foldStackRows(rows, bucket, inputs) {
79
+ const { aggs, id, position } = inputs;
80
+ const label = inputs.label ?? id;
81
+ const measure = inputs.measure ?? inputs.value;
82
+ const kept = [];
83
+ const folded = new Map();
84
+ rows.forEach((d, i)=>{
85
+ if (!bucket.members.has(`${id(d, i)}`)) {
86
+ kept.push(d);
87
+ return;
88
+ }
89
+ const at = position.map((p)=>`${valueKey(p(d, i))}`).join("\u0002");
90
+ const list = folded.get(at);
91
+ if (list) list.push(d);
92
+ else folded.set(at, [
93
+ d
94
+ ]);
95
+ });
96
+ if (!folded.size) return rows;
97
+ const merged = Array.from(folded.values(), (group)=>{
98
+ const row = merge(group, aggs);
99
+ // The fields holding the position keep it, rather than summing it.
100
+ const first = group[0];
101
+ const at = position.map((p)=>valueKey(p(first, 0)));
102
+ for (const k of Object.keys(first)){
103
+ if (at.some((v)=>group.every((d)=>valueKey(d[k]) === v))) row[k] = first[k];
104
+ }
105
+ return {
106
+ ...row,
107
+ ...bucket.identity,
108
+ _isAggregation: true,
109
+ _threshold: bucket.percent,
110
+ [MEMBERS_KEY]: thresholdMemberList(group, id, label, measure)
111
+ };
112
+ });
113
+ return kept.concat(merged);
114
+ }
115
+ /** The bucket inputs a stacked Plot reads: its series, positions, and stacked value. */ export function plotStackInputs(viz) {
116
+ const discrete = viz.schema.discrete === "y" ? "y" : "x";
117
+ const opp = discrete === "x" ? "y" : "x";
118
+ const position = [
119
+ viz[`_${discrete}`]
120
+ ];
121
+ if (viz.schema.time) position.push(viz.schema.time);
122
+ return {
123
+ aggs: viz.schema.aggs,
124
+ id: viz._id,
125
+ label: viz._drawLabel,
126
+ measure: viz[`_${opp}`],
127
+ position,
128
+ threshold: viz.schema.threshold,
129
+ value: viz.schema.thresholdKey ?? viz[`_${opp}`]
130
+ };
131
+ }
132
+ /**
133
+ A stacked Plot's `threshold`: folds `data` (the drawn rows) into a bucket
134
+ series, deciding the bucket's series from `all` (every row, legend-hidden
135
+ ones included, so hiding a series doesn't move others in or out of the
136
+ bucket). Returns `data` unchanged when the chart isn't stacked.
137
+ */ export function plotStackThreshold(viz, data, all = data) {
138
+ if (!viz.schema.stacked) return data;
139
+ const inputs = plotStackInputs(viz);
140
+ const bucket = stackThresholdBucket(all, inputs);
141
+ return bucket ? foldStackRows(data, bucket, inputs) : data;
142
+ }
143
+ /**
144
+ The legend rows of a stacked Plot with its threshold bucket folded into
145
+ one entry, so the legend shows the bucket instead of its series.
146
+ */ export function plotStackThresholdLegend(viz, legendData) {
147
+ if (!viz.schema.stacked || !legendData.length) return legendData;
148
+ const inputs = plotStackInputs(viz);
149
+ const bucket = stackThresholdBucket(legendData, inputs);
150
+ return bucket ? foldStackRows(legendData, bucket, {
151
+ ...inputs,
152
+ position: []
153
+ }) : legendData;
154
+ }
@@ -7,6 +7,7 @@
7
7
  `../polar/wedgeLayout.ts` for the geometry it shares with RadialBar).
8
8
  - `emit.ts` — wedge Paths.
9
9
  */ import accessor from "../../utils/accessor.js";
10
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
10
11
  import { centerChartTransform, chartBounds } from "../features/chartGeometry.js";
11
12
  import { makeChart } from "../definition/makeChart.js";
12
13
  import { sceneInsetRegion } from "../pipeline/insetPlacement.js";
@@ -86,7 +87,7 @@ export const polarAreaDef = {
86
87
  @type {string | function}
87
88
  */ {
88
89
  key: "metric",
89
- coerce: (v)=>typeof v === "function" ? v : typeof v === "string" ? accessor(v) : undefined
90
+ coerce: (v)=>typeof v === "function" ? v : typeof v === "string" ? fieldAccessor(v) : undefined
90
91
  },
91
92
  /**
92
93
  Room (px) reserved around the circle for the category labels, or
@@ -117,7 +118,7 @@ export const polarAreaDef = {
117
118
  /** Accessor for each row's value. */ {
118
119
  key: "value",
119
120
  default: accessor("value"),
120
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
121
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
121
122
  },
122
123
  {
123
124
  key: "legend",
@@ -6,6 +6,7 @@
6
6
  - `emit.ts` — Rect + label scene nodes per band.
7
7
  */ import { min, max } from "d3-array";
8
8
  import accessor from "../../utils/accessor.js";
9
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
9
10
  import { Axis } from "../../components/index.js";
10
11
  import { makeChart } from "../definition/makeChart.js";
11
12
  import { applyPriestleyLayout } from "./applyLayout.js";
@@ -58,7 +59,7 @@ export const priestleyDef = {
58
59
  */ {
59
60
  key: "end",
60
61
  default: accessor("end"),
61
- coerce: (v)=>typeof v === "function" ? v : accessor(v),
62
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v),
62
63
  onSet: (viz, v)=>{
63
64
  // String accessor → also seed a default aggregation (max) for that key.
64
65
  const key = typeof v === "function" ? null : v;
@@ -72,7 +73,7 @@ export const priestleyDef = {
72
73
  */ {
73
74
  key: "start",
74
75
  default: accessor("start"),
75
- coerce: (v)=>typeof v === "function" ? v : accessor(v),
76
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v),
76
77
  onSet: (viz, v)=>{
77
78
  const key = typeof v === "function" ? null : v;
78
79
  if (key && !viz.schema.aggs[key]) viz.schema.aggs[key] = min;
@@ -5,7 +5,7 @@
5
5
  internally and the value axis reads magnitudes on both halves.
6
6
  */ import { formatAbbreviate } from "@d3plus/format";
7
7
  import TextBox from "../../components/TextBox.js";
8
- import accessor from "../../utils/accessor.js";
8
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
9
9
  import { makeChart } from "../definition/makeChart.js";
10
10
  import BarChart from "../BarChart/index.js";
11
11
  import { hasUserDomain } from "../Plot/baselineDomain.js";
@@ -211,6 +211,8 @@ const pyramidState = (viz)=>viz.ctx.pyramid;
211
211
  export const pyramidDef = {
212
212
  name: "Pyramid",
213
213
  paintDriven: true,
214
+ // Its two sides are stacks of their own, so `threshold` folds nothing.
215
+ thresholdFunction: (_viz, data)=>data,
214
216
  defaults: {
215
217
  groupPadding: 1
216
218
  },
@@ -286,7 +288,7 @@ export const pyramidDef = {
286
288
  key: "comparison",
287
289
  coerce: (v)=>{
288
290
  if (typeof v !== "string") return v || undefined;
289
- const fn = accessor(v);
291
+ const fn = fieldAccessor(v);
290
292
  comparisonKeys.set(fn, v);
291
293
  return fn;
292
294
  }
@@ -9,6 +9,7 @@
9
9
  - `rings.ts` — ring styles + ring scene nodes.
10
10
  - `emit.ts` — Path scene nodes per polygon.
11
11
  */ import accessor from "../../utils/accessor.js";
12
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
12
13
  import constant from "../../utils/constant.js";
13
14
  import { centerChartTransform, chartBounds } from "../features/chartGeometry.js";
14
15
  import { makeChart } from "../definition/makeChart.js";
@@ -74,7 +75,7 @@ export const radarDef = {
74
75
  */ {
75
76
  key: "metric",
76
77
  default: accessor("metric"),
77
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
78
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
78
79
  },
79
80
  {
80
81
  key: "outerPadding",
@@ -92,7 +93,7 @@ export const radarDef = {
92
93
  */ {
93
94
  key: "value",
94
95
  default: accessor("value"),
95
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
96
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
96
97
  },
97
98
  {
98
99
  key: "axisConfig",
@@ -12,6 +12,7 @@
12
12
  */ import { backgroundColor } from "@d3plus/dom";
13
13
  import { formatAbbreviate } from "@d3plus/format";
14
14
  import accessor from "../../utils/accessor.js";
15
+ import { fieldAccessor } from "../../utils/fieldAccessor.js";
15
16
  import { centerChartTransform, chartBounds } from "../features/chartGeometry.js";
16
17
  import { makeChart } from "../definition/makeChart.js";
17
18
  import { gridStroke } from "../../components/Axis/gridStroke.js";
@@ -151,7 +152,7 @@ export const radialBarDef = {
151
152
  /** Accessor for each row's value. */ {
152
153
  key: "value",
153
154
  default: accessor("value"),
154
- coerce: (v)=>typeof v === "function" ? v : accessor(v)
155
+ coerce: (v)=>typeof v === "function" ? v : fieldAccessor(v)
155
156
  },
156
157
  /**
157
158
  RadialBar hides the legend when each row is its own entry and the