@d3plus/core 4.5.0 → 4.6.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 (241) hide show
  1. package/README.md +3698 -1074
  2. package/es/index.js +3 -3
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +6 -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 +15 -0
  13. package/es/src/charts/Chord/index.js.map +1 -1
  14. package/es/src/charts/Geomap/applyLayout.js +17 -10
  15. package/es/src/charts/Geomap/applyLayout.js.map +1 -1
  16. package/es/src/charts/Geomap/index.js +5 -1
  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/Network/applyLayout.js +52 -4
  23. package/es/src/charts/Network/applyLayout.js.map +1 -1
  24. package/es/src/charts/Network/emit.js +4 -4
  25. package/es/src/charts/Network/emit.js.map +1 -1
  26. package/es/src/charts/Network/index.js +6 -1
  27. package/es/src/charts/Network/index.js.map +1 -1
  28. package/es/src/charts/Pack/emit.js +37 -2
  29. package/es/src/charts/Pack/emit.js.map +1 -1
  30. package/es/src/charts/Pack/index.js +13 -0
  31. package/es/src/charts/Pack/index.js.map +1 -1
  32. package/es/src/charts/Pie/applyLayout.js +20 -2
  33. package/es/src/charts/Pie/applyLayout.js.map +1 -1
  34. package/es/src/charts/Pie/emit.js +274 -33
  35. package/es/src/charts/Pie/emit.js.map +1 -1
  36. package/es/src/charts/Pie/index.js +46 -1
  37. package/es/src/charts/Pie/index.js.map +1 -1
  38. package/es/src/charts/Plot/discreteSpan.js +42 -0
  39. package/es/src/charts/Plot/discreteSpan.js.map +1 -0
  40. package/es/src/charts/Plot/draw.js +3 -1
  41. package/es/src/charts/Plot/draw.js.map +1 -1
  42. package/es/src/charts/Plot/index.js +129 -14
  43. package/es/src/charts/Plot/index.js.map +1 -1
  44. package/es/src/charts/Plot/pipeline.js +47 -20
  45. package/es/src/charts/Plot/pipeline.js.map +1 -1
  46. package/es/src/charts/Plot/pipelineDomains.js +84 -8
  47. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  48. package/es/src/charts/Plot/shapeDefaults.js +3 -3
  49. package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
  50. package/es/src/charts/Plot/sharedHover.js +431 -0
  51. package/es/src/charts/Plot/sharedHover.js.map +1 -0
  52. package/es/src/charts/Plot/sharedHoverScene.js +230 -0
  53. package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
  54. package/es/src/charts/Plot/sharedTooltip.js +163 -0
  55. package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
  56. package/es/src/charts/Plot/stackShareLabels.js +137 -0
  57. package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
  58. package/es/src/charts/Plot/stackShareTooltip.js +31 -0
  59. package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
  60. package/es/src/charts/Plot/trendLines.js +367 -0
  61. package/es/src/charts/Plot/trendLines.js.map +1 -0
  62. package/es/src/charts/Plot/trendScene.js +220 -0
  63. package/es/src/charts/Plot/trendScene.js.map +1 -0
  64. package/es/src/charts/Plot/trendTooltip.js +160 -0
  65. package/es/src/charts/Plot/trendTooltip.js.map +1 -0
  66. package/es/src/charts/Priestley/emit.js +32 -3
  67. package/es/src/charts/Priestley/emit.js.map +1 -1
  68. package/es/src/charts/Radar/index.js +15 -2
  69. package/es/src/charts/Radar/index.js.map +1 -1
  70. package/es/src/charts/RadialMatrix/index.js +17 -1
  71. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  72. package/es/src/charts/Rings/applyLayout.js +72 -116
  73. package/es/src/charts/Rings/applyLayout.js.map +1 -1
  74. package/es/src/charts/Rings/emit.js +2 -3
  75. package/es/src/charts/Rings/emit.js.map +1 -1
  76. package/es/src/charts/Rings/index.js +13 -2
  77. package/es/src/charts/Rings/index.js.map +1 -1
  78. package/es/src/charts/Rings/ringsSizing.js +189 -0
  79. package/es/src/charts/Rings/ringsSizing.js.map +1 -0
  80. package/es/src/charts/StackedArea/index.js +8 -1
  81. package/es/src/charts/StackedArea/index.js.map +1 -1
  82. package/es/src/charts/Tree/emit.js +2 -2
  83. package/es/src/charts/Tree/emit.js.map +1 -1
  84. package/es/src/charts/Tree/index.js +5 -3
  85. package/es/src/charts/Tree/index.js.map +1 -1
  86. package/es/src/charts/Treemap/emit.js +56 -3
  87. package/es/src/charts/Treemap/emit.js.map +1 -1
  88. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  89. package/es/src/charts/definition/makeChart.js +8 -1
  90. package/es/src/charts/definition/makeChart.js.map +1 -1
  91. package/es/src/charts/drawSteps/backControl.js +17 -2
  92. package/es/src/charts/drawSteps/backControl.js.map +1 -1
  93. package/es/src/charts/drawSteps/bottomRightControls.js +193 -0
  94. package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
  95. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +161 -0
  96. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
  97. package/es/src/charts/drawSteps/minimap.js +34 -9
  98. package/es/src/charts/drawSteps/minimap.js.map +1 -1
  99. package/es/src/charts/drawSteps/zoomControls.js +3 -0
  100. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  101. package/es/src/charts/events/click.shape.js +24 -1
  102. package/es/src/charts/events/click.shape.js.map +1 -1
  103. package/es/src/charts/events/mouseenter.js +3 -0
  104. package/es/src/charts/events/mouseenter.js.map +1 -1
  105. package/es/src/charts/events/mouseleave.js +3 -0
  106. package/es/src/charts/events/mouseleave.js.map +1 -1
  107. package/es/src/charts/events/mousemove.shape.js +2 -0
  108. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  109. package/es/src/charts/features/axes.js +4 -1
  110. package/es/src/charts/features/axes.js.map +1 -1
  111. package/es/src/charts/features/emitHelpers.js +24 -0
  112. package/es/src/charts/features/emitHelpers.js.map +1 -1
  113. package/es/src/charts/features/features.js +6 -2
  114. package/es/src/charts/features/features.js.map +1 -1
  115. package/es/src/charts/features/featuresLegend.js +13 -5
  116. package/es/src/charts/features/featuresLegend.js.map +1 -1
  117. package/es/src/charts/features/plotPaint.js +51 -24
  118. package/es/src/charts/features/plotPaint.js.map +1 -1
  119. package/es/src/charts/features/shapeEmit.js +20 -2
  120. package/es/src/charts/features/shapeEmit.js.map +1 -1
  121. package/es/src/charts/index.js +1 -0
  122. package/es/src/charts/index.js.map +1 -1
  123. package/es/src/charts/pipeline/drillMorph.js +159 -0
  124. package/es/src/charts/pipeline/drillMorph.js.map +1 -0
  125. package/es/src/charts/pipeline/runChartDraw.js +35 -1
  126. package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
  127. package/es/src/charts/pipeline/runVizPipeline.js +16 -1
  128. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  129. package/es/src/charts/pipeline/vizDrawPure.js +20 -0
  130. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  131. package/es/src/charts/viz/Viz.js +64 -8
  132. package/es/src/charts/viz/Viz.js.map +1 -1
  133. package/es/src/charts/viz/VizBase.js +29 -1
  134. package/es/src/charts/viz/VizBase.js.map +1 -1
  135. package/es/src/charts/viz/VizBaseConfig.js +9 -1
  136. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  137. package/es/src/charts/viz/ordinalColor.js +2 -2
  138. package/es/src/charts/viz/ordinalColor.js.map +1 -1
  139. package/es/src/charts/viz/vizDefaults.js +27 -8
  140. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  141. package/es/src/charts/viz/vizRender.js +54 -4
  142. package/es/src/charts/viz/vizRender.js.map +1 -1
  143. package/es/src/charts/viz/vizTypes.js.map +1 -1
  144. package/es/src/charts/viz/vizVisibility.js +145 -0
  145. package/es/src/charts/viz/vizVisibility.js.map +1 -0
  146. package/es/src/components/Axis/Axis.js +8 -8
  147. package/es/src/components/Axis/Axis.js.map +1 -1
  148. package/es/src/components/ColorScale/ColorScale.js +11 -11
  149. package/es/src/components/ColorScale/ColorScale.js.map +1 -1
  150. package/es/src/components/ColorScale/colorScaleScale.js +22 -10
  151. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
  152. package/es/src/components/Legend/Legend.js +8 -5
  153. package/es/src/components/Legend/Legend.js.map +1 -1
  154. package/es/src/components/Legend/legendConfig.js +1 -1
  155. package/es/src/components/Legend/legendConfig.js.map +1 -1
  156. package/es/src/components/Legend/legendRender.js +29 -22
  157. package/es/src/components/Legend/legendRender.js.map +1 -1
  158. package/es/src/components/SizeLegend/SizeLegend.js +411 -0
  159. package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
  160. package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
  161. package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
  162. package/es/src/components/Timeline/timelineConfig.js +8 -4
  163. package/es/src/components/Timeline/timelineConfig.js.map +1 -1
  164. package/es/src/components/Timeline/timelineRender.js +1 -2
  165. package/es/src/components/Timeline/timelineRender.js.map +1 -1
  166. package/es/src/components/Tooltip.js +27 -7
  167. package/es/src/components/Tooltip.js.map +1 -1
  168. package/es/src/components/index.js +1 -0
  169. package/es/src/components/index.js.map +1 -1
  170. package/es/src/shapes/Box.js +4 -2
  171. package/es/src/shapes/Box.js.map +1 -1
  172. package/es/src/shapes/Shape.js +1 -1
  173. package/es/src/shapes/Shape.js.map +1 -1
  174. package/es/src/shapes/Whisker.js +3 -2
  175. package/es/src/shapes/Whisker.js.map +1 -1
  176. package/es/src/shapes/validateShapeConfig.js +141 -0
  177. package/es/src/shapes/validateShapeConfig.js.map +1 -0
  178. package/es/src/utils/BaseClass.js +134 -4
  179. package/es/src/utils/BaseClass.js.map +1 -1
  180. package/es/src/utils/D3plusConfig.js.map +1 -1
  181. package/es/src/utils/configDefault.js +17 -0
  182. package/es/src/utils/configDefault.js.map +1 -0
  183. package/es/src/utils/configPrep.js +2 -1
  184. package/es/src/utils/configPrep.js.map +1 -1
  185. package/es/src/utils/configWarnings.js +37 -0
  186. package/es/src/utils/configWarnings.js.map +1 -0
  187. package/es/src/utils/index.js +1 -0
  188. package/es/src/utils/index.js.map +1 -1
  189. package/package.json +11 -10
  190. package/types/index.d.ts +4 -4
  191. package/types/internal.d.ts +8 -1
  192. package/types/src/charts/BarChart/index.d.ts +2 -1
  193. package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
  194. package/types/src/charts/Histogram/binData.d.ts +37 -0
  195. package/types/src/charts/Histogram/index.d.ts +14 -0
  196. package/types/src/charts/Network/applyLayout.d.ts +8 -0
  197. package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
  198. package/types/src/charts/Plot/index.d.ts +39 -0
  199. package/types/src/charts/Plot/pipeline.d.ts +14 -0
  200. package/types/src/charts/Plot/sharedHover.d.ts +79 -0
  201. package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
  202. package/types/src/charts/Plot/sharedTooltip.d.ts +26 -0
  203. package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
  204. package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
  205. package/types/src/charts/Plot/trendLines.d.ts +70 -0
  206. package/types/src/charts/Plot/trendScene.d.ts +18 -0
  207. package/types/src/charts/Plot/trendTooltip.d.ts +19 -0
  208. package/types/src/charts/Rings/applyLayout.d.ts +9 -0
  209. package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
  210. package/types/src/charts/StackedArea/index.d.ts +2 -1
  211. package/types/src/charts/definition/ChartDefinition.d.ts +30 -0
  212. package/types/src/charts/definition/makeChart.d.ts +2 -1
  213. package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
  214. package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +108 -0
  215. package/types/src/charts/features/emitHelpers.d.ts +8 -0
  216. package/types/src/charts/features/plotPaint.d.ts +25 -0
  217. package/types/src/charts/index.d.ts +1 -0
  218. package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
  219. package/types/src/charts/pipeline/runVizPipeline.d.ts +8 -0
  220. package/types/src/charts/viz/Viz.d.ts +18 -1
  221. package/types/src/charts/viz/VizBase.d.ts +13 -0
  222. package/types/src/charts/viz/VizBaseConfig.d.ts +5 -1
  223. package/types/src/charts/viz/vizTypes.d.ts +147 -3
  224. package/types/src/charts/viz/vizVisibility.d.ts +34 -0
  225. package/types/src/components/Legend/legendRender.d.ts +8 -2
  226. package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
  227. package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
  228. package/types/src/components/Tooltip.d.ts +18 -3
  229. package/types/src/components/index.d.ts +1 -0
  230. package/types/src/shapes/validateShapeConfig.d.ts +10 -0
  231. package/types/src/utils/BaseClass.d.ts +15 -1
  232. package/types/src/utils/D3plusConfig.d.ts +98 -0
  233. package/types/src/utils/configDefault.d.ts +11 -0
  234. package/types/src/utils/configWarnings.d.ts +28 -0
  235. package/types/src/utils/index.d.ts +2 -1
  236. package/umd/d3plus-core.full.js +7104 -2602
  237. package/umd/d3plus-core.full.js.map +1 -1
  238. package/umd/d3plus-core.full.min.js +2860 -1583
  239. package/umd/d3plus-core.js +3682 -441
  240. package/umd/d3plus-core.js.map +1 -1
  241. package/umd/d3plus-core.min.js +1656 -719
