@d3plus/core 4.11.0 → 4.12.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 (287) hide show
  1. package/es/internal.js +15 -5
  2. package/es/src/charts/Alluvial/emit.js +2 -2
  3. package/es/src/charts/Alluvial/index.js +7 -1
  4. package/es/src/charts/Alluvial/titles.js +24 -4
  5. package/es/src/charts/ArcDiagram/emit.js +27 -13
  6. package/es/src/charts/ArcDiagram/events.js +6 -2
  7. package/es/src/charts/ArcDiagram/index.js +2 -0
  8. package/es/src/charts/BarChart/index.js +3 -10
  9. package/es/src/charts/Calendar/index.js +2 -0
  10. package/es/src/charts/Candlestick/index.js +4 -10
  11. package/es/src/charts/Gantt/applyLayout.js +2 -4
  12. package/es/src/charts/Geomap/flowEmit.js +11 -6
  13. package/es/src/charts/Hexbin/index.js +2 -0
  14. package/es/src/charts/Icicle/index.js +3 -1
  15. package/es/src/charts/Matrix/applyLayout.js +20 -9
  16. package/es/src/charts/Matrix/index.js +19 -1
  17. package/es/src/charts/Network/applyLayout.js +36 -5
  18. package/es/src/charts/Network/bundle.js +5 -4
  19. package/es/src/charts/Network/emit.js +39 -40
  20. package/es/src/charts/Network/graph.js +34 -5
  21. package/es/src/charts/Network/graphFluent.js +5 -3
  22. package/es/src/charts/Network/index.js +6 -1
  23. package/es/src/charts/Pack/applyLayout.js +16 -5
  24. package/es/src/charts/Pack/emit.js +15 -8
  25. package/es/src/charts/Pack/groupRows.js +61 -0
  26. package/es/src/charts/Pack/index.js +3 -0
  27. package/es/src/charts/Pack/neutralPaint.js +20 -0
  28. package/es/src/charts/Pack/nodeNames.js +35 -0
  29. package/es/src/charts/ParallelCoordinates/axes.js +22 -22
  30. package/es/src/charts/ParallelCoordinates/chrome.js +18 -0
  31. package/es/src/charts/ParallelCoordinates/index.js +3 -1
  32. package/es/src/charts/ParallelCoordinates/titles.js +17 -9
  33. package/es/src/charts/Pie/emit.js +9 -1
  34. package/es/src/charts/Pie/index.js +10 -0
  35. package/es/src/charts/Plot/areaEnter.js +68 -0
  36. package/es/src/charts/Plot/draw.js +26 -12
  37. package/es/src/charts/Plot/index.js +4 -10
  38. package/es/src/charts/Plot/lineMarkerKeys.js +19 -0
  39. package/es/src/charts/Plot/plotInit.js +6 -0
  40. package/es/src/charts/Plot/shapeLabelLegend.js +67 -0
  41. package/es/src/charts/Plot/sharedHover.js +2 -1
  42. package/es/src/charts/Plot/sharedTooltip.js +13 -3
  43. package/es/src/charts/PolarArea/index.js +2 -1
  44. package/es/src/charts/Priestley/applyLayout.js +11 -7
  45. package/es/src/charts/Priestley/index.js +0 -2
  46. package/es/src/charts/Priestley/timeAxis.js +11 -8
  47. package/es/src/charts/Pyramid/gutter.js +52 -16
  48. package/es/src/charts/Pyramid/index.js +55 -7
  49. package/es/src/charts/Pyramid/scene.js +4 -4
  50. package/es/src/charts/Radar/applyLayout.js +31 -33
  51. package/es/src/charts/Radar/axisDecorations.js +29 -17
  52. package/es/src/charts/Radar/curvedLabels.js +43 -2
  53. package/es/src/charts/Radar/emit.js +30 -15
  54. package/es/src/charts/Radar/index.js +41 -2
  55. package/es/src/charts/Radar/points.js +85 -0
  56. package/es/src/charts/RadialBar/emit.js +6 -1
  57. package/es/src/charts/RadialBar/index.js +10 -0
  58. package/es/src/charts/RadialMatrix/applyLayout.js +115 -31
  59. package/es/src/charts/RadialMatrix/index.js +15 -2
  60. package/es/src/charts/Rings/applyLayout.js +11 -150
  61. package/es/src/charts/Rings/emit.js +80 -40
  62. package/es/src/charts/Rings/index.js +27 -4
  63. package/es/src/charts/Rings/ringsCurves.js +156 -0
  64. package/es/src/charts/Rings/ringsParallel.js +20 -3
  65. package/es/src/charts/Rings/ringsPlacement.js +152 -0
  66. package/es/src/charts/Rings/ringsSizing.js +61 -38
  67. package/es/src/charts/Sankey/applyLayout.js +18 -4
  68. package/es/src/charts/Sankey/index.js +7 -1
  69. package/es/src/charts/Sunburst/emit.js +9 -1
  70. package/es/src/charts/Sunburst/index.js +13 -1
  71. package/es/src/charts/Tree/applyLayout.js +44 -14
  72. package/es/src/charts/Tree/emit.js +5 -5
  73. package/es/src/charts/Tree/index.js +10 -12
  74. package/es/src/charts/Tree/keys.js +33 -0
  75. package/es/src/charts/Tree/nodeLabel.js +15 -0
  76. package/es/src/charts/Treemap/emitGroupHeaders.js +3 -5
  77. package/es/src/charts/definition/makeChart.js +6 -2
  78. package/es/src/charts/drawSteps/minimap.js +4 -20
  79. package/es/src/charts/drawSteps/zoomActions.js +36 -0
  80. package/es/src/charts/drawSteps/zoomControls.js +31 -18
  81. package/es/src/charts/drawSteps/zoomControlsMarkup.js +23 -4
  82. package/es/src/charts/drawSteps/zoomDrag.js +188 -0
  83. package/es/src/charts/drawSteps/zoomFit.js +69 -0
  84. package/es/src/charts/events/click.legend.js +4 -2
  85. package/es/src/charts/events/click.shape.js +5 -3
  86. package/es/src/charts/events/mouseenter.js +6 -16
  87. package/es/src/charts/events/mouseleave.js +9 -2
  88. package/es/src/charts/events/mousemove.legend.js +28 -32
  89. package/es/src/charts/events/mousemove.shape.js +44 -44
  90. package/es/src/charts/features/axes.js +15 -4
  91. package/es/src/charts/features/axesFinal.js +7 -2
  92. package/es/src/charts/features/axesMeasure.js +26 -8
  93. package/es/src/charts/features/axisTooltip.js +138 -0
  94. package/es/src/charts/features/centerLabel.js +177 -0
  95. package/es/src/charts/features/colorScaleBivariate.js +83 -0
  96. package/es/src/charts/features/colorScaleBucket.js +18 -0
  97. package/es/src/charts/features/colorScaleHover.js +30 -5
  98. package/es/src/charts/features/colorScaleLimit.js +73 -0
  99. package/es/src/charts/features/colorScaleTooltip.js +77 -0
  100. package/es/src/charts/features/colorScaleTop.js +61 -0
  101. package/es/src/charts/features/curvedArrows.js +33 -0
  102. package/es/src/charts/features/depthKey.js +26 -0
  103. package/es/src/charts/features/edgeArrows.js +61 -2
  104. package/es/src/charts/features/featuresColorScale.js +57 -16
  105. package/es/src/charts/features/hoverTicks.js +41 -0
  106. package/es/src/charts/features/idleQueue.js +72 -0
  107. package/es/src/charts/features/linkInteraction.js +59 -7
  108. package/es/src/charts/features/networkMeasures.js +241 -0
  109. package/es/src/charts/features/nodeStats.js +309 -0
  110. package/es/src/charts/features/plotEndLabels.js +28 -7
  111. package/es/src/charts/features/plotPaint.js +9 -2
  112. package/es/src/charts/features/shapeEmit.js +7 -1
  113. package/es/src/charts/features/textHalo.js +3 -2
  114. package/es/src/charts/partition/chartFields.js +12 -3
  115. package/es/src/charts/partition/interaction.js +10 -5
  116. package/es/src/charts/pipeline/insetPlacement.js +8 -3
  117. package/es/src/charts/polar/chrome.js +81 -9
  118. package/es/src/charts/polar/config.js +4 -0
  119. package/es/src/charts/polar/wedgeLayout.js +2 -1
  120. package/es/src/charts/viz/Viz.js +24 -15
  121. package/es/src/charts/viz/VizBase.js +39 -4
  122. package/es/src/charts/viz/backgroundInk.js +10 -0
  123. package/es/src/charts/viz/emphasis.js +14 -0
  124. package/es/src/charts/viz/fillStroke.js +10 -0
  125. package/es/src/charts/viz/interactionOpacity.js +115 -32
  126. package/es/src/charts/viz/reportDrawError.js +15 -0
  127. package/es/src/charts/viz/setCursor.js +29 -0
  128. package/es/src/charts/viz/tooltipEnabled.js +38 -0
  129. package/es/src/charts/viz/userClick.js +34 -0
  130. package/es/src/charts/viz/vizDataPolling.js +0 -1
  131. package/es/src/charts/viz/vizDefaults.js +13 -34
  132. package/es/src/charts/viz/vizFields.js +6 -1
  133. package/es/src/charts/viz/vizRender.js +35 -5
  134. package/es/src/charts/viz/vizVisibility.js +12 -2
  135. package/es/src/components/Axis/Axis.js +29 -2
  136. package/es/src/components/Axis/axisBreak.js +29 -7
  137. package/es/src/components/Axis/axisDefaults.js +11 -0
  138. package/es/src/components/Axis/axisLabelKinds.js +36 -0
  139. package/es/src/components/Axis/axisLabelLineHeight.js +19 -0
  140. package/es/src/components/Axis/axisLabelRoom.js +37 -0
  141. package/es/src/components/Axis/axisLabelSize.js +171 -0
  142. package/es/src/components/Axis/axisLabelThinning.js +98 -4
  143. package/es/src/components/Axis/axisLayout.js +71 -46
  144. package/es/src/components/Axis/axisLayoutLabels.js +82 -140
  145. package/es/src/components/Axis/axisLayoutScale.js +9 -10
  146. package/es/src/components/Axis/axisLimit.js +27 -0
  147. package/es/src/components/Axis/axisMaxSize.js +39 -0
  148. package/es/src/components/Axis/axisRender.js +20 -8
  149. package/es/src/components/Axis/axisRounding.js +16 -1
  150. package/es/src/components/Axis/axisScene.js +11 -2
  151. package/es/src/components/Axis/axisTitle.js +53 -0
  152. package/es/src/components/Axis/axisTooltipTargets.js +128 -0
  153. package/es/src/components/ColorScale/ColorScale.js +62 -18
  154. package/es/src/components/ColorScale/bivariateRender.js +353 -0
  155. package/es/src/components/ColorScale/bivariateScale.js +150 -0
  156. package/es/src/components/ColorScale/colorScaleRender.js +32 -2
  157. package/es/src/components/ColorScale/colorScaleSwatchTooltips.js +77 -0
  158. package/es/src/components/Legend/Legend.js +10 -2
  159. package/es/src/components/Legend/legendCut.js +108 -0
  160. package/es/src/components/Legend/legendRender.js +38 -13
  161. package/es/src/components/TextBox.js +5 -2
  162. package/es/src/components/Timeline/timelineRender.js +2 -1
  163. package/es/src/components/textBoxScene.js +3 -0
  164. package/es/src/components/textEllipsis.js +7 -0
  165. package/es/src/components/tooltipDom.js +8 -5
  166. package/es/src/fluent.js +48 -0
  167. package/es/src/utils/BaseClass.js +7 -2
  168. package/es/src/utils/configValue.js +9 -0
  169. package/package.json +10 -10
  170. package/types/index.d.ts +1 -1
  171. package/types/internal.d.ts +22 -5
  172. package/types/src/charts/Alluvial/titles.d.ts +16 -3
  173. package/types/src/charts/ArcDiagram/emit.d.ts +3 -2
  174. package/types/src/charts/ArcDiagram/events.d.ts +2 -1
  175. package/types/src/charts/Geomap/flowEmit.d.ts +3 -2
  176. package/types/src/charts/Matrix/applyLayout.d.ts +4 -2
  177. package/types/src/charts/Network/applyLayout.d.ts +11 -0
  178. package/types/src/charts/Network/bundle.d.ts +3 -1
  179. package/types/src/charts/Network/graph.d.ts +12 -4
  180. package/types/src/charts/Pack/applyLayout.d.ts +2 -0
  181. package/types/src/charts/Pack/groupRows.d.ts +46 -0
  182. package/types/src/charts/Pack/index.d.ts +3 -0
  183. package/types/src/charts/Pack/neutralPaint.d.ts +14 -0
  184. package/types/src/charts/Pack/nodeNames.d.ts +23 -0
  185. package/types/src/charts/ParallelCoordinates/chrome.d.ts +12 -0
  186. package/types/src/charts/ParallelCoordinates/index.d.ts +1 -0
  187. package/types/src/charts/ParallelCoordinates/titles.d.ts +7 -2
  188. package/types/src/charts/Plot/areaEnter.d.ts +34 -0
  189. package/types/src/charts/Plot/index.d.ts +4 -10
  190. package/types/src/charts/Plot/lineMarkerKeys.d.ts +11 -0
  191. package/types/src/charts/Plot/shapeLabelLegend.d.ts +19 -0
  192. package/types/src/charts/Plot/sharedTooltip.d.ts +7 -1
  193. package/types/src/charts/Priestley/timeAxis.d.ts +7 -4
  194. package/types/src/charts/Pyramid/gutter.d.ts +28 -6
  195. package/types/src/charts/Pyramid/scene.d.ts +1 -1
  196. package/types/src/charts/Radar/applyLayout.d.ts +2 -3
  197. package/types/src/charts/Radar/axisDecorations.d.ts +5 -2
  198. package/types/src/charts/Radar/curvedLabels.d.ts +35 -0
  199. package/types/src/charts/Radar/emit.d.ts +5 -2
  200. package/types/src/charts/Radar/index.d.ts +7 -2
  201. package/types/src/charts/Radar/points.d.ts +50 -0
  202. package/types/src/charts/RadialMatrix/applyLayout.d.ts +6 -4
  203. package/types/src/charts/Rings/emit.d.ts +24 -2
  204. package/types/src/charts/Rings/index.d.ts +4 -2
  205. package/types/src/charts/Rings/ringsCurves.d.ts +50 -0
  206. package/types/src/charts/Rings/ringsGraph.d.ts +29 -5
  207. package/types/src/charts/Rings/ringsParallel.d.ts +4 -2
  208. package/types/src/charts/Rings/ringsPlacement.d.ts +47 -0
  209. package/types/src/charts/Rings/ringsSizing.d.ts +36 -9
  210. package/types/src/charts/Tree/applyLayout.d.ts +20 -0
  211. package/types/src/charts/Tree/keys.d.ts +25 -0
  212. package/types/src/charts/Tree/nodeLabel.d.ts +11 -0
  213. package/types/src/charts/definition/ChartDefinition.d.ts +13 -0
  214. package/types/src/charts/definition/makeChart.d.ts +2 -2
  215. package/types/src/charts/drawSteps/zoomActions.d.ts +30 -0
  216. package/types/src/charts/drawSteps/zoomControls.d.ts +15 -0
  217. package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +16 -1
  218. package/types/src/charts/drawSteps/zoomDrag.d.ts +71 -0
  219. package/types/src/charts/drawSteps/zoomFit.d.ts +30 -0
  220. package/types/src/charts/features/axisTooltip.d.ts +49 -0
  221. package/types/src/charts/features/centerLabel.d.ts +75 -0
  222. package/types/src/charts/features/colorScaleBivariate.d.ts +50 -0
  223. package/types/src/charts/features/colorScaleBucket.d.ts +10 -0
  224. package/types/src/charts/features/colorScaleHover.d.ts +13 -3
  225. package/types/src/charts/features/colorScaleLimit.d.ts +60 -0
  226. package/types/src/charts/features/colorScaleTooltip.d.ts +43 -0
  227. package/types/src/charts/features/colorScaleTop.d.ts +30 -0
  228. package/types/src/charts/features/curvedArrows.d.ts +14 -0
  229. package/types/src/charts/features/depthKey.d.ts +19 -0
  230. package/types/src/charts/features/edgeArrows.d.ts +29 -2
  231. package/types/src/charts/features/hoverTicks.d.ts +30 -0
  232. package/types/src/charts/features/idleQueue.d.ts +46 -0
  233. package/types/src/charts/features/linkInteraction.d.ts +13 -4
  234. package/types/src/charts/features/networkMeasures.d.ts +53 -0
  235. package/types/src/charts/features/nodeStats.d.ts +93 -0
  236. package/types/src/charts/features/plotEndLabels.d.ts +14 -1
  237. package/types/src/charts/features/textHalo.d.ts +4 -3
  238. package/types/src/charts/partition/chartFields.d.ts +6 -1
  239. package/types/src/charts/pipeline/insetPlacement.d.ts +6 -0
  240. package/types/src/charts/polar/chrome.d.ts +19 -6
  241. package/types/src/charts/viz/Viz.d.ts +10 -3
  242. package/types/src/charts/viz/VizBase.d.ts +31 -2
  243. package/types/src/charts/viz/backgroundInk.d.ts +8 -0
  244. package/types/src/charts/viz/emphasis.d.ts +17 -0
  245. package/types/src/charts/viz/fillStroke.d.ts +7 -0
  246. package/types/src/charts/viz/reportDrawError.d.ts +12 -0
  247. package/types/src/charts/viz/setCursor.d.ts +26 -0
  248. package/types/src/charts/viz/tooltipEnabled.d.ts +31 -0
  249. package/types/src/charts/viz/userClick.d.ts +35 -0
  250. package/types/src/charts/viz/vizFields.d.ts +5 -0
  251. package/types/src/charts/viz/vizTypes.d.ts +16 -0
  252. package/types/src/charts/viz/vizVisibility.d.ts +7 -0
  253. package/types/src/components/Axis/Axis.d.ts +33 -3
  254. package/types/src/components/Axis/axisBreak.d.ts +19 -3
  255. package/types/src/components/Axis/axisDefaults.d.ts +12 -0
  256. package/types/src/components/Axis/axisLabelKinds.d.ts +22 -0
  257. package/types/src/components/Axis/axisLabelLineHeight.d.ts +27 -0
  258. package/types/src/components/Axis/axisLabelRoom.d.ts +17 -0
  259. package/types/src/components/Axis/axisLabelSize.d.ts +82 -0
  260. package/types/src/components/Axis/axisLabelThinning.d.ts +38 -2
  261. package/types/src/components/Axis/axisLayout.d.ts +9 -2
  262. package/types/src/components/Axis/axisLayoutLabels.d.ts +28 -33
  263. package/types/src/components/Axis/axisLayoutScale.d.ts +3 -1
  264. package/types/src/components/Axis/axisLimit.d.ts +18 -0
  265. package/types/src/components/Axis/axisMaxSize.d.ts +48 -0
  266. package/types/src/components/Axis/axisRounding.d.ts +8 -0
  267. package/types/src/components/Axis/axisTitle.d.ts +30 -0
  268. package/types/src/components/Axis/axisTooltipTargets.d.ts +82 -0
  269. package/types/src/components/ColorScale/ColorScale.d.ts +21 -11
  270. package/types/src/components/ColorScale/bivariateRender.d.ts +53 -0
  271. package/types/src/components/ColorScale/bivariateScale.d.ts +92 -0
  272. package/types/src/components/ColorScale/colorScaleSwatchTooltips.d.ts +48 -0
  273. package/types/src/components/Legend/Legend.d.ts +5 -0
  274. package/types/src/components/Legend/legendCut.d.ts +31 -0
  275. package/types/src/components/Legend/legendRender.d.ts +6 -1
  276. package/types/src/components/TextBox.d.ts +4 -0
  277. package/types/src/components/textEllipsis.d.ts +6 -0
  278. package/types/src/fluent.d.ts +18 -0
  279. package/types/src/shapes/emitLabels.d.ts +1 -1
  280. package/types/src/utils/D3plusConfig.d.ts +485 -609
  281. package/types/src/utils/configValue.d.ts +8 -0
  282. package/types/src/utils/index.d.ts +1 -1
  283. package/types/umd-entry.d.ts +4 -0
  284. package/umd/d3plus-core.full.js +22930 -17936
  285. package/umd/d3plus-core.full.min.js +2 -2
  286. package/umd/d3plus-core.js +21240 -16404
  287. package/umd/d3plus-core.min.js +2 -2
