@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
@@ -29,8 +29,10 @@ import { rowSpan } from "../Plot/discreteSpan.js";
29
29
  import { emitFillBetween } from "../Plot/fillBetween.js";
30
30
  import { applyStackShareLabels } from "../Plot/stackShareLabels.js";
31
31
  import { stackEnterWindows } from "../Plot/stackEnter.js";
32
+ import { growAreasFromBaseline } from "../Plot/areaEnter.js";
32
33
  import { swarmPlacements } from "../Plot/swarm.js";
33
34
  import { forecastDashOr, forecastLineDash } from "../Plot/forecastScene.js";
35
+ import { lineMarkerKeys } from "../Plot/lineMarkerKeys.js";
34
36
  import { collectComputed, makeShape, shapeConfigFor } from "./emitHelpers.js";
35
37
  import { boxLabelsOnly } from "../Plot/areaLabelsAlong.js";
36
38
  import { markSharedConfig } from "../../utils/configWarnings.js";
@@ -92,6 +94,8 @@ import { markSharedConfig } from "../../utils/configWarnings.js";
92
94
  ...nodes,
93
95
  ...besideLabels?.() ?? []
94
96
  ]);
97
+ // Areas grow out of the value axis's baseline.
98
+ if (key === "Area") growAreasFromBaseline(ctx, nodes);
95
99
  if (key !== "Bar") return nodes;
96
100
  // Error bars paint over their bars but under the bar labels. Stacked bars
97
101
  // grow in one stack level after another.
@@ -310,7 +314,9 @@ import { markSharedConfig } from "../../utils/configWarnings.js";
310
314
  ...labelOverride?.(user)
311
315
  }) : undefined);
312
316
  out.push(...gaps ? breakLines(lines, gaps) : lines);
313
- const markers = makeShape("Circle").renderMode("compute").data(viz._lineMarkers ? values : []).config(ctx.shapeConfig).config(viz._lineMarkerConfig).id((d)=>`${d.id}_${d.discrete}`);
317
+ const points = viz._lineMarkers ? values : [];
318
+ const keys = lineMarkerKeys(points, viz.schema.discrete);
319
+ const markers = makeShape("Circle").renderMode("compute").data(points).config(ctx.shapeConfig).config(viz._lineMarkerConfig).id((d)=>keys.get(d));
314
320
  viz._wirePlotShapeEvents(markers, "Circle", ctx.events);
315
321
  markers.render();
316
322
  out.push(...collectComputed(markers));