@@ -22,8 +22,10 @@ export { applyRadarLayout } from "./src/charts/Radar/applyLayout.js";
22
22
  export { applyRadialMatrixLayout } from "./src/charts/RadialMatrix/applyLayout.js";
23
23
  export { applyTreeLayout } from "./src/charts/Tree/applyLayout.js";
24
24
  export { applyTreemapLayout } from "./src/charts/Treemap/applyLayout.js";
25
+ export { default as binData } from "./src/charts/Histogram/binData.js";
25
26
  export { chordDef } from "./src/charts/Chord/index.js";
26
27
  export { geomapDef } from "./src/charts/Geomap/index.js";
28
+ export { histogramDef } from "./src/charts/Histogram/index.js";
27
29
  export { matrixDef } from "./src/charts/Matrix/index.js";
28
30
  export { networkDef } from "./src/charts/Network/index.js";
29
31
  export { ringsDef } from "./src/charts/Rings/index.js";
@@ -37,7 +39,7 @@ export { treeDef } from "./src/charts/Tree/index.js";
37
39
  export { treemapDef } from "./src/charts/Treemap/index.js";
38
40
  export { createFluent, installFluent } from "./src/fluent.js";
39
41
  export { runStages } from "./src/charts/pipeline/stages.js";
40
- export { runVizPipeline } from "./src/charts/pipeline/runVizPipeline.js";
42
+ export { runPostDrawFeatures, runVizPipeline } from "./src/charts/pipeline/runVizPipeline.js";
41
43
  export { resolveSpec } from "./src/charts/pipeline/resolveSpec.js";
