@d3plus/core 4.11.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/es/internal.js +15 -5
  2. package/es/src/charts/Alluvial/emit.js +2 -2
  3. package/es/src/charts/Alluvial/index.js +7 -1
  4. package/es/src/charts/Alluvial/titles.js +24 -4
  5. package/es/src/charts/ArcDiagram/emit.js +27 -13
  6. package/es/src/charts/ArcDiagram/events.js +6 -2
  7. package/es/src/charts/ArcDiagram/index.js +2 -0
  8. package/es/src/charts/BarChart/index.js +3 -10
  9. package/es/src/charts/Calendar/index.js +2 -0
  10. package/es/src/charts/Candlestick/index.js +4 -10
  11. package/es/src/charts/Gantt/applyLayout.js +2 -4
  12. package/es/src/charts/Geomap/flowEmit.js +11 -6
  13. package/es/src/charts/Hexbin/index.js +2 -0
  14. package/es/src/charts/Icicle/index.js +3 -1
  15. package/es/src/charts/Matrix/applyLayout.js +20 -9
  16. package/es/src/charts/Matrix/index.js +19 -1
  17. package/es/src/charts/Network/applyLayout.js +36 -5
  18. package/es/src/charts/Network/bundle.js +5 -4
  19. package/es/src/charts/Network/emit.js +39 -40
  20. package/es/src/charts/Network/graph.js +34 -5
  21. package/es/src/charts/Network/graphFluent.js +5 -3
  22. package/es/src/charts/Network/index.js +6 -1
  23. package/es/src/charts/Pack/applyLayout.js +16 -5
  24. package/es/src/charts/Pack/emit.js +15 -8
  25. package/es/src/charts/Pack/groupRows.js +61 -0
  26. package/es/src/charts/Pack/index.js +3 -0
  27. package/es/src/charts/Pack/neutralPaint.js +20 -0
  28. package/es/src/charts/Pack/nodeNames.js +35 -0
  29. package/es/src/charts/ParallelCoordinates/axes.js +22 -22
  30. package/es/src/charts/ParallelCoordinates/chrome.js +18 -0
  31. package/es/src/charts/ParallelCoordinates/index.js +3 -1
  32. package/es/src/charts/ParallelCoordinates/titles.js +17 -9
  33. package/es/src/charts/Pie/emit.js +9 -1
  34. package/es/src/charts/Pie/index.js +10 -0
  35. package/es/src/charts/Plot/areaEnter.js +68 -0
  36. package/es/src/charts/Plot/draw.js +26 -12
  37. package/es/src/charts/Plot/index.js +4 -10
  38. package/es/src/charts/Plot/lineMarkerKeys.js +19 -0
  39. package/es/src/charts/Plot/plotInit.js +6 -0
  40. package/es/src/charts/Plot/shapeLabelLegend.js +67 -0
  41. package/es/src/charts/Plot/sharedHover.js +2 -1
  42. package/es/src/charts/Plot/sharedTooltip.js +13 -3
  43. package/es/src/charts/PolarArea/index.js +2 -1
  44. package/es/src/charts/Priestley/applyLayout.js +11 -7
  45. package/es/src/charts/Priestley/index.js +0 -2
  46. package/es/src/charts/Priestley/timeAxis.js +11 -8
  47. package/es/src/charts/Pyramid/gutter.js +52 -16
  48. package/es/src/charts/Pyramid/index.js +55 -7
  49. package/es/src/charts/Pyramid/scene.js +4 -4
  50. package/es/src/charts/Radar/applyLayout.js +31 -33
  51. package/es/src/charts/Radar/axisDecorations.js +29 -17
  52. package/es/src/charts/Radar/curvedLabels.js +43 -2
  53. package/es/src/charts/Radar/emit.js +30 -15
  54. package/es/src/charts/Radar/index.js +41 -2
  55. package/es/src/charts/Radar/points.js +85 -0
  56. package/es/src/charts/RadialBar/emit.js +6 -1
  57. package/es/src/charts/RadialBar/index.js +10 -0
  58. package/es/src/charts/RadialMatrix/applyLayout.js +115 -31
  59. package/es/src/charts/RadialMatrix/index.js +15 -2
  60. package/es/src/charts/Rings/applyLayout.js +11 -150
  61. package/es/src/charts/Rings/emit.js +80 -40
  62. package/es/src/charts/Rings/index.js +27 -4
  63. package/es/src/charts/Rings/ringsCurves.js +156 -0
  64. package/es/src/charts/Rings/ringsParallel.js +20 -3
  65. package/es/src/charts/Rings/ringsPlacement.js +152 -0
  66. package/es/src/charts/Rings/ringsSizing.js +61 -38
  67. package/es/src/charts/Sankey/applyLayout.js +18 -4
  68. package/es/src/charts/Sankey/index.js +7 -1
  69. package/es/src/charts/Sunburst/emit.js +9 -1
  70. package/es/src/charts/Sunburst/index.js +13 -1
  71. package/es/src/charts/Tree/applyLayout.js +44 -14
  72. package/es/src/charts/Tree/emit.js +5 -5
  73. package/es/src/charts/Tree/index.js +10 -12
  74. package/es/src/charts/Tree/keys.js +33 -0
  75. package/es/src/charts/Tree/nodeLabel.js +15 -0
  76. package/es/src/charts/Treemap/emitGroupHeaders.js +3 -5
  77. package/es/src/charts/definition/makeChart.js +6 -2
  78. package/es/src/charts/drawSteps/minimap.js +4 -20
  79. package/es/src/charts/drawSteps/zoomActions.js +36 -0
  80. package/es/src/charts/drawSteps/zoomControls.js +31 -18
  81. package/es/src/charts/drawSteps/zoomControlsMarkup.js +23 -4
  82. package/es/src/charts/drawSteps/zoomDrag.js +188 -0
  83. package/es/src/charts/drawSteps/zoomFit.js +69 -0
  84. package/es/src/charts/events/click.legend.js +4 -2
  85. package/es/src/charts/events/click.shape.js +5 -3
  86. package/es/src/charts/events/mouseenter.js +6 -16
  87. package/es/src/charts/events/mouseleave.js +9 -2
  88. package/es/src/charts/events/mousemove.legend.js +28 -32
  89. package/es/src/charts/events/mousemove.shape.js +44 -44
  90. package/es/src/charts/features/axes.js +15 -4
  91. package/es/src/charts/features/axesFinal.js +7 -2
  92. package/es/src/charts/features/axesMeasure.js +26 -8
  93. package/es/src/charts/features/axisTooltip.js +138 -0
  94. package/es/src/charts/features/centerLabel.js +177 -0
  95. package/es/src/charts/features/colorScaleBivariate.js +83 -0
  96. package/es/src/charts/features/colorScaleBucket.js +18 -0
  97. package/es/src/charts/features/colorScaleHover.js +30 -5
  98. package/es/src/charts/features/colorScaleLimit.js +73 -0
  99. package/es/src/charts/features/colorScaleTooltip.js +77 -0
  100. package/es/src/charts/features/colorScaleTop.js +61 -0
  101. package/es/src/charts/features/curvedArrows.js +33 -0
  102. package/es/src/charts/features/depthKey.js +26 -0
  103. package/es/src/charts/features/edgeArrows.js +61 -2
  104. package/es/src/charts/features/featuresColorScale.js +57 -16
  105. package/es/src/charts/features/hoverTicks.js +41 -0
  106. package/es/src/charts/features/idleQueue.js +72 -0
  107. package/es/src/charts/features/linkInteraction.js +59 -7
  108. package/es/src/charts/features/networkMeasures.js +241 -0
  109. package/es/src/charts/features/nodeStats.js +309 -0
  110. package/es/src/charts/features/plotEndLabels.js +28 -7
  111. package/es/src/charts/features/plotPaint.js +9 -2
  112. package/es/src/charts/features/shapeEmit.js +7 -1
  113. package/es/src/charts/features/textHalo.js +3 -2
  114. package/es/src/charts/partition/chartFields.js +12 -3
  115. package/es/src/charts/partition/interaction.js +10 -5
  116. package/es/src/charts/pipeline/insetPlacement.js +8 -3
  117. package/es/src/charts/polar/chrome.js +81 -9
  118. package/es/src/charts/polar/config.js +4 -0
  119. package/es/src/charts/polar/wedgeLayout.js +2 -1
  120. package/es/src/charts/viz/Viz.js +24 -15
  121. package/es/src/charts/viz/VizBase.js +39 -4
  122. package/es/src/charts/viz/backgroundInk.js +10 -0
  123. package/es/src/charts/viz/emphasis.js +14 -0
  124. package/es/src/charts/viz/fillStroke.js +10 -0
  125. package/es/src/charts/viz/interactionOpacity.js +115 -32
  126. package/es/src/charts/viz/reportDrawError.js +15 -0
  127. package/es/src/charts/viz/setCursor.js +29 -0
  128. package/es/src/charts/viz/tooltipEnabled.js +38 -0
  129. package/es/src/charts/viz/userClick.js +34 -0
  130. package/es/src/charts/viz/vizDataPolling.js +0 -1
  131. package/es/src/charts/viz/vizDefaults.js +13 -34
  132. package/es/src/charts/viz/vizFields.js +6 -1
  133. package/es/src/charts/viz/vizRender.js +35 -5
  134. package/es/src/charts/viz/vizVisibility.js +12 -2
  135. package/es/src/components/Axis/Axis.js +29 -2
  136. package/es/src/components/Axis/axisBreak.js +29 -7
  137. package/es/src/components/Axis/axisDefaults.js +11 -0
  138. package/es/src/components/Axis/axisLabelKinds.js +36 -0
  139. package/es/src/components/Axis/axisLabelLineHeight.js +19 -0
  140. package/es/src/components/Axis/axisLabelRoom.js +37 -0
  141. package/es/src/components/Axis/axisLabelSize.js +171 -0
  142. package/es/src/components/Axis/axisLabelThinning.js +98 -4
  143. package/es/src/components/Axis/axisLayout.js +71 -46
  144. package/es/src/components/Axis/axisLayoutLabels.js +82 -140
  145. package/es/src/components/Axis/axisLayoutScale.js +9 -10
  146. package/es/src/components/Axis/axisLimit.js +27 -0
  147. package/es/src/components/Axis/axisMaxSize.js +39 -0
  148. package/es/src/components/Axis/axisRender.js +20 -8
  149. package/es/src/components/Axis/axisRounding.js +16 -1
  150. package/es/src/components/Axis/axisScene.js +11 -2
  151. package/es/src/components/Axis/axisTitle.js +53 -0
  152. package/es/src/components/Axis/axisTooltipTargets.js +128 -0
  153. package/es/src/components/ColorScale/ColorScale.js +62 -18
  154. package/es/src/components/ColorScale/bivariateRender.js +353 -0
  155. package/es/src/components/ColorScale/bivariateScale.js +150 -0
  156. package/es/src/components/ColorScale/colorScaleRender.js +32 -2
  157. package/es/src/components/ColorScale/colorScaleSwatchTooltips.js +77 -0
  158. package/es/src/components/Legend/Legend.js +10 -2
  159. package/es/src/components/Legend/legendCut.js +108 -0
  160. package/es/src/components/Legend/legendRender.js +38 -13
  161. package/es/src/components/TextBox.js +5 -2
  162. package/es/src/components/Timeline/timelineRender.js +2 -1
  163. package/es/src/components/textBoxScene.js +3 -0
  164. package/es/src/components/textEllipsis.js +7 -0
  165. package/es/src/components/tooltipDom.js +8 -5
  166. package/es/src/fluent.js +48 -0
  167. package/es/src/utils/BaseClass.js +7 -2
  168. package/es/src/utils/configValue.js +9 -0
  169. package/package.json +10 -10
  170. package/types/index.d.ts +1 -1
  171. package/types/internal.d.ts +22 -5
  172. package/types/src/charts/Alluvial/titles.d.ts +16 -3
  173. package/types/src/charts/ArcDiagram/emit.d.ts +3 -2
  174. package/types/src/charts/ArcDiagram/events.d.ts +2 -1
  175. package/types/src/charts/Geomap/flowEmit.d.ts +3 -2
  176. package/types/src/charts/Matrix/applyLayout.d.ts +4 -2
  177. package/types/src/charts/Network/applyLayout.d.ts +11 -0
  178. package/types/src/charts/Network/bundle.d.ts +3 -1
  179. package/types/src/charts/Network/graph.d.ts +12 -4
  180. package/types/src/charts/Pack/applyLayout.d.ts +2 -0
  181. package/types/src/charts/Pack/groupRows.d.ts +46 -0
  182. package/types/src/charts/Pack/index.d.ts +3 -0
  183. package/types/src/charts/Pack/neutralPaint.d.ts +14 -0
  184. package/types/src/charts/Pack/nodeNames.d.ts +23 -0
  185. package/types/src/charts/ParallelCoordinates/chrome.d.ts +12 -0
  186. package/types/src/charts/ParallelCoordinates/index.d.ts +1 -0
  187. package/types/src/charts/ParallelCoordinates/titles.d.ts +7 -2
  188. package/types/src/charts/Plot/areaEnter.d.ts +34 -0
  189. package/types/src/charts/Plot/index.d.ts +4 -10
  190. package/types/src/charts/Plot/lineMarkerKeys.d.ts +11 -0
  191. package/types/src/charts/Plot/shapeLabelLegend.d.ts +19 -0
  192. package/types/src/charts/Plot/sharedTooltip.d.ts +7 -1
  193. package/types/src/charts/Priestley/timeAxis.d.ts +7 -4
  194. package/types/src/charts/Pyramid/gutter.d.ts +28 -6
  195. package/types/src/charts/Pyramid/scene.d.ts +1 -1
  196. package/types/src/charts/Radar/applyLayout.d.ts +2 -3
  197. package/types/src/charts/Radar/axisDecorations.d.ts +5 -2
  198. package/types/src/charts/Radar/curvedLabels.d.ts +35 -0
  199. package/types/src/charts/Radar/emit.d.ts +5 -2
  200. package/types/src/charts/Radar/index.d.ts +7 -2
  201. package/types/src/charts/Radar/points.d.ts +50 -0
  202. package/types/src/charts/RadialMatrix/applyLayout.d.ts +6 -4
  203. package/types/src/charts/Rings/emit.d.ts +24 -2
  204. package/types/src/charts/Rings/index.d.ts +4 -2
  205. package/types/src/charts/Rings/ringsCurves.d.ts +50 -0
  206. package/types/src/charts/Rings/ringsGraph.d.ts +29 -5
  207. package/types/src/charts/Rings/ringsParallel.d.ts +4 -2
  208. package/types/src/charts/Rings/ringsPlacement.d.ts +47 -0
  209. package/types/src/charts/Rings/ringsSizing.d.ts +36 -9
  210. package/types/src/charts/Tree/applyLayout.d.ts +20 -0
  211. package/types/src/charts/Tree/keys.d.ts +25 -0
  212. package/types/src/charts/Tree/nodeLabel.d.ts +11 -0
  213. package/types/src/charts/definition/ChartDefinition.d.ts +13 -0
  214. package/types/src/charts/definition/makeChart.d.ts +2 -2
  215. package/types/src/charts/drawSteps/zoomActions.d.ts +30 -0
  216. package/types/src/charts/drawSteps/zoomControls.d.ts +15 -0
  217. package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +16 -1
  218. package/types/src/charts/drawSteps/zoomDrag.d.ts +71 -0
  219. package/types/src/charts/drawSteps/zoomFit.d.ts +30 -0
  220. package/types/src/charts/features/axisTooltip.d.ts +49 -0
  221. package/types/src/charts/features/centerLabel.d.ts +75 -0
  222. package/types/src/charts/features/colorScaleBivariate.d.ts +50 -0
  223. package/types/src/charts/features/colorScaleBucket.d.ts +10 -0
  224. package/types/src/charts/features/colorScaleHover.d.ts +13 -3
  225. package/types/src/charts/features/colorScaleLimit.d.ts +60 -0
  226. package/types/src/charts/features/colorScaleTooltip.d.ts +43 -0
  227. package/types/src/charts/features/colorScaleTop.d.ts +30 -0
  228. package/types/src/charts/features/curvedArrows.d.ts +14 -0
  229. package/types/src/charts/features/depthKey.d.ts +19 -0
  230. package/types/src/charts/features/edgeArrows.d.ts +29 -2
  231. package/types/src/charts/features/hoverTicks.d.ts +30 -0
  232. package/types/src/charts/features/idleQueue.d.ts +46 -0
  233. package/types/src/charts/features/linkInteraction.d.ts +13 -4
  234. package/types/src/charts/features/networkMeasures.d.ts +53 -0
  235. package/types/src/charts/features/nodeStats.d.ts +93 -0
  236. package/types/src/charts/features/plotEndLabels.d.ts +14 -1
  237. package/types/src/charts/features/textHalo.d.ts +4 -3
  238. package/types/src/charts/partition/chartFields.d.ts +6 -1
  239. package/types/src/charts/pipeline/insetPlacement.d.ts +6 -0
  240. package/types/src/charts/polar/chrome.d.ts +19 -6
  241. package/types/src/charts/viz/Viz.d.ts +10 -3
  242. package/types/src/charts/viz/VizBase.d.ts +31 -2
  243. package/types/src/charts/viz/backgroundInk.d.ts +8 -0
  244. package/types/src/charts/viz/emphasis.d.ts +17 -0
  245. package/types/src/charts/viz/fillStroke.d.ts +7 -0
  246. package/types/src/charts/viz/reportDrawError.d.ts +12 -0
  247. package/types/src/charts/viz/setCursor.d.ts +26 -0
  248. package/types/src/charts/viz/tooltipEnabled.d.ts +31 -0
  249. package/types/src/charts/viz/userClick.d.ts +35 -0
  250. package/types/src/charts/viz/vizFields.d.ts +5 -0
  251. package/types/src/charts/viz/vizTypes.d.ts +16 -0
  252. package/types/src/charts/viz/vizVisibility.d.ts +7 -0
  253. package/types/src/components/Axis/Axis.d.ts +33 -3
  254. package/types/src/components/Axis/axisBreak.d.ts +19 -3
  255. package/types/src/components/Axis/axisDefaults.d.ts +12 -0
  256. package/types/src/components/Axis/axisLabelKinds.d.ts +22 -0
  257. package/types/src/components/Axis/axisLabelLineHeight.d.ts +27 -0
  258. package/types/src/components/Axis/axisLabelRoom.d.ts +17 -0
  259. package/types/src/components/Axis/axisLabelSize.d.ts +82 -0
  260. package/types/src/components/Axis/axisLabelThinning.d.ts +38 -2
  261. package/types/src/components/Axis/axisLayout.d.ts +9 -2
  262. package/types/src/components/Axis/axisLayoutLabels.d.ts +28 -33
  263. package/types/src/components/Axis/axisLayoutScale.d.ts +3 -1
  264. package/types/src/components/Axis/axisLimit.d.ts +18 -0
  265. package/types/src/components/Axis/axisMaxSize.d.ts +48 -0
  266. package/types/src/components/Axis/axisRounding.d.ts +8 -0
  267. package/types/src/components/Axis/axisTitle.d.ts +30 -0
  268. package/types/src/components/Axis/axisTooltipTargets.d.ts +82 -0
  269. package/types/src/components/ColorScale/ColorScale.d.ts +21 -11
  270. package/types/src/components/ColorScale/bivariateRender.d.ts +53 -0
  271. package/types/src/components/ColorScale/bivariateScale.d.ts +92 -0
  272. package/types/src/components/ColorScale/colorScaleSwatchTooltips.d.ts +48 -0
  273. package/types/src/components/Legend/Legend.d.ts +5 -0
  274. package/types/src/components/Legend/legendCut.d.ts +31 -0
  275. package/types/src/components/Legend/legendRender.d.ts +6 -1
  276. package/types/src/components/TextBox.d.ts +4 -0
  277. package/types/src/components/textEllipsis.d.ts +6 -0
  278. package/types/src/fluent.d.ts +18 -0
  279. package/types/src/shapes/emitLabels.d.ts +1 -1
  280. package/types/src/utils/D3plusConfig.d.ts +485 -609
  281. package/types/src/utils/configValue.d.ts +8 -0
  282. package/types/src/utils/index.d.ts +1 -1
  283. package/types/umd-entry.d.ts +4 -0
  284. package/umd/d3plus-core.full.js +22930 -17936
  285. package/umd/d3plus-core.full.min.js +2 -2
  286. package/umd/d3plus-core.js +21240 -16404
  287. package/umd/d3plus-core.min.js +2 -2
