@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
@@ -0,0 +1,101 @@
1
+ /** A continuous radius scale — the subset of a d3 scale the legend reads. */
2
+ export interface SizeLegendScale {
3
+ (value: number): number;
4
+ domain(): number[];
5
+ invert?(radius: number): number;
6
+ }
7
+ /** A chart's size legend as measured, and the chart area it would share, for the `sizeLegend` visibility check. */
8
+ export interface SizeLegendSize {
9
+ width: number;
10
+ height: number;
11
+ availableWidth: number;
12
+ availableHeight: number;
13
+ }
14
+ /**
15
+ The default `sizeLegend` rule: show the legend (marks are sized by more
16
+ than one value, or there'd be nothing to measure) unless it would take up
17
+ more than a third of the chart's width or height.
18
+ */
19
+ export declare function sizeLegendFits(_config: unknown, _scale: SizeLegendScale, size: SizeLegendSize): boolean;
20
+ /** Values to show: explicit numbers, a count of auto-picked values, or a picker. */
21
+ export type SizeLegendValues = number[] | number | ((domain: [number, number]) => number[]);
22
+ export interface SizeLegendLayoutInput {
23
+ scale: SizeLegendScale;
24
+ values?: SizeLegendValues;
25
+ tickFormat: (value: number) => string;
26
+ fontFamily: string;
27
+ fontSize: number;
28
+ title?: string;
29
+ titleFontFamily: string;
30
+ titleFontSize: number;
31
+ titleFontWeight: number | string;
32
+ /** Gap between the widest circle's right edge and the leader-line end. */
33
+ lineLength: number;
34
+ /** Gap between the leader-line end and its label. */
35
+ labelPadding: number;
36
+ /** Padding around the whole legend. */
37
+ padding: number;
38
+ /** Drop any value whose circle would be larger than this radius. */
39
+ maxRadius?: number;
40
+ }
41
+ export interface SizeLegendCircle {
42
+ value: number;
43
+ cx: number;
44
+ cy: number;
45
+ r: number;
46
+ }
47
+ export interface SizeLegendLine {
48
+ value: number;
49
+ points: [number, number][];
50
+ }
51
+ export interface SizeLegendLabel {
52
+ value: number;
53
+ text: string;
54
+ /** The label's left edge. */
55
+ x: number;
56
+ /** Vertical center of the label. */
57
+ y: number;
58
+ width: number;
59
+ }
60
+ export interface SizeLegendLayout {
61
+ circles: SizeLegendCircle[];
62
+ lines: SizeLegendLine[];
63
+ labels: SizeLegendLabel[];
64
+ /** The title, centered on `x`, with `y` its baseline. */
65
+ title?: {
66
+ text: string;
67
+ x: number;
68
+ y: number;
69
+ width: number;
70
+ };
71
+ width: number;
72
+ height: number;
73
+ }
74
+ /** A layout with nothing to draw. */
75
+ export declare const emptySizeLegendLayout: () => SizeLegendLayout;
76
+ /**
77
+ The default values for a domain: its min and max (the real extremes, so
78
+ the outer and inner circles match the chart's largest and smallest marks)
79
+ plus, between them, the roundest number near each evenly spaced target —
80
+ among the candidates within 15% of the range of a target, the one with
81
+ the fewest significant digits, then the closest.
82
+ */
83
+ export declare function defaultSizeLegendValues(domain: [number, number], count?: number): number[];
84
+ /**
85
+ Lays out the legend: circles sharing a bottom edge, a leader line from
86
+ each circle's top to its label in a column on the right (labels are
87
+ pushed apart so they never overlap), and the title centered over the
88
+ circles. Returns an empty layout when the scale's domain is a single
89
+ value (nothing to compare) or every value maps to a zero radius.
90
+ */
91
+ export declare function computeSizeLegend(input: SizeLegendLayoutInput): SizeLegendLayout;
92
+ /**
93
+ The legend scale for marks drawn under a zoom of `k`: on screen, each
94
+ mark's radius is `k` times its layout radius, so the circles for a value
95
+ grow by `k` too. To keep the legend inside the space reserved for its
96
+ unzoomed circles, the domain's top shrinks to the value whose zoomed
97
+ circle fits in the unzoomed largest one's space (rounded down to a nice
98
+ number) — the legend relabels rather than grows. Scales without
99
+ `invert` keep their domain.
100
+ */
101
+ export declare function zoomSizeLegendScale(scale: SizeLegendScale, k: number): SizeLegendScale;
@@ -38,7 +38,7 @@ interface TextBoxDatum {
38
38
  y: number;
39
39
  }