@@ -21,6 +21,8 @@ import type { ReferenceBandConfig, ReferenceLineConfig } from "../charts/feature
21
21
  import type { RangeBreakRule } from "../components/Axis/rangeBreaks.js";
22
22
  import type { BinValueOption, ContourConfig, ContoursOption, PointConfig } from "../charts/Hexbin/settings.js";
23
23
  type Position = "top" | "right" | "bottom" | "left";
24
+ /** One variable of a bivariate `colorScale`: a data key, or an accessor returning a number. */
25
+ export type ColorScaleField = string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]);
24
26
  /** A legend or colorScale side, or `"auto"` to let the chart choose (inside the chart when it fits, else right on wide charts and bottom otherwise). */
25
27
  type PanelPosition = Position | "auto";
26
28
  type DataPointAccessor<T> = string | ((d: DataPoint) => T);
@@ -30,96 +32,61 @@ type AxisScale = "auto" | "band" | "diverging" | "divergingLog" | "divergingPow"
30
32
  export interface AxisConfig {
31
33
  barConfig?: Record<string, string | number>;
32
34
  /**
33
- The axis's domain: `[min, max]` on a continuous axis, or the
34
- categories to show on a discrete one. A full domain is drawn exactly
35
- as given unless this axis config's `rounding` says otherwise, just as
36
- on an Axis. In a Plot's axis configs it is a lower-level override than
37
- `xDomain`/`yDomain`: it wins over them, isn't stretched to the
38
- chart's `baseline`, and isn't rounded by Plot's own "outside"
39
- default. In `xConfig`/`yConfig`, one with a single end set (`[min]`
40
- or `[undefined, max]`) on a continuous axis works exactly like
41
- `yDomain([min])` instead: it pins that end, and the data fills the
42
- other, rounded as `rounding` says.
35
+ The axis's domain: `[min, max]` on a continuous axis, or the categories
36
+ to show on a discrete one. In a Plot it overrides `xDomain`/`yDomain`
37
+ and isn't rounded unless `rounding` says so; a single end (`[min]` or
38
+ `[undefined, max]`) pins that end like `yDomain([min])`.
43
39
  */
44
40
  domain?: (number | string | Date | undefined)[];
45
41
  /**
46
- The value the axis's `baselineBreak` returns to: the tick kept below
47
- (or above) the break. Defaults to `0`. To start a Plot's value axis at
48
- a value, set the chart's `baseline` instead, which sets the axis's
49
- minimum exactly like `yDomain([n])`, break back to this tick included.
42
+ The tick the axis's `baselineBreak` returns to. Defaults to `0`. To start
43
+ a Plot's value axis at a value, set the chart's `baseline` instead.
50
44
  */
51
45
  baseline?: number;
52
46
  /**
53
- When the domain of a linear value axis stops short of the `baseline`
54
- (e.g. `[1100, 2100]` with a baseline of `0`), keeps the baseline as the
55
- axis's end tick and breaks the axis between it and the domain: a short
56
- stretch of axis holds the baseline tick and two tilted marks with a gap
57
- in the axis line, then the domain spans the rest. Style it with the
58
- axis's `baselineBreakConfig`. In a Plot it applies to a user-supplied
59
- value domain (`yDomain`/`yConfig.domain`, or the x versions for
60
- horizontal charts), and bars and areas start at the baseline tick,
61
- with the break's gap cut across them (`baselineBreakConfig`'s
62
- `mask`); turned off, a `yDomain` stretches to reach the baseline while a
63
- `yConfig.domain` is kept and cuts its bars off at the axis. Defaults
64
- to `true` for the Plots whose marks grow from `0`, such as BarChart,
65
- AreaPlot, Histogram, and Lollipop (each chart lists its own default),
66
- and `false` for other Plots and a standalone Axis.
47
+ When a linear value axis's domain stops short of the `baseline` (e.g.
48
+ `[1100, 2100]` with a baseline of `0`), keeps the baseline tick and
49
+ breaks the axis between it and the domain, styled by
50
+ `baselineBreakConfig`. Turned off, a Plot's `yDomain` stretches to the
51
+ baseline instead. Defaults to `true` for Plots whose marks grow from `0`
52
+ (BarChart, AreaPlot, Histogram, Lollipop), else `false`.
67
53
  */
68
54
  baselineBreak?: boolean;
69
55
  /**
70
- Style of the baseline break: `space` (pixels of axis between the baseline
71
- tick and the first tick after the break, default `36`), `gap` (pixels
72
- between the two marks, where the axis line is not drawn, default `5`),
73
- `size` (length of each mark, drawn outward from the axis line on the
74
- tick side so it never reaches into the plot, default `10`), `angle`
75
- (degrees each mark tilts from perpendicular to the axis, default `30`),
76
- `lines` (whether a Plot runs a straight line across the plot from the
77
- foot of each mark, perpendicular to the axis, default `true`; they take
78
- the axis line's `barConfig` style), `lineConfig` (those lines'
79
- `stroke`, `stroke-width`, and other line styles, layered over the axis
80
- line style), `mask` (whether a Plot cuts the gap between the two
81
- lines straight across the shapes, default `true`), plus `stroke`,
82
- `stroke-width`, and the other line styles `barConfig` takes, for the
83
- marks.
56
+ Style of the baseline break: `space` (axis pixels between the baseline
57
+ tick and the domain, default `36`), `gap` (pixels between the two marks,
58
+ default `5`), `size` (mark length, default `10`), `angle` (mark tilt in
59
+ degrees, default `30`), `lines` (whether a Plot draws lines across the
60
+ plot at the break, default `true`), `lineConfig` (their style), `mask`
61
+ (whether a Plot cuts the gap across its shapes, default `true`), and
62
+ `stroke`, `stroke-width`, and other line styles for the marks.
84
63
  */
85
64
  baselineBreakConfig?: Record<string, string | number | boolean | Record<string, string | number>>;
86
65
  /**
87
- Value ranges to remove from a linear axis: one `[start, end]` pair, or a
88
- list of them (`[[start, end], [start, end]]`). Each range collapses to a
89
- short fixed gap in the axis, marked like the baseline break, with no
90
- ticks or gridlines inside it and both of its edges labeled; the values
91
- on either side keep one shared scale. Reversed pairs are flipped,
92
- overlapping ones merged, and ranges that don't lie strictly inside the
93
- domain (or that don't leave room for the data) are ignored. Only
94
- positions change — tooltips and labels still show the real values.
66
+ Value ranges to remove from a linear axis: one `[start, end]` pair or a
67
+ list of them. Each collapses to a short marked gap (styled by
68
+ `breakConfig`); values either side share one scale, and tooltips still
69
+ show real values. Ranges outside the domain are ignored.
95
70
  */
96
71
  break?: false | [number, number] | [number, number][];
97
72
  /**
98
73
  Style of the ranges set with `break`: the same `space`, `gap`, `size`,
99
74
  `angle`, `lines`, `lineConfig`, `mask`, and mark line styles, with the
100
- same defaults, as `baselineBreakConfig`.
75
+ same defaults, as `baselineBreakConfig`, plus `spaceMin`: the least
76
+ `space` a break shrinks to on an axis too short for it (by default it
77
+ is dropped instead).
101
78
  */
102
79
  breakConfig?: Record<string, string | number | boolean | Record<string, string | number>>;
103
80
  /**
104
- Stretches of time to hide from a time axis, so the data closes up
105
- around them (like weekends and nights on a stock chart): one rule or a
106
- list of them. `"weekends"` hides every Saturday and Sunday;
107
- `{days: [5, 6]}` hides those days of the week (0 is Sunday);
108
- `{hours: [17, 9]}` hides the same hours every day, wrapping past
109
- midnight when the first is later (fractions are minutes, so `9.5` is
110
- 9:30); `{values: [date, …]}` hides each listed date's whole day, such
111
- as holidays; and `{bounds: [start, end]}` hides one range, from `start`
112
- up to `end`. Rules read the calendar in local time, as the axis's date
113
- labels do. In a Plot, rules on an axis whose values are dates make it
114
- a time axis even without `time`, and a chart's timeline takes the
115
- rules of the axis that plots its `time` (see `timelineConfig`). Shown time keeps one shared scale, ticks and labels never
116
- land in hidden time, lines and areas connect across it, and rows whose
117
- time is hidden are not drawn. A rule's `marker` draws the `break`
118
- marker where its time was removed, in a gap of `breakConfig.space`
119
- pixels: on by default for `bounds`, off for the others, which recur
120
- too often to mark.
81
+ Stretches of time to hide from a time axis (weekends, nights, holidays),
82
+ so the data closes up around them: one rule or a list of them.
83
+ `"weekends"`; `{days: [5, 6]}` (0 is Sunday); `{hours: [17, 9]}`, daily,
84
+ wrapping past midnight (`9.5` is 9:30); `{values: [date, …]}`, whole
85
+ days; or `{bounds: [start, end]}`, one range. Rules use local time. A
86
+ rule's `marker` draws the `break` marker at the gap (on by default for
87
+ `bounds` only).
121
88
  @example
122
- {rangeBreaks: ["weekends", {hours: [16, 9.5]}, {values: ["2024-07-04"]}]}
89
+ {rangeBreaks: ["weekends", {hours: [16, 9.5]}, {values: ["2024-07-04"]}]}
123
90
  */
124
91
  rangeBreaks?: false | RangeBreakRule | RangeBreakRule[];
125
92
  /** Grid values of the axis. */
@@ -137,15 +104,10 @@ export interface AxisConfig {
137
104
  labels?: unknown[];
138
105
  labelOffset?: false | number;
139
106
  /**
140
- Whether to rotate the axis labels, and by how much: `true` rotates
141
- them -90 degrees, `false` keeps them flat, and a number rotates them
142
- by that many degrees (clockwise, so `-45` rises to the right), each
143
- label hanging off the axis from the end of its text nearest the axis,
144
- across from its tick, and wrapping onto up to three lines when its
145
- neighbors leave room. Left `undefined` (the default), a horizontal
146
- axis of categories slants its labels 30 degrees when they would not
147
- fit flat, or stands them at -90 when they are too crowded to slant.
148
- See Axis's `labelRotation`.
107
+ Whether to rotate the axis labels: `true` rotates them -90 degrees,
108
+ `false` keeps them flat, and a number rotates them that many degrees
109
+ clockwise (`-45` rises to the right). Unset (the default), a horizontal
110
+ axis of categories slants its labels when they don't fit flat.
149
111
  */
150
112
  labelRotation?: boolean | number;
151
113
  /**
@@ -154,8 +116,18 @@ export interface AxisConfig {
154
116
  line; zooming pins a rescaled axis this way so it doesn't shift.
155
117
  */
156
118
  fixedSize?: number;
157
- /** Maximum size allowed for the space that contains the axis tick labels and title. */
158
- maxSize?: number;
119
+ /**
120
+ Maximum size allowed for the space that contains the axis tick labels
121
+ and title: a number of pixels, or a function that is given the room the
122
+ axis has across its labels and returns that maximum. The room is a
123
+ horizontal axis's `height` or a vertical axis's `width`; in a chart, it
124
+ is the chart's height (for a horizontal axis) or width (for a vertical
125
+ one) inside its margins. A chart can call the function more than once
126
+ in a draw, so it should depend only on its argument.
127
+ @example
128
+ {maxSize: size => size / 3}
129
+ */
130
+ maxSize?: number | ((size: number) => number);
159
131
  /** Minimum size alloted for the space that contains the axis tick labels and title. */
160
132
  minSize?: number;
161
133
  /**
@@ -170,18 +142,11 @@ export interface AxisConfig {
170
142
  */
171
143
  rotatedTickFormat?: (d: number | string) => string | number;
172
144
  /**
173
- How a linear or log axis rounds its domain to "nice" values:
174
- "outside" widens each end past the data, "inside" pulls each end in
175
- (marking them with the `roundingInside*` prefixes and suffixes), and
176
- "none" keeps the domain as given. Defaults to "none" on an Axis; a
177
- Plot rounds "outside" unless its axis config says otherwise or sets a
178
- full `domain`, which is rounded only when asked for here. With a
179
- user domain on a Plot (`xDomain`/`yDomain`, `baseline`, or a
180
- one-sided `domain` here) only an end left open is rounded:
181
- `yDomain([n])` keeps `n` exactly and rounds the far end where the
182
- axis would with no domain set, and "none" leaves that end at the
183
- data. A `yDomain` with both ends set isn't rounded unless `rounding`
184
- is set here.
145
+ How a linear or log axis rounds its domain to "nice" values: "outside"
146
+ widens each end past the data, "inside" pulls each end in, and "none"
147
+ keeps it as given. Defaults to "none" on an Axis and "outside" in a
148
+ Plot. A Plot only rounds the ends a user domain leaves open, unless
149
+ `rounding` is set here.
185
150
  */
186
151
  rounding?: "none" | "outside" | "inside";
187
152
  /** Scale of the axis. */
@@ -228,11 +193,62 @@ export interface AxisConfig {
228
193
  [d3-time-format](https://github.com/d3/d3-time-format/blob/master/README.md#timeFormatLocale)).
229
194
  */
230
195
  timeLocale?: Record<string, unknown>;
196
+ /**
197
+ The tooltip shown when a tick label is hovered, in a chart: its text
198
+ (the same on every tick), a function that receives the tick's value (as
199
+ `tickFormat` does) and its index and returns the text, or a tooltip
200
+ config (as `tooltipConfig`) whose accessors receive the same. The index
201
+ counts the axis's labels from the start of its domain (0 is the bottom
202
+ label of a y axis, the left one of an x axis). Unset (the default) or
203
+ when the function returns nothing, a label cut short with an ellipsis
204
+ shows its whole text; `false`, set or returned, shows no tooltip.
205
+ @example
206
+ {tickTooltip: value => notes[value]}
207
+ */
208
+ tickTooltip?: string | ((value: number | string, index: number) => string | false | void) | AxisTooltipConfig<[value: number | string, index: number]> | false;
231
209
  /** Title of the axis. */
232
210
  title?: string;
233
211
  /** Title configuration of the axis. */
234
212
  titleConfig?: Record<string, unknown>;
213
+ /**
214
+ The tooltip shown when the axis title is hovered, in a chart: the
215
+ tooltip's text, a function that receives the title and returns it, or a
216
+ tooltip config (as `tooltipConfig`) whose accessors receive the title.
217
+ Unset (the default) or when the function returns nothing, a title cut
218
+ short with an ellipsis shows its whole text; `false`, set or returned,
219
+ shows no tooltip.
220
+ @example
221
+ {title: "GDP per capita", titleTooltip: "Constant 2015 US$"}
222
+ */
223
+ titleTooltip?: string | ((title: string) => string | false | void) | AxisTooltipConfig<[title: string]> | false;
235
224
  }
225
+ /**
226
+ The `groupBy` levels a `tooltip` accessor receives as its third argument,
227
+ and whether it is asked about a legend entry.
228
+ */
229
+ export interface TooltipLevels {
230
+ /**
231
+ The `groupBy` level, from 0, the hovered item stands for: the level the
232
+ chart draws, or the item's own level where a chart draws several at
233
+ once (a Sunburst or Icicle node, a Tree node, a Treemap group header).
234
+ A legend entry stands for the level its label is read from.
235
+ */
236
+ depth: number;
237
+ /** The deepest `groupBy` level: `groupBy.length - 1`. */
238
+ maxDepth: number;
239
+ /** Whether the hovered item is a legend entry, not a mark. */
240
+ legend: boolean;
241
+ }
242
+ /** `T` with every accessor in it called with `Args`. */
243
+ type WithAccessorArgs<T, Args extends unknown[]> = T extends (...args: never[]) => infer R ? (...args: Args) => R : T extends Array<infer U> ? Array<WithAccessorArgs<U, Args>> : T;
244
+ /**
245
+ A tooltip config for an axis label (see `titleTooltip` and
246
+ `tickTooltip`): a `TooltipConfig` whose accessors are called with `Args`
247
+ in place of a data point.
248
+ */
249
+ export type AxisTooltipConfig<Args extends unknown[]> = {
250
+ [K in keyof TooltipConfig]: WithAccessorArgs<TooltipConfig[K], Args>;
251
+ };
236
252
  export interface TooltipConfig {
237
253
  /** The inner HTML content of the arrow element, empty by default. */
238
254
  arrow?: ((d: DataPoint) => string) | string;
@@ -320,9 +336,10 @@ export interface TextBoxConfig {
320
336
  overflow?: Accessor<boolean>;
321
337
  /**
322
338
  Handles truncated lines, returning the new line value. Passed the line's
323
- text and number; by default appends an ellipsis to every line except a
324
- first word that cannot fit (which returns ""). The ended line is
325
- measured, and words come off its end until it fits the box.
339
+ text and number; by default drops the line's trailing periods, commas,
340
+ and spaces and appends "...", except for a first word that cannot fit
341
+ (which returns ""). The ended line is measured, and words come off its
342
+ end until it fits the box.
326
343
  */
327
344
  ellipsis?: (text: string, line: number) => string;
328
345
  /**
@@ -567,19 +584,11 @@ export interface TrendLineConfig {
567
584
  /** Line dash pattern. Defaults to `"6 4"`. */
568
585
  strokeDasharray?: string;
569
586
  /**
570
- Labels each trend line along its own path, near its end and just above
571
- it, in the line's color: `true` names the series ("Trend" for a line
572
- fit to every point), `"equation"` shows its fitted equation and R²
573
- (e.g. "y = 2.1x + 3.4, R² = 0.84", or just R² along a time axis), and
574
- a function of the fit (its `label`, `color`, and regression `fit` with
575
- `coefficients` and `r2`) returns any text. The text follows the line's
576
- curve, reads upright whichever way the line runs, and is cut short with
577
- an ellipsis when the line is too short for it; a line too short for a
578
- few letters gets no label. It labels the fitted stretch, not a
579
- projection. Labels never overlap one another or the line labels: one
580
- whose spot near its line's end is taken slides back along the line, or
581
- moves below it, and is skipped only when no clear spot exists.
582
- Defaults to `"equation"`; `false` turns labels off.
587
+ Labels each trend line along its path, near its end, in the line's
588
+ color: `true` names the series, `"equation"` shows its fitted equation
589
+ and R², and a function of the fit (`label`, `color`, and `fit` with
590
+ `coefficients` and `r2`) returns any text. Defaults to `"equation"`;
591
+ `false` turns labels off.
583
592
  */
584
593
  label?: boolean | "equation" | ((fit: {
585
594
  label: string;
@@ -678,6 +687,12 @@ export interface ColorScaleConfig {
678
687
  outside this range map to the nearest color.
679
688
  */
680
689
  domain?: number[];
690
+ /**
691
+ Draws a bucket-type scale ("jenks", "quantile", …) as one bar with an
692
+ axis along it, labeled where the buckets start, instead of a labeled
693
+ swatch for each bucket. Defaults to `false`.
694
+ */
695
+ bucketAxis?: boolean;
681
696
  /**
682
697
  Formats the label for each bucket in a bucket-type scale ("jenks",
683
698
  "quantile", …). Passed the bucket's start value, its index, the full
@@ -698,16 +713,10 @@ export interface ColorScaleConfig {
698
713
  */
699
714
  scale?: ColorScaleTypeSetting;
700
715
  /**
701
- Whether hovering a chart shape marks its value on the scale: an extra
702
- axis tick at the value on the color bar, and a badge reading the value
703
- in the axis's tick format where that tick's label would sit, covering
704
- the labels it overlaps (a value outside the domain marks the bar's
705
- end). A bucketed bar (`bucketAxis`) also outlines the value's bucket.
706
- A scale drawn as discrete swatches gets no mark; the value's swatch
707
- stays lit and the others dim instead. On charts whose shape hover is
708
- off (`hoverOpacity: 1`, as on Geomap and Calendar or past
709
- `dataCutoff`), that swatch highlight comes from this option too, so
710
- `false` turns it off there. Defaults to `true`.
716
+ Whether hovering a shape marks its value on the color scale: a tick and
717
+ a badge with the value (and, on a `bucketAxis`, an outline around its
718
+ bucket). A swatch scale lights the value's swatch instead. Defaults to
719
+ `true`.
711
720
  */
712
721
  hoverMark?: boolean;
713
722
  /**
@@ -718,21 +727,30 @@ export interface ColorScaleConfig {
718
727
  */
719
728
  ordinalRamp?: boolean;
720
729
  /**
721
- Styles the `hoverMark`. `tickConfig` takes `stroke` and `strokeWidth`
722
- (the axis ticks' own by default) and `length` (the axis's `tickSize`
723
- by default); the badge starts where the tick ends. `badgeConfig` takes `fill`
724
- (the value's color by default), `stroke` (the background-legible text
725
- color by default), `strokeWidth` (default `1`), `fontColor` (a color
726
- contrasting the fill by default), `fontFamily`, `fontSize` (default
727
- `11`), `fontWeight` (default `400`), `padding` around the text (default
728
- `3`; across the bar it is padded to sit as far out as the tick
729
- labels), and `rx` corner radius (default `2`). `outlineConfig`, the
730
- bucket outline on a `bucketAxis` bar, takes `stroke` (the
731
- background-legible text color by default) and `strokeWidth` (default
732
- `2`). Each is a value or a function of the
733
- hovered value.
730
+ Styles the `hoverMark`: `tickConfig` (`stroke`, `strokeWidth`, `length`),
731
+ `badgeConfig` (`fill`, `stroke`, `strokeWidth`, `fontColor`,
732
+ `fontFamily`, `fontSize`, `fontWeight`, `padding`, `rx`), and
733
+ `outlineConfig`, the bucket outline on a `bucketAxis` bar (`stroke`,
734
+ `strokeWidth`). Each is a value or a function of the hovered value.
734
735
  */
735
736
  hoverMarkConfig?: ColorScaleHoverMarkConfig;
737
+ /**
738
+ Draws the scale as a bivariate key: each row's `value` is a pair of
739
+ numbers, and a chart sets this when its `colorScale` names two fields.
740
+ Defaults to `false`.
741
+ */
742
+ bivariate?: boolean;
743
+ /** How many quantile bins a bivariate scale splits each variable into, from `2` to `4`. Defaults to `3`. */
744
+ bivariateBuckets?: number;
745
+ /**
746
+ A bivariate scale's colors: a square grid, row-major from the low/low
747
+ corner, each row one bin of the second variable and each column one bin
748
+ of the first. A grid of another size than `bivariateBuckets` is blended
749
+ to fit. Defaults to Joshua Stevens' blue–red 3×3 scheme.
750
+ */
751
+ bivariateColors?: string[];
752
+ /** A bivariate key's names for its two variables, in `colorScale` order. Defaults to the two field names. */
753
+ bivariateLabels?: [string, string];
736
754
  }
737
755
  /** `colorDefaults` input: any subset of the color defaults, with `scale` also accepting an array of colors. */
738
756
  export type ColorDefaultsConfig = Partial<Omit<ColorDefaults, "scale">> & {
@@ -824,16 +842,9 @@ export interface D3plusConfig {
824
842
  shapeConfig?: Record<string, unknown>;
825
843
  };
826
844
  /**
827
- Whether hovering a Plot's mark draws a dashed guide from its point to
828
- each axis and a badge on that axis with the point's value there,
829
- formatted as the tooltip formats that axis's values (the axis's
830
- `tickFormat` when set). `"x"` or `"y"` draws them for that direction
831
- only (each including its secondary axis). A bar is badged on its value
832
- axis only. With a discrete axis, the shared tooltip's crosshair is that
833
- axis's guide, and the value axis follows the hovered series' point (or
834
- the one nearest the pointer). Defaults to `true` (`"x"` on BumpChart,
835
- whose y axes label series rather than values, and on Streamgraph, whose
836
- y positions name no values).
845
+ Whether hovering a Plot's mark draws a dashed guide to each axis with a
846
+ badge showing its value there. `"x"` or `"y"` limits it to that
847
+ direction. Defaults to `true` (`"x"` on BumpChart and Streamgraph).
837
848
  */
838
849
  axisHover?: boolean | "x" | "y";
839
850
  /**
@@ -881,20 +892,10 @@ export interface D3plusConfig {
881
892
  barWidth?: string | false | ((d: DataPoint, i?: number) => number);
882
893
  /**
883
894
  BarChart/Marimekko with `barWidth`: whether each category's axis label
884
- also shows its bar's share of the total width, beneath the name along
885
- a horizontal axis ("Retail" over "50%") and after it along a vertical
886
- one ("Retail (50%)"). Along a horizontal axis, a name wraps to fit
887
- a narrow bar, widening into room its neighbors leave; a label that
888
- still can't fit is left out, and the labels rotate, showing the name
889
- alone, only when half or more can't fit. The tooltip always shows the
890
- share. `"opposite"` moves the shares to the axis across the bars from
891
- the names, above them along a horizontal axis and to their right along
892
- a vertical one, leaving the names alone on their own axis; style it
893
- with `x2Config` (or `y2Config`). In small
894
- multiples (`facet`), each panel's shares are of that panel's own total
895
- width and add to 100%, even when shared scales draw a smaller panel
896
- narrower. `barWidthShareFormat` changes what the label says.
897
- `"opposite"` for Marimekko, off for BarChart.
895
+ also shows its bar's share of the total width ("Retail" over "50%").
896
+ `"opposite"` puts the shares on the axis across from the names (styled
897
+ with `x2Config`/`y2Config`). `barWidthShareFormat` changes the text.
898
+ Defaults to `"opposite"` for Marimekko, `false` for BarChart.
898
899
  */
899
900
  barWidthShare?: boolean | "opposite";
900
901
  /**
@@ -907,39 +908,19 @@ export interface D3plusConfig {
907
908
  */
908
909
  barWidthShareFormat?: (d: DataPoint, info: BarShareInfo) => unknown;
909
910
  /**
910
- Starts a Plot's value axis (the x axis for horizontal charts) at a
911
- value: `baseline(n)` renders exactly like `yDomain([n])` (or
912
- `xDomain([n])`). Bars, areas, and stems still grow from the chart's
913
- own `0` in the Plots that draw from one (such as BarChart, AreaPlot,
914
- Histogram, and Lollipop), so with `baselineBreak` on (their default)
915
- the axis breaks back to a `0`
916
- tick and bars run through the break, with its gap cut across them,
917
- and with it off the axis
918
- stretches down to `0`. As with `yDomain([n])`, only `n` is
919
- pinned: the far end comes from the data and is rounded where the
920
- axis would round it with no domain set (left at the data when the
921
- axis config's `rounding` is "none"), and marks for values past `n`
922
- stop at the axis's edge.
923
- When every value sits at or below `n`, it ends the axis instead,
924
- like `yDomain([undefined, n])`. A bound given in
925
- `yDomain`/`xDomain` wins.
911
+ Starts a Plot's value axis at a value, like `yDomain([n])` (or
912
+ `xDomain([n])` for horizontal charts); the far end comes from the data.
913
+ Bars, areas, and stems still grow from `0`, so with `baselineBreak` on
914
+ the axis breaks back to a `0` tick. A bound in `yDomain`/`xDomain` wins.
926
915
  */
927
916
  baseline?: number;
928
917
  /**
929
- When the domain of a linear value axis stops short of the `baseline`
930
- (e.g. `[1100, 2100]` with a baseline of `0`), keeps the baseline as the
931
- axis's end tick and breaks the axis between it and the domain: a short
932
- stretch of axis holds the baseline tick and two tilted marks with a gap
933
- in the axis line, then the domain spans the rest. Style it with the
934
- axis's `baselineBreakConfig`. In a Plot it applies to a user-supplied
935
- value domain (`yDomain`/`yConfig.domain`, or the x versions for
936
- horizontal charts), and bars and areas start at the baseline tick,
937
- with the break's gap cut across them (`baselineBreakConfig`'s
938
- `mask`); turned off, a `yDomain` stretches to reach the baseline while a
939
- `yConfig.domain` is kept and cuts its bars off at the axis. Defaults
940
- to `true` for the Plots whose marks grow from `0`, such as BarChart,
941
- AreaPlot, Histogram, and Lollipop (each chart lists its own default),
942
- and `false` for other Plots and a standalone Axis.
918
+ When a linear value axis's domain stops short of the `baseline` (e.g.
919
+ `[1100, 2100]` with a baseline of `0`), keeps the baseline tick and
920
+ breaks the axis between it and the domain, styled by
921
+ `baselineBreakConfig`. Turned off, a Plot's `yDomain` stretches to the
922
+ baseline instead. Defaults to `true` for Plots whose marks grow from `0`
923
+ (BarChart, AreaPlot, Histogram, Lollipop), else `false`.
943
924
  */
944
925
  baselineBreak?: boolean;
945
926
  /** Bullet: the qualitative ranges behind each measure, as threshold values (`[60, 85]`) or band objects (`{min, max, color}`), or a `(d, i) => bands` accessor for per-row bands. */
@@ -1019,15 +1000,13 @@ export interface D3plusConfig {
1019
1000
  /** Bullet: the most each bullet's band can be thick, in pixels (default 40); raise it to let rows fill a tall chart. */
1020
1001
  bulletSize?: number;
1021
1002
  /**
1022
- Whether the chart keeps the files it fetches for `data`, `links`,
1023
- `nodes`, `topojson`, and `fitObject`. Each chart has its own cache of
1024
- its 10 most recent requests, keyed by the request (the URL, and a
1025
- request object's `fetch` options), so loaders naming the same URL share
1026
- one request. It holds each response as fetched, before its `*Format`
1027
- formatter runs, so setting the same URL again, or a new formatter, draws
1028
- from the cache without a request. A failed request is not kept. Defaults to `true`; set it to `false` to
1029
- fetch on every load, or use `dataPollingInterval` to re-fetch `data` on
1030
- a schedule (polls always fetch).
1003
+ Whether the chart uses the data cache that every chart on the page
1004
+ shares for the files fetched by `data`, `links`, `nodes`, `topojson`,
1005
+ and `fitObject`, so charts loading the same URL share one request and
1006
+ loading it again, or changing a formatter, needs none. The cache uses
1007
+ up to about 50 MB of memory, dropping the least recently used files
1008
+ first. Defaults to `true`; `false` fetches on every load.
1009
+ `clearDataCache()` from `@d3plus/data` empties the cache.
1031
1010
  */
1032
1011
  cache?: boolean;
1033
1012
  /** Calendar: styles the weekday, month, and year labels (`fontColor`, `fontFamily`, `fontSize`, default `11`, and `fontWeight`). */
@@ -1042,31 +1021,37 @@ export interface D3plusConfig {
1042
1021
  /** Calendar: each cell's corner radius, in pixels (kept below a third of the cell). Defaults to `2`. */
1043
1022
  cellRadius?: number;
1044
1023
  /**
1045
- Sankey: draws the links that loop back into a node they left (a link
1046
- from a node to itself, or one that closes a loop through several
1047
- nodes, A → B → A) as circular bands. Each leaves its source's right
1048
- side, turns up or down, runs along a lane above or below the nodes,
1049
- and turns back into its target's left side. The lightest link on each
1050
- loop is the one drawn this way, and its lane runs above the nodes
1051
- when its two ends sit in the upper half of the chart, else below.
1052
- Nodes are sized by the flow through them, returns included. `false`
1053
- leaves these links out instead, with a warning naming them. Defaults
1054
- to `true`.
1024
+ Pie (when `innerRadius` leaves a hole, as in a Donut), Sunburst and
1025
+ RadialBar: text drawn in the chart's empty middle. `true` draws the sum
1026
+ of every drawn row's value (Sunburst's `sum`), formatted the way the
1027
+ tooltips format values; a string draws that string; a function
1028
+ receives the drawn rows (after filters and hidden legend entries) and
1029
+ their total and returns the text. The text wraps and shrinks to fit
1030
+ the hole (see `centerLabelConfig`) and is left out when it can't fit
1031
+ whole, or, on a Sunburst, once a click zooms into a node. Defaults to
1032
+ `false`.
1033
+ */
1034
+ centerLabel?: boolean | string | ((data: DataPoint[], total: number) => string | false);
1035
+ /**
1036
+ Pie, Sunburst and RadialBar: styles the `centerLabel` with TextBox keys
1037
+ (`fontColor`, `fontFamily`, `fontWeight`, `lineHeight`, `padding`, …).
1038
+ The text shrinks from `fontMax` (default `40`) to fit the hole, down to
1039
+ `fontMin` (default `10`); a `fontSize` fixes its size instead. Defaults
1040
+ to the chart's text color and `padding: 5`. Merged into the current
1041
+ config.
1042
+ */
1043
+ centerLabelConfig?: TextBoxConfig;
1044
+ /**
1045
+ Sankey: draws links that loop back to a node they left (A → B → A, or a
1046
+ node to itself) as bands that run in a lane above or below the nodes.
1047
+ `false` leaves them out, with a warning. Defaults to `true`.
1055
1048
  */
1056
1049
  circularLinks?: boolean;
1057
1050
  /**
1058
- Network and ArcDiagram: colors each node by the cluster it belongs to,
1059
- found with the Louvain method (links weighted by `linkSize`). Each
1060
- cluster is named after its most-connected node ("alpha cluster"), and
1061
- the legend lists the clusters, largest first, even for a network drawn
1062
- from `nodes` alone; clicking a cluster zooms to it. A Network also writes each name
1063
- inside its cluster, where it fits clear of the nodes and their labels.
1064
- Applies only while the chart's color is its default: setting `color`,
1065
- `colorScale`, `colorOrdinal`, or a `shapeConfig` fill, or more than one
1066
- `groupBy` level, colors nodes as configured instead. A network with
1067
- fewer than two clusters of two or more nodes keeps one color per node.
1068
- A node with no links keeps its own color and label. `false` turns
1069
- clustering off. Defaults to `true`.
1051
+ Network and ArcDiagram: colors each node by its cluster (found with the
1052
+ Louvain method, weighted by `linkSize`), named after its most-connected
1053
+ node and listed in the legend; clicking a cluster zooms to it. Applies
1054
+ only while the chart's color is its default. Defaults to `true`.
1070
1055
  */
1071
1056
  cluster?: boolean;
1072
1057
  /**
@@ -1102,14 +1087,39 @@ export interface D3plusConfig {
1102
1087
  /** Treat a discrete color field as ordered: color it with a single-hue light→dark ramp instead of nominal categorical hues. */
1103
1088
  colorOrdinal?: boolean;
1104
1089
  /**
1105
- Defines the value to be used for a color scale. Can be either an accessor function or a string key to reference in each data point.
1090
+ Defines the value to be used for a color scale. Can be either an accessor function or a string key to reference in each data point. Two of them (`["a", "b"]`) make a bivariate scale: each variable is split into quantile bins, the pair of bins picks a color from a grid, and the key is that grid turned into a diamond (see `colorScaleConfig.bivariateBuckets`, `bivariateColors`, and `bivariateLabels`). A row missing either value gets no colorScale color.
1106
1091
  */
1107
- colorScale?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | false;
1092
+ colorScale?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | [ColorScaleField, ColorScaleField] | false;
1108
1093
  /** A pass-through to the config method of ColorScale. */
1109
1094
  colorScaleConfig?: {
1095
+ /** Configures the axis that labels a gradient or `bucketAxis` scale: `labels` lists the values it labels, `ticks` the values it marks, and `tickFormat` writes their text. Along a side of the chart, the whole scale (its bar, ticks, labels and title) takes at most a third of the chart's width (a scale at the left or right) or height (top or bottom), leaving out its title, and then its labels, when they don't fit; `maxSize` sets the room for the axis's labels and title instead. On a scale drawn as swatches, `title` and `titleTooltip` apply to the swatches' title, and `tickTooltip` to each swatch's label, given the value and index of the label at that bucket's start on a `bucketAxis` bar. */
1110
1096
  axisConfig?: AxisConfig;
1097
+ /** Draws a bucket-type scale as one bar with an axis along it instead of a labeled swatch for each bucket (see `ColorScaleConfig.bucketAxis`). Defaults to `false`. */
1098
+ bucketAxis?: boolean;
1099
+ /** Formats the label for each bucket in a bucket-type scale (see `ColorScaleConfig.bucketFormat`). */
1100
+ bucketFormat?: ColorScaleConfig["bucketFormat"];
1101
+ /** Given a bucket's minimum and maximum labels, returns the full label (see `ColorScaleConfig.bucketJoiner`). */
1102
+ bucketJoiner?: ColorScaleConfig["bucketJoiner"];
1103
+ /** How many buckets a bucket-type scale splits its values into, or the value each bucket starts at. Defaults to `5`. */
1104
+ buckets?: number | number[];
1105
+ /** Splits a diverging scale evenly on either side of its `midpoint`. Defaults to `true`. */
1111
1106
  centered?: boolean;
1112
- colors?: string[];
1107
+ /** The scale's colors (see `ColorScaleConfig.color`). */
1108
+ color?: ColorScaleConfig["color"];
1109
+ /** The `[min, max]` values a linear scale spans (see `ColorScaleConfig.domain`). */
1110
+ domain?: number[];
1111
+ /** The value a diverging scale turns at. Defaults to `0`. */
1112
+ midpoint?: number;
1113
+ /** The thickness of a gradient's or a `bucketAxis` scale's bar, in pixels. Defaults to `10`. */
1114
+ size?: number;
1115
+ /** The space around the scale, in pixels. Defaults to `5`. */
1116
+ padding?: number;
1117
+ /** Styles the bar of a gradient or a `bucketAxis` scale, as a Rect config (`stroke`, `strokeWidth`, …). */
1118
+ rectConfig?: Record<string, unknown>;
1119
+ /** A scale at the left or right takes at most this many pixels of the chart's width, in place of a third of it. At the top or bottom, it is the scale's length, in place of `colorScaleMaxSize`. */
1120
+ width?: number;
1121
+ /** A scale at the top or bottom takes at most this many pixels of the chart's height, in place of a third of it. At the left or right, it is the scale's length, in place of `colorScaleMaxSize`. */
1122
+ height?: number;
1113
1123
  /** The negative pole of a diverging scale, and the hue of an all-negative ramp. Defaults to `colorDefaults.off`, or the theme's `colorScale.min` on a dark or custom theme. */
1114
1124
  colorMin?: CssColor;
1115
1125
  /** The midpoint of a diverging scale. Defaults to `colorDefaults.light`, or the theme's `colorScale.mid` on a dark or custom theme. */
@@ -1122,6 +1132,14 @@ export interface D3plusConfig {
1122
1132
  hoverMark?: boolean;
1123
1133
  /** Styles the hover mark (see `ColorScaleConfig.hoverMarkConfig`). */
1124
1134
  hoverMarkConfig?: ColorScaleHoverMarkConfig;
1135
+ /** Configures the Legend that draws a bucket-type scale as a swatch for each bucket. Along a side of the chart, the swatches, their labels and title take at most a third of the chart's width (a scale at the left or right) or height (top or bottom): the title and labels wrap onto more lines, and when they still don't fit, the title is left out and then the labels are cut short. Its `width` (left or right) or `height` (top or bottom) sets another limit. */
1136
+ legendConfig?: Record<string, unknown>;
1137
+ /** How many quantile bins a bivariate `colorScale` splits each variable into, from `2` to `4`. Defaults to `3`. */
1138
+ bivariateBuckets?: number;
1139
+ /** A bivariate `colorScale`'s colors (see `ColorScaleConfig.bivariateColors`). Defaults to Joshua Stevens' blue–red 3×3 scheme. */
1140
+ bivariateColors?: string[];
1141
+ /** A bivariate key's names for its two variables. Defaults to the two field names. */
1142
+ bivariateLabels?: [string, string];
1125
1143
  /** Holds the palest step of a light theme's single-hue ramp darker (see `ColorScaleConfig.ordinalRamp`). Defaults to `true` when links are colored by number (`linkColor`), so the lowest-valued links still read as lines, and `false` otherwise. */
1126
1144
  ordinalRamp?: boolean;
1127
1145
  };
@@ -1160,36 +1178,19 @@ export interface D3plusConfig {
1160
1178
  */
1161
1179
  confidence?: ConfidenceBandSetting | ConfidenceBandSetting[] | false;
1162
1180
  /**
1163
- Styles the `confidence` interval: a line's band (an Area) or a bar's
1164
- error bar (a Path, with `stroke`, `strokeWidth`, and `capWidth` — the end
1165
- caps' length in pixels or as a percentage string of the bar's thickness).
1166
- Keys nested under `Area` or `Bar` apply only to that shape. `tooltip:
1167
- false` leaves the bounds out of tooltips. With nested bands,
1168
- `bandOpacity` sets how each band looks where it is the innermost band
1169
- drawn — an array ramps from the outermost band to the innermost
1170
- (default `[0.15, 0.6]`), a number gives every band that opacity — in
1171
- place of `fillOpacity`. Accepted keys: any Area or Path key,
1172
- `bandOpacity`, `capWidth`, `tooltip`, `Area` (Area keys), and `Bar`
1173
- (Path keys and `capWidth`); any other key logs a warning.
1181
+ Styles the `confidence` interval: a line's band (Area keys) or a bar's
1182
+ error bar (Path keys, plus `capWidth`, in pixels or a percentage of the
1183
+ bar). Keys under `Area` or `Bar` apply to that shape only.
1184
+ `bandOpacity` ramps nested bands' opacity (default `[0.15, 0.6]`), and
1185
+ `tooltip: false` leaves the bounds out of tooltips.
1174
1186
  */
1175
1187
  confidenceConfig?: Record<string, unknown>;
1176
1188
  /**
1177
- How a line crosses a missing value: a step of the discrete axis that
1178
- another line has and this one skips, or a row whose value is `null` or
1179
- `NaN`. `true` (the default) or `"solid"` draws the line straight on
1180
- through it. `false` breaks the line there, leaving the gap empty.
1181
- `"dashed"` breaks the line and bridges the gap with a short dash
1182
- (`"2 4"`) in the line's color, distinct from a forecast's longer dash.
1183
- An object styles the bridge: `stroke` (default the line's color),
1184
- `strokeDasharray` (default `"2 4"`; `false` for a solid bridge),
1185
- `strokeWidth` (default the line's width), and `opacity` (default `1`).
1186
- A bridge follows the line's curve, since it is drawn along the same
1187
- path, and is decoration only: it has no tooltip, takes no keyboard
1188
- focus, and a shared tooltip at a missing step lists no value for that
1189
- line. Confidence bands are clipped to the stretches between gaps. A
1190
- point with a gap on both sides draws no line of its own, so turn on
1191
- `lineMarkers` to show it. Areas, including stacked ones, are drawn as
1192
- before.
1189
+ How a line crosses a missing value (a skipped step, or a `null`/`NaN`
1190
+ value): `true` (the default) or `"solid"` draws straight through,
1191
+ `false` breaks the line, and `"dashed"` breaks it and bridges the gap
1192
+ with a short dash. An object styles the bridge: `stroke`,
1193
+ `strokeDasharray` (default `"2 4"`), `strokeWidth`, and `opacity`.
1193
1194
  */
1194
1195
  connectGaps?: ConnectGaps;
1195
1196
  /** Funnel: fills the gap between consecutive stages with a neck joining their widths. */
@@ -1203,24 +1204,14 @@ export interface D3plusConfig {
1203
1204
  */
1204
1205
  connectorConfig?: Record<string, unknown>;
1205
1206
  /**
1206
- Hexbin: contour options. `bandwidth` is the density kernel's standard
1207
- deviation in pixels (default `20`); `thresholds` is about how many
1208
- levels to draw (default `8`, rounded to nice values) or the levels
1209
- themselves, in observations per bin; `strokeWidth` is the outline
1210
- width of `"lines"` contours (default `1.5`); and `fillOpacity` is the
1211
- opacity of the highest `"filled"` level (default `0.8`). `labels`
1212
- (default `true`) writes each level's value along its contour lines, as
1213
- a topographic map labels elevation: centered on the line, which breaks
1214
- beneath it, reading upright, and clear of the other contours and
1215
- labels. A long contour takes more than one label, at least
1216
- `labelSpacing` pixels apart (default `"auto"`: 20 ems or half the
1217
- plot's mean side, whichever is longer); `labelStep` labels every n-th
1218
- level (`1` all of them, `2` every other one, keeping the multiples of
1219
- twice the levels' spacing; default `"auto"`: all of up to five levels,
1220
- else every other one); and a level with no clear, gently curving
1221
- stretch goes unlabelled. `labelConfig` is TextBox config for the
1222
- labels (`fontSize` defaults to `10`), and `levelFormat` formats their
1223
- values. Merged into the current config.
1207
+ Hexbin contour options: `bandwidth` (density kernel standard deviation,
1208
+ px, default `20`), `thresholds` (a level count, default `8`, or the
1209
+ levels themselves), `strokeWidth` (`"lines"` outline width, default
1210
+ `1.5`), `fillOpacity` (top `"filled"` level, default `0.8`), `labels`
1211
+ (write each level's value along its lines, default `true`),
1212
+ `labelSpacing` (px between labels on a line, default `"auto"`),
1213
+ `labelStep` (label every n-th level, default `"auto"`), `labelConfig`
1214
+ (TextBox config), and `levelFormat`.
1224
1215
  */
1225
1216
  contourConfig?: ContourConfig;
1226
1217
  /**
@@ -1249,22 +1240,18 @@ export interface D3plusConfig {
1249
1240
  /** Maximum number of data points to render before downsampling. */
1250
1241
  dataCutoff?: number;
1251
1242
  /**
1252
- Transforms `data` before it is drawn. The function receives the loaded
1253
- file (or the parsed JSON response, or an Array of them when `data` lists
1254
- several URLs), or the Array passed as `data`, and returns the rows to
1255
- draw. It may instead return a config object holding the rows as its
1256
- `data` key, and the rest of that object is applied to the chart, so a
1257
- response can set options such as `title` from what it contains.
1258
-
1259
- It runs when the chart renders, whichever order `data` and `dataFormat`
1260
- are set in, and setting it again re-runs it on the next render, over the
1261
- cached response (see `cache`). Every `dataPollingInterval` poll runs it too. Passing a
1262
- formatter as the second argument of `data(url, format)` sets it, and
1263
- setting `data` alone keeps it.
1243
+ Transforms `data` before it is drawn: receives the loaded file (or the
1244
+ Array passed as `data`) and returns the rows to draw, or a config object
1245
+ holding them as `data` (its other keys are applied to the chart). Also
1246
+ set by `data(url, format)`.
1264
1247
  */
1265
1248
  dataFormat?: (data: DataPoint[]) => DataPoint[] | Record<string, unknown>;
1266
1249
  /**
1267
- When `data` is loaded from a URL (or a request object, or an Array holding one), re-fetches it every this many milliseconds and redraws with a transition when it changes, keeping hover, zoom, legend toggles, and the timeline selection. Each poll uses the same request and `dataFormat` as the first load, and a response identical to the drawn data is not redrawn. Polling waits while the browser tab is hidden or, with `detectVisible`, while the chart is scrolled out of view, and catches up as soon as it is visible again. A failed request keeps the last data, logs one warning per run of failures, and tries again on the next tick. `destroy()`, setting this to `false`, or passing new `data` stops polling. Only `data` is polled, not `links`, `nodes`, or `topojson`. Defaults to `false` (load once).
1250
+ When `data` comes from a URL, re-fetches it every this many milliseconds
1251
+ and redraws when it changes, keeping hover, zoom, and legend state.
1252
+ Polling pauses while the tab (or, with `detectVisible`, the chart) is
1253
+ hidden, and a failed request keeps the last data. Only `data` is polled.
1254
+ Defaults to `false` (load once).
1268
1255
  */
1269
1256
  dataPollingInterval?: number | false;
1270
1257
  /**
@@ -1330,17 +1317,33 @@ export interface D3plusConfig {
1330
1317
  */
1331
1318
  detectVisibleInterval?: number;
1332
1319
  /**
1333
- When `true` (the default) and `detectVisible` is enabled, the Viz releases its DOM and scene while it is scrolled out of view and redraws when it returns, keeping the page light when there are many visualizations. Data and configuration are retained; interaction state such as zoom or selection is not, so set this to `false` to keep it. With `detectVisible` enabled, each chart's `<svg>` is also given `content-visibility: auto`, so the browser skips rendering its contents while it is far off-screen (this matters most when this is `false` and charts are kept). For a larger saving you can also apply `content-visibility: auto` and a `contain-intrinsic-size` to the container element yourself; that adds paint containment to an element you own, so it is not done automatically. Requires `IntersectionObserver`.
1320
+ With `detectVisible` on, releases the chart's DOM and scene while it is
1321
+ scrolled out of view and redraws it when it returns, keeping pages with
1322
+ many charts light. Data and config are kept; zoom and selection are not,
1323
+ so set `false` to keep them. Defaults to `true`.
1334
1324
  */
1335
1325
  detectVisibleUnload?: boolean;
1336
1326
  /**
1337
1327
  ParallelCoordinates: per-dimension options, keyed by dimension — `domain`
1338
1328
  (either end of a numeric domain may be `undefined`), `reverse`, `title`,
1339
- and any Axis config (`tickFormat`, `ticks`, `scale`, …).
1329
+ and any Axis config (`tickFormat`, `ticks`, `scale`, `tickTooltip`,
1330
+ `titleTooltip`, …).
1340
1331
  */
1341
1332
  dimensionConfig?: Record<string, DimensionOptions>;
1342
- /** Alluvial: styles the column titles drawn above each column (any TextBox config). */
1343
- dimensionTitleConfig?: Record<string, unknown>;
1333
+ /**
1334
+ Alluvial: styles the column titles drawn above each column (any TextBox
1335
+ config), and takes a `titleTooltip`: the tooltip shown when a title is
1336
+ hovered, as its text, a function that receives the title and returns it,
1337
+ or a tooltip config (as `tooltipConfig`) whose accessors receive the
1338
+ title. Unset (the default) or when the
1339
+ function returns nothing, a title cut short with an ellipsis shows its
1340
+ whole text; `false`, set or returned, shows no tooltip.
1341
+ @example
1342
+ {maxLines: 1, titleTooltip: title => notes[title]}
1343
+ */
1344
+ dimensionTitleConfig?: Record<string, unknown> & {
1345
+ titleTooltip?: string | ((title: string) => string | false | void) | AxisTooltipConfig<[title: string]> | false;
1346
+ };
1344
1347
  /**
1345
1348
  ParallelCoordinates: the data keys to draw an axis for, in order.
1346
1349
  Defaults to every numeric key except the `groupBy` keys and `id`; a key
@@ -1396,48 +1399,29 @@ export interface D3plusConfig {
1396
1399
  /** Allows removing specific geographies from topojson file to improve zoom. */
1397
1400
  fitFilter?: number | string | ((d: Record<string, unknown>) => boolean);
1398
1401
  /**
1399
- Marks a forecast: the stretch of the discrete axis after it gets a
1400
- shaded backdrop, a rule at its start, and a translated "Forecast"
1401
- label, and each line's forecast stretch is dashed (see
1402
- `forecastConfig`). A function flags the forecast rows (e.g.
1403
- `d => d.Type === "Predicted"`): each line is dashed from its last
1404
- unflagged point, or throughout when every row is flagged, and the
1405
- backdrop starts at the earliest of those. `"auto"` (or `true`) flags
1406
- the rows whose `confidence` bounds spread away from their line. A
1407
- discrete-axis value (a date or year on a time axis) starts the
1408
- forecast there. Unset (the default), only a trend line projection
1409
- (`trendLineConfig.projection`) is marked, from the last fitted value;
1410
- `false` marks nothing, not even a projection. On bar charts the
1411
- backdrop starts at the edge of the first forecast bar, and bars keep
1412
- their own styles. Defaults to `"auto"` on a FanChart.
1402
+ Marks a forecast: a shaded backdrop, a rule, and a "Forecast" label over
1403
+ the forecast stretch, with lines dashed there (see `forecastConfig`).
1404
+ A function flags the forecast rows; `"auto"` (or `true`) flags rows whose
1405
+ `confidence` bounds spread from their line; a discrete-axis value starts
1406
+ the forecast there; `false` marks nothing. Unset (the default), only a
1407
+ trend line projection is marked. Defaults to `"auto"` on a FanChart.
1413
1408
 
1414
- Bullet: each row's forecast (or other comparative measure), drawn as
1415
- a paler bar behind the measure: a data key, an accessor returning the
1416
- row's value, a number shared by every row, or `false`.
1409
+ Bullet: each row's forecast (or other comparative measure), drawn as a
1410
+ paler bar behind the measure: a data key, an accessor, a number, or
1411
+ `false`.
1417
1412
  */
1418
1413
  forecast?: boolean | "auto" | number | string | Date | ((d: DataPoint, i: number) => boolean | number);
1419
1414
  /**
1420
- Styles for the `forecast` marker: the backdrop's `fill` and
1421
- `fillOpacity` (default `0.05`; `fill: false` hides it), the rule's
1422
- `stroke`, `strokeWidth` (`1`), `strokeOpacity` (`0.4`), and
1423
- `strokeDasharray` (`"4 4"`; `stroke: false` hides it), the label's
1424
- text as `label` (default "Forecast", translated; `false` hides it)
1425
- with `fontColor`, `fontFamily`, `fontSize` (`12`), `fontWeight`, and
1426
- `fontOpacity` (`0.7`), and `lineDasharray`, the dash pattern of each
1427
- line's forecast stretch (default `"6 4"`; `false` keeps lines solid).
1428
- Colors default to the chart's text color for its background. The
1429
- backdrop is chart chrome with no data row, so `shapeConfig.texture`
1430
- and `shapeConfig.backgroundImage` leave it plain; give it its own
1431
- `texture` (a textures.js name or config, drawn in the backdrop's color
1432
- over its shade at `textureOpacity`, default `0.3`, with
1433
- `textureDefault`) or `backgroundImage` (a URL,
1434
- fit by `backgroundImageFit`, `"cover"` or `"contain"`). Both are off
1435
- by default.
1415
+ Styles the `forecast` marker: the backdrop's `fill` and `fillOpacity`
1416
+ (default `0.05`), the rule's `stroke`, `strokeWidth`, `strokeOpacity`,
1417
+ and `strokeDasharray`, the `label` text (default "Forecast"; `false`
1418
+ hides it) and its font keys, `lineDasharray` for each line's forecast
1419
+ stretch (default `"6 4"`; `false` keeps lines solid), and an optional
1420
+ `texture` or `backgroundImage` for the backdrop. `fill: false` or
1421
+ `stroke: false` hides the backdrop or rule.
1436
1422
 
1437
- Bullet: the forecast bar's `size` (a fraction of the band's
1438
- thickness), `opacity`, `fill`, `texture`, and
1439
- `backgroundImage`/`backgroundImageFit`, each a value or a `(d, i)`
1440
- accessor.
1423
+ Bullet: the forecast bar's `size` (a share of the band), `opacity`,
1424
+ `fill`, `texture`, and `backgroundImage`/`backgroundImageFit`.
1441
1425
  */
1442
1426
  forecastConfig?: Record<string, unknown>;
1443
1427
  /**
@@ -1506,19 +1490,9 @@ export interface D3plusConfig {
1506
1490
  /** The hover callback function for highlighting shapes on mouseover. */
1507
1491
  hover?: ((d: DataPoint, i: number) => boolean) | false | null;
1508
1492
  /**
1509
- How close, in pixels, the pointer has to come to a point mark for it to
1510
- count as hovering that point. Over empty space, or over something other
1511
- than a point (a gridline, a link), the pointer acts on the closest point
1512
- whose edge lies within this distance: its tooltip, hover highlight, and
1513
- axis guides show, and a click there clicks it. A point's tooltip points
1514
- at the top of the point (on it or near it) and holds still until
1515
- another point takes over. Applies to the point
1516
- marks of scatter and bubble plots (Circle and Rect shapes, Beeswarm
1517
- included), Network nodes, and Geomap points; bars, areas, lines, and
1518
- other area-filling marks keep exact hit-testing.
1519
- Plots with a discrete axis and `tooltipShared` on snap to the nearest
1520
- column instead. Defaults to `20`; `0` turns it off, along with the
1521
- anchored tooltip.
1493
+ How close (px) the pointer must come to a point mark (scatter and
1494
+ bubble points, Network nodes, Geomap points, Radar dots) to hover it, so small
1495
+ points are easy to reach. Defaults to `20`; `0` turns it off.
1522
1496
  */
1523
1497
  hoverDistance?: number;
1524
1498
  /** Candlestick: accessor or data key for each period's highest value (default `"high"`). */
@@ -1547,17 +1521,10 @@ export interface D3plusConfig {
1547
1521
  points?: Record<string, unknown>;
1548
1522
  };
1549
1523
  /**
1550
- Lets keyboard users move between the chart's data marks. The chart is
1551
- one Tab stop (a focusable `role="application"` element laid over it,
1552
- named by `svgTitle` or the chart's `title`); once it has focus, the
1553
- arrow keys move to the nearest mark in that direction, Home and End
1554
- jump to the first and last mark, Enter or Space selects the focused
1555
- mark as a click would (drilling down, or toggling a legend item), and
1556
- Escape clears it. The focused mark shows its tooltip and hover
1557
- highlight, a ring outlines it (see `keyboardNavConfig`), and a live
1558
- region announces its label to screen readers. Legend items are
1559
- included after the chart's marks; Line and Area series are visited
1560
- point by point. On by default; `false` removes the Tab stop.
1524
+ Lets keyboard users move between the chart's marks: the chart is one Tab
1525
+ stop, the arrow keys move to the nearest mark in that direction, Home and
1526
+ End jump to the ends, Enter or Space click the focused mark, and Escape
1527
+ clears it. Defaults to `true`; `false` removes the Tab stop.
1561
1528
  */
1562
1529
  keyboardNav?: boolean;
1563
1530
  /** Styles the focus ring around the mark keyboard navigation has focused (see `KeyboardNavConfig`). */
@@ -1575,96 +1542,34 @@ export interface D3plusConfig {
1575
1542
  */
1576
1543
  labelWidth?: number;
1577
1544
  /**
1578
- Where each shape's label goes, as a string for every shape or a
1579
- `(d, i) => string` accessor of the data row.
1545
+ Where each shape's label goes: `"auto"`, `"along"`, `"inside"`, or
1546
+ `"outside"`, or a `(d, i) => string` accessor. `"auto"` picks
1547
+ whichever fits best per shape, and a label with no room is left out.
1580
1548
 
1581
- - Ring segments (Donut slices and those of a Pie with an
1582
- `innerRadius`, Sunburst arcs, Chord groups, and RadialBar tracks):
1583
- `"along"` runs a segment's name along its arc, following the ring,
1584
- reading left to right on the bottom half as on the top. `"auto"`
1585
- picks, segment by segment, whichever reads better: the curve when
1586
- its arc is long enough for the whole name and it shows it larger
1587
- than a straight label could (a thin ring), the straight label when
1588
- that fits as well, and a curve cut short with an ellipsis when
1589
- nothing else fits. A full Pie (no `innerRadius`) keeps its labels
1590
- inside straight: its wedges run to a point at the center. On a Pie
1591
- or Donut (any `innerRadius`, and partial rings such as a half pie),
1592
- a slice whose label inside can't show its whole name under
1593
- `"auto"` is labelled outside the ring instead, and `"outside"`
1594
- labels every slice there: its name and share, horizontal, in the
1595
- Path `labelConfig`'s font at its `fontSize` (12px by default), in
1596
- the theme's text color unless `labelConfig.fontColor` sets one,
1597
- joined to the slice by a thin leader line. These labels stack in a
1598
- column on the side of the ring their slice faces, wrapping onto a
1599
- second line between words when their column is narrow; the ring
1600
- shrinks (its hole with it) to leave room for them, never below 60%
1601
- of its full radius, and when they don't all fit, the smallest
1602
- slices' labels are left out (those slices keep their label inside,
1603
- if any). `"inside"` keeps a Pie or Donut's labels straight inside
1604
- their slices, and on the other ring segments both `"inside"` and
1605
- `"outside"` keep the straight labels. A Donut's curves
1606
- follow the middle of its ring (the rim, when its hole is small),
1607
- with the slice's share on a smaller second line when there is room.
1608
- A Sunburst also weighs a label turned along its radius, which suits
1609
- the narrow arcs of the outer rings. Curved Donut and Sunburst names
1610
- keep 5px from the ring's edges and at least 0.3em from the
1611
- segment's ends, at the largest size from the Path `labelConfig`'s
1612
- `fontSize` (else `fontMax`, 24px by default) down to its `fontMin`
1613
- (8px). A Chord curves its group names just outside the ring when
1614
- every name fits along its arc, which leaves the ring more room;
1615
- otherwise it curves those that fit and turns the rest along their
1616
- spokes, all at the Path `labelConfig`'s `fontSize` (11px by
1617
- default). A Radar does the same with its metric names, just outside
1618
- the web, each between its neighbors' spokes, wrapping a long name
1619
- onto a second curved line. A RadialBar curves each track's name along the track, inside
1620
- its bar (or past its end when the bar is too short), when the sweep
1621
- leaves no room before the start for the straight labels, and at any
1622
- sweep for `"along"`; when every track is named this way, the default
1623
- legend hides. Curved text takes the color that contrasts with what
1624
- lies under it (the theme's ink outside the ring) and dims with its
1625
- segment on hover. A label with no room is left out.
1626
- - Bars: `"inside"` or `"outside"` the bar, or `"auto"`, which goes
1627
- outside when the bar is shorter than half the room along its axis.
1628
- Stacked bars always label inside.
1629
- - Circles (scatter and bubble points, Beeswarm points given a `label`,
1630
- Network nodes, and Geomap coordinate points): `"auto"` keeps a label
1631
- inside its circle when it fits there at `pointLabelConfig.fontMin` or
1632
- larger, else moves it beside the circle, else hides it. A Network or
1633
- Geomap's labels beside their circles stay in the chart area, a
1634
- Plot's in its plot area. `"inside"` keeps every label
1635
- inside, shrinking it to fit (a label that can't fit is dropped).
1636
- `"outside"` always puts it beside the circle. A label goes beside its
1637
- circle on the side with the most open room: the side facing its
1638
- Voronoi cell's centroid first, then right, left, top, bottom, and the
1639
- diagonals. A side is taken only where the label lies mostly in the
1640
- circle's Voronoi cell, stays in that area, and overlaps no circle and
1641
- no label placed before it. Larger circles are
1642
- placed first. A label with no room is hidden; the circle's tooltip and
1643
- aria-label still name it. Geomap points are labeled by
1644
- `shapeConfig.Circle.label` when it is set (`false` turns their labels
1645
- off), else by `label`. Labels are placed when the chart draws: a
1646
- zoomed Plot places them again for its new scales, while a zoomed
1647
- Network or Geomap scales them with the picture.
1648
- - Stacked areas (StackedArea, Streamgraph, and a stacked AreaPlot):
1649
- `"auto"` or `"along"` runs each series' name along its band's
1650
- centerline, following its curve, on the stretch where the band is at
1651
- least the font size plus 4px thick under the whole label and flattest.
1652
- The text reads upright, in the color that contrasts with the band's
1653
- fill (or the Area `labelConfig`'s `fontColor`, when you set one), and
1654
- dims with its band on hover. It starts at the Area `labelConfig`'s
1655
- `fontSize` (or `fontMax`, else 16px) and shrinks a pixel at a time
1656
- down to its `fontMin`, but no lower than 8px, before giving up; a
1657
- band too thin for its name everywhere goes unlabeled. When every band
1658
- gets a name, the default legend hides (a `legend` of your own always
1659
- wins, and the legend stays while a series is hidden from it).
1660
- `"inside"` (or `"outside"`) puts the label in the band's largest box
1661
- instead. `shapeConfig.Area.label` sets the text, or `false` for none.
1549
+ - Rings (Pie, Donut, Sunburst, Chord, RadialBar) and polar charts
1550
+ (Radar, PolarArea, RadialMatrix): `"along"` curves the name along its
1551
+ arc. `"inside"` keeps it straight; on a Pie or Donut, `"outside"`
1552
+ moves it beside the ring with a leader line.
1553
+ - Bars: inside or outside the bar. `"auto"` goes outside when the bar
1554
+ is short. Stacked bars always label inside.
1555
+ - Circles (Plot points, Network nodes, Geomap points): inside the
1556
+ circle, or beside it when it doesn't fit (`"outside"` always beside).
1557
+ - Stacked areas: `"auto"` and `"along"` run each name along its band;
1558
+ `"inside"` puts it in the band's largest box.
1662
1559
 
1663
- Defaults to `"auto"`.
1560
+ When every stacked area or RadialBar track is named along its shape,
1561
+ the default legend hides. Defaults to `"auto"`.
1664
1562
  */
1665
1563
  labelPosition?: "auto" | "along" | "inside" | "outside" | ((d: DataPoint, i: number) => "auto" | "along" | "inside" | "outside");
1666
1564
  /**
1667
- Whether to display the legend. By default, the legend shows when it has more than one entry and each entry stands for a single group (or two groups at most), or when the entries are colored by a category that isn't a `groupBy` level (see `color`), in which case each entry is labelled by its category. Pass `false` to hide it, `true` to always show it, or a `(config, data) => boolean` function to decide.
1565
+ Whether to display the legend. By default it shows when it has more than
1566
+ one entry and each entry stands for a single group, or when entries are
1567
+ colored by a category that isn't a `groupBy` level. It hides when the
1568
+ chart's own labels already name every entry (see `labelPosition`), or
1569
+ when every Circle, Rect, and Bar of a Plot shows its whole label as its
1570
+ legend entry would, and stays while a series is hidden or soloed.
1571
+ `false` hides it, `true` always shows it, and a `(config, data) =>
1572
+ boolean` function decides.
1668
1573
  */
1669
1574
  legend?: boolean | ((config: D3plusConfig, arr: DataPoint[]) => boolean);
1670
1575
  /** Configuration object passed to the legend's config method. */
@@ -1684,11 +1589,17 @@ export interface D3plusConfig {
1684
1589
  */
1685
1590
  legendFilterInvert?: boolean | ((viz: VizBase) => boolean);
1686
1591
  /**
1687
- Whether legend clicks go on the chart's Back history. A click or shift+click (or Enter or Space on a legend item) that changes what is hidden or solo'd shows the Back button, and Back undoes legend clicks and drill-downs in the order they happened, restoring the legend exactly as it was. A drill-down to a deeper level starts with every group shown, and Back out of it brings back the legend it left. A click that changes nothing adds no step, and new `data` clears the legend's steps along with the legend. Clicking a Sunburst or Icicle center zooms out without undoing the legend clicks made since the zoom. Defaults to `true`; `false` leaves legend clicks off the history, so Back only steps out of drill-downs.
1592
+ Whether legend clicks go on the chart's Back history, so Back undoes
1593
+ them along with drill-downs, in order. Defaults to `true`; `false` leaves
1594
+ them off, so Back only steps out of drill-downs.
1688
1595
  */
1689
1596
  legendHistory?: boolean;
1690
1597
  /**
1691
- Whether the chart may draw one of its legends inside the empty space around its marks instead of in a margin, for charts that leave open space around their marks, such as Plot and the charts built on it, Network, Pack, Pie, and Geomap; a chart whose marks fill its area, like Treemap, keeps its legends in the margins. After the chart lays out, the size legend is tried first, then the legend, then the colorScale; the first that fits is drawn over a semi-transparent box (see `legendInsetConfig`), and any others keep their margins. Space enclosed by the marks, like the middle of a ring of points, is never used. Only a legend or colorScale whose position is `"auto"` (the default) can move inside; one set to a side stays in that margin. Defaults to `true`; also accepts a function that receives the resolved chart config and returns a boolean.
1598
+ Whether the chart may draw a legend, size legend, or colorScale inside
1599
+ empty space around its marks (over a translucent box, see
1600
+ `legendInsetConfig`) instead of in a margin. Only a legend whose position
1601
+ is `"auto"` can move inside. Defaults to `true`; also accepts a function
1602
+ of the resolved config.
1692
1603
  */
1693
1604
  legendInset?: boolean | ((config: D3plusConfig) => boolean);
1694
1605
  /**
@@ -1722,10 +1633,10 @@ export interface D3plusConfig {
1722
1633
  /** Configuration object for the legend tooltip. */
1723
1634
  legendTooltip?: TooltipConfig;
1724
1635
  /**
1725
- Formats the Radar's level value labels, or the Hexbin's contour level
1726
- labels and tooltips. Receives the level's value and returns its label.
1727
- Defaults to the abbreviated number format the axes use (`1.5k`, `2M`,
1728
- …).
1636
+ Formats the Radar's level value labels and dot tooltip values, or the
1637
+ Hexbin's contour level labels and tooltips. Receives the value and
1638
+ returns its label. Defaults to the abbreviated number format the axes
1639
+ use (`1.5k`, `2M`, …).
1729
1640
  */
1730
1641
  levelFormat?: (d: number) => string | number;
1731
1642
  /**
@@ -1762,28 +1673,13 @@ export interface D3plusConfig {
1762
1673
  /** ParallelCoordinates: the lines' stroke opacity, or `"auto"` (default) to fade them as their number grows. */
1763
1674
  lineOpacity?: number | "auto";
1764
1675
  /**
1765
- Labels each line of a line chart with its series name, just past the
1766
- line's ends: `true` or `"end"` labels the right end, `"start"` the left
1767
- end, and `"both"` both ends. A function of each row returns any of
1768
- these (or `false`) to choose per series. The plot leaves room for the
1769
- labels on the side they sit, at most a quarter of its width past the y
1770
- axis per side;
1771
- a label wider than that drops its value, then shortens its name with
1772
- an ellipsis, then hides. Labels that would overlap are moved apart,
1773
- each side on its own, with a dotted connector back to their line; when
1774
- the plot is too short for them all, the last that fits reads "+N more".
1775
- `lineLabelConfig` adds each end's value to its label.
1776
-
1777
- `"along"` writes each series name along its own line instead, following
1778
- its curve: on the stretch that bends and slopes least and stays clear
1779
- of the other lines and labels, reading upright whichever way the line
1780
- runs. A line with no clear stretch for its name goes unlabeled, a chart
1781
- (or small-multiples panel) with a single line names none, and the plot
1782
- leaves no room past the lines for these labels. The Line shape's
1783
- `labelConfig` sets their `fontSize`, `fontFamily`, and `fontWeight`.
1784
- When every line gets a name, the default legend hides (a `legend` of
1785
- your own always wins). LinePlot defaults to `"along"`; other charts
1786
- default to no labels.
1676
+ Labels each line with its series name: `true` or `"end"` past its right
1677
+ end, `"start"` past its left end, `"both"` at both ends, or `"along"`
1678
+ written along the line itself, following its curve. A function of each
1679
+ row picks per series (or `false`). End labels that would overlap are
1680
+ moved apart, and `lineLabelConfig` can add each end's value. When every
1681
+ line is named along it, the default legend hides. Defaults to `"along"`
1682
+ on LinePlot, no labels elsewhere.
1787
1683
  */
1788
1684
  lineLabels?: LineLabelsSetting;
1789
1685
  /**
@@ -1801,28 +1697,16 @@ export interface D3plusConfig {
1801
1697
  maxAngle?: number;
1802
1698
  /**
1803
1699
  Geomap: how far each link bows into an arc, as a share of the distance
1804
- between its ends. `0` draws the plain great-circle path; the default
1805
- `0.2` lifts a link's middle by a fifth of that distance, to the left
1806
- of its direction (a negative value bows to the right), so links
1807
- running both ways between two places stay apart. On a flat map, a
1808
- link whose great circle the projection cuts (across the antimeridian,
1809
- or between `"geoAlbersUsa"`'s insets) is drawn on the screen between
1810
- its ends, bowed the same way, so it crosses the map instead of leaving
1811
- by one edge. On a projection that clips to a circle (a globe such as
1812
- `"geoOrthographic"`), links follow the great circle without the lift.
1700
+ between its ends: `0` draws the plain great-circle path, and the default
1701
+ `0.2` bows it to the left of its direction (negative bows right), so
1702
+ links running both ways stay apart. Globes ignore it.
1813
1703
  */
1814
1704
  linkCurve?: number;
1815
1705
  /**
1816
- Network and Geomap: bundles the links (force-directed edge bundling,
1817
- after Holten and van Wijk). Links that run the same way near each
1818
- other are pulled together into shared curves that fan out at their
1819
- ends, so the main flows read through the clutter of a dense chart.
1820
- Arrowheads, labels, hover, and click focus follow each bundled curve.
1821
- A Network's links from a node to itself, and a Geomap's links on a
1822
- globe or cut by its projection, are drawn as usual; a bundled Geomap
1823
- link ignores `linkCurve`. The bundling is worked out once per layout
1824
- (under a second for 2,500 links) and reused while the chart zooms,
1825
- pans, or is hovered. Defaults to `false`.
1706
+ Network and Geomap: bundles links that run the same way into shared
1707
+ curves (force-directed edge bundling), so the main flows read through
1708
+ the clutter of a dense chart. A bundled Geomap link ignores
1709
+ `linkCurve`. Defaults to `false`.
1826
1710
  */
1827
1711
  linkBundle?: boolean;
1828
1712
  /**
@@ -1846,18 +1730,11 @@ export interface D3plusConfig {
1846
1730
  */
1847
1731
  linkSizeMin?: number;
1848
1732
  /**
1849
- Colors each link of a Network, Rings, Sankey, ArcDiagram, or Geomap,
1850
- and its arrowheads: `"source"` or `"target"` takes that end node's color, and
1851
- a key or accessor function reads a value from each link (receiving the
1852
- link, with `source` and `target` set to the data of its nodes, and its
1853
- index in `links`). A number is colored on the chart's
1854
- colorScale, which then shows the links' values beside the nodes' color
1855
- legend (when the chart also has a `colorScale` for its nodes, nodes and
1856
- links share it, on one domain); a string is a color when it parses as
1857
- one, or else a category in the chart's palette, as `color` colors
1858
- nodes. `false` (the default) draws every link in the theme's `link`
1859
- gray (on a Geomap, a gray halfway between the chart's background and
1860
- text colors, which reads over land and water alike).
1733
+ Colors each link of a Network, Rings, Sankey, ArcDiagram, or Geomap (and
1734
+ its arrowheads): `"source"` or `"target"` takes that node's color, and a
1735
+ key or accessor reads a value from each link: a number is colored on the
1736
+ colorScale, and a string is a color or a palette category. `false` (the
1737
+ default) draws every link in the theme's link gray.
1861
1738
  */
1862
1739
  linkColor?: false | "source" | "target" | string | ((d: DataPoint, i: number) => unknown);
1863
1740
  /**
@@ -1873,35 +1750,21 @@ export interface D3plusConfig {
1873
1750
  */
1874
1751
  linkLabel?: string | ((d: DataPoint, i: number) => unknown);
1875
1752
  /**
1876
- Styles the link labels (see `linkLabel`): `rotate`, `"along"` (the
1877
- default) to run text along its link, kept upright, or `"horizontal"`;
1878
- `fontSize` (10); `padding`, the pad around the text (2);
1879
- `backgroundOpacity`, the opacity of that pad in the chart's background
1880
- color (0.85); `minRadius`, the tightest bend a curved label follows,
1881
- in ems (2); and any other TextBox setting, such as `fontColor`
1882
- (defaults to the chart's text color), `fontFamily`, or `fontWeight`.
1883
- Along a curved link (a Rings spline or fanned parallel link, an
1884
- ArcDiagram arc, a self-loop, a bundled Network edge, a Geomap flow
1885
- arc, or a Sankey band or return lane), an `"along"` label follows the
1886
- curve, centered where a straight label would sit, over a pad that
1887
- curves with it, and is cut short with an ellipsis when the curve has
1888
- too little room (or left out when fewer than three letters fit). A
1889
- loop bending tighter than `minRadius` keeps a straight label.
1753
+ Styles the link labels (see `linkLabel`): `rotate` (`"along"`, the
1754
+ default, runs text along its link, curves included; `"horizontal"`
1755
+ keeps it flat), `fontSize` (default `10`), `padding` (default `2`),
1756
+ `backgroundOpacity` of the pad behind the text (default `0.85`),
1757
+ `minRadius`, the tightest bend a label follows in ems (default `2`), and
1758
+ any other TextBox setting, such as `fontColor`.
1890
1759
  */
1891
1760
  linkLabelConfig?: LinkLabelConfig;
1892
1761
  /** Links this chart to every other chart with the same group name, so hovering, `active`, `highlight` (including search), and legend hide/solo clicks in one are mirrored in the rest, and a value gets the same categorical color in every chart. Rows match across charts by the value of `by` (a data key or accessor), which defaults to the chart's own id. A string is shorthand for `{group}`; set `hover`, `active`, `highlight`, `legend`, or `color` to `false` to stop sharing that behavior. */
1893
1762
  link?: LinkOption;
1894
1763
  /**
1895
- Network, Rings, ArcDiagram, and Geomap: the thickness of each link, as
1896
- a pixel number used for every link, or an accessor function whose
1897
- values are scaled (see `linkSizeScale`) from `linkSizeMin` up to
1898
- `linkSizeMax` on a Network, Rings, or Geomap (by default half the
1899
- smallest node's radius on the first two, and 10 pixels on a Geomap),
1900
- or up to the smallest node's radius on an ArcDiagram. The
1901
- function receives each link with its own fields, with `source` and
1902
- `target` set to the data of the nodes at its ends (not their ids or
1903
- indices), and its index in `links`. Link `shapeConfig` functions, arrow
1904
- accessors, and tooltip accessors receive the same object.
1764
+ Network, Rings, ArcDiagram, and Geomap: each link's thickness, as a
1765
+ pixel number, or an accessor whose values are scaled (see
1766
+ `linkSizeScale`) between `linkSizeMin` and `linkSizeMax`. The accessor
1767
+ receives each link with `source` and `target` set to its nodes' data.
1905
1768
  */
1906
1769
  linkSize?: number | ((d: DataPoint & {
1907
1770
  source: DataPoint;
@@ -1948,7 +1811,7 @@ export interface D3plusConfig {
1948
1811
  messageStyle?: Record<string, unknown>;
1949
1812
  /** Metric key for the visualization. */
1950
1813
  metric?: string;
1951
- /** Shows a small overview + draggable-viewport minimap underneath the zoom controls once the chart is zoomed in. On by default whenever `zoom` is enabled. */
1814
+ /** Shows a small overview + draggable-viewport minimap in the chart's top-right corner (beneath the zoom controls, when they show) once the chart is zoomed in. On by default whenever `zoom` is enabled. */
1952
1815
  minimap?: boolean;
1953
1816
  /**
1954
1817
  An additional CSS class name (or space-separated list of class names) applied to the minimap's outer box, viewport box, and zoom-level label, alongside their fixed `d3plus-minimap` / `d3plus-minimap-viewport` / `d3plus-minimap-label` classes. Setting this automatically disables d3plus's built-in inline `minimapStyle`/`minimapViewportStyle`/`minimapViewportStyleActive`/`minimapLabelStyle` defaults (as long as you haven't already customized them yourself), so a host page's own styling applies through the cascade with no other configuration needed.
@@ -2019,6 +1882,29 @@ export interface D3plusConfig {
2019
1882
  in value (`linkSize`, or Sankey's `value`), and none when they don't.
2020
1883
  */
2021
1884
  nodeTooltipLinks?: number | false;
1885
+ /**
1886
+ Network, Rings, ArcDiagram, and Sankey: the network measures a node's
1887
+ tooltip lists. `true` (the default) lists them all, `false` none, or
1888
+ an Array picks some, in the order to list them: `"degree"` (its number
1889
+ of links, as "In-degree" and "Out-degree" when the chart draws arrows
1890
+ and in Sankey; it replaces the "Connections" count), `"betweenness"`
1891
+ (the share of shortest paths between other nodes that pass through
1892
+ it, 0 to 1), `"closeness"` (how near it is to the nodes it can reach,
1893
+ 0 to 1), and `"cluster"` (the name of its cluster, when clusters color
1894
+ the chart). Betweenness and closeness are worked out while the browser
1895
+ is idle after the chart draws, and an open tooltip fills them in once
1896
+ they are ready.
1897
+ */
1898
+ nodeTooltipStats?: boolean | ("degree" | "betweenness" | "closeness" | "cluster")[];
1899
+ /**
1900
+ Network, Rings, ArcDiagram, and Sankey: settings for the network
1901
+ measures in node tooltips. `weighted: true` counts a strong link (by
1902
+ `linkSize`, or Sankey's `value`) as a shorter step than a weak one for
1903
+ betweenness and closeness; by default every link is one step.
1904
+ */
1905
+ nodeTooltipStatsConfig?: {
1906
+ weighted?: boolean;
1907
+ };
2022
1908
  /**
2023
1909
  Ocean color for geomaps (any CSS value including 'transparent'), or a
2024
1910
  `{light, dark}` pair chosen by the chart's `theme` (the page behind it
@@ -2046,16 +1932,11 @@ export interface D3plusConfig {
2046
1932
  */
2047
1933
  overlap?: number;
2048
1934
  /**
2049
- Room (px) the Radar reserves around its web for the metric labels.
2050
- `"auto"` (the default) curves every metric name along the web when
2051
- they all fit (see `labelPosition`), on one line or, for long names,
2052
- two, which needs only that much room.
2053
- Otherwise it measures the labels along their spokes and gives the web
2054
- the largest radius at which every label fits inside the chart,
2055
- wrapping long labels onto two lines (and truncating what still doesn't
2056
- fit) rather than shrinking the web below half its largest possible
2057
- size; names that fit along the web at that radius still curve. A
2058
- number reserves exactly that much room and wraps labels to that width.
1935
+ Room (px) reserved around a Radar's web (or a polar chart's circle) for
1936
+ its labels. `"auto"` (the default) curves every label along the edge
1937
+ when they all fit (see `labelPosition`), else sizes the circle to the
1938
+ labels measured along their spokes, wrapping long ones onto two lines.
1939
+ A number reserves exactly that much room.
2059
1940
  */
2060
1941
  outerPadding?: number | "auto";
2061
1942
  /** Priestley and Gantt: the space between neighboring bars, as a share of each row (d3's band `paddingInner`). */
@@ -2124,49 +2005,25 @@ export interface D3plusConfig {
2124
2005
  */
2125
2006
  reducedMotion?: "auto" | boolean;
2126
2007
  /**
2127
- Plot: shaded spans across the plot between two values, such as a
2128
- recession or a target range. Give each entry `x` (a vertical band) or
2129
- `y` (a horizontal one) as `[start, end]` in data units (numbers, dates,
2130
- or categories; on a category axis the band covers each end category's
2131
- whole slot), or `x2`/`y2` for the secondary axes, or `ref: "plot"` for
2132
- fractions of the plot area. An optional `label` sits inside the band's
2133
- top-left corner (`labelPosition: "end"` for the top-right), with
2134
- `fontColor`, `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, and
2135
- `maxWidth`. The fill defaults to the chart's text color at `fillOpacity`
2136
- `0.08`, so it reads on light and dark themes; `stroke`, `strokeWidth`,
2137
- and `strokeOpacity` add edges. On a continuous or time axis the band's
2138
- ends count toward the axis domain, widening it to show the whole band
2139
- (an end set by `xDomain`/`yDomain`/`x2Domain`/`y2Domain` or the axis
2140
- config's `domain` stays put). Each entry expands into a
2141
- `"ReferenceBand"` annotation (see `annotations`) behind the data
2142
- (`layer: "front"` to draw it over; its label always draws above), which follows zoom and never
2143
- responds to the pointer or keyboard. A label that would cover a data
2144
- label or another reference label moves to the band's other corners or
2145
- along its length, inside the plot, and is hidden when no spot is free.
2008
+ Plot: shaded spans between two values, such as a recession or a target
2009
+ range. Give each entry `x` (vertical) or `y` (horizontal) as
2010
+ `[start, end]` in data units, `x2`/`y2` for the secondary axes, or
2011
+ `ref: "plot"` for fractions of the plot. Optional: a `label` (top-left;
2012
+ `labelPosition: "end"` for top-right) with font keys and `maxWidth`,
2013
+ `fill`/`fillOpacity` (default the text color at `0.08`), `stroke`,
2014
+ `strokeWidth`, `strokeOpacity`, and `layer: "front"` to draw over the
2015
+ data. A band widens a continuous axis's domain to fit.
2146
2016
  */
2147
2017
  referenceBands?: ReferenceBandConfig[];
2148
2018
  /**
2149
- Plot: lines across the whole plot at one value, such as a target or a
2150
- launch date. Give each entry `x` (a vertical line) or `y` (a horizontal
2151
- one) in data units (a number, a date, or a category), or `x2`/`y2` for
2152
- the secondary axes, or `ref: "plot"` for a fraction of the plot area.
2153
- An optional `label` sits at the line's `"end"` (the right of a
2154
- horizontal line, the top of a vertical one) or `"start"`
2155
- (`labelPosition`), with `fontColor`, `fontFamily`, `fontSize`,
2156
- `fontWeight`, `lineHeight`, and `maxWidth`. The line's `stroke`
2157
- defaults to the chart's text color at `strokeOpacity` `0.6`, `strokeWidth`
2158
- `1`; `dash: true` dashes it ("4 4"), or give a dash pattern. On a
2159
- continuous or time axis the value counts toward the axis domain,
2160
- widening it to show the line (an end set by `xDomain`/`yDomain`/
2161
- `x2Domain`/`y2Domain` or the axis config's `domain` stays put; a value
2162
- outside such a domain is not drawn). Each entry
2163
- expands into a `"ReferenceLine"` annotation (see `annotations`) behind
2164
- the data (`layer: "front"` to draw it over; its label always draws
2165
- above), which follows zoom and
2166
- never responds to the pointer or keyboard. A label that would cover a
2167
- data label or another reference label moves to the line's other side
2168
- or end, or along it, inside the plot, and is hidden when no spot is
2169
- free.
2019
+ Plot: lines across the plot at one value, such as a target or a launch
2020
+ date. Give each entry `x` (vertical) or `y` (horizontal) in data units,
2021
+ `x2`/`y2` for the secondary axes, or `ref: "plot"` for a fraction of the
2022
+ plot. Optional: a `label` at the line's `"end"` or `"start"`
2023
+ (`labelPosition`) with font keys and `maxWidth`, `stroke`/`strokeOpacity`
2024
+ (default the text color at `0.6`), `strokeWidth` (`1`), `dash` (`true`
2025
+ or a dash pattern), and `layer: "front"` to draw over the data. A line
2026
+ widens a continuous axis's domain to fit.
2170
2027
  */
2171
2028
  referenceLines?: ReferenceLineConfig[];
2172
2029
  /** Row key for matrix-style layouts. */
@@ -2347,16 +2204,12 @@ export interface D3plusConfig {
2347
2204
  /** Accessor function or string for the visualization's subtitle. */
2348
2205
  subtitle?: string | ((data: DataPoint[]) => string);
2349
2206
  /**
2350
- Packs a Plot's circles into a beeswarm: each circle keeps its value along
2351
- one axis and is placed beside its neighbors along the other, so none
2352
- overlap. `"x"` or `"y"` names the value axis; `true` uses x when its
2353
- values are numeric, else y; `false` draws a plain scatter. When the other
2354
- axis holds categories (strings), each category gets its own swarm in its
2355
- own band; otherwise that axis's values are ignored and its axis is hidden.
2356
- Circles keep their ids, so switching a chart between `false` and `true`
2357
- animates each circle between its scatter and swarm position. The default,
2358
- `"auto"`, swarms only when every mark is a Circle and every row lacks a y
2359
- (or x) value.
2207
+ Packs a Plot's circles into a beeswarm: each keeps its value along one
2208
+ axis and is placed beside its neighbors along the other, so none
2209
+ overlap. `"x"` or `"y"` names the value axis; `true` picks x when its
2210
+ values are numeric, else y; `false` draws a plain scatter. A category
2211
+ axis gets one swarm per category. The default, `"auto"`, swarms only
2212
+ when every mark is a Circle and rows lack the other axis's value.
2360
2213
  */
2361
2214
  swarm?: boolean | "auto" | "x" | "y";
2362
2215
  /**
@@ -2432,19 +2285,11 @@ export interface D3plusConfig {
2432
2285
  targetConfig?: Record<string, unknown>;
2433
2286
  /**
2434
2287
  The chart's colors. `"auto"` (the default) paints no background and
2435
- follows the page behind the chart: its chrome text contrasts with the
2436
- page, its tooltip, table view, and overlays turn dark on a dark page,
2437
- and it redraws when the page flips between light and dark. `"light"` and
2438
- `"dark"` paint the theme's background behind the chart (so it reads the
2439
- same on any page, and in a saved image) and take every chrome color
2440
- from the theme. An object sets your own tokens on top of the preset its
2441
- `base` names (`"light"` or `"dark"`), for example
2442
- `{base: "dark", background: "#123", accent: "#ffd43b"}`. A dark theme
2443
- also turns color scale ramps around, from a dim tint near the background
2444
- up to a bright pole (see the `colorScale` tokens). Colors you set in the
2445
- other config (`titleConfig.fontColor`, `tooltipConfig`,
2446
- `colorScaleConfig.colorMax`, the `*Style` options, …) win over the
2447
- theme.
2288
+ follows the page, light or dark. `"light"` and `"dark"` paint the
2289
+ theme's background and take every chrome color from it. An object
2290
+ overrides tokens on top of its `base` preset, e.g.
2291
+ `{base: "dark", background: "#123", accent: "#ffd43b"}`. Colors set
2292
+ elsewhere in the config win over the theme.
2448
2293
  */
2449
2294
  theme?: ThemeSetting;
2450
2295
  /**
@@ -2513,8 +2358,15 @@ export interface D3plusConfig {
2513
2358
  `labelPosition`.
2514
2359
  */
2515
2360
  todayConfig?: Omit<ReferenceLineConfig, "x" | "y" | "x2" | "y2" | "ref">;
2516
- /** Whether to show tooltips, or a `(datum, index)` accessor deciding per mark. */
2517
- tooltip?: boolean | ((d: DataPoint, i: number) => boolean);
2361
+ /**
2362
+ Whether to show tooltips, or a
2363
+ `(datum, index, {depth, maxDepth, legend})` accessor deciding per mark
2364
+ and legend entry. `depth` is the `groupBy` level (from 0) the hovered
2365
+ item stands for and `maxDepth` the deepest level, so
2366
+ `depth === maxDepth` keeps tooltips to the deepest level; `legend` is
2367
+ true for a legend entry. Defaults to `true`.
2368
+ */
2369
+ tooltip?: boolean | ((d: DataPoint, i: number, levels: TooltipLevels) => boolean);
2518
2370
  /** Configuration for the tooltip component. */
2519
2371
  tooltipConfig?: TooltipConfig;
2520
2372
  /**
@@ -2616,16 +2468,10 @@ export interface D3plusConfig {
2616
2468
  */
2617
2469
  xBreak?: [number, number] | [number, number][];
2618
2470
  /**
2619
- The x domain as an array. On a continuous axis it is `[min, max]`.
2620
- Setting just one end (`[min]` or `[undefined, max]`) pins only that
2621
- end: the data fills the other, rounded where the axis would round it
2622
- with no domain set (left at the data when `xConfig`'s `rounding`
2623
- is "none"; time axes aren't rounded). With both ends set, neither is
2624
- rounded. On a discrete axis it lists the categories to show, in
2625
- order; data in other categories is not drawn. A full `xConfig`
2626
- `domain` is the lower-level override: it wins over this, and is drawn
2627
- exactly as given (rounded only by `xConfig`'s own `rounding`),
2628
- without stretching to the chart's `baseline`.
2471
+ The x domain: `[min, max]` on a continuous axis, or the categories to
2472
+ show, in order, on a discrete one. Setting one end (`[min]` or
2473
+ `[undefined, max]`) pins only that end; the data fills the other. An
2474
+ `xConfig.domain` overrides this.
2629
2475
  */
2630
2476
  xDomain?: (number | string | Date)[];
2631
2477
  /** The x2 domain as an array. If either value is undefined, it is calculated from the data. */
@@ -2646,16 +2492,10 @@ export interface D3plusConfig {
2646
2492
  */
2647
2493
  yBreak?: [number, number] | [number, number][];
2648
2494
  /**
2649
- The y domain as an array. On a continuous axis it is `[min, max]`.
2650
- Setting just one end (`[min]` or `[undefined, max]`) pins only that
2651
- end: the data fills the other, rounded where the axis would round it
2652
- with no domain set (left at the data when `yConfig`'s `rounding`
2653
- is "none"; time axes aren't rounded). With both ends set, neither is
2654
- rounded. On a discrete axis it lists the categories to show, in
2655
- order; data in other categories is not drawn. A full `yConfig`
2656
- `domain` is the lower-level override: it wins over this, and is drawn
2657
- exactly as given (rounded only by `yConfig`'s own `rounding`),
2658
- without stretching to the chart's `baseline`.
2495
+ The y domain: `[min, max]` on a continuous axis, or the categories to
2496
+ show, in order, on a discrete one. Setting one end (`[min]` or
2497
+ `[undefined, max]`) pins only that end; the data fills the other. A
2498
+ `yConfig.domain` overrides this.
2659
2499
  */
2660
2500
  yDomain?: (number | string | Date)[];
2661
2501
  /** The y2 domain as an array. If either value is undefined, it is calculated from the data. */
@@ -2666,7 +2506,13 @@ export interface D3plusConfig {
2666
2506
  y2Sort?: (a: DataPoint, b: DataPoint) => number;
2667
2507
  /** Calendar: formats the year beside each year block — a d3-time-format specifier (default `"%Y"`), a function of the year's first day, or `false` for none. */
2668
2508
  yearFormat?: string | ((date: Date) => string) | false;
2669
- /** Enables pan/zoom with zoom-control buttons. On by default for every chart. */
2509
+ /**
2510
+ Enables pan and zoom: the mouse wheel or a pinch (see `zoomScroll`), a
2511
+ drag (see `zoomDrag`), a double-click (see `zoomDoubleClick`), the
2512
+ zoom-control buttons (see `zoomControls`), and the `zoomIn`, `zoomOut`,
2513
+ `zoomReset`, and `zoomBrush` methods. On by default for every chart;
2514
+ `false` turns all of them off.
2515
+ */
2670
2516
  zoom?: boolean;
2671
2517
  /** The pixel stroke-width of the zoom brush area. */
2672
2518
  zoomBrushHandleSize?: number;
@@ -2683,7 +2529,21 @@ export interface D3plusConfig {
2683
2529
  */
2684
2530
  zoomControlClassName?: string;
2685
2531
  /**
2686
- Overrides one or more of the four built-in zoom-control icons (`zoomIn`, `zoomOut`, `zoomReset`, `zoomBrush`), which otherwise render as inline SVGs. Each value is either an HTML string — used as the button's content in place of the built-in icon — or a mount function, `(el: HTMLElement) => void | (() => void)`, called once with the button's reserved icon slot (a 12x12px element) so you can mount anything imperative into it: a React tree (`createRoot(el).render(<Icon/>)`), a Vue app, a canvas sprite, a brand `<img>`. Return a cleanup function from the mount function if there's teardown to do; it runs right before that slot is discarded — which happens whenever the whole button panel's markup regenerates (a `.locale(...)` change, a `zoomControlClassName` change, or the brush toggle switching), not just once per chart.
2532
+ Whether the zoom-control buttons (zoom in, zoom out, reset, and brush)
2533
+ show in the chart's top-right corner. `false` hides them and gives the
2534
+ room they take back to the chart's title, legend, and other top
2535
+ content, while zooming stays on: the wheel, pinch, drag, and
2536
+ double-click gestures still work, and the chart's `zoomIn`, `zoomOut`,
2537
+ `zoomReset`, and `zoomBrush` methods let buttons of your own drive it.
2538
+ Defaults to `true`.
2539
+ */
2540
+ zoomControls?: boolean;
2541
+ /**
2542
+ Overrides the zoom-control icons (`zoomIn`, `zoomOut`, `zoomReset`,
2543
+ `zoomBrush`). Each value is an HTML string, or a mount function
2544
+ `(el) => void | (() => void)` called with the button's 12×12px icon slot
2545
+ (for a React tree, an `<img>`, …); a returned cleanup runs when the
2546
+ buttons redraw.
2687
2547
  */
2688
2548
  zoomControlIcons?: Partial<Record<"zoomIn" | "zoomOut" | "zoomReset" | "zoomBrush", string | ((el: HTMLElement) => void | (() => void))>>;
2689
2549
  /**
@@ -2698,11 +2558,27 @@ export interface D3plusConfig {
2698
2558
  An object containing CSS key/value pairs that is used to style each zoom control button on hover (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.zoomControlClassName(...)` is set, unless you've explicitly customized this yourself.
2699
2559
  */
2700
2560
  zoomControlStyleHover?: Record<string, unknown> | false;
2561
+ /**
2562
+ What a double-click on the chart does: `"in"` (the default) doubles
2563
+ the zoom around the pointer (Shift + double-click halves it),
2564
+ `"reset"` returns to the chart's initial view, like the reset button,
2565
+ and `false` does nothing.
2566
+ */
2567
+ zoomDoubleClick?: "in" | "reset" | false;
2568
+ /**
2569
+ What a mouse drag on the chart does. `"pan"` (the default) pans it
2570
+ (see `zoomPan`). `"brush"` draws a box and zooms into it on release,
2571
+ as the brush button does, without turning brush mode on: a click that
2572
+ doesn't drag still reaches the shape under it, and hovering still
2573
+ shows tooltips. Shift + drag pans in `"brush"` mode, and touch keeps
2574
+ panning and pinching as in `"pan"`.
2575
+ */
2576
+ zoomDrag?: "pan" | "brush";
2701
2577
  /** Multiplier applied to programmatic zoom steps. */
2702
2578
  zoomFactor?: number;
2703
2579
  /** Maximum zoom scale factor. Defaults to the scale at which the smallest shape fills the chart area. */
2704
2580
  zoomMax?: number;
2705
- /** A pixel value to be used to pad all sides of a zoomed area. */
2581
+ /** A pixel value to be used to pad all sides of a zoomed area. A Plot's brushed box fills its plot without it, so its axes show the brushed range. */
2706
2582
  zoomPadding?: number;
2707
2583
  /** Whether panning (drag) is enabled while zoomed. */
2708
2584
  zoomPan?: boolean;