@@ -7,15 +7,18 @@
7
7
  - `axisLabels.ts` — sizes the web to its metric labels.
8
8
  - `levels.ts` — nice ring values + level value labels.
9
9
  - `rings.ts` — ring styles + ring scene nodes.
10
- - `emit.ts` — Path scene nodes per polygon.
10
+ - `points.ts` — a dot on each vertex, its tooltip row, and its hover.
11
+ - `emit.ts` — Path scene nodes per polygon, then the dots.
11
12
  */ import accessor from "../../utils/accessor.js";
12
13
  import { fieldAccessor } from "../../utils/fieldAccessor.js";
13
14
  import constant from "../../utils/constant.js";
14
15
  import { centerChartTransform, chartBounds } from "../features/chartGeometry.js";
15
16
  import { makeChart } from "../definition/makeChart.js";
17
+ import { isPointShape } from "../viz/nearestHover.js";
16
18
  import { backgroundInk, chartGridline } from "../viz/backgroundInk.js";
17
19
  import { applyRadarLayout } from "./applyLayout.js";
18
20
  import { radarEmit } from "./emit.js";
21
+ import { radarPointHover, radarPointTooltipRows } from "./points.js";
19
22
  export const radarDef = {
20
23
  name: "Radar",
21
24
  layoutStage: applyRadarLayout,
@@ -37,6 +40,10 @@ export const radarDef = {
37
40
  height
38
41
  };
39
42
  },
