@d3plus/core 4.5.0 → 4.7.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 (312) hide show
  1. package/README.md +3930 -2032
  2. package/es/index.js +3 -3
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +11 -1
  5. package/es/internal.js.map +1 -1
  6. package/es/src/charts/BarChart/index.js +8 -1
  7. package/es/src/charts/BarChart/index.js.map +1 -1
  8. package/es/src/charts/BoxWhisker/index.js +5 -0
  9. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  10. package/es/src/charts/Chord/emit.js +55 -3
  11. package/es/src/charts/Chord/emit.js.map +1 -1
  12. package/es/src/charts/Chord/index.js +17 -0
  13. package/es/src/charts/Chord/index.js.map +1 -1
  14. package/es/src/charts/Geomap/applyLayout.js +20 -11
  15. package/es/src/charts/Geomap/applyLayout.js.map +1 -1
  16. package/es/src/charts/Geomap/index.js +8 -2
  17. package/es/src/charts/Geomap/index.js.map +1 -1
  18. package/es/src/charts/Histogram/binData.js +225 -0
  19. package/es/src/charts/Histogram/binData.js.map +1 -0
  20. package/es/src/charts/Histogram/index.js +271 -0
  21. package/es/src/charts/Histogram/index.js.map +1 -0
  22. package/es/src/charts/Matrix/emit.js +5 -4
  23. package/es/src/charts/Matrix/emit.js.map +1 -1
  24. package/es/src/charts/Network/applyLayout.js +52 -4
  25. package/es/src/charts/Network/applyLayout.js.map +1 -1
  26. package/es/src/charts/Network/emit.js +4 -4
  27. package/es/src/charts/Network/emit.js.map +1 -1
  28. package/es/src/charts/Network/index.js +10 -1
  29. package/es/src/charts/Network/index.js.map +1 -1
  30. package/es/src/charts/Pack/emit.js +42 -7
  31. package/es/src/charts/Pack/emit.js.map +1 -1
  32. package/es/src/charts/Pack/index.js +15 -0
  33. package/es/src/charts/Pack/index.js.map +1 -1
  34. package/es/src/charts/Pie/applyLayout.js +20 -2
  35. package/es/src/charts/Pie/applyLayout.js.map +1 -1
  36. package/es/src/charts/Pie/emit.js +275 -35
  37. package/es/src/charts/Pie/emit.js.map +1 -1
  38. package/es/src/charts/Pie/index.js +48 -1
  39. package/es/src/charts/Pie/index.js.map +1 -1
  40. package/es/src/charts/Plot/discreteSpan.js +42 -0
  41. package/es/src/charts/Plot/discreteSpan.js.map +1 -0
  42. package/es/src/charts/Plot/draw.js +3 -1
  43. package/es/src/charts/Plot/draw.js.map +1 -1
  44. package/es/src/charts/Plot/index.js +143 -14
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/insetRegion.js +21 -0
  47. package/es/src/charts/Plot/insetRegion.js.map +1 -0
  48. package/es/src/charts/Plot/pipeline.js +47 -20
  49. package/es/src/charts/Plot/pipeline.js.map +1 -1
  50. package/es/src/charts/Plot/pipelineDomains.js +84 -8
  51. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  52. package/es/src/charts/Plot/shapeDefaults.js +3 -3
  53. package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
  54. package/es/src/charts/Plot/sharedHover.js +532 -0
  55. package/es/src/charts/Plot/sharedHover.js.map +1 -0
  56. package/es/src/charts/Plot/sharedHoverScene.js +230 -0
  57. package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
  58. package/es/src/charts/Plot/sharedTooltip.js +183 -0
  59. package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
  60. package/es/src/charts/Plot/stackShareLabels.js +137 -0
  61. package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
  62. package/es/src/charts/Plot/stackShareTooltip.js +31 -0
  63. package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
  64. package/es/src/charts/Plot/trendLines.js +469 -0
  65. package/es/src/charts/Plot/trendLines.js.map +1 -0
  66. package/es/src/charts/Plot/trendProjection.js +120 -0
  67. package/es/src/charts/Plot/trendProjection.js.map +1 -0
  68. package/es/src/charts/Plot/trendScene.js +234 -0
  69. package/es/src/charts/Plot/trendScene.js.map +1 -0
  70. package/es/src/charts/Plot/trendTooltip.js +222 -0
  71. package/es/src/charts/Plot/trendTooltip.js.map +1 -0
  72. package/es/src/charts/Priestley/emit.js +34 -6
  73. package/es/src/charts/Priestley/emit.js.map +1 -1
  74. package/es/src/charts/Radar/index.js +15 -2
  75. package/es/src/charts/Radar/index.js.map +1 -1
  76. package/es/src/charts/RadialMatrix/emit.js +4 -4
  77. package/es/src/charts/RadialMatrix/emit.js.map +1 -1
  78. package/es/src/charts/RadialMatrix/index.js +17 -1
  79. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  80. package/es/src/charts/Rings/applyLayout.js +72 -116
  81. package/es/src/charts/Rings/applyLayout.js.map +1 -1
  82. package/es/src/charts/Rings/emit.js +2 -3
  83. package/es/src/charts/Rings/emit.js.map +1 -1
  84. package/es/src/charts/Rings/index.js +18 -3
  85. package/es/src/charts/Rings/index.js.map +1 -1
  86. package/es/src/charts/Rings/ringsSizing.js +189 -0
  87. package/es/src/charts/Rings/ringsSizing.js.map +1 -0
  88. package/es/src/charts/Sankey/index.js +2 -0
  89. package/es/src/charts/Sankey/index.js.map +1 -1
  90. package/es/src/charts/StackedArea/index.js +8 -1
  91. package/es/src/charts/StackedArea/index.js.map +1 -1
  92. package/es/src/charts/Tree/emit.js +2 -2
  93. package/es/src/charts/Tree/emit.js.map +1 -1
  94. package/es/src/charts/Tree/index.js +7 -3
  95. package/es/src/charts/Tree/index.js.map +1 -1
  96. package/es/src/charts/Treemap/emit.js +58 -6
  97. package/es/src/charts/Treemap/emit.js.map +1 -1
  98. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  99. package/es/src/charts/definition/makeChart.js +14 -1
  100. package/es/src/charts/definition/makeChart.js.map +1 -1
  101. package/es/src/charts/drawSteps/backControl.js +17 -2
  102. package/es/src/charts/drawSteps/backControl.js.map +1 -1
  103. package/es/src/charts/drawSteps/bottomRightControls.js +196 -0
  104. package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
  105. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +292 -0
  106. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
  107. package/es/src/charts/drawSteps/minimap.js +34 -9
  108. package/es/src/charts/drawSteps/minimap.js.map +1 -1
  109. package/es/src/charts/drawSteps/searchControlsMarkup.js +15 -38
  110. package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -1
  111. package/es/src/charts/drawSteps/zoomControls.js +3 -0
  112. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  113. package/es/src/charts/events/click.legend.js +10 -5
  114. package/es/src/charts/events/click.legend.js.map +1 -1
  115. package/es/src/charts/events/click.shape.js +24 -1
  116. package/es/src/charts/events/click.shape.js.map +1 -1
  117. package/es/src/charts/events/mouseenter.js +3 -0
  118. package/es/src/charts/events/mouseenter.js.map +1 -1
  119. package/es/src/charts/events/mouseleave.js +3 -0
  120. package/es/src/charts/events/mouseleave.js.map +1 -1
  121. package/es/src/charts/events/mousemove.shape.js +10 -1
  122. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  123. package/es/src/charts/features/axes.js +4 -1
  124. package/es/src/charts/features/axes.js.map +1 -1
  125. package/es/src/charts/features/emitHelpers.js +43 -5
  126. package/es/src/charts/features/emitHelpers.js.map +1 -1
  127. package/es/src/charts/features/features.js +3 -104
  128. package/es/src/charts/features/features.js.map +1 -1
  129. package/es/src/charts/features/featuresColorScale.js +161 -0
  130. package/es/src/charts/features/featuresColorScale.js.map +1 -0
  131. package/es/src/charts/features/featuresLegend.js +155 -34
  132. package/es/src/charts/features/featuresLegend.js.map +1 -1
  133. package/es/src/charts/features/insetState.js +174 -0
  134. package/es/src/charts/features/insetState.js.map +1 -0
  135. package/es/src/charts/features/plotPaint.js +51 -24
  136. package/es/src/charts/features/plotPaint.js.map +1 -1
  137. package/es/src/charts/features/sceneBounds.js +271 -0
  138. package/es/src/charts/features/sceneBounds.js.map +1 -0
  139. package/es/src/charts/features/shapeEmit.js +20 -2
  140. package/es/src/charts/features/shapeEmit.js.map +1 -1
  141. package/es/src/charts/features/tooltipSwatch.js +73 -0
  142. package/es/src/charts/features/tooltipSwatch.js.map +1 -0
  143. package/es/src/charts/index.js +1 -0
  144. package/es/src/charts/index.js.map +1 -1
  145. package/es/src/charts/pipeline/drillMorph.js +159 -0
  146. package/es/src/charts/pipeline/drillMorph.js.map +1 -0
  147. package/es/src/charts/pipeline/insetPlacement.js +406 -0
  148. package/es/src/charts/pipeline/insetPlacement.js.map +1 -0
  149. package/es/src/charts/pipeline/runChartDraw.js +35 -1
  150. package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
  151. package/es/src/charts/pipeline/runVizPipeline.js +22 -3
  152. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  153. package/es/src/charts/pipeline/vizDrawPure.js +20 -0
  154. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  155. package/es/src/charts/viz/Viz.js +82 -11
  156. package/es/src/charts/viz/Viz.js.map +1 -1
  157. package/es/src/charts/viz/VizBase.js +29 -1
  158. package/es/src/charts/viz/VizBase.js.map +1 -1
  159. package/es/src/charts/viz/VizBaseConfig.js +25 -21
  160. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  161. package/es/src/charts/viz/interactionOpacity.js +21 -13
  162. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  163. package/es/src/charts/viz/linkGroup.js +386 -0
  164. package/es/src/charts/viz/linkGroup.js.map +1 -0
  165. package/es/src/charts/viz/ordinalColor.js +2 -2
  166. package/es/src/charts/viz/ordinalColor.js.map +1 -1
  167. package/es/src/charts/viz/sceneRows.js +33 -0
  168. package/es/src/charts/viz/sceneRows.js.map +1 -0
  169. package/es/src/charts/viz/vizDefaults.js +39 -15
  170. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  171. package/es/src/charts/viz/vizRender.js +54 -4
  172. package/es/src/charts/viz/vizRender.js.map +1 -1
  173. package/es/src/charts/viz/vizTypes.js.map +1 -1
  174. package/es/src/charts/viz/vizVisibility.js +145 -0
  175. package/es/src/charts/viz/vizVisibility.js.map +1 -0
  176. package/es/src/components/Axis/Axis.js +8 -8
  177. package/es/src/components/Axis/Axis.js.map +1 -1
  178. package/es/src/components/Axis/AxisBottom.js +1 -1
  179. package/es/src/components/Axis/AxisBottom.js.map +1 -1
  180. package/es/src/components/Axis/AxisLeft.js +1 -1
  181. package/es/src/components/Axis/AxisLeft.js.map +1 -1
  182. package/es/src/components/Axis/AxisRight.js +1 -1
  183. package/es/src/components/Axis/AxisRight.js.map +1 -1
  184. package/es/src/components/Axis/AxisTop.js +1 -1
  185. package/es/src/components/Axis/AxisTop.js.map +1 -1
  186. package/es/src/components/Axis/axisLayoutLabels.js +13 -1
  187. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  188. package/es/src/components/ColorScale/ColorScale.js +11 -11
  189. package/es/src/components/ColorScale/ColorScale.js.map +1 -1
  190. package/es/src/components/ColorScale/colorScaleScale.js +22 -10
  191. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
  192. package/es/src/components/Legend/Legend.js +8 -5
  193. package/es/src/components/Legend/Legend.js.map +1 -1
  194. package/es/src/components/Legend/legendConfig.js +3 -2
  195. package/es/src/components/Legend/legendConfig.js.map +1 -1
  196. package/es/src/components/Legend/legendRender.js +70 -26
  197. package/es/src/components/Legend/legendRender.js.map +1 -1
  198. package/es/src/components/SizeLegend/SizeLegend.js +411 -0
  199. package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
  200. package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
  201. package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
  202. package/es/src/components/TextBox.js +1 -1
  203. package/es/src/components/TextBox.js.map +1 -1
  204. package/es/src/components/Timeline/timelineConfig.js +8 -4
  205. package/es/src/components/Timeline/timelineConfig.js.map +1 -1
  206. package/es/src/components/Timeline/timelineRender.js +1 -2
  207. package/es/src/components/Timeline/timelineRender.js.map +1 -1
  208. package/es/src/components/Tooltip.js +27 -7
  209. package/es/src/components/Tooltip.js.map +1 -1
  210. package/es/src/components/index.js +1 -0
  211. package/es/src/components/index.js.map +1 -1
  212. package/es/src/shapes/Bar.js +1 -1
  213. package/es/src/shapes/Bar.js.map +1 -1
  214. package/es/src/shapes/Box.js +5 -3
  215. package/es/src/shapes/Box.js.map +1 -1
  216. package/es/src/shapes/Rect.js +1 -1
  217. package/es/src/shapes/Rect.js.map +1 -1
  218. package/es/src/shapes/Shape.js +10 -37
  219. package/es/src/shapes/Shape.js.map +1 -1
  220. package/es/src/shapes/Whisker.js +4 -3
  221. package/es/src/shapes/Whisker.js.map +1 -1
  222. package/es/src/shapes/textureKey.js +104 -0
  223. package/es/src/shapes/textureKey.js.map +1 -0
  224. package/es/src/shapes/validateShapeConfig.js +141 -0
  225. package/es/src/shapes/validateShapeConfig.js.map +1 -0
  226. package/es/src/utils/BaseClass.js +134 -4
  227. package/es/src/utils/BaseClass.js.map +1 -1
  228. package/es/src/utils/D3plusConfig.js.map +1 -1
  229. package/es/src/utils/configDefault.js +17 -0
  230. package/es/src/utils/configDefault.js.map +1 -0
  231. package/es/src/utils/configPrep.js +2 -1
  232. package/es/src/utils/configPrep.js.map +1 -1
  233. package/es/src/utils/configWarnings.js +37 -0
  234. package/es/src/utils/configWarnings.js.map +1 -0
  235. package/es/src/utils/index.js +1 -0
  236. package/es/src/utils/index.js.map +1 -1
  237. package/package.json +12 -10
  238. package/types/index.d.ts +5 -4
  239. package/types/internal.d.ts +15 -1
  240. package/types/src/charts/BarChart/index.d.ts +2 -1
  241. package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
  242. package/types/src/charts/Histogram/binData.d.ts +37 -0
  243. package/types/src/charts/Histogram/index.d.ts +14 -0
  244. package/types/src/charts/Network/applyLayout.d.ts +8 -0
  245. package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
  246. package/types/src/charts/Plot/index.d.ts +47 -0
  247. package/types/src/charts/Plot/insetRegion.d.ts +4 -0
  248. package/types/src/charts/Plot/pipeline.d.ts +14 -0
  249. package/types/src/charts/Plot/sharedHover.d.ts +84 -0
  250. package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
  251. package/types/src/charts/Plot/sharedTooltip.d.ts +36 -0
  252. package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
  253. package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
  254. package/types/src/charts/Plot/trendLines.d.ts +90 -0
  255. package/types/src/charts/Plot/trendProjection.d.ts +28 -0
  256. package/types/src/charts/Plot/trendScene.d.ts +19 -0
  257. package/types/src/charts/Plot/trendTooltip.d.ts +30 -0
  258. package/types/src/charts/Rings/applyLayout.d.ts +9 -0
  259. package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
  260. package/types/src/charts/StackedArea/index.d.ts +2 -1
  261. package/types/src/charts/definition/ChartDefinition.d.ts +39 -0
  262. package/types/src/charts/definition/makeChart.d.ts +2 -1
  263. package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
  264. package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +110 -0
  265. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +7 -5
  266. package/types/src/charts/features/emitHelpers.d.ts +18 -4
  267. package/types/src/charts/features/features.d.ts +1 -8
  268. package/types/src/charts/features/featuresColorScale.d.ts +24 -0
  269. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  270. package/types/src/charts/features/insetState.d.ts +95 -0
  271. package/types/src/charts/features/plotPaint.d.ts +25 -0
  272. package/types/src/charts/features/sceneBounds.d.ts +18 -0
  273. package/types/src/charts/features/tooltipSwatch.d.ts +31 -0
  274. package/types/src/charts/index.d.ts +1 -0
  275. package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
  276. package/types/src/charts/pipeline/insetPlacement.d.ts +45 -0
  277. package/types/src/charts/pipeline/runVizPipeline.d.ts +10 -1
  278. package/types/src/charts/viz/Viz.d.ts +27 -2
  279. package/types/src/charts/viz/VizBase.d.ts +13 -0
  280. package/types/src/charts/viz/VizBaseConfig.d.ts +11 -11
  281. package/types/src/charts/viz/linkGroup.d.ts +96 -0
  282. package/types/src/charts/viz/sceneRows.d.ts +13 -0
  283. package/types/src/charts/viz/vizTypes.d.ts +164 -3
  284. package/types/src/charts/viz/vizVisibility.d.ts +34 -0
  285. package/types/src/components/Axis/AxisBottom.d.ts +1 -1
  286. package/types/src/components/Axis/AxisLeft.d.ts +1 -1
  287. package/types/src/components/Axis/AxisRight.d.ts +1 -1
  288. package/types/src/components/Axis/AxisTop.d.ts +1 -1
  289. package/types/src/components/ColorScale/ColorScale.d.ts +4 -4
  290. package/types/src/components/Legend/legendRender.d.ts +9 -3
  291. package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
  292. package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
  293. package/types/src/components/TextBox.d.ts +1 -1
  294. package/types/src/components/Tooltip.d.ts +18 -3
  295. package/types/src/components/index.d.ts +1 -0
  296. package/types/src/shapes/Bar.d.ts +1 -1
  297. package/types/src/shapes/Box.d.ts +1 -1
  298. package/types/src/shapes/Rect.d.ts +1 -1
  299. package/types/src/shapes/Whisker.d.ts +1 -1
  300. package/types/src/shapes/textureKey.d.ts +9 -0
  301. package/types/src/shapes/validateShapeConfig.d.ts +10 -0
  302. package/types/src/utils/BaseClass.d.ts +15 -1
  303. package/types/src/utils/D3plusConfig.d.ts +139 -0
  304. package/types/src/utils/configDefault.d.ts +11 -0
  305. package/types/src/utils/configWarnings.d.ts +28 -0
  306. package/types/src/utils/index.d.ts +2 -1
  307. package/umd/d3plus-core.full.js +9325 -3024
  308. package/umd/d3plus-core.full.js.map +1 -1
  309. package/umd/d3plus-core.full.min.js +3348 -1727
  310. package/umd/d3plus-core.js +5412 -831
  311. package/umd/d3plus-core.js.map +1 -1
  312. package/umd/d3plus-core.min.js +2199 -948