42
44
  export { vizDraw } from "./src/charts/pipeline/vizDraw.js";
43
45
  export { vizDrawPure } from "./src/charts/pipeline/vizDrawPure.js";
@@ -49,6 +51,11 @@ export { computeAxisLayout, measureAxis } from "./src/components/Axis/Axis.js";
49
51
  export { colorScaleFeature, legendFeature, runLayout, subtitleFeature, timelineFeature, titleFeature, totalFeature, } from "./src/charts/features/features.js";
50
52
  export { getTopLeftContributions, topLeftControlsFeature, TOP_LEFT_CONTRIBUTORS, } from "./src/charts/drawSteps/topLeftControls.js";
51
53
  export { backContribution } from "./src/charts/drawSteps/backControl.js";
54
+ export { BOTTOM_RIGHT_CONTRIBUTORS, bottomRightControlsFeature, reserveBottomRight, sizeLegendContribution, } from "./src/charts/drawSteps/bottomRightControls.js";
55
+ export { bottomRightClearance, bottomRightControlsBox, bottomRightControlsDrop, bottomRightControlsInset, bottomRightControlsShortfall, } from "./src/charts/drawSteps/bottomRightControlsMarkup.js";
56
+ export type { BottomRightBox, BottomRightContribution } from "./src/charts/drawSteps/bottomRightControlsMarkup.js";
57
+ export { computeSizeLegend, defaultSizeLegendValues, zoomSizeLegendScale, } from "./src/components/SizeLegend/sizeLegendLayout.js";
58
+ export type { SizeLegendLayout, SizeLegendScale, SizeLegendSize } from "./src/components/SizeLegend/sizeLegendLayout.js";
52
59
  export { tableViewContribution } from "./src/charts/drawSteps/tableViewControl.js";
53
60
  export { searchContribution } from "./src/charts/drawSteps/searchControls.js";
54
61
  export type { ResolvedSpec } from "./src/charts/pipeline/resolveSpec.js";
@@ -4,7 +4,8 @@
4
4
  import type { ChartDefinition } from "../definition/ChartDefinition.js";
5
5
  export declare const barChartDef: ChartDefinition;
6
6
  /**
7
- Creates a bar chart based on an array of data.
7
+ Creates a bar chart based on an array of data. When stacked, each bar's
8
+ fraction of its stack total is available to tooltip accessors as `share`.
8
9
  */
9
10
  declare const _default: new () => any;
10
11
  export default _default;
@@ -3,5 +3,13 @@
3
3
  topojson → feature conversion + filter, builds the d3-geo path
4
4
  generator, fits the projection, and stashes `geomapCtx` on `viz.ctx`.
5
5
  */