43
+ // The vertex dots are points for `hoverDistance`; polygons keep exact
44
+ // hit-testing.
45
+ pointMark: (_viz, node)=>isPointShape(node),
46
+ setup: radarPointHover,
40
47
  // Small-multiple panels as close to square as the grid allows.
41
48
  facet: {
42
49
  aspect: 1
@@ -85,6 +92,34 @@ export const radarDef = {
85
92
  default: constant("Path"),
86
93
  coerce: "const"
87
94
  },
95
+ // See-through polygons outlined in their own color, so overlapping
96
+ // groups all stay readable, and a dot on each vertex, styled by
97
+ // `shapeConfig.Circle` (`r: 0` hides them).
98
+ {
99
+ key: "shapeConfig",
100
+ merge: true,
101
+ factory: (viz)=>({
102
+ Path: {
103
+ fillOpacity: 0.25,
104
+ stroke: (d, i)=>{
105
+ const sc = viz.schema.shapeConfig;
106
+ const fill = sc.Path?.fill ?? sc.fill;
107
+ return typeof fill === "function" ? fill(d, i) : fill;
108
+ },
109
+ strokeWidth: 2
110
+ },
111
+ Circle: {
112
+ r: 3
113
+ }
114
+ })
115
+ },
116
+ {
117
+ key: "tooltipConfig",
118
+ merge: true,
119
+ factory: (viz)=>({
120
+ tbody: (d)=>radarPointTooltipRows(viz, d)
121
+ })
122
+ },
88
123
  /**
89
124
  Accessor function or string key for each data point's value, which sets its
90
125
  distance from the center along its metric's spoke.
@@ -126,5 +161,9 @@ export const radarDef = {
126
161
  ]
127
162
  };
128
163
  /**
129
- Creates a radar visualization based on an array of data.
164
+ Creates a radar visualization based on an array of data. Each polygon is
165
+ a see-through fill outlined in its color (`shapeConfig.Path`), with a dot
166
+ on every vertex, styled by `shapeConfig.Circle`. The dots, not the
167
+ polygons, answer the pointer: hovering one shows that group's value for
168
+ its metric. `r: 0` hides them, and the polygons answer instead.
130
169
  */ export default makeChart(radarDef);
@@ -0,0 +1,85 @@
1
+ /**
2
+ Radar vertex dots: one Circle per polygon vertex, painted from
3
+ `shapeConfig.Circle` (a `r` of 0 or less draws none). Hovering a dot
4
+ shows that group's value for its metric and keeps only that metric's
5
+ label bright.
6
+ */ import { formatAbbreviate } from "@d3plus/format";
7
+ import { paintFromShapeConfig, resolveAccessor } from "../features/emitHelpers.js";
8
+ /** The dot rows of every drawn radar, each to the metric and value it shows. */ const pointRows = new WeakMap();
9
+ /** Marks `row` as the dot for `point`, so its tooltip and hover read it. */ export function registerRadarPoint(row, point) {
10
+ pointRows.set(row, point);
11
+ }
12
+ /** The metric and value `d` stands for when it is a dot's row, else undefined. */ export function radarPointOf(d) {
13
+ return d && typeof d === "object" ? pointRows.get(d) : undefined;
14
+ }
15
+ /** A dot's value as text: through `levelFormat` when set, as the ring labels are, else abbreviated. */ function valueText(viz, value) {
16
+ const format = viz.schema.levelFormat;
17
+ return typeof format === "function" ? `${format(value)}` : formatAbbreviate(value, viz.schema.locale);
18
+ }
19
+ /**
20
+ The tooltip rows for a hovered datum: a dot's metric and value, nothing
21
+ for a polygon.
22
+ */ export function radarPointTooltipRows(viz, d) {
23
+ const point = radarPointOf(d);
24
+ return point ? [
25
+ [
26
+ `${point.metric}`,
27
+ valueText(viz, point.value)
28
+ ]
29
+ ] : [];
30
+ }
31
+ /**
32
+ One Circle node per vertex of group `g` (the `gi`th), painted from
33
+ `circleConfig`. None when the radius resolves to 0 or less.
34
+ */ export function radarGroupPointNodes(viz, g, gi, circleConfig) {
35
+ const out = [];
36
+ g.points.forEach((p, k)=>{
37
+ const datum = g.arr[k];
38
+ const r = Number(resolveAccessor(circleConfig.r, datum, gi));
39
+ if (!(r > 0)) return;
40
+ const metric = g.metrics[k];
41
+ out.push({
42
+ type: "circle",
43
+ key: `radar-point-${g.id}-${metric}`,
44
+ cx: 0,
45
+ cy: 0,
46
+ r,
47
+ transform: {
48
+ x: p.x,
49
+ y: p.y
50
+ },
51
+ datum,
52
+ // Only this dot's metric label stays bright on hover.
53
+ hoverKeys: {
54
+ metric: [
55
+ metric
56
+ ]
57
+ },
58
+ paint: paintFromShapeConfig(circleConfig, datum, gi),
59
+ aria: {
60
+ label: `${viz._drawLabel(datum, gi)}, ${metric}: ${valueText(viz, g.values[k])}.`
61
+ }
62
+ });
63
+ });
64
+ return out;
65
+ }
66
+ /** The vertex dots of every group, in group order (see `radarGroupPointNodes`). */ export const radarPointNodes = (viz, groups, circleConfig)=>groups.flatMap((g, gi)=>radarGroupPointNodes(viz, g, gi, circleConfig));
67
+ /**
68
+ Wraps the chart's `mouseenter` handler so hovering a dot lights its
69
+ whole polygon but only its own metric's label (see `_hoverFocus`).
70
+ */ export function radarPointHover(viz) {
71
+ const base = viz.schema.on.mouseenter;
72
+ viz.schema.on.mouseenter = (d, i, x, event)=>{
73
+ if (base) base.call(viz, d, i, x, event);
74
+ const point = radarPointOf(d);
75
+ const hover = viz._hover;
76
+ if (point && typeof hover === "function") viz._hoverFocus = {
77
+ hover: hover,
78
+ rows: [
79
+ {
80
+ metric: point.metric
81
+ }
82
+ ]
83
+ };
84
+ };
85
+ }
@@ -3,6 +3,7 @@
3
3
  whole track (so a short bar is still easy to hover).
4
4
  */ import { formatAbbreviate } from "@d3plus/format";
5
5
  import { arcPath } from "@d3plus/render";
6
+ import { centerLabelNodes } from "../features/centerLabel.js";
6
7
  import { polarWedgeNodes } from "../polar/config.js";
7
8
  import { radialBarCurvedLabels } from "./curvedLabels.js";
8
9
  export const radialBarEmit = ({ viz, shapeData })=>{
@@ -33,9 +34,13 @@ export const radialBarEmit = ({ viz, shapeData })=>{
33
34
  });
34
35
  const bars = polarWedgeNodes(viz, wedges, "radialbar", (w)=>`${viz._drawLabel(w.data, w.i)}, ${formatAbbreviate(w.value, viz.schema.locale)}.`);
35
36
  const labels = angular ? [] : radialBarCurvedLabels(viz, wedges, frame);
37
+ const center = centerLabelNodes(viz, {
38
+ radius: frame.inner
39
+ }, viz.schema.value);
36
40
  return [
37
41
  ...hits,
38
42
  ...bars,
39
- ...labels
43
+ ...labels,
44
+ ...center
40
45
  ];
41
46
  };
