@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
@@ -11,18 +11,38 @@
11
11
  import { colorGrayscale } from "@d3plus/color";
12
12
  import { activeBucketColors } from "../features/colorScaleBucket.js";
13
13
  import { hoveredSwatch } from "../features/colorScaleHover.js";
14
+ import { datumValues } from "../features/hoverTicks.js";
15
+ import { STROKE_EMPHASIS } from "./emphasis.js";
14
16
  import { MARK_TYPES } from "./sceneRows.js";
15
17
  /** z value that floats a hovered/highlighted node above its (z-less, i.e. 0) siblings. */ const HOVER_RAISE_Z = 1e6;
16
18
  /**
17
19
  Emphasizes a matched mark's stroke on hover/active — the v3 `hoverStyle` /
18
20
  `activeStyle` look (a thicker, darker outline). v4 paints from the scene
19
- graph, so this reapplies it here: darken the fill by `darken` for the stroke
20
- and multiply the stroke width by `widthMult` (treating a 0/absent width as 1,
21
- matching the shape defaults). Non-mark nodes (labels, groups) are untouched.
22
- */ function emphasizeStroke(node, darken, widthMult) {
21
+ graph, so this reapplies it here: darken the fill by the kind's `darken`
22
+ for the stroke and multiply the stroke width by its `width` (treating a
23
+ 0/absent width as 1, matching the shape defaults; see `STROKE_EMPHASIS`).
24
+ A path with an `emphasis` takes its `d` for the kind, and a filled glyph
25
+ (an arrowhead) darkens its fill instead, so it stays the color of its
26
+ edge's stroke. Non-mark nodes (labels, groups) are untouched.
27
+ */ function emphasizeStroke(node, kind) {
28
+ const { darken, width } = STROKE_EMPHASIS[kind];
23
29
  const paint = {
24
30
  ...node.paint ?? {}
25
31
  };
32
+ const emphasis = node.type === "path" ? node.emphasis : undefined;
33
+ const d = emphasis?.d?.[kind];
34
+ const shaped = d ? {
35
+ ...node,
36
+ d
37
+ } : node;
38
+ if (emphasis?.fill) {
39
+ const c = typeof paint.fill === "string" ? color(paint.fill) : null;
40
+ if (c) paint.fill = c.darker(darken).formatHex();
41
+ return {
42
+ ...shaped,
43
+ paint
44
+ };
45
+ }
26
46
  let base = typeof paint.fill === "string" ? paint.fill : undefined;
27
47
  if (!base || base === "transparent" || base === "none") base = typeof paint.stroke === "string" ? paint.stroke : undefined;
28
48
  // No visible paint to emphasize (e.g. an invisible hit-area node): leave it
@@ -31,9 +51,9 @@ import { MARK_TYPES } from "./sceneRows.js";
31
51
  const c = color(base);
32
52
  if (c) paint.stroke = c.darker(darken).formatHex();
33
53
  const w = typeof paint.strokeWidth === "number" && paint.strokeWidth ? paint.strokeWidth : 1;
34
- paint.strokeWidth = w * widthMult;
54
+ paint.strokeWidth = w * width;
35
55
  return {
36
- ...node,
56
+ ...shaped,
37
57
  paint
38
58
  };
39
59
  }
@@ -153,6 +173,50 @@ import { MARK_TYPES } from "./sceneRows.js";
153
173
  return matchesChain(predicate, d, typeof d.i === "number" ? d.i : k);
154
174
  });
155
175
  }