6
- import type { TransformStage } from "../pipeline/stages.js";
6
+ import type { DataPoint } from "@d3plus/data";
7
+ import type { TransformStage, VizContext } from "../pipeline/stages.js";
8
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
9
+ type GeomapViz = VizContext["viz"];
10
+ /** The rows drawn as points: those whose `point` accessor returns coordinates. */
11
+ export declare function geomapPointData(v: GeomapViz): DataPoint[];
12
+ /** The point radius scale: `pointSizeScale` over the points' `pointSize` extent, onto `[pointSizeMin, pointSizeMax]`. */
13
+ export declare function geomapPointSizeScale(v: GeomapViz, pointData: DataPoint[]): SizeLegendScale;
7
14
  export declare const applyGeomapLayout: TransformStage;
15
+ export {};
@@ -0,0 +1,37 @@
1
+ import type { DataPoint } from "@d3plus/data";
2
+ /** A d3-array threshold generator: `(values, min, max) → count | edges`. */
3
+ export type ThresholdGenerator = (values: ArrayLike<number>, min: number, max: number) => number | number[];
4
+ /** How bin heights are normalized. */
5
+ export type BinNormalize = "count" | "density" | "relative";
6
+ export interface BinOptions {
7
+ /** Numeric observation accessor. */
8
+ value: (d: DataPoint, i: number) => unknown;
9
+ /** Series key for a row; rows sharing a key are binned together. */
10
+ group?: (d: DataPoint, i: number) => string;
11
+ /** Bin count, explicit edges, or a threshold generator. */
12
+ thresholds?: number | number[] | ThresholdGenerator;
13
+ /** `[min, max]` to bin across; defaults to the values' extent. */
14
+ domain?: [number, number];
15
+ /** Uniform bin width; overrides `thresholds`. */
16
+ width?: number;
17
+ /** `"count"` (default), `"density"` (area sums to 1), or `"relative"` (heights sum to 1). */
18
+ normalize?: BinNormalize;
19
+ }
20
+ /** One bin of one group. Carries the group's first row's fields. */
21
+ export interface BinRow extends DataPoint {
22
+ /** Bin start (inclusive). */
23
+ x0: number;
24
+ /** Bin end (exclusive, except for the last bin). */
25
+ x1: number;
26
+ /** Bin midpoint. */
27
+ x: number;
28
+ /** Observations in this group's bin. */
29
+ count: number;
30
+ /** The normalized height. */
31
+ y: number;
32
+ }
33
+ /**
34
+ Bins `rows` by `options.value`. Non-finite values are dropped. Every group
35
+ gets a row for every bin (empty bins included, so stacks line up).
36
+ */
37
+ export default function binData(rows: DataPoint[], options: BinOptions): BinRow[];
@@ -0,0 +1,14 @@
1
+ /**
2
+ Histogram — BarChart-style Plot that bins raw observations along a linear
3
+ x axis, one contiguous bar per bin, stacking series by `groupBy`.
4
+ */
5
+ import type { ChartDefinition } from "../definition/ChartDefinition.js";
6
+ export declare const histogramDef: ChartDefinition;
7
+ /**
8
+ Creates a histogram from an array of raw observations: the `value` of each
9
+ row is binned along a linear x axis, and bar heights show each bin's
10
+ count (or density / relative frequency via `binNormalize`). Series set by
11
+ `groupBy` share bin edges and are stacked.
12
+ */
13
+ declare const _default: new () => any;
14
+ export default _default;
@@ -7,4 +7,12 @@
7
7
  `viz.ctx` for the click/hover handlers installed by `setup`.
8
8
  */
9
9
  import type { TransformStage } from "../pipeline/stages.js";
10
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
11
+ /**
12
+ Network's size-legend scale for a chart area of `width` × `height`: the
13
+ same node set, positions, and fitted radius scale the layout builds, run
14
+ on a scratch copy of the nodes. The fit only shrinks as the area does, so
15
+ the layout's final radii never exceed this estimate's.
16
+ */
17
+ export declare function networkSizeLegendScale(v: Parameters<TransformStage>[0]["viz"], width: number, height: number): SizeLegendScale | null;
10
18
  export declare const applyNetworkLayout: TransformStage;
@@ -0,0 +1,9 @@
1
+ import type { VizInstance } from "../viz/vizTypes.js";
2
+ /** Whether `axis` is a span-valued discrete axis. */
3
+ export declare function isSpanAxis(viz: VizInstance, axis: string): boolean;
4
+ /** `[start, end]` of a formatted Plot row (reads its source `data`). */
5
+ export declare function rowSpan(viz: VizInstance, row: Record<string, unknown>): [number, number];
6
+ /** The `[min start, max end]` domain covering every row's span. */
7
+ export declare function spanDomain(viz: VizInstance, rows: Record<string, unknown>[]): number[];
8
+ /** Every unique span boundary, ascending — the tick values for a span axis. */
9
+ export declare function spanEdges(viz: VizInstance, rows: Record<string, unknown>[]): number[];
@@ -1,6 +1,7 @@
1
1
  import { type StackOffsetFn, type StackOrderFn, type StackOrderInput } from "./stackHelpers.js";
2
2
  import type { PlotPaintContext } from "../features/plotPaint.js";
3
3
  import { type ZoomState } from "./plotZoom.js";
4
+ import { type TrendLineType } from "./trendLines.js";
4
5
  import Viz from "../viz/Viz.js";
5
6
  import type { InteractionPoint, PickResult, Scene, SceneEvent } from "@d3plus/render";
6
7
  import type { DataPoint } from "@d3plus/data";
@@ -13,6 +14,8 @@ type PlotAccessorArg = string | PlotAccessor;
13
14
  Creates an x/y plot based on an array of data.
14
15
  */