@@ -13,6 +13,7 @@
13
13
  import accessor from "../../utils/accessor.js";
14
14
  import { fieldAccessor } from "../../utils/fieldAccessor.js";
15
15
  import { centerChartTransform, chartBounds } from "../features/chartGeometry.js";
16
+ import { centerLabelDefaults } from "../features/centerLabel.js";
16
17
  import { makeChart } from "../definition/makeChart.js";
17
18
  import { mergeConfig } from "../../fluent.js";
18
19
  import { dialDefaults } from "../Gauge/emit.js";
@@ -60,6 +61,15 @@ export const radialBarDef = {
60
61
  facet: polarFacetHooks(radialBarDomainValues),
61
62
  ctx: {},
62
63
  fields: [
64
+ {
65
+ key: "centerLabel",
66
+ default: false
67
+ },
68
+ {
69
+ key: "centerLabelConfig",
70
+ merge: true,
71
+ factory: centerLabelDefaults
72
+ },
63
73
  /**
64
74
  Which polar dimension holds the categories: `"radius"` (default) gives
65
75
  each row a concentric track whose arc length shows its value;
@@ -2,49 +2,69 @@
2
2
  `applyRadialMatrixLayout` — RadialMatrix's chart-specific layout stage.
3
3
 
4
4
  Runs `matrixData.prepData`, computes polar geometry (label positions,
5
- arc generator), runs `viz.ctx.columnLabels` (a TextBox) in compute
6
- mode and absorbs it into `_chartScene`. Stashes `arcData` on
7
- `viz.ctx`, plus `radialMatrixWidth`/`radialMatrixHeight` so the chart
8
- transform can center the layout.
5
+ arc generator), and lays the column labels into `_chartScene`: curved
6
+ just outside the circle when they all fit (see `labelPosition`), which
7
+ leaves the circle the most room, else straight in `viz.ctx.columnLabels`
8
+ (a TextBox, in compute mode) wherever they don't curve. Stashes
9
+ `arcData` on `viz.ctx`, plus `radialMatrixWidth`/`radialMatrixHeight`
10
+ so the chart transform can center the layout.
9
11
  */ import { min } from "d3-array";
10
12
  import * as d3Shape from "d3-shape";
11
13
  import { chartBounds } from "../features/chartGeometry.js";
14
+ import { textLineBoxes } from "../features/linkLabels.js";
15
+ import { clearRingLabels } from "../features/ringLabelNodes.js";
16
+ import { ringLabelPosition } from "../features/ringLabels.js";
12
17
  import matrixPrepData from "../helpers/matrixData.js";
18
+ import { RADAR_EDGE_GAP } from "../Radar/axisLabels.js";
19
+ import { labelFont } from "../Radar/axisDecorations.js";
20
+ import { radarCurveNodes, radarCurvedLayout, radarCurvesAt } from "../Radar/curvedLabels.js";
13
21
  const TAU = Math.PI * 2;
14
- /** Renders the column-label TextBox in compute mode and absorbs it into `_chartScene`. */ const renderColumnLabels = (viz, displayLabels, labelWidth, labelHeight, labelConfig)=>{
22
+ /**
23
+ The straight column labels: the TextBox, rendered in compute mode, each
24
+ following the hover of its column's cells.
25
+ */ const straightColumnLabels = (viz, displayLabels, labelWidth, labelHeight, labelConfig)=>{
26
+ if (!displayLabels.length) return [];
15
27
  const columnLabels = viz.ctx.columnLabels;
16
28
  columnLabels.renderMode("compute").select(undefined).data(displayLabels).x((d)=>d.x).y((d)=>d.y).text((d)=>d.key).width(labelWidth).height(labelHeight).config(labelConfig).render();
17
- const labelsScene = columnLabels.toScene();
18
- if (labelsScene) {
19
- (viz._chartScene ||= []).push({
20
- type: "group",
21
- key: "radialmatrix-columns",
22
- children: labelsScene.children ?? []
23
- });
29
+ const nodes = columnLabels.toScene()?.children ?? [];
30
+ // Each label follows the hover of its column's cells.
31
+ for (const n of nodes){
32
+ const column = n.datum?.key;
33
+ if (column !== undefined) n.hoverMatch = {
34
+ field: "column",
35
+ value: column
36
+ };
24
37
  }
38
+ return nodes;
25
39
  };
26
- export const applyRadialMatrixLayout = ({ viz })=>{
27
- const { rowValues, columnValues, shapeData } = matrixPrepData.bind(viz)(viz._filteredData);
28
- const { width, height } = chartBounds(viz);
29
- if (!rowValues.length || !columnValues.length) {
30
- viz.ctx.radialMatrixWidth = width;
31
- viz.ctx.radialMatrixHeight = height;
40
+ /**
41
+ Each column's label curved just outside the circle, column `k` centered
42
+ on its slice: every one when they all fit, at the radius that leaves
43
+ (`radius` null), else those that fit at `radius`. Columns `shown` leaves
44
+ out take no label.
45
+ */ const columnCurves = (viz, columns, shown, labelConfig, room, radius)=>{
46
+ const inputs = columns.map(({ key, data }, k)=>{
47
+ const text = shown(key) ? `${key}` : "";
32
48
  return {
33
- shapeData: []
49
+ text,
50
+ data,
51
+ angle: k / columns.length * TAU - Math.PI / 2,
52
+ font: labelFont(viz, text, data, k, labelConfig)
34
53
  };
35
- }
36
- viz.ctx.radialMatrixWidth = width;
37
- viz.ctx.radialMatrixHeight = height;
38
- const labelHeight = 50;
39
- const labelWidth = 100;
40
- const radius = (min([
41
- height - labelHeight * 2,
42
- width - labelWidth * 2
43
- ]) ?? 0) / 2;
54
+ });
55
+ return radarCurvedLayout(viz, inputs, room) ?? {
56
+ radius,
57
+ curves: radarCurvesAt(viz, inputs, radius, room)
58
+ };
59
+ };
60
+ /**
61
+ Where each column's straight label sits for a circle of `radius`: a
62
+ `labelWidth` × `labelHeight` box beyond the circle at its column's angle.
63
+ */ const straightPlacements = (columnValues, radius, labelWidth, labelHeight)=>{
44
64
  const flippedColumns = columnValues.slice().reverse();
45
65
  flippedColumns.unshift(flippedColumns.pop());
46
66
  const total = flippedColumns.length;
47
- const labelData = flippedColumns.map((key, i)=>{
67
+ return flippedColumns.map((key, i)=>{
48
68
  const radians = i / total * TAU;
49
69
  const angle = Math.round(radians * 180 / Math.PI);
50
70
  const quadrant = Math.floor((angle + 90) / 90 % 4 + 1);
@@ -71,9 +91,73 @@ export const applyRadialMatrixLayout = ({ viz })=>{
71
91
  y: radius * Math.cos(radians + Math.PI) + yMod
72
92
  };
73
93
  });
94
+ };
95
+ /**
96
+ Lays the column labels into `_chartScene` and returns the circle's
97
+ radius they leave, with each column's straight label placement.
98
+ */ const layColumnLabels = (viz, columnValues, shapeData, width, height)=>{
99
+ const labelHeight = 50;
100
+ const labelWidth = 100;
74
101
  const columnConfig = viz.schema.columnConfig;
75
- const displayLabels = columnConfig.labels instanceof Array ? labelData.filter((d)=>columnConfig.labels.includes(d.key)) : labelData;
76
- renderColumnLabels(viz, displayLabels, labelWidth, labelHeight, columnConfig.shapeConfig?.labelConfig);
102
+ const labelConfig = columnConfig.shapeConfig?.labelConfig ?? {};
103
+ const shown = (key)=>!(columnConfig.labels instanceof Array) || columnConfig.labels.includes(key);
104
+ const rowOf = new Map();
105
+ for (const d of shapeData)if (!rowOf.has(d.column)) rowOf.set(d.column, d.data ?? d);
106
+ const columns = columnValues.map((key)=>({
107
+ key,
108
+ data: rowOf.get(key) ?? {
109
+ column: key
110
+ }
111
+ }));
112
+ const { radius, curves } = columnCurves(viz, columns, shown, labelConfig, Math.max(0, Math.min(width, height) / 2 - RADAR_EDGE_GAP), Math.max(0, min([
113
+ height - labelHeight * 2,
114
+ width - labelWidth * 2
115
+ ]) ?? 0) / 2);
116
+ const labelData = straightPlacements(columnValues, radius, labelWidth, labelHeight);
117
+ const curved = radarCurveNodes(viz, columns.flatMap(({ key, data }, k)=>{
118
+ const curve = curves[k];
119
+ return curve ? [
120
+ {
121
+ key: `radialmatrix-column-${key}`,
122
+ data,
123
+ i: k,
124
+ curve,
125
+ hoverMatch: {
126
+ field: "column",
127
+ value: key
128
+ }
129
+ }
130
+ ] : [];
131
+ }), labelConfig);
132
+ const straightKeys = new Set(columns.filter(({ key, data }, k)=>shown(key) && !curves[k] && ringLabelPosition(viz, data, k) !== "along").map((c)=>c.key));
133
+ const straight = straightColumnLabels(viz, labelData.filter((d)=>straightKeys.has(d.key)), labelWidth, labelHeight, labelConfig);
134
+ const labels = [
135
+ ...curved,
136
+ ...clearRingLabels(straight, textLineBoxes(curved))
137
+ ];
138
+ if (labels.length) (viz._chartScene ||= []).push({
139
+ type: "group",
140
+ key: "radialmatrix-columns",
141
+ children: labels
142
+ });
143
+ return {
144
+ radius,
145
+ labelData
146
+ };
147
+ };
148
+ export const applyRadialMatrixLayout = ({ viz })=>{
149
+ const { rowValues, columnValues, shapeData } = matrixPrepData.bind(viz)(viz._filteredData);
150
+ const { width, height } = chartBounds(viz);
151
+ if (!rowValues.length || !columnValues.length) {
152
+ viz.ctx.radialMatrixWidth = width;
153
+ viz.ctx.radialMatrixHeight = height;
154
+ return {
155
+ shapeData: []
156
+ };
157
+ }
158
+ viz.ctx.radialMatrixWidth = width;
159
+ viz.ctx.radialMatrixHeight = height;
160
+ const { radius, labelData } = layColumnLabels(viz, columnValues, shapeData, width, height);
77
161
  const innerRadiusFn = viz.schema.innerRadius;
78
162
  const innerRadius = innerRadiusFn(radius);
79
163
  const rowHeight = (radius - innerRadius) / rowValues.length;
@@ -46,7 +46,19 @@ export const radialMatrixDef = {
46
46
  if (colorScaleBucketOf(x) || colorScaleBucketOf(d)) return;
47
47
  const row = getProp.bind(viz)("row", d, i);
48
48
  const column = getProp.bind(viz)("column", d, i);
49
- viz.hover((h, ii)=>getProp.bind(viz)("row", h, ii) === row || getProp.bind(viz)("column", h, ii) === column);
49
+ const hover = (h, ii)=>getProp.bind(viz)("row", h, ii) === row || getProp.bind(viz)("column", h, ii) === column;
50
+ // The crosshair lights the whole row and column; only the hovered
51
+ // cell's column label stays bright.
52
+ viz._hoverFocus = {
53
+ hover,
54
+ rows: [
55
+ {
56
+ row,
57
+ column
58
+ }
59
+ ]
60
+ };
61
+ viz.hover(hover);
50
62
  };
51
63
  },
52
64
  // Small-multiple panels as close to square as the grid allows.
@@ -114,7 +126,8 @@ export const radialMatrixDef = {
114
126
  coerce: (v)=>typeof v === "function" ? v : constant(v)
115
127
  },
116
128
  /**
117
- Config for the column labels drawn around the circle:
129
+ Config for the column labels drawn around the circle, curved just
130
+ outside it when they all fit (see `labelPosition`):
118
131
  `shapeConfig.labelConfig` styles them (a `TextBox` config), and
119
132
  `labels`, an array of column values, limits which ones are drawn.
120
133
  */ {
@@ -1,19 +1,21 @@
1
1
  /**
2
2
  `applyRingsLayout` — Rings' chart-specific layout stage. Lays out the
3
- focal center node + two concentric rings of connected nodes, sizes
3
+ focal center node + `hops` concentric rings of connected nodes, sizes
4
4
  each by extent, builds bezier link `d` accessor, and stashes
5
5
  `ringsCtx` + `nodeLookup`/`linkLookup` on `viz.ctx`.
6
- */ import { extent, groups, max, min } from "d3-array";
6
+ */ import { extent, groups, min } from "d3-array";
7
7
  import * as scales from "d3-scale";
8
8
  import { colorContrast } from "@d3plus/color";
9
9
  import { chartBounds } from "../features/chartGeometry.js";
10
10
  import { resolveAccessor, shapeConfigFor } from "../features/emitHelpers.js";
11
- import { ringsCenterLabel, ringsGeometry, sizeRingsNodes } from "./ringsSizing.js";
11
+ import { ringsCenterLabel, ringsGeometry, ringsHops } from "./ringsSizing.js";
12
12
  import { publishLinkGraph } from "../features/linkInteraction.js";
13
13
  import { linkWidthRange } from "../features/linkWidths.js";
14
14
  import { buildRingsGraph, ringsLinkEnd } from "./ringsGraph.js";
15
15
  import { ringsLoops } from "./ringsLoops.js";
16
- import { edgesBetween, fanParallelEdges, firstPerNeighbor } from "./ringsParallel.js";
16
+ import { fanParallelEdges } from "./ringsParallel.js";
17
+ import { ringsSegmentsD } from "./ringsCurves.js";
18
+ import { buildRingsEdges, placeRingsNodes } from "./ringsPlacement.js";
17
19
  import { backgroundInk } from "../viz/backgroundInk.js";
18
20
  /** Shared empty `ringsCtx` value for the early-return branches. */ const emptyRingsCtx = ()=>({
19
21
  edges: [],
@@ -22,146 +24,6 @@ import { backgroundInk } from "../viz/backgroundInk.js";
22
24
  linkD: ()=>"",
23
25
  nodeShapeConfig: {}
24
26
  });
25
- /**
26
- Claim the center node + two rings, compute each node's angle/position, build
27
- the radius scale, and size every node. Returns the rebuilt `nodes` array
28
- plus the `primaries`/`secondaries` rings.
29
- */ function placeRingsNodes(v, nodeLookup, linkMap, center, geom) {
30
- const { width, height, primaryRing, secondaryRing } = geom;
31
- center.x = width / 2;
32
- center.y = height / 2;
33
- center.r = v.schema.sizeMin ? max([
34
- v.schema.sizeMin,
35
- primaryRing * 0.65
36
- ]) : v.schema.sizeMax ? min([
37
- v.schema.sizeMax,
38
- primaryRing * 0.65
39
- ]) : primaryRing * 0.65;
40
- const claimed = [
41
- center
42
- ];
43
- const primaries = [];
44
- const centerLinks = linkMap[v.schema.center] || [];
45
- centerLinks.forEach((edge)=>{
46
- const node = edge.source.id === v.schema.center ? edge.target : edge.source;
47
- // A node takes one place however many center links reach it.
48
- if (primaries.includes(node)) return;
49
- node.edges = linkMap[node.id].filter((link)=>link.source.id !== v.schema.center || link.target.id !== v.schema.center);
50
- claimed.push(node);
51
- primaries.push(node);
52
- });
53
- primaries.sort((a, b)=>a.edges.length - b.edges.length);
54
- const secondaries = [];
55
- let totalEndNodes = 0;
56
- primaries.forEach((p)=>{
57
- const primaryId = p.id;
58
- p.edges = firstPerNeighbor(p.edges.filter((edge)=>!claimed.includes(edge.source) && edge.target.id === primaryId || !claimed.includes(edge.target) && edge.source.id === primaryId), primaryId);
59
- totalEndNodes += p.edges.length || 1;
60
- p.edges.forEach((edge)=>{
61
- const { source, target } = edge;
62
- const claim = target.id === primaryId ? source : target;
63
- claimed.push(claim);
64
- });
65
- });
66
- const tau = Math.PI * 2;
67
- let offset = 0;
68
- primaries.forEach((p, i)=>{
69
- const pEdges = p.edges;
70
- const children = pEdges.length || 1;
71
- const space = tau / totalEndNodes * children;
72
- if (i === 0) offset -= space / 2;
73
- const angle = offset + space / 2 - tau / 4;
74
- p.radians = angle;
75
- p.x = width / 2 + primaryRing * Math.cos(angle);
76
- p.y = height / 2 + primaryRing * Math.sin(angle);
77
- offset += space;
78
- pEdges.forEach((edge, j)=>{
79
- const node = edge.source.id === p.id ? edge.target : edge.source;
80
- const s = tau / totalEndNodes;
81
- const a = angle - s * children / 2 + s / 2 + s * j;
82
- node.radians = a;
83
- node.x = width / 2 + secondaryRing * Math.cos(a);
84
- node.y = height / 2 + secondaryRing * Math.sin(a);
85
- secondaries.push(node);
86
- });
87
- });
88
- const radius = sizeRingsNodes(v, center, geom, totalEndNodes, primaries, secondaries);
89
- const nodes = [
90
- center
91
- ].concat(primaries).concat(secondaries);
92
- return {
93
- nodes,
94
- primaries,
95
- secondaries,
96
- radius
97
- };
98
- }
99
- /**
100
- Resolve link endpoints to placed nodes, compute bezier control points for
101
- spline edges, and push every edge onto `edges` once (mutated in place):
102
- an edge between two primaries is reached from both.
103
- */ function buildRingsEdges(v, nodes, primaries, secondaries, linkMap, center, geom, edges) {
104
- const { width, height, ringWidth, primaryRing, secondaryRing } = geom;
105
- primaries.forEach((p)=>{
106
- const checks = [
107
- "source",
108
- "target"
109
- ];
110
- edgesBetween(linkMap[p.id], p.id, center.id).forEach((pEdge)=>{
111
- checks.forEach((node)=>{
112
- pEdge[node] = nodes.find((n)=>n.id === pEdge[node].id);
113
- });
114
- if (!edges.includes(pEdge)) edges.push(pEdge);
115
- });
116
- linkMap[p.id].forEach((edge)=>{
117
- const otherNode = edge.source.id === p.id ? edge.target : edge.source;
118
- if (otherNode.id === center.id) return;
119
- let target = secondaries.find((s)=>s.id === otherNode.id);
120
- if (!target) target = primaries.find((s)=>s.id === otherNode.id);
121
- if (!target) return;
122
- edge.spline = true;
123
- const centerX = width / 2;
124
- const centerY = height / 2;
125
- const middleRing = primaryRing + (secondaryRing - primaryRing) * 0.5;
126
- const checks2 = [
127
- "source",
128
- "target"
129
- ];
130
- checks2.forEach((endKey, i)=>{
131
- const endNode = edge[endKey];
132
- const endRadians = endNode.radians;
133
- const endRing = endNode.ring;
134
- const endRX = endNode.x;
135
- const endRY = endNode.y;
136
- const endRR = endNode.r;
137
- const rotated = endRing === 2 ? endRadians + Math.PI : endRadians;
138
- edge[`${endKey}X`] = endRX + Math.cos(rotated) * endRR;
139
- edge[`${endKey}Y`] = endRY + Math.sin(rotated) * endRR;
140
- edge[`${endKey}BisectX`] = centerX + middleRing * Math.cos(endRadians);
141
- edge[`${endKey}BisectY`] = centerY + middleRing * Math.sin(endRadians);
142
- edge[endKey] = nodes.find((n)=>n.id === endNode.id);
143
- const ringNode = edge[endKey];
144
- if (ringNode.edges === undefined) {
145
- ringNode.edges = {};
146
- }
147
- const oppId = i === 0 ? edge.target.id : edge.source.id;
148
- const edgeMap = ringNode.edges;
149
- if (ringNode.id === p.id) {
150
- edgeMap[oppId] = {
151
- angle: p.radians + Math.PI,
152
- radius: ringWidth / 2
153
- };
154
- } else {
155
- edgeMap[oppId] = {
156
- angle: target.radians,
157
- radius: ringWidth / 2
158
- };
159
- }
160
- });
161
- if (!edges.includes(edge)) edges.push(edge);
162
- });
163
- });
164
- }
165
27
  /** Compute each node's label bounds, rotation, and text anchor (mutated in place). */ function applyRingsLabelBounds(v, nodes, geom) {
166
28
  const { ringWidth } = geom;
167
29
  nodes.forEach((node)=>{
@@ -224,7 +86,7 @@ import { backgroundInk } from "../viz/backgroundInk.js";
224
86
  scaleRingsStrokes(v, nodes, links);
225
87
  const linkConfig = shapeConfigFor(v, "Path", v.schema.shapeConfig, "edge");
226
88
  delete linkConfig.on;
227
- const linkD = (d)=>d.loop ? d.loop.d : d.spline ? `M${d.sourceX},${d.sourceY}C${d.sourceBisectX},${d.sourceBisectY} ${d.targetBisectX},${d.targetBisectY} ${d.targetX},${d.targetY}` : `M${d.source.x},${d.source.y} ${d.target.x},${d.target.y}`;
89
+ const linkD = (d)=>d.loop ? d.loop.d : d.segments ? ringsSegmentsD(d.segments) : d.spline ? `M${d.sourceX},${d.sourceY}C${d.sourceBisectX},${d.sourceBisectY} ${d.targetBisectX},${d.targetBisectY} ${d.targetX},${d.targetY}` : `M${d.source.x},${d.source.y} ${d.target.x},${d.target.y}`;
228
90
  // The center's label sits inside its circle unless the circle is too small
229
91
  // (see `ringsCenterLabel`), in which case it sits below like any other.
230
92
  const centerInside = (node)=>node.id === v.schema.center && nodeLookup[node.id]?.labelInside !== false;
@@ -299,7 +161,7 @@ import { backgroundInk } from "../viz/backgroundInk.js";
299
161
  v.ctx.nodeLookup = nodeLookup;
300
162
  if (!prepared || !prepared.center) return null;
301
163
  const { graph, center } = prepared;
302
- return placeRingsNodes(v, graph.nodeLookup, graph.linkMap, center, ringsGeometry(width, height)).radius;
164
+ return placeRingsNodes(v, graph.linkMap, center, ringsGeometry(width, height, ringsHops(v.schema.hops))).radius;
303
165
  }
304
166
  export const applyRingsLayout = ({ viz })=>{
305
167
  const v = viz;
@@ -322,11 +184,10 @@ export const applyRingsLayout = ({ viz })=>{
322
184
  };
323
185
  }
324
186
  const { width, height } = chartBounds(v);
325
- const edges = [];
326
- const geom = ringsGeometry(width, height);
327
- const { nodes, primaries, secondaries, radius } = placeRingsNodes(v, nodeLookup, linkMap, center, geom);
187
+ const geom = ringsGeometry(width, height, ringsHops(v.schema.hops));
188
+ const { nodes, rings, radius } = placeRingsNodes(v, linkMap, center, geom);
328
189
  v._sizeLegendFinal = radius;
329
- buildRingsEdges(v, nodes, primaries, secondaries, linkMap, center, geom, edges);
190
+ const edges = buildRingsEdges(rings, linkMap, center, geom, !!v.schema.ringLinks);
330
191
  applyRingsLabelBounds(v, nodes, geom);
331
192
  publishRingsCtx(v, nodes, nodeLookup, links, edges);
332
193
  // Parallel links fan apart by their scaled sizes.