40
40
  /**
41
- Creates a wrapped text box for each point in an array of data. See [this example](https://d3plus.org/examples/d3plus-text/getting-started/) for help getting started using the TextBox class.
41
+ Creates a wrapped text box for each point in an array of data.
42
42
  */
43
43
  export default class TextBox extends BaseClass {
44
44
  [key: string]: any;
@@ -110,8 +110,23 @@ export default class Tooltip extends BaseClass {
110
110
  trStyle(): Record<string, unknown>;
111
111
  trStyle(_: Record<string, unknown>): this;
112
112
  /**
113
- An object with CSS keys and values to be applied to all <td> elements inside of each <tr>.
113
+ An object with CSS keys and values to be applied to all <td> elements inside of each <tr>. Values may be `(d, i)` functions, where `i` is the cell's column index.
114
+
115
+ @example <caption>default styles</caption>
116
+ {
117
+ "text-align": (d, i) => i ? "right" : "left"
118
+ }
119
+ */
120
+ tdStyle(): Record<string, unknown>;
121
+ tdStyle(_: Record<string, unknown>): this;
122
+ /**
123
+ An object with CSS keys and values to be applied to all <th> elements inside of the <thead>. Values may be `(d, i)` functions, where `i` is the cell's column index.
124
+
125
+ @example <caption>default styles</caption>
126
+ {
127
+ "text-align": (d, i) => i ? "right" : "left"
128
+ }
114
129
  */
115
- tdStyle(): Record<string, string>;
116
- tdStyle(_: Record<string, string>): this;
130
+ thStyle(): Record<string, unknown>;
131
+ thStyle(_: Record<string, unknown>): this;
117
132
  }
@@ -5,6 +5,7 @@ export { default as AxisRight } from "./Axis/AxisRight.js";
5
5
  export { default as AxisTop } from "./Axis/AxisTop.js";
6
6
  export { default as ColorScale } from "./ColorScale/ColorScale.js";
7
7
  export { default as Legend } from "./Legend/Legend.js";
8
+ export { default as SizeLegend } from "./SizeLegend/SizeLegend.js";
8
9
  export { default as Message } from "./Message.js";
9
10
  export { default as TextBox } from "./TextBox.js";
10
11
  export { default as Timeline } from "./Timeline/Timeline.js";
@@ -4,7 +4,7 @@ import type { AccessorFn } from "../utils/index.js";
4
4
  import type { BarConfig } from "./shapeConfig.js";
5
5
  import Shape, { type ShapeAes } from "./Shape.js";
6
6
  /**
7
- Creates SVG areas based on an array of data.
7
+ Creates SVG bars based on an array of data.
8
8
  */
9
9
  export default class Bar extends Shape {
10
10
  /**
@@ -7,7 +7,7 @@ import Rect from "./Rect.js";
7
7
  import type { BoxConfig } from "./shapeConfig.js";
8
8
  import Whisker from "./Whisker.js";
9
9
  /**
10
- Creates SVG box based on an array of data.
10
+ Creates SVG box-and-whisker plots based on an array of data, one per group of values.
11
11
  */
12
12
  export default class Box extends BaseClass {
13
13
  [key: string]: any;
@@ -3,7 +3,7 @@ import type { D3Selection } from "@d3plus/dom";
3
3
  import type { RectConfig } from "./shapeConfig.js";
4
4
  import Shape, { type ShapeAes } from "./Shape.js";
5
5
  /**
6
- Creates SVG rectangles based on an array of data. See [this example](https://d3plus.org/examples/d3plus-shape/getting-started/) for help getting started using the rectangle generator.
6
+ Creates SVG rectangles based on an array of data.
7
7
  */
8
8
  export default class Rect extends Shape {
9
9
  /**
@@ -7,7 +7,7 @@ import Line from "./Line.js";
7
7
  import Rect from "./Rect.js";
8
8
  import type { WhiskerConfig } from "./shapeConfig.js";
9
9
  /**
10
- Creates SVG whisker based on an array of data.
10
+ Creates SVG whiskers based on an array of data: a line from each point in a given direction, capped with an endpoint shape.
11
11
  */
12
12
  export default class Whisker extends BaseClass {
13
13
  [key: string]: any;
@@ -0,0 +1,9 @@
1
+ /**
2
+ Builds the JSON key of a textures.js config for one datum, or `false` when
3
+ the datum has no texture or no fill (`"none"`, e.g. a line or link). The key is what a `pattern:<key>` scene fill
4
+ carries for the renderer backends to materialize. `fill` and `stroke` are
5
+ the shape's resolved fill and stroke for the datum, used as the texture's
6
+ default background and line colors.
7
+ @private
8
+ */
9
+ export declare function textureKey(textureVal: unknown, fill: () => unknown, stroke: () => unknown, textureDefault?: Record<string, unknown>): string | false;
@@ -0,0 +1,10 @@
1
+ /**
2
+ Warns about `shapeConfig` keys that no shape supports. A top-level key is
3
+ valid if any shape class has it (the config is shared by every shape type);
4
+ a key nested under a shape name (like `{Rect: {…}}`) must exist on that
5
+ shape.
6
+ @param owner The class name of the chart receiving the config.
7
+ @param config The user-supplied `shapeConfig` object.
8
+ @private
9
+ */
10
+ export default function validateShapeConfig(owner: string, config: Record<string, unknown>): void;
@@ -1,4 +1,5 @@
1
- import type { D3plusConfig } from "./D3plusConfig.js";
1
+ import { type ColorDefaults } from "@d3plus/color";
2
+ import type { ColorDefaultsConfig, D3plusConfig } from "./D3plusConfig.js";
2
3
  /**
3
4
  Provides shared configuration, event handling, and locale management inherited by all d3plus classes.
4
5
  */
@@ -43,6 +44,19 @@ export default class BaseClass {
43
44
  */
44
45
  locale(): string;
45
46
  locale(_: string | object): this;
47
+ /**
48
+ Overrides the default colors used when assigning fills from data and choosing legible text colors: `dark` and `light` (the text colors picked for contrast against a background), `missing` (null/undefined values), `on`/`off` (`true`/`false` values), `sequential` (the anchor hue for magnitude ramps), and `scale` (the categorical palette, given as a d3 ordinal scale or an array of colors). Keys are merged into the current defaults, and a Viz passes its overrides down to the shapes and components it draws.
49
+
50
+ @example
51
+ new Treemap()
52
+ .colorDefaults({
53
+ dark: "#222",
54
+ light: "#fff",
55
+ scale: ["#1b9e77", "#d95f02", "#7570b3"]
56
+ })
57
+ */
58
+ colorDefaults(): ColorDefaults;
59
+ colorDefaults(_: ColorDefaultsConfig): this;
46
60
  /**
47
61
  Event listener for the specified event *typenames*. Mirrors the core [d3-selection](https://github.com/d3/d3-selection#selection_on) behavior.
48
62
 
@@ -1,6 +1,10 @@
1
+ import type { ColorDefaults } from "@d3plus/color";
1
2
  import type { DataPoint } from "@d3plus/data";
2
3
  import type VizBase from "../charts/viz/VizBase.js";
4
+ import type { LinkOption } from "../charts/viz/linkGroup.js";
3
5
  import type { AccessorFn } from "./AccessorFn.js";
6
+ import type { SizeLegendLineConfig, SizeLegendShapeConfig, SizeLegendTextConfig } from "../components/SizeLegend/SizeLegend.js";
7
+ import type { SizeLegendScale, SizeLegendSize } from "../components/SizeLegend/sizeLegendLayout.js";
4
8
  type Position = "top" | "right" | "bottom" | "left";
5
9
  type DataPointAccessor<T> = string | ((d: DataPoint) => T);
6
10
  /** A config value that is either a constant or a `(datum, index)` accessor. */
@@ -183,7 +187,64 @@ export interface LegendConfig {
183
187
  /** The shape type used for each legend entry. */
184
188
  shape?: Accessor<string>;
185
189
  }
190
+ export interface SizeLegendConfig {
191
+ /**
192
+ The values to draw circles for: an array of values, how many to pick
193
+ from the size domain (default 3: its min, max, and a round middle), or
194
+ a function receiving the `[min, max]` domain and returning values.
195
+ */
196
+ values?: number[] | number | ((domain: [number, number]) => number[]);
197
+ /** Formats each value's label. Defaults to the locale's abbreviated number format. */
198
+ tickFormat?: (value: number) => string;
199
+ /** Title above the circles. Defaults to the `size` key when `size` is set to a string. */
200
+ title?: string;
201
+ /** Circle paint: `fill`, `fillOpacity`, `stroke`, `strokeWidth`, `strokeOpacity`. */
202
+ shapeConfig?: SizeLegendShapeConfig;
203
+ /** Leader-line paint: `stroke`, `strokeWidth`, `strokeOpacity`, `strokeDasharray`. */
204
+ lineConfig?: SizeLegendLineConfig;
205
+ /** Value-label font: `fontColor`, `fontFamily`, `fontSize`. */
206
+ labelConfig?: SizeLegendTextConfig;
207
+ /** Title font: `fontColor`, `fontFamily`, `fontSize`, `fontWeight`. */
208
+ titleConfig?: SizeLegendTextConfig;
209
+ padding?: number;
210
+ /** Length of the leader lines past the largest circle, in pixels. */
211
+ lineLength?: number;
212
+ /** Gap between each leader line and its label, in pixels. */
213
+ labelPadding?: number;
214
+ }
215
+ export interface TrendLineConfig {
216
+ /** `"series"` (default) fits one line per series, colored to match it; `"all"` fits one line to every point. Stacked charts always fit the stack totals. */
217
+ group?: "series" | "all";
218
+ /** The polynomial degree when `trendLine` is `"polynomial"`. Defaults to 2. */
219
+ order?: number;
220
+ /** Draws a confidence band around a linear fit. Defaults to `false`. */
221
+ confidence?: boolean;
222
+ /** The confidence band's level, between 0 and 1. Defaults to 0.95. */
223
+ confidenceLevel?: number;
224
+ /** Area shape config for the confidence band. Its fill defaults to the line color. */
225
+ confidenceConfig?: Record<string, unknown>;
226
+ /**
227
+ Extends each trend line past the end of its data: a number of steps (at the data's own spacing — the median gap between values, or the calendar interval of dates), or `{to}` an end value to step up to (a number, or on a time axis a Date or a parseable date such as a year). Widens the axis to fit. Ignored on a category axis. Defaults to `0` (off).
228
+ */
229
+ projection?: number | {
230
+ to: number | string | Date;
231
+ };
232
+ /** Line shape config for the projected stretch, merged over the line's own styles. Defaults to `{strokeDasharray: "2 4"}`. */
233
+ projectionConfig?: Record<string, unknown>;
234
+ /** Shows the fitted equation, R², and observations when hovering a line. Defaults to `true`. */
235
+ tooltip?: boolean;
236
+ /** Line color. Defaults to the series color (dark gray when `group` is `"all"`). */
237
+ stroke?: string;
238
+ /** Line width in pixels. Defaults to 2. */
239
+ strokeWidth?: number;
240
+ /** Line dash pattern. Defaults to `"6 4"`. */
241
+ strokeDasharray?: string;
242
+ /** Other Line shape config. */
243
+ [key: string]: unknown;
244
+ }
186
245
  export interface ColorScaleConfig {
246
+ /** The scale's colors: one color, expanded into a light→dark ramp, or an array of colors to step through. */
247
+ color?: string | string[];
187
248
  /**
188
249
  For a linear scale, the `[min, max]` values used by the color scale; values
189
250
  outside this range map to the nearest color.
@@ -198,6 +259,10 @@ export interface ColorScaleConfig {
198
259
  /** Given a bucket's minimum and maximum values, returns the full label. */
199
260
  bucketJoiner?: (min: string, max: string) => string;
200
261
  }
262
+ /** `colorDefaults` input: any subset of the color defaults, with `scale` also accepting an array of colors. */
263
+ export type ColorDefaultsConfig = Partial<Omit<ColorDefaults, "scale">> & {
264
+ scale?: ColorDefaults["scale"] | string[];
265
+ };
201
266
  export interface D3plusConfig {
202
267
  /** Data array or URL string to load data from. */
203
268
  data?: DataPoint[] | string;
@@ -239,6 +304,8 @@ export interface D3plusConfig {
239
304
  baseline?: number;
240
305
  /** Whether to cache the processed data between renders. */
241
306
  cache?: boolean;
307
+ /** Overrides for the default colors used for data fills and legible text (see `colorDefaults` in @d3plus/color). */
308
+ colorDefaults?: ColorDefaultsConfig;
242
309
  /** Treat a discrete color field as ordered: color it with a single-hue light→dark ramp instead of nominal categorical hues. */
243
310
  colorOrdinal?: boolean;
244
311
  /** Color scale key or custom color function. */
@@ -268,6 +335,11 @@ export interface D3plusConfig {
268
335
  string | ((d: DataPoint, i: number) => number),
269
336
  string | ((d: DataPoint, i: number) => number)
270
337
  ] | false;
338
+ /**
339
+ Paint for the shared tooltip's crosshair guide line (`stroke`,
340
+ `strokeWidth`, `strokeDasharray`, `strokeOpacity`, …).
341
+ */
342
+ crosshairConfig?: Record<string, unknown>;
271
343
  /** Maximum number of data points to render before downsampling. */
272
344
  dataCutoff?: number;
273
345
  /** Active depth level for nested groupings. */
@@ -306,10 +378,37 @@ export interface D3plusConfig {
306
378
  /** Configuration for the legend component. */
307
379
  legendConfig?: {
308
380
  label?: DataPointAccessor<string>;
381
+ /**
382
+ Each item's swatch: `"Rect"` (a square), `"Circle"` (a dot), or `"Line"`
383
+ (a dot with a short stroke through it). Defaults to the shape of the
384
+ series it stands for: a dot for Circles, the line glyph for Lines, and
385
+ a square for everything else.
386
+ */
387
+ shape?: "Rect" | "Circle" | "Line" | DataPointAccessor<string>;
309
388
  shapeConfig?: Record<string, string | number>;
310
389
  };
311
390
  /** Inverts legend click behavior (click hides / shift-click solos, or the reverse), or an accessor receiving the viz. */
312
391
  legendFilterInvert?: boolean | ((viz: VizBase) => boolean);
392
+ /**
393
+ Whether one legend may be drawn inside the empty space around the chart's
394
+ marks instead of in a margin (size legend first, then legend, then
395
+ colorScale), or an accessor receiving the resolved config. Defaults to `true`.
396
+ */
397
+ legendInset?: boolean | ((config: D3plusConfig) => boolean);
398
+ /** Style of the semi-transparent box behind a legend drawn inside the chart. */
399
+ legendInsetConfig?: {
400
+ /** Box fill; defaults to the chart's background color. */
401
+ fill?: string;
402
+ fillOpacity?: number;
403
+ stroke?: string;
404
+ strokeWidth?: number;
405
+ /** Corner radius. */
406
+ rx?: number;
407
+ /** Space between the box's edge and the legend inside it. */
408
+ margin?: number;
409
+ /** Space kept between the box and the chart's marks and edges. */
410
+ padding?: number;
411
+ };
313
412
  /** Whether the legend uses the visualization's internal padding when positioning, or an accessor receiving the viz. */
314
413
  legendPadding?: boolean | ((viz: VizBase) => boolean);
315
414
  /** Position of the legend, or an accessor returning it. */
@@ -320,6 +419,8 @@ export interface D3plusConfig {
320
419
  legendTooltip?: TooltipConfig;
321
420
  /** Whether to show labels on line charts. */
322
421
  lineLabels?: boolean;
422
+ /** Links this chart to every other chart with the same group name, so hovering, `active`, `highlight` (including search), and legend hide/solo clicks in one are mirrored in the rest, and a value gets the same categorical color in every chart. Rows match across charts by the value of `by` (a data key or accessor), which defaults to the chart's own id. A string is shorthand for `{group}`; set `hover`, `active`, `highlight`, `legend`, or `color` to `false` to stop sharing that behavior. */
423
+ link?: LinkOption;
323
424
  /** Whether to show the loading message. */
324
425
  loadingMessage?: boolean;
325
426
  /** Custom HTML content for the loading indicator, or a function receiving the viz instance. */
@@ -381,6 +482,23 @@ export interface D3plusConfig {
381
482
  shapeSort?: (a: string, b: string) => number;
382
483
  /** Size accessor key. */
383
484
  size?: string;
485
+ /**
486
+ Controls size-legend visibility — the nested-circle key drawn in the
487
+ bottom-right corner of charts that size their marks. Shown by default
488
+ whenever marks are sized by more than one value, unless it would take
489
+ up more than a third of the chart's width or height; pass `true` to
490
+ always show it, `false` to hide it, or a `(config, scale, size) =>
491
+ boolean` accessor.
492
+ */
493
+ sizeLegend?: boolean | ((config: D3plusConfig, scale: SizeLegendScale, size: SizeLegendSize) => boolean);
494
+ /** Configuration for the size-legend component. */
495
+ sizeLegendConfig?: SizeLegendConfig;
496
+ /**
497
+ Which margin the size legend claims in the bottom-right corner:
498
+ `"right"` (default) keeps the chart's full height, `"bottom"` its full
499
+ width.
500
+ */
501
+ sizeLegendPosition?: "right" | "bottom";
384
502
  /** Whether to stack series. */
385
503
  stacked?: boolean;
386
504
  /**
@@ -463,6 +581,27 @@ export interface D3plusConfig {
463
581
  tooltip?: boolean | ((d: DataPoint, i: number) => boolean);
464
582
  /** Configuration for the tooltip component. */
465
583
  tooltipConfig?: TooltipConfig;
584
+ /**
585
+ Whether hovering a Plot's plot area shows one tooltip listing every
586
+ series' value at the nearest discrete-axis position, with a crosshair
587
+ through it. Applies when a discrete axis is set and at least two series
588
+ share that position.
589
+ */
590
+ tooltipShared?: boolean;
591
+ /**
592
+ Draws an automatic trend line fit to the plotted data: `true` (or
593
+ `"linear"`) for a least-squares line, or `"exponential"`,
594
+ `"logarithmic"`, `"power"`, or `"polynomial"`. `false` removes it.
595
+ */
596
+ trendLine?: boolean | "linear" | "exponential" | "logarithmic" | "power" | "polynomial";
597
+ /**
598
+ Options for the trend lines: `group` (`"series"` or `"all"`), the
599
+ polynomial `order`, a `confidence` band with `confidenceLevel` and
600
+ `confidenceConfig`, a `projection` into the future with
601
+ `projectionConfig`, `tooltip`, and Line styles (`stroke`,
602
+ `strokeWidth`, `strokeDasharray`, …).
603
+ */
604
+ trendLineConfig?: TrendLineConfig;
466
605
  /** Path or object for the topojson data. */
467
606
  topojson?: string | object;
468
607
  /** CSS color to fill the map shapes. */
@@ -0,0 +1,11 @@
1
+ /**
2
+ Marks a config function seeded by the library itself, so code that layers
3
+ config can tell it apart from one the user set.
4
+ @private
5
+ */
6
+ export declare function markDefault<T extends object>(value: T): T;
7
+ /**
8
+ Whether a config value is one registered with `markDefault`.
9
+ @private
10
+ */
11
+ export declare function isDefault(value: unknown): boolean;
@@ -0,0 +1,28 @@
1
+ /**
2
+ Toggles the console warnings d3plus logs when a class receives a config
3
+ property it does not support (like a misspelled key passed to `.config()`
4
+ or `shapeConfig`). Warnings are on by default and the setting applies to
5
+ every chart on the page. With no argument, returns the current setting.
6
+
7
+ @example
8
+ import {configWarnings} from "@d3plus/core";
9
+ configWarnings(false);
10
+ */
11
+ export declare function configWarnings(): boolean;
12
+ export declare function configWarnings(_: boolean): void;
13
+ /**
14
+ Marks a config object as shared across several classes, so keys meant for
15
+ other targets (like a `shapeConfig` carrying both `r` and `width`) are
16
+ applied where supported without `BaseClass.config()` warning about the rest.
17
+ @private
18
+ */
19
+ export declare function markSharedConfig<T extends object>(config: T): T;
20
+ /** @private */
21
+ export declare function isSharedConfig(config: unknown): boolean;
22
+ /**
23
+ Warns that `owner` was given a config key it does not support. Each message
24
+ is logged once, so re-renders (and framework wrappers re-applying the same
25
+ config) don't flood the console.
26
+ @private
27
+ */
28
+ export declare function warnUnknownConfig(owner: string, key: string): void;
@@ -1,9 +1,10 @@
1
1
  export type { AccessorFn } from "./AccessorFn.js";
2
2
  export { default as accessor } from "./accessor.js";
3
3
  export { default as BaseClass } from "./BaseClass.js";
4
- export type { D3plusConfig, AxisConfig, ColorScaleConfig, LegendConfig, TextBoxConfig, TimelineConfig, TooltipConfig, } from "./D3plusConfig.js";
4
+ export type { D3plusConfig, AxisConfig, ColorDefaultsConfig, ColorScaleConfig, LegendConfig, SizeLegendConfig, TextBoxConfig, TimelineConfig, TooltipConfig, TrendLineConfig, } from "./D3plusConfig.js";
5
5
  export type { D3Scale } from "./D3Scale.js";
6
6
  export { default as configPrep } from "./configPrep.js";
7
+ export { configWarnings } from "./configWarnings.js";
7
8
  export { default as constant } from "./constant.js";
8
9
  export { default as getProp } from "./getProp.js";
9
10
  export { paintComponentScene } from "./paintComponentScene.js";