15
16
  export default class Plot extends Viz {
17
+ _trendLine: TrendLineType;
18
+ _trendLineConfig: Record<string, unknown>;
16
19
  /**
17
20
  Invoked when creating a new class instance, and sets any default parameters.
18
21
  @private
@@ -70,11 +73,24 @@ export default class Plot extends Viz {
70
73
  @private
71
74
  */
72
75
  _nearestInteractionPoint(points: InteractionPoint[], point: [number, number]): InteractionPoint | null;
76
+ /**
77
+ Drives the shared multi-series tooltip + crosshair: while the pointer is
78
+ inside the plot area, snaps to the nearest discrete position and, when
79
+ two or more series share it, shows them all in one tooltip (suppressing
80
+ the single-shape tooltip). Clears on leaving the plot area or the chart.
81
+ @private
82
+ */
83
+ _sharedHover(event: SceneEvent): void;
73
84
  /**
74
85
  Extends the draw behavior of the abstract Viz class.
75
86
  @private
76
87
  */
77
88
  _draw(callback?: () => void): VizInstance;
89
+ /**
90
+ The bubble radius scale, for the size legend (see `plotSizeLegendScale`).
91
+ @private
92
+ */
93
+ _sizeLegendScale(): import("../../../internal.js").SizeLegendScale | null;
78
94
  /**
79
95
  Paint phase: production axis rendering, shape buffer setup, and shape
80
96
  emission with event handlers. Receives all cross-phase locals from
@@ -140,6 +156,29 @@ export default class Plot extends Viz {
140
156
  The behavior to be used when calculating the position and size of each shape's label(s). The value passed can either be the _String_ name of the behavior to be used for all shapes, or an accessor _Function_ that will be provided each data point and will be expected to return the behavior to be used for that data point. The availability and options for this method depend on the default logic for each Shape. As an example, the values "outside" or "inside" can be set for Bar shapes, whose "auto" default will calculate the best position dynamically based on the available space.
141
157
  */
142
158
  labelPosition(_?: string | ((d: DataPoint, i: number) => string)): this | ((d: DataPoint, i: number) => string);
159
+ /**
160
+ Paint for the shared tooltip's crosshair guide line (`stroke`,
161
+ `strokeWidth`, `strokeDasharray`, `strokeOpacity`, …). Merged into the
162
+ current config.
163
+ */
164
+ crosshairConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
165
+ /**
166
+ Draws an automatic trend line fit to the plotted data: `true` (or `"linear"`) for a least-squares line, or one of `"exponential"`, `"logarithmic"`, `"power"`, or `"polynomial"`. By default each series gets its own line in its color; see `trendLineConfig` for grouping, a confidence band, and styling. On a chart with a discrete axis, the line runs along that axis, fitting categories by their order. Set to `false` (the default) to remove.
167
+ */
168
+ trendLine(_?: TrendLineType): this | TrendLineType;
169
+ /**
170
+ Options for the trend lines drawn by `trendLine`, merged into the current config:
171
+ - `group`: `"series"` (default) fits one line per series, colored to match it; `"all"` fits a single line to every point.
172
+ - `order`: the polynomial degree when `trendLine` is `"polynomial"` (default `2`).
173
+ - `confidence`: draws a confidence band around a linear fit (default `false`).
174
+ - `confidenceLevel`: the band's confidence level (default `0.95`).
175
+ - `confidenceConfig`: Area shape config for the band (default `{fillOpacity: 0.15}`; fill defaults to the line color).
176
+ - `tooltip`: shows the fitted equation and R² when hovering a line (default `true`).
177
+ - Any other key (`stroke`, `strokeWidth`, `strokeDasharray`, …) styles the Line shape.
178
+
179
+ Stacked charts always fit one line to the stack totals.
180
+ */
181
+ trendLineConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
143
182
  /**
144
183
  Shape config for the Circle shapes drawn by the lineMarkers method.
145
184
  */
@@ -1,7 +1,21 @@
1
1
  import type { ChartDefinition } from "../definition/ChartDefinition.js";
2
2
  import type { TransformStage } from "../pipeline/stages.js";
3
+ import type { D3Scale } from "../../utils/index.js";
4
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
3
5
  export { computePlotInitialDomains } from "./pipelineDomains.js";
4
6
  export { measurePlotLineLabels } from "./pipelineLineLabels.js";
7
+ /**
8
+ The bubble radius scale: `sizeScale` over the extent of `sizes`, ranging
9
+ from `sizeMin` (capped at half of `sizeMax`) to `sizeMax`. A single-value
10
+ extent maps everything to `sizeMax`.
11
+ */
12
+ export declare function plotSizeScale(viz: Parameters<TransformStage>[0]["viz"], sizes: number[]): D3Scale;
13
+ /**
14
+ Plot's size-legend scale, available before layout: the same scale
15
+ `formatPlotData` builds, over the plottable rows. Null when there's no
16
+ `size` accessor or none of those rows draws as a circle.
17
+ */
18
+ export declare function plotSizeLegendScale(viz: Parameters<TransformStage>[0]["viz"]): SizeLegendScale | null;
5
19
  /**
6
20
  `formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
7
21
  time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
@@ -0,0 +1,79 @@
1
+ /**
2
+ Shared multi-series tooltip + crosshair for Plot charts (#779): while the
3
+ pointer is over the plot area, snap to the nearest discrete-axis position
4
+ and list every series' value there in one tooltip, with a guide line drawn
5
+ through that position.
6
+ */
7
+ import type { DataPoint } from "@d3plus/data";
8
+ import type { InteractionPoint, SceneEvent, SceneNode } from "@d3plus/render";
9
+ import type { VizInstance } from "../viz/vizTypes.js";
10
+ /** One series' entry in the shared tooltip. */
11
+ export interface SharedRow {
12
+ id: string;
13
+ name: string;
14
+ value: number;
15
+ color?: string;
16
+ /** The mark's shape type, which picks the row's swatch (dot vs. square). */
17
+ shape?: string;
18
+ datum: DataPoint;
19
+ index: number;
20
+ }
21
+ /**
22
+ The resolved shared hover: the snapped discrete position (pixel + data
23
+ value) and its rows. `stack` holds the column's stacked-bar rows
24
+ (highlighted together) and every stacked-bar row in the chart, when the
25
+ column has bars; `markers` the column's Line points; `layer` puts the
26
+ crosshair in front of the marks when the chart has areas, else behind.
27
+ */
28
+ export interface SharedHover {
29
+ /** "shared": every series at the column; "single": one hovered mark. */
30
+ mode: "shared" | "single";
31
+ axis: "x" | "y";
32
+ px: number;
33
+ value: unknown;
34
+ rows: SharedRow[];
35
+ markers: {
36
+ datum: DataPoint;
37
+ x: number;
38
+ y: number;
39
+ }[];
40
+ layer: "back" | "front";
41
+ stack?: {
42
+ rows: Set<DataPoint>;
43
+ bars: Set<DataPoint>;
44
+ };
45
+ }
46
+ export type ShapeNode = SceneNode & {
47
+ shapeType?: string;
48
+ interactionGroup?: string;
49
+ interactionPoints?: InteractionPoint[];
50
+ interactive?: boolean;
51
+ datum?: DataPoint;
52
+ paint?: {
53
+ stroke?: unknown;
54
+ fill?: unknown;
55
+ };
56
+ children?: SceneNode[];
57
+ };
58
+ /**
59
+ Converts a surface-local pointer position into chart content space: undoes
60
+ the `viz-zoom` group's `_zoomTransform`, then the `viz-chart-body` group's
61
+ `_chartTransform`.
62
+ */
63
+ export declare function contentPoint(viz: VizInstance, point: [number, number]): [number, number];
64
+ /**
65
+ Whether a scene node is a data mark the shared tooltip reads: Line/Area
66
+ series and other single marks, but Bars only when stacked (side-by-side
67
+ bars keep the single-bar tooltip).
68
+ */
69
+ export declare function sharedMark(viz: VizInstance, node: ShapeNode): boolean;
70
+ /** Whether the chart scene holds any mark the shared tooltip reads. */
71
+ export declare function hasSharedMarks(viz: VizInstance): boolean;
72
+ /**
73
+ Plot's `_sharedHover`: snaps the tooltip to the hovered discrete position
74
+ (see `resolveHover`), hiding its arrow and drawing a crosshair through it —
75
+ one tooltip for every series ("shared"), or the hovered mark's x/y values
76
+ ("single"). Replaces the default shape tooltip while active; clears on
77
+ leaving the plot area (or the mark) or the chart.
78
+ */
79
+ export declare function handleSharedHover(viz: VizInstance, event: SceneEvent): void;
@@ -0,0 +1,11 @@
1
+ import type { Scene } from "@d3plus/render";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ /**
4
+ Adds the snapped hover's scene nodes to the chart body group (content
5
+ space, so they track zoom): with `tooltipShared`, a transparent hover
6
+ surface behind the marks, so the SVG backend receives pointer events over
7
+ empty plot space; and — while a hover is active — the crosshair and the
8
+ hovered Line markers, inside the zoom-clipped plot content when the chart
9
+ is zoomable.
10
+ */
11
+ export declare function appendSharedHoverNodes(viz: VizInstance, scene: Scene): void;
@@ -0,0 +1,26 @@
1
+ import type { SceneEvent } from "@d3plus/render";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ import type { SharedHover } from "./sharedHover.js";
4
+ /**
5
+ Holds the tooltip's own arrow/thead/tbody to restore once the snapped
6
+ hover ends (see `restoreTooltip`), so the next legend or default tooltip
7
+ isn't left with these rows — and resets thead/tbody to them before each
8
+ render so rows never accumulate.
9
+ */
10
+ export declare function prepareTooltip(viz: VizInstance): any;
11
+ /** Puts back what `prepareTooltip` held. */
12
+ export declare function restoreTooltip(viz: VizInstance): void;
13
+ /**
14
+ The shared tooltip: title from the continuous axis, a header row naming
15
+ the hovered discrete value, then one `[name, value]` row per series, the
16
+ name led by a swatch in its series stroke. User `tooltipConfig` styles
17
+ apply first; the shared title/rows win.
18
+ */
19
+ export declare function renderSharedTooltip(viz: VizInstance, hover: SharedHover, event: SceneEvent): void;
20
+ /**
21
+ The single-mark tooltip (one series, `tooltipShared(false)`, or a
22
+ side-by-side bar): the default title (the mark's label, unless
23
+ `tooltipConfig` sets one), its x and y values, then any rows the chart's
24
+ `tooltipConfig` adds.
25
+ */
26
+ export declare function renderSingleTooltip(viz: VizInstance, hover: SharedHover, event: SceneEvent): void;
@@ -0,0 +1,21 @@
1
+ import type { Shape } from "../../shapes/index.js";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ /** A label bounds box, as returned by a shape's `labelBounds`. */
4
+ interface Box {
5
+ height: number;
6
+ width: number;
7
+ x: number;
8
+ y: number;
9
+ }
10
+ /**
11
+ Splits a label box into a name box and a share band beneath it. Their
12
+ padding overlaps so the bottom-aligned name and top-aligned share meet at
13
+ one line. Returns null when the box is too short to split.
14
+ */
15
+ export declare function splitShareBox(b: Box, padding: number): [Box, Box] | null;
16
+ /**
17
+ Adds a share line to each stacked Bar label on `s`. Labels a user
18
+ already returns as an array (their own multi-line layout) are left alone.
19
+ */
20
+ export declare function applyStackShareLabels(viz: VizInstance, s: Shape): void;
21
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { DataPoint } from "@d3plus/data";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ /**
4
+ A `tooltipConfig` default whose `tbody` resolves per hover, so the Share
5
+ row only appears while the chart is stacked.
6
+ */
7
+ export declare function stackShareTooltipConfig(viz: VizInstance): {
8
+ tbody: () => ((() => any) | ((_d: DataPoint, _i: number, x: Record<string, unknown>) => string))[][];
9
+ };
@@ -0,0 +1,70 @@
1
+ import type { DataPoint } from "@d3plus/data";
2
+ import type { RegressionResult, RegressionType } from "@d3plus/math";
3
+ import type { TransformStage } from "../pipeline/stages.js";
4
+ import type { VizInstance } from "../viz/vizTypes.js";
5
+ type Row = Record<string, unknown>;
6
+ type Axis = "x" | "y";
7
+ /** The regression types `trendLine` accepts. */
8
+ export declare const trendTypes: RegressionType[];
9
+ /** One point along a fitted trend line, in plot data space. */
10
+ export interface TrendSample {
11
+ x: unknown;
12
+ y: unknown;
13
+ /** Lower confidence bound on the dependent axis. */
14
+ lci?: number;
15
+ /** Upper confidence bound on the dependent axis. */
16
+ hci?: number;
17
+ }
18
+ /** A fitted trend line, ready to paint. */
19
+ export interface TrendFit {
20
+ /** Stable key: the series id, or "all". */
21
+ id: string;
22
+ /** Tooltip title: the series label, or the translated "Trend Line". */
23
+ label: string;
24
+ /** Line stroke (and band fill). */
25
+ color: string;
26
+ /** The independent axis the fit runs along. */
27
+ axis: Axis;
28
+ fit: RegressionResult;
29
+ samples: TrendSample[];
30
+ /** A source row of the series, so hover dimming treats the line as part of it. */
31
+ row?: DataPoint;
32
+ }
33
+ /** The values `trendLine` accepts: a regression type, `true` (linear), or `false` (off). */
34
+ export type TrendLineType = boolean | RegressionType;
35
+ /** The default `trendLineConfig`. */
36
+ export declare function trendLineDefaults(): Record<string, unknown>;
37
+ /** Resolves the `trendLine` setting to a regression type, or null when off. */
38
+ export declare function resolveTrendType(value: unknown): RegressionType | null;
39
+ /**
40
+ The axis a trend line runs along: the discrete axis when one is set (so a
41
+ horizontal bar chart fits along y), otherwise x.
42
+ */
43
+ export declare function trendAxis(discrete: unknown): Axis;
44
+ /**
45
+ Maps independent-axis values to numbers for fitting, and back again for
46
+ plotting: Dates by timestamp, numbers as-is, and anything else (category
47
+ names) by its position in the axis's ordered values.
48
+ */
49
+ export declare function trendNumberScale(order: unknown[]): {
50
+ toNumber: (v: unknown) => number;
51
+ fromNumber: (n: number) => unknown;
52
+ };
53
+ /**
54
+ The independent-axis positions to sample a fit at, within its extent: one
55
+ per category on a point scale (in-between positions can't be placed), or
56
+ evenly spaced points on a continuous axis.
57
+ */
58
+ export declare function trendSamplePositions(extent: [number, number], categories: number[] | null, count?: number): number[];
59
+ /** Fits the trend lines for the current data; empty when `trendLine` is off. */
60
+ export declare function computeTrendFits(viz: VizInstance, rows: Row[], order: unknown[]): TrendFit[];
61
+ /** The dependent-axis values a set of fits plots, including band bounds. */
62
+ export declare function trendDomainValues(fits: TrendFit[]): number[];
63
+ /**
64
+ `computePlotTrendFits` — runs after `computePlotAxisValues`: fits the
65
+ trend lines onto `viz._trendFits` and appends their values to the
66
+ dependent axis's values, so the non-stacked domain covers them (the
67
+ stacked domain reads `viz._trendFits` directly).
68
+ */
69
+ export declare const computePlotTrendFits: TransformStage;
70
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ Paints the fitted trend lines (`viz._trendFits`) behind the plot's marks:
3
+ per fit, an optional confidence band and the line itself, in one
4
+ stably-keyed group so frames tween rather than re-enter.
5
+ */
6
+ import type { SceneNode } from "@d3plus/render";
7
+ import type { PlotAxisFn } from "../features/plotPaint.js";
8
+ import type { VizInstance } from "../viz/vizTypes.js";
9
+ import type { TrendFit } from "./trendLines.js";
10
+ /** Scene-node fields the trend line stamps for hover routing. */
11
+ export type TrendNode = SceneNode & {
12
+ interactive?: boolean;
13
+ interactionGroup?: string;
14
+ trendFit?: TrendFit;
15
+ children?: SceneNode[];
16
+ };
17
+ /** The scene groups for every fitted trend line, painted behind the marks. */
18
+ export declare function emitTrendLines(viz: VizInstance, x: PlotAxisFn, y: PlotAxisFn): SceneNode[];
@@ -0,0 +1,19 @@
1
+ import type { RegressionResult } from "@d3plus/math";
2
+ import type { SceneEvent } from "@d3plus/render";
3
+ import type { VizInstance } from "../viz/vizTypes.js";
4
+ import type { TrendFit } from "./trendLines.js";
5
+ /** Display names for each regression type, as translation keys. */
6
+ export declare const trendTypeNames: Record<string, string>;
7
+ /**
8
+ The fitted equation as display text, e.g. `y = 1.24x + 3.41k` or
9
+ `y = 2e^(0.3x)`. `x` and `y` name the independent and dependent axes, and
10
+ swap for a fit along the y axis (a horizontal chart).
11
+ @param fit The regression result.
12
+ @param format Formats each coefficient.
13
+ @param axis The independent axis the fit runs along.
14
+ */
15
+ export declare function trendEquation(fit: Pick<RegressionResult, "type" | "coefficients">, format?: (n: number) => string, axis?: "x" | "y"): string;
16
+ /** The tooltip rows for a fit: type, equation, R², and observations. */
17
+ export declare function trendTooltipRows(viz: VizInstance, trend: TrendFit): string[][];
18
+ /** Renders the trend tooltip at the pointer. */
19
+ export declare function renderTrendTooltip(viz: VizInstance, trend: TrendFit, event: SceneEvent): void;
@@ -1,2 +1,11 @@
1
1
  import type { TransformStage } from "../pipeline/stages.js";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
4
+ /**
5
+ Rings' size-legend scale for a chart area of `width` × `height`: places a
6
+ scratch copy of the node graph exactly as the layout does and returns the
7
+ radius scale it sized with. The ring geometry only shrinks as the area
8
+ does, so the layout's final radii never exceed this estimate's.
9
+ */
10
+ export declare function ringsSizeLegendScale(v: VizInstance, width: number, height: number): SizeLegendScale | null;
2
11
  export declare const applyRingsLayout: TransformStage;
@@ -0,0 +1,49 @@
1
+ import type { DataPoint } from "@d3plus/data";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
4
+ /** The fields of a laid-out Rings node that sizing reads and writes. */
5
+ interface SizedNode {
6
+ data: DataPoint;
7
+ i: number;
8
+ r?: number;
9
+ ring?: 1 | 2;
10
+ size?: number;
11
+ }
12
+ type RadiusScale = SizeLegendScale & ((n: number) => number);
13
+ /** Ring geometry derived from the chart bounds. */
14
+ export interface RingGeometry {
15
+ width: number;
16
+ height: number;
17
+ ringWidth: number;
18
+ primaryRing: number;
19
+ secondaryRing: number;
20
+ }
21
+ /** Ring geometry for a chart area: the center plus two rings, each a third of the radius apart. */
22
+ export declare function ringsGeometry(width: number, height: number): RingGeometry;
23
+ /**
24
+ Assigns each ring node its `ring` + `r`, and `center.r`. Sized charts
25
+ (`size` set) run every node, center included, through one
26
+ `ringsSizeScale`, and return it; unsized charts use the fixed ring radii
27
+ and return null.
28
+ */
29
+ export declare function sizeRingsNodes(v: VizInstance, center: SizedNode, geom: RingGeometry, slots: number, primaries: SizedNode[], secondaries: SizedNode[]): RadiusScale | null;
30
+ /**
31
+ Where the center node's label goes. Unsized, the center circle is always
32
+ large, so the label fills the inner ring's square as before. Sized, the
33
+ center can be small: the label goes inside only if its longest word fits
34
+ the circle's inscribed square at a legible size; otherwise it sits below
35
+ the circle (`inside: false`), where it reads against the background
36
+ rather than the circle's fill.
37
+ */
38
+ export declare function ringsCenterLabel(v: VizInstance, center: SizedNode & {
39
+ r?: number;
40
+ }, geom: RingGeometry, text: string, fontFamily: string | string[]): {
41
+ bounds: {
42
+ x: number;
43
+ y: number;
44
+ width: number;
45
+ height: number;
46
+ };
47
+ inside: boolean;
48
+ };
49
+ export {};
@@ -4,7 +4,8 @@
4
4
  import type { ChartDefinition } from "../definition/ChartDefinition.js";
5
5
  export declare const stackedAreaDef: ChartDefinition;
6
6
  /**
7
- Creates a stacked area plot based on an array of data.
7
+ Creates a stacked area plot based on an array of data. Each point's
8
+ fraction of its stack total is available to tooltip accessors as `share`.
8
9
  */
9
10
  declare const _default: new () => any;
10
11
  export default _default;
@@ -11,6 +11,7 @@ import type { SceneNode } from "@d3plus/render";
11
11
  import type { FeatureModule } from "../features/features.js";
12
12
  import type { TransformStage, VizContext } from "../pipeline/stages.js";
13
13
  import type { VizInstance } from "../viz/vizTypes.js";
14
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
14
15
  interface ChartDefinitionBase {
15
16
  /** Stable name for tagging and class generation. */
16
17
  name: string;
@@ -32,6 +33,19 @@ interface ChartDefinitionBase {
32
33
  `runChartDraw` — the chart relies on its parent's `_draw` only.
33
34
  */
34
35
  layoutStage?: TransformStage;
36
+ /**
37
+ Optional size-legend scale, called before layout so the bottom-right
38
+ corner panel can reserve room: the value → pixel-radius scale the chart
39
+ will draw with, for a chart area of `available` px (the area before the
40
+ legend's own reservation, so any area-dependent radius only shrinks
41
+ from here). Return null when nothing is sized. The chart's layout
42
+ stores the scale it actually drew with on `viz._sizeLegendFinal`, which
43
+ is what the legend paints.
44
+ */
45
+ sizeLegendScale?: (viz: VizInstance, available: {
46
+ width: number;
47
+ height: number;
48
+ }) => SizeLegendScale | null;
35
49
  /** Optional pure threshold algorithm (replaces `Viz._thresholdFunction`). */
36
50
  thresholdFunction?: (viz: VizInstance, data: unknown[]) => unknown[];
37
51
  /**
@@ -50,6 +64,22 @@ interface ChartDefinitionBase {
50
64
  without one are clipped to the chart area.
51
65
  */
52
66
  chartClip?: (viz: VizInstance) => import("@d3plus/render").ClipShape | undefined;
67
+ /**
68
+ Optional chart-specific "local body rect" — the box the drill-down morph
69
+ transition (`enterFrom`/`exitTo`) measures its fractions against. Read
70
+ directly off `def` by `runChartDraw` (same pattern as `chartClip`), after
71
+ the layout stage runs. Default: the margin-adjusted chart area at local
72
+ origin (0,0), i.e. `{x: 0, y: 0, ...chartBounds(viz)}` — correct for any
73
+ chart whose emitted nodes sit inside the `chartTransform`-wrapped body
74
+ group at that same local origin (Treemap; Pack overrides this, since its
75
+ body is a diameter-sized square, not the full chart area).
76
+ */
77
+ chartBodyRect?: (viz: VizInstance) => {
78
+ x: number;
79
+ y: number;
80
+ width: number;
81
+ height: number;
82
+ };
53
83
  /**
54
84
  Imperative per-instance setup hook — runs once after `applyDefinition`
55
85
  seeds the chart. Use for event handler overrides and shadowed methods
@@ -5,7 +5,8 @@
5
5
  The class is identical for every chart: its constructor runs
6
6
  `applyDefinition(this, def)`, its `_draw` runs the shared Viz pipeline
7
7
  then the chart's own layout stage via `runChartDraw`, and its
8
- `_thresholdFunction` delegates to `def.thresholdFunction` if present.
8
+ `_thresholdFunction` / `_sizeLegendScale` delegate to
9
+ `def.thresholdFunction` / `def.sizeLegendScale` if present.
9
10
 
10
11
  A chart's `index.ts` becomes literally `export default makeChart(def)`.
11
12
  */