@@ -85,11 +85,13 @@ export interface SearchMatch {
85
85
  /**
86
86
  Every currently-rendered mark matching the given term, in scene order.
87
87
  Walks `viz._chartScene` (the actual painted scene, post-layout) rather
88
- than the raw data array, unwrapping each node's datum the same way
89
- `applyInteractionOpacity` does, so a grouped/aggregated chart matches by
90
- rendered mark, not by raw input row — and de-dupes by datum reference so
91
- a mark's separate label node doesn't double-count it. An empty term
92
- matches nothing (there's no "everything" state to jump through).
88
+ than the raw data array, via `forEachSceneRow` — the same row/index
89
+ resolution `applyInteractionOpacity` uses — so a grouped/aggregated chart
90
+ matches by rendered mark, not by raw input row, and the index a custom
91
+ searchAccessor sees always matches the one the highlight predicate was
92
+ evaluated with (Enter/Shift+Enter never jumps to a different mark than the
93
+ one that's actually highlighted). An empty term matches nothing (there's
94
+ no "everything" state to jump through).
93
95
  */
94
96
  export declare function searchMatches(viz: Viz, term: string): SearchMatch[];
95
97
  /**
@@ -58,13 +58,19 @@ export interface VizLike {
58
58
  Priestley, …). Centralized here so each emit doesn't need its own copy.
59
59
  */
60
60
  export declare function resolveAccessor<T>(val: unknown, d: DataPoint, i: number | undefined): T | undefined;
61
+ /**
62
+ Resolve a datum's scene fill from a shape-config record: a
63
+ `pattern:<json>` token when `sc.texture` is set for the datum (the
64
+ renderer backends materialize it), otherwise the resolved `fill` when
65
+ it is a string. `fill` is the datum's already-resolved `sc.fill`.
66
+ */
67
+ export declare function textureFill(sc: Record<string, unknown>, d: DataPoint, i: number | undefined, fill: unknown): string | undefined;
61
68
  /**
62
69
  Resolve the standard paint properties (`fill`, `stroke`, `strokeWidth`,
63
70
  `opacity`) from a shape-config record for a single datum. Returns a
64
- `Paint`-shaped object compatible with `SceneNode.paint`. `fill` is
65
- forced to `string | undefined` to match `Paint.fill` (texture/object
66
- fills fall through to `undefined`; the existing flat-data emits already
67
- do this same coercion).
71
+ `Paint`-shaped object compatible with `SceneNode.paint`. `fill` resolves
72
+ through `textureFill`, so a texture becomes a `pattern:<json>` token and
73
+ a non-string fill becomes `undefined`.
68
74
  */
69
75
  export declare function paintFromShapeConfig(sc: Record<string, unknown>, d: DataPoint, i: number | undefined): {
70
76
  fill?: string;
@@ -97,6 +103,14 @@ export declare function drawNodeLabel(viz: {
97
103
  uses `"edge"` instead.
98
104
  */
99
105
  export declare function shapeConfigFor(viz: VizLike, shapeKey: string, config?: Record<string, unknown>, kind?: string): Record<string, unknown>;
106
+ /**
107
+ The user's label config for one shape kind — `shapeConfig.labelConfig`
108
+ overlaid with `shapeConfig[shapeKey].labelConfig`, data-wrapped the same
109
+ way the Shape path wraps it. Spread it over a chart's own label defaults so
110
+ user settings (including `fontFamily()`) win. Library-seeded defaults are
111
+ left out so they don't override the chart's.
112
+ */
113
+ export declare function userLabelConfig(viz: VizLike, shapeKey: string): Record<string, unknown>;
100
114
  /**
101
115
  Run `shape.render()` in compute mode and collect the resulting scene
102
116
  nodes — shape children and/or label children — in a single flat array.
@@ -150,14 +150,7 @@ export { legendFeature } from "./featuresLegend.js";
150
150
  components collection) and claims `margin.bottom` from its outerBounds.
151
151
  */
152
152
  export declare const timelineFeature: FeatureModule;
153
- /**
154
- Converts `drawColorScale.ts` to a FeatureModule.
155
-
156
- Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves
157
- to a side. Renders the chart's `_colorScaleClass` ColorScale instance and
158
- claims margin along its position side.
159
- */
160
- export declare const colorScaleFeature: FeatureModule;
153
+ export { colorScaleFeature } from "./featuresColorScale.js";
161
154
  export { attributionFeature } from "./attributionFeature.js";
162
155
  /**
163
156
  Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/
@@ -0,0 +1,24 @@
1
+ import type { VizInstance } from "../viz/vizTypes.js";
2
+ import type { FeatureModule } from "./features.js";
3
+ import type { InsetOrient } from "./insetState.js";
4
+ /**
5
+ Lays the colorScale out to be drawn inside the chart: at the origin —
6
+ Viz.toScene moves it into place — vertically (`"column"`) or
7
+ horizontally (`"row"`), sized against the chart area `area`. Returns its
8
+ measured size, or null when it isn't showing.
9
+ */
10
+ export declare function paintColorScaleInset(viz: VizInstance, orient: InsetOrient, area: {
11
+ width: number;
12
+ height: number;
13
+ }): {
14
+ width: number;
15
+ height: number;
16
+ } | null;
17
+ /**
18
+ Converts `drawColorScale.ts` to a FeatureModule.
19
+
20
+ Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves
21
+ to a side. Renders the chart's `_colorScaleClass` ColorScale instance and
22
+ claims margin along its position side.
23
+ */
24
+ export declare const colorScaleFeature: FeatureModule;
@@ -1,6 +1,7 @@
1
1
  import type { DataPoint } from "@d3plus/data";
2
2
  import type { FeatureModule } from "./features.js";
3
3
  import type { VizInstance } from "../viz/vizTypes.js";
4
+ import type { InsetOrient } from "./insetState.js";
4
5
  interface LegendData {
5
6
  legendData: DataPoint[];
6
7
  legendKey: (d: DataPoint, i: number) => string;
@@ -13,6 +14,20 @@ interface LegendData {
13
14
  render step reuses.
14
15
  */
15
16
  export declare function buildLegendData(viz: VizInstance): LegendData;
17
+ /**
18
+ Lays the legend out to be drawn inside the chart (see
19
+ `pipeline/insetPlacement.ts`): at the origin — Viz.toScene moves it into
20
+ place — as a column or a row sized against the chart area `area`.
21
+ Returns the legend's measured size, or null when it isn't showing or
22
+ couldn't fit its labels.
23
+ */
24
+ export declare function paintLegendInset(viz: VizInstance, orient: InsetOrient, area: {
25
+ width: number;
26
+ height: number;
27
+ }, built?: LegendData): {
28
+ width: number;
29
+ height: number;
30
+ } | null;
16
31
  /**
17
32
  Converts `drawLegend.ts` to a FeatureModule.
18
33
 
@@ -0,0 +1,95 @@
1
+ /**
2
+ Shared state for drawing chart chrome (the size legend, legend, or
3
+ colorScale) inside the chart's negative space instead of in a margin.
4
+ The placement itself is decided in `pipeline/insetPlacement.ts`; this
5
+ module holds the types and the small queries the features use while they
6
+ lay out, so they don't depend on the placement pipeline.
7
+
8
+ @module
9
+ */
10
+ import type { Bounds } from "@d3plus/math";
11
+ import type { SceneNode } from "@d3plus/render";
12
+ import type { VizInstance } from "../viz/vizTypes.js";
13
+ /** The chrome that can be drawn inside the chart, in the order it is tried. */
14
+ export type InsetKey = "sizeLegend" | "legend" | "colorScale";
15
+ export declare const INSET_PRIORITY: InsetKey[];
16
+ /** How a legend or colorScale is laid out when drawn inside the chart. */
17
+ export type InsetOrient = "column" | "row";
18
+ /** The region a chart offers for inset chrome, in surface coordinates. */
19
+ export interface InsetRegion {
20
+ /** The area chrome may be drawn in (e.g. the plot area). */
21
+ bounds: Bounds;
22
+ /** The boxes of the chart's marks, which chrome must stay clear of. */
23
+ obstacles: Bounds[];
24
+ }
25
+ /** Where the inset chrome landed: its background box, in surface coordinates. */
26
+ export interface InsetPlacement extends Bounds {
27
+ key: InsetKey;
28
+ orient: InsetOrient;
29
+ /** Which side of its open space the box hugs, so content smaller than it can keep to that side. */
30
+ alignX: "left" | "center" | "right";
31
+ alignY: "top" | "middle" | "bottom";
32
+ }
33
+ /**
34
+ Seeds `legendInset`/`legendInsetConfig`, and remembers the default
35
+ legend/colorScale position accessors so a placement can tell a position
36
+ the user chose (which it leaves alone) from the default. Runs after the
37
+ legend and color defaults are seeded.
38
+ */
39
+ export declare function initInsetDefaults(viz: VizInstance): void;
40
+ /** Resolved `legendInsetConfig`. */
41
+ export interface InsetStyle {
42
+ /** Gap kept between the box and the chart's marks and edges. */
43
+ padding: number;
44
+ /** Space between the box's edge and the chrome inside it. */
45
+ margin: number;
46
+ fill?: string;
47
+ fillOpacity: number;
48
+ stroke?: string;
49
+ strokeWidth: number;
50
+ rx: number;
51
+ }
52
+ /** The resolved background-box style, with the chart's defaults filled in. */
53
+ export declare function insetStyle(viz: VizInstance): InsetStyle;
54
+ /** Whether `key` is being laid out for the chart's interior this pass (so it claims no margin). */
55
+ export declare function isInsetPending(viz: VizInstance, key: InsetKey): boolean;
56
+ /** The final placement of `key`, or null when it isn't drawn inside the chart. */
57
+ export declare function insetPlacementFor(viz: VizInstance, key: InsetKey): InsetPlacement | null;
58
+ /** The orientation `key` is laid out with when inset (column until placement picks one). */
59
+ export declare function insetOrient(viz: VizInstance, key: InsetKey): InsetOrient;
60
+ /**
61
+ The largest frame a legend or colorScale may lay itself out in when inset,
62
+ for a chart area of `area`: a column takes up to 40% of the width and 60%
63
+ of the height, a row the reverse.
64
+ */
65
+ export declare function insetFrame(orient: InsetOrient, area: {
66
+ width: number;
67
+ height: number;
68
+ }): {
69
+ width: number;
70
+ height: number;
71
+ };
72
+ /** The semi-transparent box drawn behind inset chrome, so it stays legible over marks panned beneath it. */
73
+ export declare function insetBackground(viz: VizInstance, placement: InsetPlacement): SceneNode;
74
+ /**
75
+ The scene children for a legend or colorScale component: just its own
76
+ scene normally, or — when it's drawn inside the chart — its background box
77
+ plus its scene moved into the box. `bounds` is the component's
78
+ `outerBounds()` (its content box within its own frame).
79
+ */
80
+ export declare function insetComponentScene(viz: VizInstance, key: InsetKey, scene: SceneNode, bounds: {
81
+ x?: number;
82
+ y?: number;
83
+ }): SceneNode[];
84
+ /**
85
+ Where a legend or colorScale component's own frame goes so its content
86
+ (`bounds`, its `outerBounds()`) lands inside its placed box; null when it
87
+ isn't drawn inside the chart.
88
+ */
89
+ export declare function insetComponentOffset(viz: VizInstance, key: InsetKey, bounds: {
90
+ x?: number;
91
+ y?: number;
92
+ }): {
93
+ x: number;
94
+ y: number;
95
+ } | null;
@@ -13,6 +13,7 @@
13
13
  import type { DataPoint } from "@d3plus/data";
14
14
  import type { ClipShape, SceneNode } from "@d3plus/render";
15
15
  import type Axis from "../../components/Axis/Axis.js";
16
+ import * as shapes from "../../shapes/index.js";
16
17
  import type { VizInstance as Viz } from "../viz/vizTypes.js";
17
18
  /** An axis position function: maps a domain value to a pixel coordinate. */
18
19
  export type PlotAxisFn = (d: unknown, axis?: string) => number;
@@ -52,6 +53,12 @@ export interface PlotDatum {
52
53
  hci?: number;
53
54
  [key: string]: unknown;
54
55
  }
56
+ /** A user annotation: a shape key plus its config, optionally z-layered. */
57
+ export interface Annotation {
58
+ shape: string;
59
+ layer?: string;
60
+ [key: string]: unknown;
61
+ }
55
62
  /**
56
63
  Cross-phase locals threaded from `Plot._draw` (and its extracted pipeline
57
64
  stages) into `plotPaint` — the contract any consumer of `plotPaint` must
@@ -209,6 +216,24 @@ export interface PlotMeasureResult {
209
216
  yOffset: number;
210
217
  labelPositions: Record<string, number>;
211
218
  }
219
+ /**
220
+ Wraps one annotation's scene in its OWN stable-keyed group, keeping the
221
+ shape's node group and label group as distinct sub-groups (rather than
222
+ flattening them into the chart-cell siblings, as `collectComputed` would).
223
+
224
+ The per-annotation `key` scopes the renderer's keyed join: ids reused
225
+ across different annotation shapes (e.g. "curve-mask" on both a Circle and
226
+ a Rect) no longer collide into one sibling list, so each annotation's nodes
227
+ match old→new by id frame-to-frame and TWEEN instead of exit/entering. The
228
+ subtree is marked inert (annotations never show tooltips).
229
+ */
230
+ export declare function collectAnnotationGroup(inst: shapes.Shape, key: string): SceneNode | null;
231
+ /**
232
+ Renders one annotation in compute mode: the annotation's own config, with
233
+ positions mapped from data space through the plot's axis functions — the
234
+ same mapping user `annotations` get.
235
+ */
236
+ export declare function renderPlotAnnotation(viz: Viz, annotation: Annotation, x: PlotAxisFn, y: PlotAxisFn, domains: Record<string, unknown[]>, yOffset: number): shapes.Shape;
212
237
  /**
213
238
  EMIT phase of plotPaint. Takes the `PlotMeasureResult` from
214
239
  `renderAxes` and produces ALL the scene nodes: background rect,
@@ -0,0 +1,18 @@
1
+ /**
2
+ Bounding boxes of a chart's data marks, read off its scene graph — the
3
+ obstacles `negativeSpace` keeps chart chrome clear of.
4
+
5
+ @module
6
+ */
7
+ import type { Bounds } from "@d3plus/math";
8
+ import type { SceneNode, Transform } from "@d3plus/render";
9
+ /**
10
+ Boxes, in the coordinate space of `nodes` after `base` is applied, of
11
+ every data mark and label in a scene: datum-bearing nodes at any depth,
12
+ with group transforms composed. `::hit` duplicates and chart decorations
13
+ (axes, gridlines and other nodes without a datum) are skipped.
14
+ @param nodes The chart's scene nodes (e.g. `viz._chartScene`).
15
+ @param base A transform applied to all of them (e.g. `viz._chartTransform`).
16
+ @param skip Excludes a node and everything inside it, for decorations that carry a datum (like axis ticks).
17
+ */
18
+ export declare function markBoxes(nodes: SceneNode[], base?: Transform, skip?: (node: SceneNode) => boolean): Bounds[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ The small colored glyph that ties a tooltip row or title to the mark it
3
+ describes, matching the legend's swatches: a dot with a short line through
4
+ it for a Line, a dot for a Circle, and a square for everything else.
5
+ */
6
+ import type { SceneNode } from "@d3plus/render";
7
+ import type { VizInstance } from "../viz/vizTypes.js";
8
+ /**
9
+ A swatch's HTML for a mark of `shape` in `color`, to lead a tooltip title
10
+ or row (see `withSwatch`). Empty without a color.
11
+ @param color The mark's color.
12
+ @param shape The mark's shape type (e.g. "Line", "Circle", "Bar").
13
+ */
14
+ export declare function tooltipSwatch(color?: string, shape?: string): string;
15
+ /**
16
+ Leads `text` with a swatch, centered on the text however large or bold it
17
+ is (a tooltip title, or a row's name). Just `text` without a swatch.
18
+ @param swatch The swatch HTML, from `tooltipSwatch`.
19
+ @param text The title or name it leads.
20
+ */
21
+ export declare function withSwatch(swatch: string, text: unknown): string;
22
+ /** A paint color that actually shows: not unset, "none", or transparent. */
23
+ export declare const visibleColor: (s: unknown) => string | undefined;
24
+ /**
25
+ The color a picked scene node draws in: a Line's stroke, otherwise its
26
+ fill (or stroke, for an unfilled mark). A transparent hover target (a
27
+ `::hit` node) reads its visible sibling's paint.
28
+ @param viz The chart, whose scene holds the sibling.
29
+ @param node The picked scene node.
30
+ */
31
+ export declare function nodeColor(viz: VizInstance, node: SceneNode | undefined): string | undefined;
@@ -5,6 +5,7 @@ export { default as BumpChart } from "./BumpChart/index.js";
5
5
  export { default as Chord } from "./Chord/index.js";
6
6
  export { default as Donut } from "./Donut/index.js";
7
7
  export { default as Geomap } from "./Geomap/index.js";
8
+ export { default as Histogram } from "./Histogram/index.js";
8
9
  export { default as LinePlot } from "./LinePlot/index.js";
9
10
  export { default as Matrix } from "./Matrix/index.js";
10
11
  export { default as Network } from "./Network/index.js";
@@ -0,0 +1,29 @@
1
+ /**
2
+ `resolveDrillMorph(viz)` — resolves the one-shot drill-down morph state
3
+ armed by `clickShape`'s forward capture or a Back click's reunion lookup
4
+ (see `events/click.shape.ts`, `viz/vizDefaults.ts`, `viz/Viz.ts`) into the
5
+ `_resolvedEnterFrom`/`_resolvedExitTo` boxes `_drawSceneToTarget` passes to
6
+ `drawScene`, using the *current* draw's `_bodyRect`/`_chartScene` — the
7
+ ones the layout/paint step just produced.
8
+
9
+ Chart-family-agnostic: every emitted rect/circle node already carries
10
+ `.datum`/`.index` (Treemap/Pack hand-built, or Plot's Shape-based), so the
11
+ Back-click reunion lookup needs no per-chart code — beyond unwrapping the
12
+ datum the same way every other interaction handler does (see
13
+ `unwrapDatum` below). Call once per draw, after `_draw()`/post-draw
14
+ features and before `_drawSceneToTarget()` (`runVizPipeline`) — by then
15
+ `_bodyRect`/`_chartScene` reflect the new frame, and both pending fields
16
+ are cleared unconditionally so a later, unrelated repaint (hover, resize,
17
+ legend toggle) never inherits a stale morph.
18
+ */
19
+ import type { SceneNode, TransitionRect } from "@d3plus/render";
20
+ import type { VizInstance as Viz } from "../viz/vizTypes.js";
21
+ /**
22
+ A flip-eligible node's geometry as a plain bounding box — every type
23
+ `isFlipEligible` (render package) approves: rect, circle, the `AreaNode`
24
+ type, and a `path` node stamped `shapeType: "Area"` (StackedArea/
25
+ AreaPlot's actual band representation). Shared with `click.shape.ts`'s
26
+ forward capture, which needs the identical conversion for the clicked node.
27
+ */
28
+ export declare function nodeRect(node: SceneNode): TransitionRect | null;
29
+ export declare function resolveDrillMorph(viz: Viz): void;
@@ -0,0 +1,45 @@
1
+ /**
2
+ Draws one piece of chart chrome — the size legend, else the legend, else
3
+ the colorScale — inside the chart's negative space instead of in a
4
+ margin, when the chart offers a region (`ChartDefinition.insetRegion`)
5
+ and `legendInset` is on.
6
+
7
+ Placement needs the chart's laid-out marks, but chrome normally claims
8
+ its margin before the chart lays out, so the draw runs optimistically:
9
+ 1. Every candidate skips its margin claim, and the chart lays out in
10
+ the full area.
11
+ 2. The open space around the marks (`negativeSpace`) is searched for
12
+ the first candidate, in priority order, that fits.
13
+ 3. If one fits and nothing else is waiting on a margin, that draw
14
+ stands. If other candidates are showing, the chart lays out again
15
+ with them back in their margins, and the winner is fitted again in
16
+ the (smaller) chart. When nothing fits, the chart lays out normally.
17
+
18
+ @module
19
+ */
20
+ import type { Bounds } from "@d3plus/math";
21
+ import type { SceneNode } from "@d3plus/render";
22
+ import type { InsetPlacement, InsetRegion } from "../features/insetState.js";
23
+ import type { VizInstance } from "../viz/vizTypes.js";
24
+ /**
25
+ The default inset region: the chart area (or `bounds`, in surface
26
+ coordinates), with the boxes of every data mark in the chart's scene as
27
+ obstacles (less any subtree `skip` excludes). Charts opt in by returning
28
+ this from their `insetRegion`.
29
+ */
30
+ export declare function sceneInsetRegion(viz: VizInstance, bounds?: Bounds, skip?: (node: SceneNode) => boolean): InsetRegion;
31
+ /**
32
+ Where a box of `width` × `height` sits in the open rects (sorted largest
33
+ first): in the first chart corner, in `CORNERS` order, that some rect
34
+ reaching that corner has room for. When it fits in no corner, it goes in
35
+ the first rect it fits, against whichever of the rect's sides lie on the
36
+ region's edges (bottom-right when it touches both), centered along an
37
+ axis otherwise.
38
+ */
39
+ export declare function fitInset(rects: Bounds[], bounds: Bounds, width: number, height: number): (Bounds & Pick<InsetPlacement, "alignX" | "alignY">) | null;
40
+ /**
41
+ `viz._draw()`, placing chrome inside the chart's negative space when it
42
+ fits (see the module docs). Leaves `viz._insetPlacement` set to what was
43
+ placed, or null.
44
+ */
45
+ export declare function drawWithInset(viz: VizInstance): void;
@@ -13,10 +13,12 @@
13
13
  callback:
14
14
 
15
15
  1. `viz._preDraw()` — data filtering + legend-data + drawDepth
16
- 2. `viz._draw()` — chart-specific layout + scene absorption
16
+ 2. `viz._draw()` — chart-specific layout + scene absorption, re-run
17
+ when chrome is placed inside the chart (`drawWithInset`)
17
18
  3. `zoomControls(viz)` — zoom HTML overlay (architectural carve-out)
18
19
  4. `minimapFeature.layout(viz)` — zoomed-chart viewport indicator
19
20
  5. `topLeftControlsFeature.layout(viz)` — back/table-view/search panel
21
+ 5b. `bottomRightControlsFeature.layout(viz)` — size-legend corner panel
20
22
  6. `attributionFeature.layout(viz)` — bottom-right attribution panel
21
23
  7. `tableViewFeature.layout(viz)` — chart-sized data-table overlay
22
24
  8. `viz._drawSceneToTarget()` — paint scene via SvgRenderer/CanvasRenderer
@@ -32,3 +34,10 @@
32
34
  */
33
35
  import type { VizInstance as Viz } from "../viz/vizTypes.js";
34
36
  export declare function runVizPipeline(viz: Viz): void;
37
+ /**
38
+ Runs the post-draw features (see above) and appends their panels. Anything
39
+ that re-runs `viz._draw()` outside this pipeline — Rings re-centering on a
40
+ click, say — must call this after it: `_draw()` resets the feature panels,
41
+ so skipping it drops the corner controls, size legend, and attribution.
42
+ */
43
+ export declare function runPostDrawFeatures(viz: Viz): void;
@@ -1,8 +1,10 @@
1
1
  import type { DataPoint } from "@d3plus/data";
2
2
  import type { PickResult, Renderer, Scene, SceneEvent } from "@d3plus/render";
3
3
  import VizBase from "./VizBase.js";
4
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
5
+ import type { InsetRegion } from "../features/insetState.js";
4
6
  /**
5
- Creates an x/y plot based on an array of data. See [this example](https://d3plus.org/examples/d3plus-treemap/getting-started/) for help getting started using the treemap generator.
7
+ The base class every d3plus chart extends. Owns the shared configuration surface (data, groupBy, size and color accessors, title, legend, tooltip, timeline, zoom, table view) and the render lifecycle that each chart type's definition plugs its layout into. Not used directly; see the chart classes (BarChart, Treemap, …).
6
8
  */
7
9
  export default class Viz extends VizBase {
8
10
  /**
@@ -30,6 +32,22 @@ export default class Viz extends VizBase {
30
32
  @private
31
33
  */
32
34
  _draw(): void;
35
+ /**
36
+ The chart's size-legend radius scale (see `ChartDefinition.sizeLegendScale`).
37
+ Charts that size marks override this; the base chart sizes nothing.
38
+ @private
39
+ */
40
+ _sizeLegendScale(_available: {
41
+ width: number;
42
+ height: number;
43
+ }): SizeLegendScale | null;
44
+ /**
45
+ The region chart chrome may be drawn inside, with the chart's mark boxes
46
+ as obstacles (see `ChartDefinition.insetRegion`). Charts that leave
47
+ negative space override this; the base chart offers none.
48
+ @private
49
+ */
50
+ _insetRegion(): InsetRegion | null;
33
51
  /**
34
52
  * Applies the threshold algorithm according to the type of chart used.
35
53
  * @param {Array} data The data to process.
@@ -113,6 +131,13 @@ export default class Viz extends VizBase {
113
131
  i: number;
114
132
  x: unknown;
115
133
  };
134
+ /**
135
+ Pointer hook run by `_routeSceneEvent` before any handler routing, for
136
+ every event including ones over empty space. No-op here; Plot overrides
137
+ it to drive the shared multi-series tooltip and crosshair.
138
+ @private
139
+ */
140
+ _sharedHover(_event: SceneEvent): void;
116
141
  /**
117
142
  Routes a renderer pointer event to the matching `viz.schema.on` handlers.
118
143
  Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where
@@ -135,7 +160,7 @@ export default class Viz extends VizBase {
135
160
  */
136
161
  _scheduleSceneRepaint(): void;
137
162
  /**
138
- Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
163
+ Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
139
164
  */
140
165
  destroy(): this;
141
166
  }
@@ -2,6 +2,7 @@ import { select } from "d3-selection";
2
2
  import type { DataPoint } from "@d3plus/data";
3
3
  import type { D3plusConfig } from "../../utils/index.js";
4
4
  import type { ZoomControlIcons } from "../drawSteps/zoomControlsMarkup.js";
5
+ import type { SizeLegendScale, SizeLegendSize } from "../../components/SizeLegend/sizeLegendLayout.js";
5
6
  import VizBaseConfig from "./VizBaseConfig.js";
6
7
  /**
7
8
  Second half of the fluent config accessors shared by every Viz chart
@@ -102,6 +103,18 @@ export default class VizBase extends VizBaseConfig {
102
103
  */
103
104
  shapeConfig(): D3plusConfig;
104
105
  shapeConfig(_: D3plusConfig): this;
106
+ /**
107
+ Whether to display the size legend: a nested-circle key, in the chart's bottom-right corner, for charts that size their marks with a `size` accessor (bubble plots, Geomap points via `pointSize`, Network, Rings). By default it shows whenever marks are sized by more than one value, unless it would take up more than a third of the chart's width or height. Pass `true` to always show it, `false` to hide it, or a function that receives the resolved chart config, the radius scale, and the legend's measured `{width, height, availableWidth, availableHeight}`, and returns a boolean.
108
+ */
109
+ sizeLegend(_?: boolean | ((config: Record<string, unknown>, scale: SizeLegendScale, size: SizeLegendSize) => boolean)): this | boolean | ((config: Record<string, unknown>, scale: SizeLegendScale, size: SizeLegendSize) => boolean);
110
+ /**
111
+ Configuration object passed to the size legend's config method: `values` (an array of values to draw, or how many to pick), `tickFormat`, `title` (defaults to the `size` key when `size` is set to a string), `shapeConfig`, `lineConfig`, `labelConfig`, `titleConfig`, `padding`, `lineLength`, and `labelPadding`.
112
+ */
113
+ sizeLegendConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
114
+ /**
115
+ Which margin the size legend claims in the chart's bottom-right corner. `"right"` (the default) widens the right margin, so the chart keeps its full height and the legend sits at the bottom of the right column, below any right-side legend or colorScale. `"bottom"` deepens the bottom margin instead, so the chart keeps its full width and any bottom legend or colorScale narrows to sit beside it.
116
+ */
117
+ sizeLegendPosition(_?: "right" | "bottom"): this | "right" | "bottom";
105
118
  /**
106
119
  Accessor function or string for the visualization's subtitle.
107
120
  */
@@ -99,21 +99,13 @@ export default class VizBaseConfig extends BaseClass {
99
99
  */
100
100
  detectVisible(_?: boolean): this | boolean;
101
101
  /**
102
- The interval, in milliseconds, for checking if the visualization is visible on the page.
102
+ The interval, in milliseconds, for checking if the visualization is visible on the page. When `detectVisible` defers a render until the visualization scrolls into view, this is also how long it must stay in view before it renders, so visualizations scrolled past quickly are never drawn.
103
103
  */
104
104
  detectVisibleInterval(_?: number): this | number;
105
105
  /**
106
- Shows a button that allows for downloading the current visualization.
106
+ 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`.
107
107
  */
108
- downloadButton(_?: boolean): this | boolean;
109
- /**
110
- Sets specific options of the saveElement function used when downloading the visualization.
111
- */
112
- downloadConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
113
- /**
114
- Defines which control group to add the download button into.
115
- */
116
- downloadPosition(_?: string): this | string;
108
+ detectVisibleUnload(_?: boolean): this | boolean;
117
109
  /**
118
110
  The font family used throughout the visualization.
119
111
  */
@@ -160,6 +152,14 @@ export default class VizBaseConfig extends BaseClass {
160
152
  Defines the click functionality of categorical legend squares. When set to false, clicking will hide that category and shift+clicking will solo that category. When set to true, clicking with solo that category and shift+clicking will hide that category.
161
153
  */
162
154
  legendFilterInvert(_?: boolean | ((viz: VizBase) => boolean)): this | boolean | ((viz: VizBase) => boolean);
155
+ /**
156
+ 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 room (Plot, Network, Pack, Pie, Rings, Tree, and Geomap). 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. A legend or colorScale whose position was set explicitly stays in that margin. Defaults to `true`; also accepts a function that receives the resolved chart config and returns a boolean.
157
+ */
158
+ legendInset(_?: boolean | ((config: Record<string, unknown>) => boolean)): this | boolean | ((config: Record<string, unknown>) => boolean);
159
+ /**
160
+ Style of the box drawn behind a legend placed inside the chart (see `legendInset`): `fill` (defaults to the chart's background color), `fillOpacity` (0.85), `stroke` (defaults to a faint contrasting line), `strokeWidth` (1), `rx` (corner radius, 4), `margin` (space between the box's edge and the legend, 6), and `padding` (space kept between the box and the chart's marks and edges, 10).
161
+ */
162
+ legendInsetConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
163
163
  /**
164
164
  Tells the legend whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the legend appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
165
165
  */