@@ -7,7 +7,8 @@
7
7
  `width` pixels wide (half of it past each glyph's edge).
8
8
  @param nodes The scene nodes.
9
9
  @param color The halo color, usually the chart's background.
10
- @param width The halo's stroke width.
10
+ @param width The halo's stroke width, or a function of each text node
11
+ that gives it (to scale it with the text's size).
11
12
  */ export function textHalo(nodes, color, width) {
12
13
  return nodes.map((node)=>{
13
14
  if (node.type === "group") return {
@@ -21,7 +22,7 @@
21
22
  paint: {
22
23
  ...node.paint,
23
24
  stroke: color,
24
- strokeWidth: width,
25
+ strokeWidth: typeof width === "function" ? width(node) : width,
25
26
  strokeOpacity: 1
26
27
  }
27
28
  };
@@ -7,7 +7,8 @@
7
7
  import { legendLargestFirst } from "../features/sharedFields.js";
8
8
  import { thresholdFunction } from "../Treemap/thresholdFunction.js";
9
9
  import { partitionSort } from "./hierarchy.js";
10
- import { partitionHandlers } from "./interaction.js";
10
+ import { partitionHandlers, partitionNodeOf } from "./interaction.js";
11
+ import { setOwnClick } from "../viz/userClick.js";
11
12
  /** Buckets small branches into a "Values" node per `threshold` (Treemap's algorithm). */ export function partitionThreshold(viz, data) {
12
13
  return thresholdFunction(data, {
13
14
  aggs: viz.schema.aggs,
@@ -31,14 +32,22 @@ import { partitionHandlers } from "./interaction.js";
31
32
  /** Legend entries ordered by value, largest first. */ export function partitionLegendSort(viz) {
32
33
  return legendLargestFirst(viz, "sum");
33
34
  }
35
+ /**
36
+ A def's `shapeDepth`: the `groupBy` level of the node a row is laid out
37
+ as, so a `tooltip` accessor can tell a parent node from the deepest ones.
38
+ */ export function partitionShapeDepth(interaction) {
39
+ return (viz, d)=>partitionNodeOf(viz, d, interaction.prefix)?.level;
40
+ }
34
41
  /**
35
42
  Records the chart's own default `color` and `shapeConfig.fill` (shading
36
43
  applies only while they stay in place) as `<prefix>DefaultColor` and
37
44
  `<prefix>DefaultFill`, and installs the shared hover, tooltip, and
38
- click-to-zoom handlers.
45
+ click-to-zoom handlers, the last as the chart's own click.
39
46
  */ export function partitionSetup(viz, interaction) {
40
47
  const { prefix } = interaction;
41
48
  viz.ctx[`${prefix}DefaultColor`] = viz.schema.color;
42
49
  viz.ctx[`${prefix}DefaultFill`] = viz.schema.shapeConfig.fill;
43
- Object.assign(viz.schema.on, partitionHandlers(viz, (viz.schema.tooltipConfig.tbody ?? [])[0] ?? [], interaction));
50
+ const handlers = partitionHandlers(viz, (viz.schema.tooltipConfig.tbody ?? [])[0] ?? [], interaction);
51
+ Object.assign(viz.schema.on, handlers);
52
+ setOwnClick(viz, "click.shape", handlers["click.shape"]);
44
53
  }
@@ -7,6 +7,9 @@
7
7
  */ import { formatAbbreviate } from "@d3plus/format";
8
8
  import { leadTitleWithSwatch, pickSwatch } from "../features/tooltipSwatch.js";
9
9
  import { latestDrillEntry, removeLatestDrillEntry } from "../viz/history.js";
10
+ import { setCursor } from "../viz/setCursor.js";
11
+ import { tooltipEnabled } from "../viz/tooltipEnabled.js";
12
+ import { hasOwnClick, hasUserClick } from "../viz/userClick.js";
10
13
  import { partitionLineage } from "./hierarchy.js";
11
14
  import { partitionFocus } from "./zoom.js";
12
15
  /** The laid-out node an event datum (a row, or a label wrapping one) belongs to. */ export function partitionNodeOf(viz, d, prefix) {
@@ -98,7 +101,7 @@ import { partitionFocus } from "./zoom.js";
98
101
  Fills in what the shared shape tooltip can't know about a node — its label
99
102
  at its own level, the click hint, and its share of the parent — leaving
100
103
  any of them the user configured through `tooltipConfig` alone.
101
- */ function partitionTooltip(viz, node, shareRow) {
104
+ */ function partitionTooltip(viz, node, shareRow, zooms) {
102
105
  const tooltip = viz._tooltipClass;
103
106
  const config = viz.schema.tooltipConfig;
104
107
  if (config.title === undefined) {
@@ -106,7 +109,7 @@ import { partitionFocus } from "./zoom.js";
106
109
  leadTitleWithSwatch(tooltip.title(()=>label), pickSwatch(viz, viz._lastScenePick));
107
110
  }
108
111
  if (config.footer === undefined) {
109
- const hint = !partitionClickable(viz, node) ? false : viz.schema.translate(partitionDrillable(viz, node) ? "Click to Expand" : "Click to Zoom Out");
112
+ const hint = !zooms ? false : viz.schema.translate(partitionDrillable(viz, node) ? "Click to Expand" : "Click to Zoom Out");
110
113
  tooltip.footer(hint);
111
114
  }
112
115
  const extra = partitionParentShareRow(viz, node);
@@ -147,9 +150,11 @@ import { partitionFocus } from "./zoom.js";
147
150
  const node = nodeOf(d);
148
151
  if (!node) return;
149
152
  if (viz.ctx[`${prefix}Hovered`] !== node) hoverNode(node);
150
- const userClick = Boolean(viz.schema.on.click);
151
- viz._select?.style("cursor", userClick || partitionClickable(viz, node) ? "pointer" : "auto");
152
- if (viz._tooltipClass && viz.schema.tooltip(d, i)) partitionTooltip(viz, node, shareRow);
153
+ // The hand shows where a click zooms, or runs a handler of the user's;
154
+ // a click zooms only while the chart's own handler is in place.
155
+ const zooms = hasOwnClick(viz, "click.shape") && partitionClickable(viz, node);
156
+ setCursor(viz, zooms || hasUserClick(viz, "click.shape") ? "pointer" : "auto");
157
+ if (viz._tooltipClass && tooltipEnabled(viz, d, i)) partitionTooltip(viz, node, shareRow, zooms);
153
158
  },
154
159
  "click.shape": (d, _i, _x, event)=>{
155
160
  event?.stopPropagation?.();
@@ -17,6 +17,7 @@
17
17
 
18
18
  @module
19
19
  */ import { negativeSpace } from "@d3plus/math";
20
+ import { labelLineHeight } from "../../components/Axis/axisLabelLineHeight.js";
20
21
  import { chartBounds } from "../features/chartGeometry.js";
21
22
  import { colorScaleValue } from "../features/colorScaleValue.js";
22
23
  import { paintColorScaleInset } from "../features/featuresColorScale.js";
@@ -29,7 +30,7 @@ import { bottomRightControlsBox } from "../drawSteps/bottomRightControlsMarkup.j
29
30
  import { MINIMAP_RIGHT_INSET } from "../drawSteps/minimapMarkup.js";
30
31
  import { getTopLeftContributions } from "../drawSteps/topLeftControls.js";
31
32
  import { topLeftControlsBox } from "../drawSteps/topLeftControlsMarkup.js";
32
- import { zoomControlsBox } from "../drawSteps/zoomControlsMarkup.js";
33
+ import { minimapAnchor, zoomControlsBox } from "../drawSteps/zoomControlsMarkup.js";
33
34
  import { resolveSpec } from "./resolveSpec.js";
34
35
  /**
35
36
  The default inset region: the chart area (or `bounds`, in surface
@@ -52,7 +53,11 @@ import { resolveSpec } from "./resolveSpec.js";
52
53
  const flag = viz.schema.legendInset;
53
54
  return typeof flag === "function" ? Boolean(flag.bind(viz)(resolveSpec(viz))) : Boolean(flag);
54
55
  }
55
- /** The smallest a legend entry can be: a swatch (1.4× the 12px label font) plus its padding. */ const MIN_LEGEND_ENTRY = 12 * 1.4 + 5;
56
+ /**
57
+ The smallest a legend entry can be: the row a 12px label line takes, as
58
+ the Legend measures it (the line at the height it paints, see
59
+ `labelLineHeight`, and the pixel above it), plus the Legend's padding.
60
+ */ export const MIN_LEGEND_ENTRY = Math.ceil(labelLineHeight(undefined, null, 0, 12) + 1) + 5;
56
61
  /**
57
62
  Whether the legend could possibly lay out inside the chart: its entries,
58
63
  even with their labels dropped, must fit the largest frame an inset
@@ -179,7 +184,7 @@ import { resolveSpec } from "./resolveSpec.js";
179
184
  */ function chromeBoxes(viz) {
180
185
  const boxes = [];
181
186
  const { width, height } = chartBounds(viz);
182
- const zoom = zoomControlsBox(viz);
187
+ const zoom = viz.schema.minimap ? minimapAnchor(viz) : zoomControlsBox(viz);
183
188
  if (zoom) {
184
189
  const minimap = viz.schema.minimap ? (zoom.width - MINIMAP_RIGHT_INSET) * (height / Math.max(1, width)) : 0;
185
190
  boxes.push({
@@ -6,8 +6,12 @@
6
6
  everything here is non-interactive scenery drawn beneath the marks.
7
7
  */ import { textWidth } from "@d3plus/dom";
8
8
  import { emitLabels } from "../../shapes/emitLabels.js";
9
+ import { textLineBoxes } from "../features/linkLabels.js";
10
+ import { clearRingLabels } from "../features/ringLabelNodes.js";
11
+ import { ringLabelPosition } from "../features/ringLabels.js";
9
12
  import { radarAxisLabelLayout, RADAR_EDGE_GAP, RADAR_LABEL_MAX_LINES } from "../Radar/axisLabels.js";
10
13
  import { labelFont, radarLevelLabelNodes, radarRingNodes } from "../Radar/axisDecorations.js";
14
+ import { radarCurveNodes, radarCurvedLayout, radarCurvesAt } from "../Radar/curvedLabels.js";
11
15
  import { textWrap } from "@d3plus/text";
12
16
  import { POLAR_LABEL_PADDING, polarHorizontalLayout, polarLabelPlacement, polarLabelsCollide, polarSpokeRotation } from "./labels.js";
13
17
  /** The narrowest box a category label is laid out in, in pixels. */ const LABEL_MIN_WIDTH = 12;
@@ -62,17 +66,61 @@ const alignFor = (uy)=>uy < -0.3 ? "bottom" : uy > 0.3 ? "top" : "middle";
62
66
  }
63
67
  /**
64
68
  Lays out the category labels around a circle centered in `width` ×
65
- `height`, and the circle's radius. `outerPadding` "auto" sizes both from
66
- the measured labels; a number reserves that many pixels around the
67
- circle. With `show` false, the circle fills the area.
69
+ `height`, and the circle's radius. `outerPadding` "auto" curves every
70
+ label just outside the circle when they all fit (see `labelPosition`),
71
+ which leaves the circle the most room, and otherwise sizes both from the
72
+ measured straight labels; a number reserves that many pixels around the
73
+ circle. Either way, a label that fits along the circle curves. With
74
+ `show` false, the circle fills the area.
68
75
  */ export function polarCategoryLayout(viz, categories, width, height, show = true) {
69
76
  const half = Math.max(0, Math.min(width, height) / 2);
70
77
  if (!show || !categories.length) return {
71
78
  radius: half,
72
- labels: []
79
+ labels: [],
80
+ curves: []
73
81
  };
74
- const outerPadding = viz.schema.outerPadding;
75
82
  const fonts = categories.map((c, i)=>labelFont(viz, c.text, c.data, i));
83
+ const inputs = categories.map((c, i)=>({
84
+ text: c.text,
85
+ data: c.data,
86
+ angle: c.angle - Math.PI / 2,
87
+ span: c.span,
88
+ font: fonts[i]
89
+ }));
90
+ const curveLabels = (curves)=>categories.flatMap((c, i)=>{
91
+ const curve = curves[i];
92
+ return curve ? [
93
+ {
94
+ key: c.key,
95
+ data: c.data,
96
+ i,
97
+ curve
98
+ }
99
+ ] : [];
100
+ });
101
+ const room = Math.max(0, half - RADAR_EDGE_GAP);
102
+ if (typeof viz.schema.outerPadding !== "number") {
103
+ const curved = radarCurvedLayout(viz, inputs, room);
104
+ if (curved) return {
105
+ radius: curved.radius,
106
+ labels: [],
107
+ curves: curveLabels(curved.curves)
108
+ };
109
+ }
110
+ const straight = straightLayout(viz, categories, fonts, width, height);
111
+ const curves = radarCurvesAt(viz, inputs, straight.radius, room);
112
+ return {
113
+ radius: straight.radius,
114
+ labels: straight.labels.filter((l, i)=>!curves[i] && ringLabelPosition(viz, l.data, i) !== "along"),
115
+ curves: curveLabels(curves)
116
+ };
117
+ }
118
+ /**
119
+ The straight category labels: read horizontally, or along their spokes
120
+ when neighbors would overlap that way.
121
+ */ function straightLayout(viz, categories, fonts, width, height) {
122
+ const half = Math.max(0, Math.min(width, height) / 2);
123
+ const outerPadding = viz.schema.outerPadding;
76
124
  const style = (i)=>({
77
125
  "font-family": fonts[i].fontFamily,
78
126
  "font-size": fonts[i].fontSize,
@@ -131,11 +179,24 @@ const alignFor = (uy)=>uy < -0.3 ? "bottom" : uy > 0.3 ? "top" : "middle";
131
179
  outerPadding
132
180
  });
133
181
  }
134
- /** Builds the category label nodes laid out by `polarCategoryLayout`. */ export function polarCategoryNodes(viz, labels, key) {
135
- if (!labels.length) return [];
182
+ /**
183
+ Builds the category label nodes laid out by `polarCategoryLayout`: the
184
+ curved ones, and the straight ones that stay clear of them.
185
+ */ export function polarCategoryNodes(viz, { labels, curves }, key) {
186
+ if (!labels.length && !curves.length) return [];
136
187
  const axisConfig = viz.schema.axisConfig;
188
+ const labelConfig = axisConfig.shapeConfig?.labelConfig ?? {};
189
+ // Each label follows the hover of its slot's marks (see `hoverKeys`).
190
+ const curved = radarCurveNodes(viz, curves.map((c)=>({
191
+ ...c,
192
+ key: `${key}-label-${c.key}`,
193
+ hoverMatch: {
194
+ field: "slot",
195
+ value: c.key
196
+ }
197
+ })), labelConfig);
137
198
  const asLabel = (d)=>d;
138
- const nodes = emitLabels({
199
+ const straight = emitLabels({
139
200
  data: labels,
140
201
  label: (d)=>asLabel(d).text,
141
202
  x: (d)=>asLabel(d).x,
@@ -145,10 +206,21 @@ const alignFor = (uy)=>uy < -0.3 ? "bottom" : uy > 0.3 ? "top" : "middle";
145
206
  id: (d)=>`${key}-label-${asLabel(d).id}`,
146
207
  labelBounds: (d)=>asLabel(d).labelBounds,
147
208
  labelConfig: {
148
- ...axisConfig.shapeConfig?.labelConfig ?? {},
209
+ ...labelConfig,
149
210
  verticalAlign: (d)=>d.data?.verticalAlign ?? "middle"
150
211
  }
151
212
  });
213
+ for (const n of straight){
214
+ const slot = n.datum?.data?.id;
215
+ if (slot !== undefined) n.hoverMatch = {
216
+ field: "slot",
217
+ value: slot
218
+ };
219
+ }
220
+ const nodes = [
221
+ ...curved,
222
+ ...clearRingLabels(straight, textLineBoxes(curved))
223
+ ];
152
224
  for (const n of nodes)n.interactive = false;
153
225
  return nodes.length ? [
154
226
  {
@@ -60,6 +60,10 @@ import { backgroundInk, chartGridline } from "../viz/backgroundInk.js";
60
60
  arc: w.arc,
61
61
  datum: w.data,
62
62
  index: w.i,
63
+ // Its category's labels stay bright while it's hovered.
64
+ hoverKeys: {
65
+ slot: w.slot
66
+ },
63
67
  // Explicit, so an exiting wedge fades from a real starting opacity.
64
68
  paint: {
65
69
  ...paint,
@@ -92,6 +92,7 @@ import { polarSharedExtent } from "./polarFacet.js";
92
92
  key: s.key,
93
93
  text: opts.slotLabel(s.key, members),
94
94
  angle: s.angle,
95
+ span: s.endAngle - s.startAngle,
95
96
  data: members.length === 1 ? members[0] : merge(members, aggs)
96
97
  };
97
98
  });
@@ -123,7 +124,7 @@ import { polarSharedExtent } from "./polarFacet.js";
123
124
  const chrome = polarLevelNodes(viz, levels, outer, toRadius, opts.key);
124
125
  const scene = Array.isArray(viz._chartScene) ? viz._chartScene : viz._chartScene = [];
125
126
  if (opts.trackPaint) scene.push(trackGroup(opts.key, slots, tracks, opts.trackPaint));
126
- scene.push(...chrome.rings, ...polarCategoryNodes(viz, layout.labels, opts.key), ...chrome.labels);
127
+ scene.push(...chrome.rings, ...polarCategoryNodes(viz, layout, opts.key), ...chrome.labels);
127
128
  const frame = {
128
129
  inner,
129
130
  outer,
@@ -19,11 +19,13 @@ import { handlerDatum, shapeClassTargets } from "./shapeClassTargets.js";
19
19
  import { reportHandlerError } from "./reportHandlerError.js";
20
20
  import { vizClassNameTargets } from "./vizClassName.js";
21
21
  import { themeBackground, unwatchPageTheme } from "./vizTheme.js";
22
- import { stopVisibilityWatch } from "./vizVisibility.js";
22
+ import { releaseScene, stopVisibilityWatch } from "./vizVisibility.js";
23
23
  import { applyClassName, withRootClasses } from "../../utils/className.js";
24
- import { handleColorScaleHover } from "../features/colorScaleHover.js";
24
+ import { handleAxisTooltip } from "../features/axisTooltip.js";
25
+ import { handleColorScaleHover, handleSwatchLabelHover } from "../features/colorScaleHover.js";
25
26
  import { appendFocusRing, syncKeyboardNav, teardownKeyboardNav } from "./keyboardNav.js";
26
27
  import { mountTargetFor } from "./mountTarget.js";
28
+ import { resetCursor } from "./setCursor.js";
27
29
  import { routePointerEvent } from "./nearestHover.js";
28
30
  import { nearestHoverSurface } from "./nearestHoverSurface.js";
29
31
  /**
@@ -256,8 +258,8 @@ import { nearestHoverSurface } from "./nearestHoverSurface.js";
256
258
  }
257
259
  }
258
260
  /**
259
- Draws the visualization given the specified configuration.
260
- @param callback Optional callback invoked after rendering completes. It also runs after every later redraw that doesn't pass a callback of its own, including the ones the chart starts itself (legend clicks, resizes, reloading after scrolling back into view), so it can redraw anything it adds to the chart.
261
+ Draws the visualization given the specified configuration. An error thrown while the chart draws (by an accessor in its config, say) is logged with `console.error`, and the chart keeps what it last painted.
262
+ @param callback Optional callback invoked after rendering completes. It also runs after every later redraw that doesn't pass a callback of its own, including the ones the chart starts itself (legend clicks, resizes, reloading after scrolling back into view), so it can redraw anything it adds to the chart. It still runs when the draw throws.
261
263
  */ render(callback) {
262
264
  return vizRender(this, callback);
263
265
  }
@@ -414,6 +416,14 @@ import { nearestHoverSurface } from "./nearestHoverSurface.js";
414
416
  */ _interactionDatum(pick, _event) {
415
417
  return handlerDatum(pick.datum, pick.index ?? 0);
416
418
  }
419
+ /**
420
+ The `groupBy` level a shape's row stands for (see
421
+ `ChartDefinition.shapeDepth`): undefined in the base chart, where every
422
+ shape sits at the level the chart draws.
423
+ @private
424
+ */ _shapeDepth(_d) {
425
+ return undefined;
426
+ }
417
427
  /**
418
428
  Whether a painted scene node is a point mark that nearest-point hover
419
429
  (`hoverDistance`) resolves the pointer to. None in the base chart;
@@ -460,6 +470,8 @@ import { nearestHoverSurface } from "./nearestHoverSurface.js";
460
470
  // transition timers; without this, switching kind (svg<->canvas) or
461
471
  // container orphans that DOM in the user's element, stacking the old
462
472
  // mode's output behind the new one and accumulating on every switch.
473
+ // The surface it leaves behind drops the hand cursor it may hold.
474
+ if (this._sceneRenderer) resetCursor(this);
463
475
  if (this._sceneRenderer && typeof this._sceneRenderer.destroy === "function") this._sceneRenderer.destroy();
464
476
  const Ctor = kind === "canvas" ? CanvasRenderer : SvgRenderer;
465
477
  this._sceneRenderer = new Ctor();
@@ -518,6 +530,12 @@ import { nearestHoverSurface } from "./nearestHoverSurface.js";
518
530
  // the transition guard below, so leaving mid-transition still clears it.
519
531
  this._sharedHover(event);
520
532
  handleColorScaleHover(this, event);
533
+ // An axis title or tick label with a tooltip of its own (see
534
+ // `handleAxisTooltip`), shown last so nothing above replaces it; a
535
+ // swatch label showing one also lights its bucket.
536
+ const axisTip = handleAxisTooltip(this, event);
537
+ handleSwatchLabelHover(this, event, axisTip);
538
+ if (axisTip) return;
521
539
  if (this._transitionEndsAt && Date.now() < this._transitionEndsAt) return;
522
540
  const pick = event.pick;
523
541
  // Dispatch helper shared by the live-pick path and the leave path.
@@ -619,7 +637,7 @@ import { nearestHoverSurface } from "./nearestHoverSurface.js";
619
637
  });
620
638
  }
621
639
  /**
622
- Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads and polling for data, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
640
+ Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads and polling for data, cancels work waiting for idle time, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
623
641
  */ destroy() {
624
642
  unregisterLink(this);
625
643
  teardownKeyboardNav(this);
@@ -632,16 +650,7 @@ import { nearestHoverSurface } from "./nearestHoverSurface.js";
632
650
  this._tooltipClass.data([]).render();
633
651
  select("body").on(`touchstart.${this._uuid}`, null);
634
652
  stopVisibilityWatch(this);
635
- if (this._sceneRepaintRAF != null) {
636
- if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(this._sceneRepaintRAF);
637
- this._sceneRepaintRAF = undefined;
638
- }
639
- // Destroy the active scene renderer (clears its own pointer-rect
640
- // listeners, overlay host, canvas/svg DOM, timers).
641
- if (this._sceneRenderer && typeof this._sceneRenderer.destroy === "function") {
642
- this._sceneRenderer.destroy();
643
- this._sceneRenderer = undefined;
644
- }
653
+ releaseScene(this);
645
654
  return this;
646
655
  }
647
656
  }
@@ -11,13 +11,15 @@ import { broadcastLink } from "./linkGroup.js";
11
11
  import { shapeHoverEnabled } from "./shapeHover.js";
12
12
  import { setLoaderValue } from "./loaderFormat.js";
13
13
  import { stopDataPolling } from "./vizDataPolling.js";
14
+ import { setZoomBrush, zoomBy } from "../drawSteps/zoomActions.js";
15
+ import { isBrushing } from "../drawSteps/zoomControlsMarkup.js";
14
16
  import { isPlainObject, mergeConfigBag, resolvesReset } from "../../fluent.js";
15
17
  import validateShapeConfig from "../../shapes/validateShapeConfig.js";
16
18
  import { displayName } from "../../utils/displayName.js";
17
19
  /**
18
20
  The fluent config accessors shared by every Viz chart that need more than
19
- storing their value (most are generated from `vizFields.ts`); `Viz` adds
20
- the render lifecycle.
21
+ storing their value (most are generated from `vizFields.ts`), and the
22
+ zoom actions; `Viz` adds the render lifecycle.
21
23
  */ class VizBase extends BaseClass {
22
24
  static _displayName = "VizBase";
23
25
  /**
@@ -154,6 +156,7 @@ Defaults to an empty array (`[]`).
154
156
  }
155
157
  hover(_) {
156
158
  if (!arguments.length) return this._hover;
159
+ const hadHover = typeof this._hover === "function";
157
160
  let hoverFunction = this._hover = _;
158
161
  if (this.schema.shapeConfig.hoverOpacity !== 1 && _ !== undefined) {
159
162
  if (typeof _ === "function") {
@@ -186,8 +189,10 @@ Defaults to an empty array (`[]`).
186
189
  // (`hoverOpacity: 1`, e.g. Geomap): the bucket highlight is applied by that
187
190
  // same pass, so without a repaint the map would never re-compose. Coalesced
188
191
  // to one paint per frame so a fast pointer sweep doesn't saturate the main
189
- // thread.
190
- if (this._sceneRenderer && _ !== undefined && (shapeHoverEnabled(this) || this._hoverBucket)) this._scheduleSceneRepaint();
192
+ // thread. Clearing a highlight always repaints: leaving a colorScale
193
+ // swatch clears its highlight a moment after the next shape's hover has
194
+ // already reset `_hoverBucket`.
195
+ if (this._sceneRenderer && _ !== undefined && (shapeHoverEnabled(this) || this._hoverBucket || hadHover)) this._scheduleSceneRepaint();
191
196
  broadcastLink(this, "hover", _);
192
197
  return this;
193
198
  }
@@ -298,6 +303,36 @@ Defaults to an empty array (`[]`).
298
303
  return this;
299
304
  } else return this.schema.total;
300
305
  }
306
+ /**
307
+ Zooms the chart in by `zoomFactor` about the center of the chart area,
308
+ as the zoom-in button does. Works whether or not the zoom-control
309
+ buttons show (see `zoomControls`), so a page's own button can call it;
310
+ does nothing while `zoom` is off or before the chart first renders.
311
+ */ zoomIn() {
312
+ zoomBy(this, this.schema.zoomFactor);
313
+ return this;
314
+ }
315
+ /**
316
+ Zooms the chart out by `zoomFactor` about the center of the chart
317
+ area, as the zoom-out button does. Does nothing while `zoom` is off or
318
+ before the chart first renders.
319
+ */ zoomOut() {
320
+ zoomBy(this, 1 / this.schema.zoomFactor);
321
+ return this;
322
+ }
323
+ /**
324
+ Returns the chart to its initial, unzoomed view, as the reset button
325
+ does. Does nothing while `zoom` is off or before the chart first
326
+ renders.
327
+ */ zoomReset() {
328
+ zoomBy(this, 0);
329
+ return this;
330
+ }
331
+ zoomBrush(_) {
332
+ if (!arguments.length) return isBrushing(this);
333
+ setZoomBrush(this, Boolean(_));
334
+ return this;
335
+ }
301
336
  }
302
337
  resolvesReset(VizBase.prototype, "facetConfig", "shapeConfig");
303
338
  export default VizBase; /* eslint-enable @typescript-eslint/no-unsafe-declaration-merging */
@@ -1,3 +1,4 @@
1
+ import { interpolateRgb } from "d3-interpolate";
1
2
  import { inkBackground, inkGrid, inkText } from "../../utils/themeInk.js";
2
3
  /**
3
4
  The chart's background: its theme's (the page's own in `"auto"` mode), or,
@@ -21,3 +22,12 @@ import { inkBackground, inkGrid, inkText } from "../../utils/themeInk.js";
21
22
  */ export function chartGridline(viz) {
22
23
  return inkGrid(viz);
23
24
  }
25
+ /**
26
+ A neutral fill between the chart's background and its ink, for a mark
27
+ that stands for a group rather than one value: Treemap's group headers
28
+ and Pack's group circles while a colorScale colors the rest, and Pack's
29
+ outermost circle.
30
+ @private
31
+ */ export function neutralFill(viz) {
32
+ return interpolateRgb(chartBackground(viz), backgroundInk(viz))(0.7);
33
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ How hover and active emphasize a matched mark (see
3
+ `applyInteractionOpacity`): its stroke darkened by `darken` and drawn
4
+ `width` times as wide.
5
+ */ export const STROKE_EMPHASIS = {
6
+ hover: {
7
+ darken: 0.5,
8
+ width: 2
9
+ },
10
+ active: {
11
+ darken: 1,
12
+ width: 3
13
+ }
14
+ };
@@ -0,0 +1,10 @@
1
+ import { color } from "d3-color";
2
+ /**
3
+ The stroke the chart's default `shapeConfig.stroke` draws around `fill`:
4
+ a shade darker, or the fill itself when it doesn't parse as a color (e.g.
5
+ "none"/"transparent" on a confidence band), which has no darker shade.
6
+ @private
7
+ */ export function fillStroke(fill) {
8
+ const c = color(fill);
9
+ return c ? c.darker(0.25).toString() : fill;
10
+ }