176
+ /** Each `field` the scene's `hoverMatch` labels ask about. */ function hoverFields(nodes, out = new Set()) {
177
+ for (const node of nodes){
178
+ if (node.hoverMatch) out.add(node.hoverMatch.field);
179
+ const kids = node.children;
180
+ if (kids) hoverFields(kids, out);
181
+ }
182
+ return out;
183
+ }
184
+ /**
185
+ The values the marks `predicate` matches hold under each of `fields`
186
+ (as strings), for the `hoverMatch` labels. Chrome is skipped: axis and
187
+ timeline subtrees, and the labels themselves.
188
+ */ function matchedValues(nodes, predicate, fields) {
189
+ const out = new Map([
190
+ ...fields
191
+ ].map((f)=>[
192
+ f,
193
+ new Set()
194
+ ]));
195
+ const add = (datum)=>{
196
+ for (const [field, values] of out)for (const v of datumValues(datum, field))values.add(v);
197
+ };
198
+ const walk = (node)=>{
199
+ const group = node.interactionGroup;
200
+ if (group === "axis" || group === "timeline" || node.hoverMatch) return;
201
+ if (nodeMatches(node, predicate)) {
202
+ if (node.hoverKeys) add(node.hoverKeys);
203
+ if (node.datum) add(node.datum);
204
+ else for (const p of node.interactionPoints ?? [])if (matchesChain(predicate, p.datum, 0)) add(p.datum);
205
+ }
206
+ const kids = node.children;
207
+ if (kids) kids.forEach(walk);
208
+ };
209
+ nodes.forEach(walk);
210
+ return out;
211
+ }
212
+ /** The values `rows` hold under each of `fields` (see `_hoverFocus`). */ function focusValues(rows, fields) {
213
+ return new Map([
214
+ ...fields
215
+ ].map((f)=>[
216
+ f,
217
+ new Set(rows.flatMap((r)=>datumValues(r, f)))
218
+ ]));
219
+ }
156
220
  export function applyInteractionOpacity(nodes, viz) {
157
221
  // Precedence (hover → active → highlight) and the dim-vs-gray treatment are
158
222
  // resolved once in dimSettings; picking one source avoids ambiguous
@@ -160,38 +224,57 @@ export function applyInteractionOpacity(nodes, viz) {
160
224
  const settings = dimSettings(viz);
161
225
  if (!settings) return nodes;
162
226
  const { predicate, dimOpacity, isHover, gray, kind, activePredicate } = settings;
227
+ const fields = hoverFields(nodes);
228
+ const focus = viz._hoverFocus;
229
+ const values = !fields.size ? null : focus && kind === "hover" && focus.hover === viz._hover ? focusValues(focus.rows, fields) : matchedValues(nodes, predicate, fields);
230
+ /** A node left out of the interaction: grayed for highlight, else dimmed. */ const fade = (node)=>{
231
+ const paint = node.paint ?? {};
232
+ if (gray) {
233
+ // highlight: recolor the mark to the de-emphasis gray so the
234
+ // highlighted series keeps the only color on the chart.
235
+ const next2 = {
236
+ ...paint
237
+ };
238
+ if (typeof paint.fill === "string") next2.fill = colorGrayscale(paint.fill);
239
+ if (typeof paint.stroke === "string") next2.stroke = colorGrayscale(paint.stroke);
240
+ return {
241
+ ...node,
242
+ paint: next2
243
+ };
244
+ }
245
+ const base = typeof paint.opacity === "number" ? paint.opacity : 1;
246
+ return {
247
+ ...node,
248
+ paint: {
249
+ ...paint,
250
+ opacity: base * dimOpacity
251
+ }
252
+ };
253
+ };
254
+ /** A `hoverMatch` label: kept when a matched mark holds its value, else faded. */ const label = (node)=>{
255
+ const { field, value } = node.hoverMatch;
256
+ return values?.get(field)?.has(String(value)) ? node : fade(node);
257
+ };
258
+ /** Chrome keeps full opacity, all but its `hoverMatch` labels. */ const chrome = (node)=>{
259
+ if (node.hoverMatch) return label(node);
260
+ const kids = node.children;
261
+ return values && kids && kids.length ? {
262
+ ...node,
263
+ children: kids.map(chrome)
264
+ } : node;
265
+ };
163
266
  const walk = (node)=>{
164
267
  // Axes and the timeline are chrome, not data marks — they keep full
165
- // opacity when a shape is hovered/selected (the whole subtree is tagged).
268
+ // opacity when a shape is hovered/selected (the whole subtree is
269
+ // tagged), all but the discrete tick labels that follow the hover.
166
270
  const group = node.interactionGroup;
167
- if (group === "axis" || group === "timeline") return node;
271
+ if (group === "axis" || group === "timeline") return chrome(node);
272
+ if (node.hoverMatch) return label(node);
168
273
  let next = node;
169
274
  const matched = nodeMatches(node, predicate);
170
275
  if (matched !== null) {
171
276
  if (!matched) {
172
- const paint = node.paint ?? {};
173
- if (gray) {
174
- // highlight: recolor the mark to the de-emphasis gray so the
175
- // highlighted series keeps the only color on the chart.
176
- const next2 = {
177
- ...paint
178
- };
179
- if (typeof paint.fill === "string") next2.fill = colorGrayscale(paint.fill);
180
- if (typeof paint.stroke === "string") next2.stroke = colorGrayscale(paint.stroke);
181
- next = {
182
- ...node,
183
- paint: next2
184
- };
185
- } else {
186
- const base = typeof paint.opacity === "number" ? paint.opacity : 1;
187
- next = {
188
- ...node,
189
- paint: {
190
- ...paint,
191
- opacity: base * dimOpacity
192
- }
193
- };
194
- }
277
+ next = fade(node);
195
278
  } else {
196
279
  // Matched (hovered / active / highlighted) mark. Restore the v3
197
280
  // hover/active emphasis — a thicker, darker stroke — on the mark shapes
@@ -200,7 +283,7 @@ export function applyInteractionOpacity(nodes, viz) {
200
283
  // while hovered, rather than dropping to the thinner hover stroke.
201
284
  if (kind !== "highlight" && MARK_TYPES.has(node.type)) {
202
285
  const active = kind === "active" || (activePredicate ? nodeMatches(node, activePredicate) === true : false);
203
- next = active ? emphasizeStroke(node, 1, 3) : emphasizeStroke(node, 0.5, 2);
286
+ next = emphasizeStroke(node, active ? "active" : "hover");
204
287
  }
205
288
  if (isHover) {
206
289
  // Raise the hovered node above its siblings. Both renderers paint by
@@ -0,0 +1,15 @@
1
+ /**
2
+ The name a chart reports itself by: its class's `_displayName` (kept
3
+ through minification), else the constructor's name.
4
+ @private
5
+ */ export function chartName(viz) {
6
+ const ctor = viz.constructor;
7
+ return ctor?._displayName || ctor?.name || "chart";
8
+ }
9
+ /**
10
+ Logs an error a chart threw while drawing, naming the chart. The error
11
+ object is passed through, so the console shows its stack.
12
+ @private
13
+ */ export function reportDrawError(viz, error) {
14
+ console.error(`d3plus: ${chartName(viz)} could not draw.`, error);
15
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ The cursor a chart shows over its shapes and legend entries (the hand
3
+ over one a click acts on). It is set on the element under the pointer:
4
+ the chart's root `<svg>` or, with the Canvas renderer, its `<canvas>`
5
+ (the root svg sits above the canvas and passes pointer events through,
6
+ so its own cursor never shows).
7
+ */ /** The canvas the chart's renderer draws on, if it draws on one. */ function canvasOf(viz) {
8
+ const elements = viz._sceneRenderer?.elements?.() ?? [];
9
+ return elements.find((el)=>el.localName === "canvas");
10
+ }
11
+ /**
12
+ Sets the cursor shown over the chart's drawing surface.
13
+ @param viz The chart.
14
+ @param cursor A CSS cursor.
15
+ */ export function setCursor(viz, cursor) {
16
+ const canvas = viz._renderer === "canvas" ? canvasOf(viz) : undefined;
17
+ if (canvas) canvas.style.cursor = cursor;
18
+ else viz._select?.style("cursor", cursor);
19
+ }
20
+ /**
21
+ Returns both of the chart's drawing surfaces to the default cursor. Run
22
+ before the renderer is swapped for another: the pointer may rest on a
23
+ clickable shape, and the outgoing surface would keep its hand cursor.
24
+ @param viz The chart, still holding the outgoing renderer.
25
+ */ export function resetCursor(viz) {
26
+ const canvas = canvasOf(viz);
27
+ if (canvas) canvas.style.cursor = "auto";
28
+ viz._select?.style("cursor", "auto");
29
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ Whether a hovered shape or legend entry shows a tooltip. Every caller asks
3
+ through `tooltipEnabled`, so the chart's `tooltip` accessor receives the
4
+ same arguments wherever it is consulted.
5
+ */ import { groupDepthOf } from "./groupRow.js";
6
+ /**
7
+ The `groupBy` levels a `tooltip` accessor receives for `d`. `depth` is the
8
+ level `d` stands for: a group row's own level (see `groupRow.ts`), else
9
+ the level its chart reports for the shape (`ChartDefinition.shapeDepth`),
10
+ else the level the chart draws. A legend entry stands for the level its
11
+ label is read at. `maxDepth` is the deepest `groupBy` level, and `legend`
12
+ says which of the two `d` is.
13
+ @param viz The chart.
14
+ @param d The hovered shape's row, or the legend entry's.
15
+ @param legend Whether `d` is a legend entry.
16
+ */ export function tooltipLevels(viz, d, legend = false) {
17
+ const groupBy = viz.schema.groupBy;
18
+ const maxDepth = Math.max(0, (groupBy?.length ?? 1) - 1);
19
+ const own = legend ? viz._legendDepth : groupDepthOf(d) ?? (d ? viz._shapeDepth?.(d) : undefined);
20
+ const depth = own ?? viz._drawDepth ?? 0;
21
+ return {
22
+ depth: Math.min(Math.max(depth, 0), maxDepth),
23
+ maxDepth,
24
+ legend
25
+ };
26
+ }
27
+ /**
28
+ Whether `d` shows a tooltip: the chart's `tooltip` setting, called with
29
+ the datum, its index, and its `groupBy` levels (see `tooltipLevels`).
30
+ @param viz The chart.
31
+ @param d The hovered shape's row, or the legend entry's.
32
+ @param i The row's index.
33
+ @param legend Whether `d` is a legend entry.
34
+ */ export function tooltipEnabled(viz, d, i, legend = false) {
35
+ const { schema } = viz;
36
+ if (typeof schema.tooltip !== "function") return Boolean(schema.tooltip);
37
+ return Boolean(schema.tooltip(d, i, tooltipLevels(viz, d, legend)));
38
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ Which click handlers a chart's `on` holds for a shape or a legend entry:
3
+ one of the user's, or the chart's own. The hand cursor shows where a
4
+ click runs either. A chart registers each handler it installs as its own
5
+ (`setOwnClick`); any other handler is the user's, compared by identity.
6
+ */ const ownClicks = new WeakMap();
7
+ /**
8
+ Records `handler` as the chart's own handler for `key`, in place of any
9
+ recorded before.
10
+ @param viz The chart.
11
+ @param key The event the chart handles itself: `"click.shape"` or `"click.legend"`.
12
+ @param handler The handler the chart installs under `key`.
13
+ */ export function setOwnClick(viz, key, handler) {
14
+ let handlers = ownClicks.get(viz);
15
+ if (!handlers) ownClicks.set(viz, handlers = new Map());
16
+ handlers.set(key, handler);
17
+ }
18
+ /**
19
+ Whether the chart's own handler is still the one under `key`.
20
+ @param viz The chart.
21
+ @param key The event the chart handles itself: `"click.shape"` or `"click.legend"`.
22
+ */ export function hasOwnClick(viz, key) {
23
+ const handler = viz.schema.on?.[key];
24
+ return Boolean(handler) && ownClicks.get(viz)?.get(key) === handler;
25
+ }
26
+ /**
27
+ Whether a click runs a handler of the user's: any `click` handler, or one
28
+ under `key` that is not the chart's own.
29
+ @param viz The chart.
30
+ @param key The event the chart handles itself: `"click.shape"` or `"click.legend"`.
31
+ */ export function hasUserClick(viz, key) {
32
+ const on = viz.schema.on ?? {};
33
+ return Boolean(on.click) || Boolean(on[key]) && !hasOwnClick(viz, key);
34
+ }
@@ -55,7 +55,6 @@ import { displayName } from "../../utils/displayName.js";
55
55
  let config;
56
56
  const ctx = {
57
57
  _cache: false,
58
- _lrucache: viz._lrucache,
59
58
  _data: [],
60
59
  config: (obj)=>{
61
60
  config = obj;
@@ -16,12 +16,14 @@ import { legendCategoryOf } from "../features/legendCategory.js";
16
16
  import { legendLabel } from "../features/legendLabel.js";
17
17
  import clickShape from "../events/click.shape.js";
18
18
  import clickLegend from "../events/click.legend.js";
19
+ import { setOwnClick } from "./userClick.js";
19
20
  import mouseenter from "../events/mouseenter.js";
20
21
  import mouseleave from "../events/mouseleave.js";
21
22
  import mousemoveLegend from "../events/mousemove.legend.js";
22
23
  import mousemoveShape from "../events/mousemove.shape.js";
23
24
  import { colorScaleColor } from "../features/colorScaleValue.js";
24
25
  import { backgroundInk } from "./backgroundInk.js";
26
+ import { fillStroke } from "./fillStroke.js";
25
27
  import { defaultPadding, initLabelDefaults } from "./labelDefaults.js";
26
28
  import { linkedColorDefaults } from "./linkGroup.js";
27
29
  import { themed } from "../../utils/theme.js";
@@ -33,30 +35,6 @@ function debounce(func, delay) {
33
35
  timeout = setTimeout(()=>func.apply(context, args), delay);
34
36
  };
35
37
  }
36
- /**
37
- Minimal LRU cache backed by a Map (insertion-order iteration enables O(1) eviction).
38
- Only .get() and .set() are used by Viz.
39
- @private
40
- */ class LRU {
41
- _cap;
42
- _map;
43
- constructor(capacity){
44
- this._cap = capacity;
45
- this._map = new Map();
46
- }
47
- get(key) {
48
- if (!this._map.has(key)) return undefined;
49
- const val = this._map.get(key);
50
- this._map.delete(key);
51
- this._map.set(key, val);
52
- return val;
53
- }
54
- set(key, val) {
55
- this._map.delete(key);
56
- if (this._map.size >= this._cap) this._map.delete(this._map.keys().next().value);
57
- this._map.set(key, val);
58
- }
59
- }
60
38
  /**
61
39
  Renderer backend, accessibility, attribution, and back-button defaults.
62
40
  @private
@@ -207,7 +185,6 @@ function debounce(func, delay) {
207
185
  <sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;"><a href="https://d3plus.org" target="_blank">${viz.schema.translate("Powered by D3plus")}</a></sub>
208
186
  </div>`;
209
187
  viz.schema.loadingMessage = true;
210
- viz._lrucache = new LRU(10);
211
188
  viz._messageClass = new Message();
212
189
  viz.schema.messageMask = "rgba(0, 0, 0, 0.05)";
213
190
  viz.schema.messageStyle = {
@@ -228,9 +205,13 @@ function debounce(func, delay) {
228
205
  Event handler bindings, render queue, resize observer, and scroll container.
229
206
  @private
230
207
  */ function initEventDefaults(viz) {
231
- viz.schema.on = {
208
+ const ownClick = {
232
209
  "click.shape": clickShape.bind(viz),
233
- "click.legend": clickLegend.bind(viz),
210
+ "click.legend": clickLegend.bind(viz)
211
+ };
212
+ for (const [key, handler] of Object.entries(ownClick))setOwnClick(viz, key, handler);
213
+ viz.schema.on = {
214
+ ...ownClick,
234
215
  mouseenter: mouseenter.bind(viz),
235
216
  mouseleave: mouseleave.bind(viz),
236
217
  "mousemove.shape": mousemoveShape.bind(viz),
@@ -307,13 +288,8 @@ function debounce(func, delay) {
307
288
  })
308
289
  },
309
290
  opacity: constant(1),
310
- stroke: (d, i)=>{
311
- const c = typeof viz.schema.shapeConfig.fill === "function" ? viz.schema.shapeConfig.fill(d, i) : viz.schema.shapeConfig.fill;
312
- // A fill that doesn't parse as a color (e.g. "none"/"transparent" on a
313
- // confidence band) has no darker shade — fall back to the fill itself.
314
- const col = color(c);
315
- return col ? col.darker(0.25).toString() : c;
316
- },
291
+ // Marked so a chart can tell it from a user's own stroke.
292
+ stroke: markDefault((d, i)=>fillStroke(typeof viz.schema.shapeConfig.fill === "function" ? viz.schema.shapeConfig.fill(d, i) : viz.schema.shapeConfig.fill)),
317
293
  role: "presentation",
318
294
  strokeWidth: constant(0)
319
295
  };
@@ -416,9 +392,12 @@ export const tableViewControlStyleHoverDefault = false;
416
392
  };
417
393
  viz.schema.zoomControlClassName = undefined;
418
394
  viz.schema.zoomControlIcons = undefined;
395
+ viz.schema.zoomControls = true;
419
396
  viz.schema.zoomControlStyle = zoomControlStyleDefault;
420
397
  viz.schema.zoomControlStyleActive = zoomControlStyleActiveDefault;
421
398
  viz.schema.zoomControlStyleHover = zoomControlStyleHoverDefault;
399
+ viz.schema.zoomDoubleClick = "in";
400
+ viz.schema.zoomDrag = "pan";
422
401
  viz.schema.zoomFactor = 2;
423
402
  viz.schema.zoomMax = undefined;
424
403
  viz.schema.zoomPadding = 20;
@@ -1,8 +1,10 @@
1
1
  import { fieldAccessor } from "../../utils/fieldAccessor.js";
2
+ import { bivariateAccessor, isBivariateSetting } from "../features/colorScaleBivariate.js";
2
3
  import { teardownKeyboardNav } from "./keyboardNav.js";
3
4
  import { registerLink } from "./linkGroup.js";
4
5
  import { onDataPollingIntervalSet } from "./vizDataPolling.js";
5
6
  /** A falsy value (no color) is stored as given, a key string read from each datum. */ export const optionalAccessor = (value)=>!value || typeof value === "function" ? value : fieldAccessor(value);
7
+ /** `optionalAccessor`, except that two keys or accessors make a bivariate accessor (see `colorScaleBivariate.ts`). */ export const colorScaleAccessor = (value)=>isBivariateSetting(value) ? bivariateAccessor(value) : optionalAccessor(value);
6
8
  /**
7
9
  The config keys every chart has, as generated accessors (`viz.<key>(value)`
8
10
  sets, `viz.<key>()` gets): stored as given, wrapped as a constant
@@ -31,7 +33,7 @@ import { onDataPollingIntervalSet } from "./vizDataPolling.js";
31
33
  default: false
32
34
  },
33
35
  colorScale: {
34
- coerce: optionalAccessor
36
+ coerce: colorScaleAccessor
35
37
  },
36
38
  colorScaleConfig: {
37
39
  merge: true
@@ -233,9 +235,12 @@ import { onDataPollingIntervalSet } from "./vizDataPolling.js";
233
235
  zoomBrushSelectionStyle: {},
234
236
  zoomControlClassName: {},
235
237
  zoomControlIcons: {},
238
+ zoomControls: {},
236
239
  zoomControlStyle: {},
237
240
  zoomControlStyleActive: {},
238
241
  zoomControlStyleHover: {},
242
+ zoomDoubleClick: {},
243
+ zoomDrag: {},
239
244
  zoomFactor: {},
240
245
  zoomMax: {},
241
246
  zoomPadding: {},
@@ -12,6 +12,7 @@ import { effectiveDuration } from "./reducedMotion.js";
12
12
  import { canObserveVisibility, observeVisibility, syncUnloadObserver } from "./vizVisibility.js";
13
13
  import { queuedFormatter, syncLoaderFormats } from "./loaderFormat.js";
14
14
  import { recordDataSignature, syncDataPolling } from "./vizDataPolling.js";
15
+ import { reportDrawError } from "./reportDrawError.js";
15
16
  /**
16
17
  Whether the chart counts as on-screen for this render. `_forceVisible` is set
17
18
  by the observer callbacks, whose margin admits charts that are just outside
@@ -175,12 +176,19 @@ import { recordDataSignature, syncDataPolling } from "./vizDataPolling.js";
175
176
  const formatter = queuedFormatter(viz, p[3], p[2]);
176
177
  let done = false;
177
178
  const promise = new Promise((resolve)=>{
178
- p[0](p[1], formatter, p[3], (err, data)=>{
179
+ const loaded = (err, data)=>{
179
180
  done = true;
180
181
  if (err) console.error(err);
181
182
  else if (p[3] === "data") recordDataSignature(viz, data);
182
183
  resolve();
183
- });
184
+ };
185
+ // A load served from the cache formats synchronously; a formatter
186
+ // that throws there fails the load as it would when fetched.
187
+ try {
188
+ p[0](p[1], formatter, p[3], loaded);
189
+ } catch (err) {
190
+ loaded(err);
191
+ }
184
192
  });
185
193
  if (!done) promises.push(promise);
186
194
  });
@@ -252,19 +260,41 @@ import { recordDataSignature, syncDataPolling } from "./vizDataPolling.js";
252
260
  } else {
253
261
  viz._resizeObserver?.unobserve(viz._select.node().parentNode);
254
262
  }
263
+ scheduleCallback(viz, callback);
264
+ }
265
+ /**
266
+ Calls the render callback once the draw's transitions have had time to
267
+ finish.
268
+ @private
269
+ */ function scheduleCallback(viz, callback) {
255
270
  if (callback) setTimeout(()=>{
256
271
  callback();
257
272
  viz._callback = undefined;
258
273
  }, effectiveDuration(viz) + 100);
259
274
  }
275
+ /**
276
+ Handles an error thrown while drawing: logs it, hides the loading message
277
+ this render showed, and still calls the render callback, so callers
278
+ waiting on it don't hang. The chart keeps whatever it last painted.
279
+ @param loading Whether this render showed the loading message.
280
+ @private
281
+ */ function drawFailed(viz, error, loading, callback) {
282
+ reportDrawError(viz, error);
283
+ if (loading && viz._messageClass._isVisible) viz._messageClass.hide({
284
+ duration: effectiveDuration(viz)
285
+ });
286
+ scheduleCallback(viz, callback);
287
+ }
260
288
  /**
261
289
  Loads any queued data (showing the loading message while in flight) then
262
- draws the chart.
290
+ draws the chart. An error thrown while drawing is reported rather than
291
+ left as an unhandled rejection (see `drawFailed`).
263
292
  @private
264
293
  */ function loadAndDraw(viz, callback) {
265
294
  syncLoaderFormats(viz);
266
295
  const promises = queuePromises(viz);
267
- if (viz.schema.loadingMessage && promises.length) {
296
+ const loading = Boolean(viz.schema.loadingMessage && promises.length);
297
+ if (loading) {
268
298
  viz._messageClass.render({
269
299
  container: viz._select.node().parentNode,
270
300
  duration: effectiveDuration(viz),
@@ -273,7 +303,7 @@ import { recordDataSignature, syncDataPolling } from "./vizDataPolling.js";
273
303
  style: viz.schema.messageStyle
274
304
  });
275
305
  }
276
- Promise.all(promises).then(()=>finishDraw(viz, callback));
306
+ Promise.all(promises).then(()=>finishDraw(viz, callback)).catch((error)=>drawFailed(viz, error, loading, callback));
277
307
  }
278
308
  /**
279
309
  Draws the visualization given the specified configuration.
@@ -1,4 +1,5 @@
1
1
  import { select } from "d3-selection";
2
+ import { cancelIdleWork } from "../features/idleQueue.js";
2
3
  /** Vertical buffer around the scroll root, so charts start rendering just before they scroll into view. */ const ROOT_MARGIN = "25% 0px";
3
4
  const WINDOW_ROOT = {};
4
5
  const entries = new WeakMap();
@@ -90,15 +91,24 @@ const entries = new WeakMap();
90
91
  const parent = viz._select.node()?.parentNode;
91
92
  if (parent) viz._resizeObserver?.unobserve(parent);
92
93
  viz._tooltipClass.data([]).render();
94
+ releaseScene(viz);
95
+ viz._select.selectAll("g.data-table").remove();
96
+ }
97
+ /**
98
+ Stops what a chart's drawn scene keeps running: its idle work (network
99
+ measures, queued again when it redraws), a pending repaint, and the
100
+ scene renderer with its DOM, listeners, and timers.
101
+ @private
102
+ */ export function releaseScene(viz) {
103
+ cancelIdleWork(viz);
93
104
  if (viz._sceneRepaintRAF != null) {
94
- cancelAnimationFrame(viz._sceneRepaintRAF);
105
+ if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(viz._sceneRepaintRAF);
95
106
  viz._sceneRepaintRAF = undefined;
96
107
  }
97
108
  if (viz._sceneRenderer && typeof viz._sceneRenderer.destroy === "function") {
98
109
  viz._sceneRenderer.destroy();
99
110
  viz._sceneRenderer = undefined;
100
111
  }
101
- viz._select.selectAll("g.data-table").remove();
102
112
  }
103
113
  /**
104
114
  Redraws an unloaded chart without an entrance animation.
@@ -2,7 +2,7 @@ import { extent, min } from "d3-array";
2
2
  import { select } from "d3-selection";
3
3
  import { elem } from "@d3plus/dom";
4
4
  import { TextBox } from "../index.js";
5
- import { measureAxis } from "./axisLayout.js";
5
+ import { measureAxis } from "./axisLimit.js";
6
6
  import { axisBarConfig, axisBreakConfig, axisGridConfig, axisShapeConfig, axisTitleConfig } from "./axisDefaults.js";
7
7
  import { timeDataInDomain } from "./timeValues.js";
8
8
  import { axisToScene } from "./axisScene.js";
@@ -194,6 +194,10 @@ import { installFluent, mergeConfigBag, resolvesReset } from "../../fluent.js";
194
194
  coerce: "identity",
195
195
  default: "normal"
196
196
  },
197
+ {
198
+ key: "tickTooltip",
199
+ coerce: "identity"
200
+ },
197
201
  {
198
202
  key: "timeLocale",
199
203
  coerce: "identity",
@@ -203,6 +207,10 @@ import { installFluent, mergeConfigBag, resolvesReset } from "../../fluent.js";
203
207
  key: "title",
204
208
  coerce: "identity"
205
209
  },
210
+ {
211
+ key: "titleTooltip",
212
+ coerce: "identity"
213
+ },
206
214
  {
207
215
  key: "width",
208
216
  coerce: "identity",
@@ -231,6 +239,20 @@ import { installFluent, mergeConfigBag, resolvesReset } from "../../fluent.js";
231
239
  0,
232
240
  0
233
241
  ];
242
+ /**
243
+ Whether the `maxSize` is the chart's own default limit (see
244
+ `defaultMaxSize`), which lets one line of labels and the title take
245
+ more than it.
246
+ */ _softMaxSize = false;
247
+ /**
248
+ Whether a vertical axis hides labels to give the ones it shows more
249
+ lines (see `thinForLines`): a bucketed ColorScale's.
250
+ */ _thinForLines = false;
251
+ /** Whether the last layout pass left the title out to fit `maxSize` (see `measureAxis`). */ _dropTitle = false;
252
+ /**
253
+ How the last layout pass fit `maxSize`: how many shown labels it left
254
+ out, and the room the labels had (see `limitLabels`).
255
+ */ _limited;
234
256
  _position;
235
257
  _tickUnit;
236
258
  _titleClass;
@@ -241,6 +263,11 @@ import { installFluent, mergeConfigBag, resolvesReset } from "../../fluent.js";
241
263
  _gridLineData;
242
264
  _d3Scale = null;
243
265
  _d3ScaleNegative = null;
266
+ /**
267
+ Whether the domain is handed over last value first, as a Plot hands its
268
+ y axes theirs (they run bottom to top). Tick tooltips count a
269
+ categorical axis's labels from the domain's start (see `tickRank`).
270
+ */ _domainEndFirst = false;
244
271
  /** The active baseline break, set by the layout pass (see `baselineBreak`). */ _baselineBreak = null;
245
272
  /** Every active break (baseline and explicit), set by the layout pass. */ _breaks = [];
246
273
  _group;
@@ -566,4 +593,4 @@ export function computeAxisLayout(axis) {
566
593
  resolvesReset(Axis.prototype, "barConfig", "breakConfig", "baselineBreakConfig", "gridConfig", "shapeConfig", "titleConfig");
567
594
  // Re-export the standalone `measureAxis` and its result type so consumers
568
595
  // can import them from the same module as the Axis class.
569
- export { measureAxis } from "./axisLayout.js";
596
+ export { measureAxis } from "./axisLimit.js";