@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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/Plot/index.ts"],"sourcesContent":["/* eslint no-cond-assign: 0*/\n\n// @ts-ignore\nimport pkg from \"open-color/open-color.js\";\nimport {zoomTransform} from \"d3-zoom\";\nconst {theme: openColor} = pkg;\n\nimport {\n colorAssign,\n colorContrast,\n colorDefaults,\n} from \"@d3plus/color\";\nimport {assign, backgroundColor} from \"@d3plus/dom\";\n\nimport {\n AxisBottom,\n AxisLeft,\n AxisRight,\n AxisTop,\n} from \"../../components/index.js\";\nimport {accessor, constant} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\n\n// E4: Plot's identity-coerce accessor schema (18 keys). installFluent's\n// per-key idempotence lets this co-exist with vizSchema on the parent\n// Viz.prototype — installFluent walks the actual prototype (Plot.prototype\n// here) and skips keys already present.\nconst plotSchema = [\n {key: \"barPadding\", coerce: \"identity\" as const},\n {key: \"baseline\", coerce: \"identity\" as const},\n {key: \"lineLabels\", coerce: \"identity\" as const},\n {key: \"shapeSort\", coerce: \"identity\" as const},\n {key: \"sizeMax\", coerce: \"identity\" as const},\n {key: \"sizeMin\", coerce: \"identity\" as const},\n {key: \"sizeScale\", coerce: \"identity\" as const},\n {key: \"stacked\", coerce: \"identity\" as const},\n {key: \"xCutoff\", coerce: \"identity\" as const},\n {key: \"xDomain\", coerce: \"identity\" as const},\n {key: \"x2Domain\", coerce: \"identity\" as const},\n {key: \"xSort\", coerce: \"identity\" as const},\n {key: \"x2Sort\", coerce: \"identity\" as const},\n {key: \"yCutoff\", coerce: \"identity\" as const},\n {key: \"yDomain\", coerce: \"identity\" as const},\n {key: \"y2Domain\", coerce: \"identity\" as const},\n {key: \"ySort\", coerce: \"identity\" as const},\n {key: \"y2Sort\", coerce: \"identity\" as const},\n];\n\nimport {plotDef} from \"./pipeline.js\";\nimport {drawPlot} from \"./draw.js\";\nimport {plotShapeDefaults} from \"./shapeDefaults.js\";\nimport {\n resolveStackOffset,\n resolveStackOrder,\n stackOffsetDiverging,\n stackOrderTotalDescending,\n type StackOffsetFn,\n type StackOrderFn,\n type StackOrderInput,\n} from \"./stackHelpers.js\";\nimport type {PlotPaintContext} from \"../features/plotPaint.js\";\nimport {paintZoomablePlot, zoomPlot, type ZoomState} from \"./plotZoom.js\";\nimport Viz from \"../viz/Viz.js\";\n\nimport type {InteractionPoint, PickResult, Scene, SceneEvent, SceneNode} from \"@d3plus/render\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** Accessor function or string key for a plotted value. */\ntype PlotAccessor = (d: DataPoint, i: number) => number | Date | string;\n/** Function-or-string-key value accepted by accessor setters. */\ntype PlotAccessorArg = string | PlotAccessor;\n\nimport {default as BarBuffer} from \"../plotBuffers/Bar.js\";\nimport {default as BoxBuffer} from \"../plotBuffers/Box.js\";\nimport {default as CircleBuffer} from \"../plotBuffers/Circle.js\";\nimport {default as LineBuffer} from \"../plotBuffers/Line.js\";\nimport {default as RectBuffer} from \"../plotBuffers/Rect.js\";\nconst defaultBuffers = {\n Bar: BarBuffer,\n Box: BoxBuffer,\n Circle: CircleBuffer,\n Line: LineBuffer,\n Rect: RectBuffer,\n};\n\n/**\n Creates an x/y plot based on an array of data.\n*/\nexport default class Plot extends Viz {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n // E4: install identity-coerce accessors on Plot.prototype. Defaults\n // are still applied below imperatively from plotDef; installFluent\n // skips slots that are already set, so the constructor wins.\n installFluent(this, plotSchema);\n // E3: scalar defaults sourced from plotDef.\n const defaults = plotDef.defaults!;\n this._axisPersist = defaults.axisPersist as boolean;\n this._annotations = defaults.annotations as unknown[];\n this._backgroundConfig = {\n duration: 0,\n fill: \"transparent\",\n };\n this.schema.barPadding = defaults.barPadding as number;\n this._buffer = assign({}, defaultBuffers, {Bar: false, Line: false});\n this._confidenceConfig = {\n // A line's colour is its stroke, so the confidence band fills with that\n // same colour (at the reduced opacity below). Prefer a per-Line stroke\n // override, else the shared stroke accessor (the Line config itself sets\n // no `stroke` — the colour comes from the top-level `shapeConfig.stroke`).\n fill: (d: DataPoint, i: number) => {\n const {Line, stroke} = this.schema.shapeConfig;\n const s = Line && Line.stroke !== undefined ? Line.stroke : stroke;\n return typeof s === \"function\" ? s(d, i) : s;\n },\n fillOpacity: constant(0.5),\n };\n this._discreteCutoff = defaults.discreteCutoff as number;\n this._groupPadding = defaults.groupPadding as number;\n this._labelConnectorConfig = {\n strokeDasharray: \"1 1\",\n };\n this._labelPosition = constant(\"auto\");\n this._lineMarkerConfig = {\n fill: (d: DataPoint, i: number) => colorAssign(this._id(d, i)),\n r: constant(3),\n };\n this._lineMarkers = defaults.lineMarkers as boolean;\n this._previousAnnotations = {back: [], front: []};\n this._previousShapes = [];\n this.schema.shape = defaults.shape;\n this.schema.shapeConfig = assign(this.schema.shapeConfig, plotShapeDefaults.call(this as unknown as VizInstance));\n this._shapeOrder = [\"Area\", \"Path\", \"Bar\", \"Box\", \"Line\", \"Rect\", \"Circle\"];\n this.schema.shapeSort = (a: string, b: string) =>\n this._shapeOrder.indexOf(a) - this._shapeOrder.indexOf(b);\n this.schema.sizeMax = 20;\n this.schema.sizeMin = 5;\n this.schema.sizeScale = \"sqrt\";\n this._stackOffset = stackOffsetDiverging;\n this._stackOrder = stackOrderTotalDescending;\n this.schema.timelineConfig = assign(this.schema.timelineConfig, {\n brushMin: () =>\n this._xTime || this._yTime || this._x2Time || this._y2Time ? 2 : 1,\n });\n\n this._x = accessor(\"x\");\n this._xKey = \"x\";\n this._xAxis = new AxisBottom().align(\"end\");\n // _xTest/_yTest/_x2Test/_y2Test are NOT persistent fields anymore. The\n // measure-only test axes are allocated as locals inside `_draw` and\n // garbage-collected after each draw — proving Plot doesn't need to\n // own a long-lived Axis instance just for layout. See measureAxis()\n // in axisLayout.ts for the standalone shape.\n this._xConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"x\")\n return \"transparent\";\n const range = this._xAxis.range();\n const position = this._xAxis._getPosition.bind(this._xAxis)(d.id);\n if (range[0] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.xCutoff = 150;\n\n this._x2 = accessor(\"x2\");\n this._x2Key = \"x2\";\n this._x2Axis = new AxisTop().align(\"start\");\n this._x2Config = {};\n\n this._y = accessor(\"y\");\n this._yKey = \"y\";\n this._yAxis = new AxisLeft().align(\"start\");\n this._yKey = \"y\";\n this._yConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"y\")\n return \"transparent\";\n const range = this._yAxis.range();\n const position = this._yAxis._getPosition.bind(this._yAxis)(d.id);\n if (range[range.length - 1] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.yCutoff = 150;\n\n this._y2 = accessor(\"y2\");\n this._y2Key = \"y2\";\n this._y2Axis = new AxisRight().align(\"end\");\n this._y2Config = {};\n }\n\n /**\n Extends the preDraw behavior of the abstract Viz class.\n @private\n*/\n _preDraw() {\n // logic repeated for each axis\n [\"x\", \"y\", \"x2\", \"y2\"].forEach(k => {\n // if user has supplied a String key as the main method value\n if (this[`_${k}Key`]) {\n const str = this[`_${k}Key`];\n\n // if axis is discrete and numerical, do not sum values\n if (!this.schema.aggs[str] && this.schema.discrete === k) {\n this.schema.aggs[str] = (a: DataPoint[], c: (d: DataPoint) => unknown) => {\n const v = Array.from(new Set(a.map(c)));\n return v.length === 1 ? v[0] : v;\n };\n }\n\n // set axis title if not discrete\n if (\n str !== k &&\n this[`_${k}Title`] === this[`_${k}Config`].title &&\n this.schema.discrete !== k\n ) {\n this[`_${k}Title`] = str;\n this[`_${k}Config`].title = str;\n }\n }\n });\n\n super._preDraw();\n }\n\n /**\n Composes the chart's scene graph: the native shape scenes from Viz.toScene\n (bars/lines/areas + labels) plus snapshots of the rendered axes, so a Plot\n renders fully — geometry and axes — through the @d3plus/render backends.\n*/\n toScene(): Scene {\n const scene = (Viz.prototype.toScene as () => Scene).call(this);\n // Skip the axis walk when an explicit empty-data render just\n // happened. Axes are constructor-allocated and never reset between\n // renders, so a previous-render's axis._select.node() still exists\n // after `.data([]).render()` — emitting its toScene snapshot\n // would leak stale tick marks + grid lines under the no-data\n // overlay. We test `length === 0` explicitly so test fixtures that\n // construct viz without ever calling .render() (and leave\n // _filteredData undefined) don't trip the early-return.\n if (\n Array.isArray(this._filteredData) &&\n this._filteredData.length === 0 &&\n (!this._annotations || this._annotations.length === 0)\n )\n return scene;\n const axisNodes: SceneNode[] = [];\n for (const name of [\"_xAxis\", \"_x2Axis\", \"_yAxis\", \"_y2Axis\"]) {\n const axis = this[name];\n if (\n axis &&\n typeof axis.toScene === \"function\" &&\n axis._select &&\n typeof axis._select.node === \"function\" &&\n axis._select.node()\n ) {\n // Wrap in a uniquely-keyed group so sibling axes never collide (axis\n // snapshots reuse a per-call key counter).\n axisNodes.push({type: \"group\", key: `plot-${name}`, children: [axis.toScene()]});\n }\n }\n // Axes are drawn behind the shapes.\n scene.root.children.unshift(...axisNodes);\n return scene;\n }\n\n /**\n Wires user-registered `on()` event handlers onto a freshly-configured\n shape instance. Splits the registered events into three buckets:\n global (`\"click\"`), shape-scoped (`\"click.shape\"`), and\n shape-class-scoped (`\"click.Bar\"` etc.). All three forward into\n `this.schema.on[event](d.data, d.i, x, event)`. Extracted from\n Plot._paint so the chart-level event wiring is in one place.\n\n On the scene path (SvgRenderer/CanvasRenderer) these d3-selection\n bindings don't fire — compute-mode shapes mount no per-shape DOM.\n Pointer events are instead routed by `Viz._drawSceneToTarget`'s\n renderer bridge: it hit-tests via `Renderer.pick`, reads the picked\n node's stamped `shapeType`, and dispatches the matching global,\n `.shape`, and shape-class-scoped (`.Bar`) handlers — the same three\n buckets this method wires, so SVG and Canvas behave identically.\n */\n _wirePlotShapeEvents(\n shape: {on(event: string, handler: unknown): unknown},\n shapeKey: string,\n events: string[],\n ) {\n const classEvents = events.filter(e => e.includes(`.${shapeKey}`));\n const globalEvents = events.filter(e => !e.includes(\".\"));\n const shapeEvents = events.filter(e => e.includes(\".shape\"));\n const forward =\n (evt: string) =>\n (d: {data: DataPoint; i: number}, i: number, x: unknown, event: unknown) =>\n this.schema.on[evt](d.data, d.i, x, event);\n for (const evt of globalEvents) shape.on(evt, forward(evt));\n for (const evt of shapeEvents) shape.on(evt, forward(evt));\n for (const evt of classEvents) shape.on(evt, forward(evt));\n }\n\n /**\n For a multi-point shape (Line/Area) reports the point nearest the cursor\n along the discrete axis, so every mouse event (tooltip, click, user\n handlers) reflects the hovered x rather than the whole-series aggregate.\n Non-nested shapes and legend swatches fall through to the base (aggregate)\n behavior.\n @private\n*/\n _interactionDatum(\n pick: PickResult,\n event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const node = pick.node as SceneNode & {\n interactionPoints?: InteractionPoint[];\n interactionGroup?: string;\n };\n const points = node && node.interactionPoints;\n if (\n node &&\n node.interactionGroup !== \"legend\" &&\n Array.isArray(points) &&\n points.length &&\n event &&\n Array.isArray(event.point)\n ) {\n const nearest = this._nearestInteractionPoint(points, event.point);\n if (nearest) {\n const wrapped = nearest.datum as {data?: unknown; i?: number};\n return {\n d: wrapped && wrapped.data ? wrapped.data : wrapped,\n i: typeof wrapped.i === \"number\" ? wrapped.i : nearest.index,\n x: wrapped,\n };\n }\n }\n return super._interactionDatum(pick, event);\n }\n\n /**\n Picks the interaction point closest to a surface-local cursor position\n along the discrete axis. `event.point` is post-zoom surface space while the\n points are in chart content space (under the `viz-zoom` group and then\n the chart's own `viz-chart-body` transform), so the cursor is un-zoomed\n by `_zoomTransform` and offset by `_chartTransform` before comparing.\n @private\n*/\n _nearestInteractionPoint(\n points: InteractionPoint[],\n point: [number, number],\n ): InteractionPoint | null {\n const t = this._zoomTransform;\n const scale = t && t.scale ? t.scale : 1;\n const c = this._chartTransform;\n const cx = (point[0] - (t ? t.x : 0)) / scale - (c ? c.x : 0);\n const cy = (point[1] - (t ? t.y : 0)) / scale - (c ? c.y : 0);\n const axis = this.schema.discrete === \"y\" ? \"y\" : \"x\";\n const target = axis === \"y\" ? cy : cx;\n let best: InteractionPoint | null = null;\n let bestDist = Infinity;\n for (const p of points) {\n const dist = Math.abs(p[axis] - target);\n if (dist < bestDist) {\n bestDist = dist;\n best = p;\n }\n }\n return best;\n }\n\n /**\n Extends the draw behavior of the abstract Viz class.\n @private\n*/\n _draw(callback?: () => void) {\n return drawPlot(this as unknown as VizInstance, callback);\n }\n\n /**\n Paint phase: production axis rendering, shape buffer setup, and shape\n emission with event handlers. Receives all cross-phase locals from\n _draw via `pCtx` (so this method has zero coupling to _draw's local\n scope beyond the explicit context).\n */\n _paint(pCtx: PlotPaintContext) {\n // plotPaint builds the chart scene as a fresh array from the paint\n // context (data, scales, axis measurements) — emission is a pure\n // function of its inputs. `super._draw` resets `_chartScene` to []\n // before the paint phase, so the emit output IS the scene. Viz.toScene\n // wraps the collection in viz-chart-cells + zoom transform.\n const viz = this as unknown as VizInstance;\n const target = viz._zoomEventTarget || viz._container;\n this._chartScene = paintZoomablePlot(\n viz,\n pCtx,\n target && target.node() ? zoomTransform(target.node()) : undefined,\n );\n return this;\n }\n\n /**\n Zooms by rescaling the plot's linear axes instead of scaling the\n rendered picture (see `Plot/plotZoom.ts`). Returns false when no axis\n is linear, so the plot falls back to picture zoom.\n @private\n*/\n _zoomRescale(t: ZoomState, duration = 0): boolean {\n const nodes = zoomPlot(this as unknown as VizInstance, t, duration);\n if (!nodes) return false;\n this._chartScene = nodes;\n return true;\n }\n\n /**\n Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the \"shape\", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).\n\nAdditionally, each config object can also contain an optional \"layer\" key, which defines whether the annotations will be displayed in \"front\" or in \"back\" of the primary visualization shapes. This value defaults to \"back\" if not present.\n*/\n annotations(_?: unknown): this | unknown[] {\n return arguments.length\n ? ((this._annotations = _ instanceof Array ? _ : [_]), this)\n : this._annotations;\n }\n\n /**\n Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to `true` to make the axes stay consistent when the timeline changes).\n*/\n axisPersist(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._axisPersist = _), this)\n : this._axisPersist;\n }\n\n /**\n A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).\n*/\n backgroundConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._backgroundConfig = assign(this._backgroundConfig, _!)), this)\n : this._backgroundConfig;\n }\n\n /**\n Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).\n*/\n buffer(_?: boolean | Record<string, boolean>): this | Record<string, unknown> {\n if (arguments.length) {\n if (!_) this._buffer = {};\n else if (_ === true) this._buffer = defaultBuffers;\n else {\n this._buffer = assign({}, this._buffer, _);\n for (const key in this._buffer) {\n const buf = this._buffer as Record<string, unknown>;\n if (buf[key] === true) buf[key] = (defaultBuffers as Record<string, unknown>)[key];\n }\n }\n return this;\n }\n return this._buffer;\n }\n\n /**\n The confidence interval as an array of [lower, upper] bounds.\n\n@example <caption>Can be called with accessor functions or static keys:</caption>\n var data = {id: \"alpha\", value: 10, lci: 9, hci: 11};\n ...\n // Accessor functions\n .confidence([function(d) { return d.lci }, function(d) { return d.hci }])\n\n // Or static keys\n .confidence([\"lci\", \"hci\"])\n*/\n confidence(_?: unknown): this | [number, number] | false {\n if (arguments.length && _ instanceof Array) {\n this._confidence = [];\n const lower = _[0];\n this._confidence[0] =\n typeof lower === \"function\" || !lower ? lower : accessor(lower);\n const upper = _[1];\n this._confidence[1] =\n typeof upper === \"function\" || !upper ? upper : accessor(upper);\n\n return this;\n } else return this._confidence;\n }\n\n /**\n Configuration object for shapes rendered as confidence intervals.\n*/\n confidenceConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._confidenceConfig = assign(this._confidenceConfig, _!)), this)\n : this._confidenceConfig;\n }\n\n /**\n When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.\n*/\n discreteCutoff(_?: number): this | number {\n return arguments.length\n ? ((this._discreteCutoff = _), this)\n : this._discreteCutoff;\n }\n\n /**\n The pixel space between groups of bars.\n*/\n groupPadding(_?: number): this | number {\n return arguments.length\n ? ((this._groupPadding = _), this)\n : this._groupPadding;\n }\n\n /**\n The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.\n*/\n labelConnectorConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._labelConnectorConfig = assign(this._labelConnectorConfig, _!)),\n this)\n : this._labelConnectorConfig;\n }\n\n /**\n 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.\n*/\n labelPosition(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this._labelPosition = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this._labelPosition;\n }\n\n /**\n Shape config for the Circle shapes drawn by the lineMarkers method.\n*/\n lineMarkerConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._lineMarkerConfig = assign(this._lineMarkerConfig, _!)), this)\n : this._lineMarkerConfig;\n }\n\n /**\n Draws circle markers on each vertex of a Line.\n*/\n lineMarkers(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._lineMarkers = _), this)\n : this._lineMarkers;\n }\n\n /**\n Sets the size of bubbles to the given Number, data key, or function.\n*/\n size(_?: PlotAccessorArg | false): this | PlotAccessor {\n return arguments.length\n ? ((this._size = typeof _ === \"function\" || !_ ? _ : accessor(_ as string)), this)\n : this._size;\n }\n\n /**\n Sets the vertical offset applied to stacked series. Accepts a named\n offset — `\"diverging\"` (default), `\"none\"`, `\"expand\"`, `\"silhouette\"`,\n or `\"wiggle\"` — or a custom offset function. Unknown names warn and fall\n back to `\"diverging\"`. If *value* is not specified, returns the current\n stack offset function.\n*/\n stackOffset(_?: string | StackOffsetFn): this | StackOffsetFn {\n return arguments.length\n ? ((this._stackOffset = resolveStackOffset(_!)), this)\n : (this._stackOffset as StackOffsetFn);\n }\n\n /**\n Sets the order of stacked series, from the bottom of the stack upward.\n Accepts:\n - a named order: `\"descending\"` (default) / `\"ascending\"` by summed\n value, `\"key\"` / `\"keyReverse\"` alphabetically by series key,\n `\"none\"` / `\"data\"` for input order, or d3's `\"insideOut\"`,\n `\"appearance\"`, `\"reverse\"`;\n - an Array of series keys for an explicit order;\n - a value accessor, or a `{value, order}` config, to rank series by an\n aggregate of any data field.\n\n Unknown named strings warn and fall back to `\"descending\"`. If *value*\n is not specified, returns the current stack order.\n*/\n stackOrder(_?: StackOrderInput): this | StackOrderFn | string[] {\n return arguments.length\n ? ((this._stackOrder = resolveStackOrder(_!)), this)\n : (this._stackOrder as StackOrderFn | string[]);\n }\n\n /**\n Accessor function or string key for the x-axis value of each data point.\n*/\n x(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x = _;\n else {\n this._x = accessor(_ as string);\n this._xKey = _;\n }\n return this;\n } else return this._x;\n }\n\n /**\n Accessor function or string key for the secondary x-axis value of each data point.\n*/\n x2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x2 = _;\n else {\n this._x2 = accessor(_ as string);\n this._x2Key = _;\n }\n return this;\n } else return this._x2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n xConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._xConfig = assign(this._xConfig, _!)), this)\n : this._xConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n x2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._x2Config = assign(this._x2Config, _!)), this)\n : this._x2Config;\n }\n\n /**\n Accessor function or string key for the y-axis value of each data point.\n*/\n y(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y = _;\n else {\n this._y = accessor(_ as string);\n this._yKey = _;\n }\n return this;\n } else return this._y;\n }\n\n /**\n Accessor function or string key for the secondary y-axis value of each data point.\n*/\n y2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y2 = _;\n else {\n this._y2 = accessor(_ as string);\n this._y2Key = _;\n }\n return this;\n } else return this._y2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n\n*Note:* If a \"domain\" array is passed to the y-axis config, it will be reversed.\n*/\n yConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._yConfig = assign(this._yConfig, _!);\n return this;\n }\n return this._yConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n y2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._y2Config = assign(this._y2Config, _!);\n return this;\n }\n return this._y2Config;\n }\n\n}\n"],"names":["pkg","zoomTransform","theme","openColor","colorAssign","colorContrast","colorDefaults","assign","backgroundColor","AxisBottom","AxisLeft","AxisRight","AxisTop","accessor","constant","installFluent","plotSchema","key","coerce","plotDef","drawPlot","plotShapeDefaults","resolveStackOffset","resolveStackOrder","stackOffsetDiverging","stackOrderTotalDescending","paintZoomablePlot","zoomPlot","Viz","default","BarBuffer","BoxBuffer","CircleBuffer","LineBuffer","RectBuffer","defaultBuffers","Bar","Box","Circle","Line","Rect","Plot","defaults","_axisPersist","axisPersist","_annotations","annotations","_backgroundConfig","duration","fill","schema","barPadding","_buffer","_confidenceConfig","d","i","shapeConfig","stroke","s","undefined","fillOpacity","_discreteCutoff","discreteCutoff","_groupPadding","groupPadding","_labelConnectorConfig","strokeDasharray","_labelPosition","_lineMarkerConfig","_id","r","_lineMarkers","lineMarkers","_previousAnnotations","back","front","_previousShapes","shape","call","_shapeOrder","shapeSort","a","b","indexOf","sizeMax","sizeMin","sizeScale","_stackOffset","_stackOrder","timelineConfig","brushMin","_xTime","_yTime","_x2Time","_y2Time","_x","_xKey","_xAxis","align","_xConfig","gridConfig","discrete","charAt","range","position","_getPosition","bind","id","bg","_select","node","contrast","dark","colors","gray","xCutoff","_x2","_x2Key","_x2Axis","_x2Config","_y","_yKey","_yAxis","_yConfig","length","yCutoff","_y2","_y2Key","_y2Axis","_y2Config","_preDraw","forEach","k","str","aggs","c","v","Array","from","Set","map","title","toScene","scene","prototype","isArray","_filteredData","axisNodes","name","axis","push","type","children","root","unshift","_wirePlotShapeEvents","shapeKey","events","classEvents","filter","e","includes","globalEvents","shapeEvents","forward","evt","x","event","on","data","_interactionDatum","pick","points","interactionPoints","interactionGroup","point","nearest","_nearestInteractionPoint","wrapped","datum","index","t","_zoomTransform","scale","_chartTransform","cx","cy","y","target","best","bestDist","Infinity","p","dist","Math","abs","_draw","callback","_paint","pCtx","viz","_zoomEventTarget","_container","_chartScene","_zoomRescale","nodes","_","arguments","backgroundConfig","buffer","buf","confidence","_confidence","lower","upper","confidenceConfig","labelConnectorConfig","labelPosition","lineMarkerConfig","size","_size","stackOffset","stackOrder","x2","xConfig","x2Config","y2","yConfig","cfg","domain","slice","reverse","y2Config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA2B,GAE3B,aAAa;AACb,OAAOA,SAAS,2BAA2B;AAC3C,SAAQC,aAAa,QAAO,UAAU;AACtC,IAAOC,AAAOC,YAAaH,IAApBE;AAEP,SACEE,WAAW,EACXC,aAAa,EACbC,aAAa,QACR,gBAAgB;AACvB,SAAQC,MAAM,EAAEC,eAAe,QAAO,cAAc;AAEpD,SACEC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,OAAO,QACF,4BAA4B;AACnC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,uBAAuB;AACxD,SAAQC,aAAa,QAAO,kBAAkB;AAE9C,wEAAwE;AACxE,sEAAsE;AACtE,2EAA2E;AAC3E,wCAAwC;AACxC,IAAMC,aAAa;IACjB;QAACC,KAAK;QAAcC,QAAQ;IAAmB;IAC/C;QAACD,KAAK;QAAYC,QAAQ;IA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BxF;EAAab;AAHlC;;AAEA,GACA,SAAqBa,kBA8mBpB"}
1
+ {"version":3,"sources":["../../../../src/charts/Plot/index.ts"],"sourcesContent":["/* eslint no-cond-assign: 0*/\n\n// @ts-ignore\nimport pkg from \"open-color/open-color.js\";\nimport {zoomTransform} from \"d3-zoom\";\nconst {theme: openColor} = pkg;\n\nimport {\n colorAssign,\n colorContrast,\n} from \"@d3plus/color\";\nimport {assign, backgroundColor} from \"@d3plus/dom\";\n\nimport {\n AxisBottom,\n AxisLeft,\n AxisRight,\n AxisTop,\n} from \"../../components/index.js\";\nimport {accessor, constant} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\n\n// E4: Plot's identity-coerce accessor schema (18 keys). installFluent's\n// per-key idempotence lets this co-exist with vizSchema on the parent\n// Viz.prototype — installFluent walks the actual prototype (Plot.prototype\n// here) and skips keys already present.\nconst plotSchema = [\n {key: \"barPadding\", coerce: \"identity\" as const},\n {key: \"baseline\", coerce: \"identity\" as const},\n {key: \"lineLabels\", coerce: \"identity\" as const},\n {key: \"shapeSort\", coerce: \"identity\" as const},\n {key: \"sizeMax\", coerce: \"identity\" as const},\n {key: \"sizeMin\", coerce: \"identity\" as const},\n {key: \"sizeScale\", coerce: \"identity\" as const},\n {key: \"stacked\", coerce: \"identity\" as const},\n {key: \"tooltipShared\", coerce: \"identity\" as const},\n {key: \"xCutoff\", coerce: \"identity\" as const},\n {key: \"xDomain\", coerce: \"identity\" as const},\n {key: \"x2Domain\", coerce: \"identity\" as const},\n {key: \"xSort\", coerce: \"identity\" as const},\n {key: \"x2Sort\", coerce: \"identity\" as const},\n {key: \"yCutoff\", coerce: \"identity\" as const},\n {key: \"yDomain\", coerce: \"identity\" as const},\n {key: \"y2Domain\", coerce: \"identity\" as const},\n {key: \"ySort\", coerce: \"identity\" as const},\n {key: \"y2Sort\", coerce: \"identity\" as const},\n];\n\nimport {plotDef, plotSizeLegendScale} from \"./pipeline.js\";\nimport {drawPlot} from \"./draw.js\";\nimport {plotShapeDefaults} from \"./shapeDefaults.js\";\nimport {\n resolveStackOffset,\n resolveStackOrder,\n stackOffsetDiverging,\n stackOrderTotalDescending,\n type StackOffsetFn,\n type StackOrderFn,\n type StackOrderInput,\n} from \"./stackHelpers.js\";\nimport type {PlotPaintContext} from \"../features/plotPaint.js\";\nimport {paintZoomablePlot, zoomPlot, type ZoomState} from \"./plotZoom.js\";\nimport {trendLineDefaults, type TrendLineType} from \"./trendLines.js\";\nimport {contentPoint, handleSharedHover} from \"./sharedHover.js\";\nimport {appendSharedHoverNodes} from \"./sharedHoverScene.js\";\nimport Viz from \"../viz/Viz.js\";\n\nimport type {InteractionPoint, PickResult, Scene, SceneEvent, SceneNode} from \"@d3plus/render\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** Accessor function or string key for a plotted value. */\ntype PlotAccessor = (d: DataPoint, i: number) => number | Date | string;\n/** Function-or-string-key value accepted by accessor setters. */\ntype PlotAccessorArg = string | PlotAccessor;\n\nimport {default as BarBuffer} from \"../plotBuffers/Bar.js\";\nimport {default as BoxBuffer} from \"../plotBuffers/Box.js\";\nimport {default as CircleBuffer} from \"../plotBuffers/Circle.js\";\nimport {default as LineBuffer} from \"../plotBuffers/Line.js\";\nimport {default as RectBuffer} from \"../plotBuffers/Rect.js\";\nconst defaultBuffers = {\n Bar: BarBuffer,\n Box: BoxBuffer,\n Circle: CircleBuffer,\n Line: LineBuffer,\n Rect: RectBuffer,\n};\n\n/**\n Creates an x/y plot based on an array of data.\n*/\nexport default class Plot extends Viz {\n _trendLine: TrendLineType = plotDef.defaults!.trendLine as TrendLineType;\n _trendLineConfig: Record<string, unknown> = trendLineDefaults();\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n // E4: install identity-coerce accessors on Plot.prototype. Defaults\n // are still applied below imperatively from plotDef; installFluent\n // skips slots that are already set, so the constructor wins.\n installFluent(this, plotSchema);\n // E3: scalar defaults sourced from plotDef.\n const defaults = plotDef.defaults!;\n this._axisPersist = defaults.axisPersist as boolean;\n this._annotations = defaults.annotations as unknown[];\n this._backgroundConfig = {\n duration: 0,\n fill: \"transparent\",\n };\n this.schema.barPadding = defaults.barPadding as number;\n this._buffer = assign({}, defaultBuffers, {Bar: false, Line: false});\n this._confidenceConfig = {\n // A line's colour is its stroke, so the confidence band fills with that\n // same colour (at the reduced opacity below). Prefer a per-Line stroke\n // override, else the shared stroke accessor (the Line config itself sets\n // no `stroke` — the colour comes from the top-level `shapeConfig.stroke`).\n fill: (d: DataPoint, i: number) => {\n const {Line, stroke} = this.schema.shapeConfig;\n const s = Line && Line.stroke !== undefined ? Line.stroke : stroke;\n return typeof s === \"function\" ? s(d, i) : s;\n },\n fillOpacity: constant(0.5),\n };\n this._crosshairConfig = {\n stroke: openColor.colors.gray[500],\n strokeDasharray: \"4 3\",\n strokeWidth: 1,\n };\n this._discreteCutoff = defaults.discreteCutoff as number;\n this._groupPadding = defaults.groupPadding as number;\n this._labelConnectorConfig = {\n strokeDasharray: \"1 1\",\n };\n this._labelPosition = constant(\"auto\");\n this._lineMarkerConfig = {\n fill: (d: DataPoint, i: number) => colorAssign(this._id(d, i), this.schema.colorDefaults),\n r: constant(3),\n };\n this._lineMarkers = defaults.lineMarkers as boolean;\n this._previousAnnotations = {back: [], front: []};\n this._previousShapes = [];\n this.schema.shape = defaults.shape;\n this.schema.shapeConfig = assign(this.schema.shapeConfig, plotShapeDefaults.call(this as unknown as VizInstance));\n this._shapeOrder = [\"Area\", \"Path\", \"Bar\", \"Box\", \"Line\", \"Rect\", \"Circle\"];\n this.schema.shapeSort = (a: string, b: string) =>\n this._shapeOrder.indexOf(a) - this._shapeOrder.indexOf(b);\n this.schema.tooltipShared = defaults.tooltipShared as boolean;\n this.schema.sizeMax = 20;\n this.schema.sizeMin = 5;\n this.schema.sizeScale = \"sqrt\";\n this._stackOffset = stackOffsetDiverging;\n this._stackOrder = stackOrderTotalDescending;\n this.schema.timelineConfig = assign(this.schema.timelineConfig, {\n brushMin: () =>\n this._xTime || this._yTime || this._x2Time || this._y2Time ? 2 : 1,\n });\n\n this._x = accessor(\"x\");\n this._xKey = \"x\";\n this._xAxis = new AxisBottom().align(\"end\");\n // _xTest/_yTest/_x2Test/_y2Test are NOT persistent fields anymore. The\n // measure-only test axes are allocated as locals inside `_draw` and\n // garbage-collected after each draw — proving Plot doesn't need to\n // own a long-lived Axis instance just for layout. See measureAxis()\n // in axisLayout.ts for the standalone shape.\n this._xConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"x\")\n return \"transparent\";\n const range = this._xAxis.range();\n const position = this._xAxis._getPosition.bind(this._xAxis)(d.id);\n if (range[0] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg, this.schema.colorDefaults);\n return contrast === this.schema.colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.xCutoff = 150;\n\n this._x2 = accessor(\"x2\");\n this._x2Key = \"x2\";\n this._x2Axis = new AxisTop().align(\"start\");\n this._x2Config = {};\n\n this._y = accessor(\"y\");\n this._yKey = \"y\";\n this._yAxis = new AxisLeft().align(\"start\");\n this._yKey = \"y\";\n this._yConfig = {\n gridConfig: {\n stroke: (d: {id: string}) => {\n if (this.schema.discrete && this.schema.discrete.charAt(0) === \"y\")\n return \"transparent\";\n const range = this._yAxis.range();\n const position = this._yAxis._getPosition.bind(this._yAxis)(d.id);\n if (range[range.length - 1] === position) return \"transparent\";\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg, this.schema.colorDefaults);\n return contrast === this.schema.colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n },\n };\n this.schema.yCutoff = 150;\n\n this._y2 = accessor(\"y2\");\n this._y2Key = \"y2\";\n this._y2Axis = new AxisRight().align(\"end\");\n this._y2Config = {};\n }\n\n /**\n Extends the preDraw behavior of the abstract Viz class.\n @private\n*/\n _preDraw() {\n // logic repeated for each axis\n [\"x\", \"y\", \"x2\", \"y2\"].forEach(k => {\n // if user has supplied a String key as the main method value\n if (this[`_${k}Key`]) {\n const str = this[`_${k}Key`];\n\n // if axis is discrete and numerical, do not sum values\n if (!this.schema.aggs[str] && this.schema.discrete === k) {\n this.schema.aggs[str] = (a: DataPoint[], c: (d: DataPoint) => unknown) => {\n const v = Array.from(new Set(a.map(c)));\n return v.length === 1 ? v[0] : v;\n };\n }\n\n // set axis title if not discrete\n if (\n str !== k &&\n this[`_${k}Title`] === this[`_${k}Config`].title &&\n this.schema.discrete !== k\n ) {\n this[`_${k}Title`] = str;\n this[`_${k}Config`].title = str;\n }\n }\n });\n\n super._preDraw();\n }\n\n /**\n Composes the chart's scene graph: the native shape scenes from Viz.toScene\n (bars/lines/areas + labels) plus snapshots of the rendered axes, so a Plot\n renders fully — geometry and axes — through the @d3plus/render backends.\n*/\n toScene(): Scene {\n const scene = (Viz.prototype.toScene as () => Scene).call(this);\n // Skip the axis walk when an explicit empty-data render just\n // happened. Axes are constructor-allocated and never reset between\n // renders, so a previous-render's axis._select.node() still exists\n // after `.data([]).render()` — emitting its toScene snapshot\n // would leak stale tick marks + grid lines under the no-data\n // overlay. We test `length === 0` explicitly so test fixtures that\n // construct viz without ever calling .render() (and leave\n // _filteredData undefined) don't trip the early-return.\n if (\n Array.isArray(this._filteredData) &&\n this._filteredData.length === 0 &&\n (!this._annotations || this._annotations.length === 0)\n )\n return scene;\n const axisNodes: SceneNode[] = [];\n for (const name of [\"_xAxis\", \"_x2Axis\", \"_yAxis\", \"_y2Axis\"]) {\n const axis = this[name];\n if (\n axis &&\n typeof axis.toScene === \"function\" &&\n axis._select &&\n typeof axis._select.node === \"function\" &&\n axis._select.node()\n ) {\n // Wrap in a uniquely-keyed group so sibling axes never collide (axis\n // snapshots reuse a per-call key counter).\n axisNodes.push({type: \"group\", key: `plot-${name}`, children: [axis.toScene()]});\n }\n }\n // Axes are drawn behind the shapes.\n scene.root.children.unshift(...axisNodes);\n appendSharedHoverNodes(this as unknown as VizInstance, scene);\n return scene;\n }\n\n /**\n Wires user-registered `on()` event handlers onto a freshly-configured\n shape instance. Splits the registered events into three buckets:\n global (`\"click\"`), shape-scoped (`\"click.shape\"`), and\n shape-class-scoped (`\"click.Bar\"` etc.). All three forward into\n `this.schema.on[event](d.data, d.i, x, event)`. Extracted from\n Plot._paint so the chart-level event wiring is in one place.\n\n On the scene path (SvgRenderer/CanvasRenderer) these d3-selection\n bindings don't fire — compute-mode shapes mount no per-shape DOM.\n Pointer events are instead routed by `Viz._drawSceneToTarget`'s\n renderer bridge: it hit-tests via `Renderer.pick`, reads the picked\n node's stamped `shapeType`, and dispatches the matching global,\n `.shape`, and shape-class-scoped (`.Bar`) handlers — the same three\n buckets this method wires, so SVG and Canvas behave identically.\n */\n _wirePlotShapeEvents(\n shape: {on(event: string, handler: unknown): unknown},\n shapeKey: string,\n events: string[],\n ) {\n const classEvents = events.filter(e => e.includes(`.${shapeKey}`));\n const globalEvents = events.filter(e => !e.includes(\".\"));\n const shapeEvents = events.filter(e => e.includes(\".shape\"));\n const forward =\n (evt: string) =>\n (d: {data: DataPoint; i: number}, i: number, x: unknown, event: unknown) =>\n this.schema.on[evt](d.data, d.i, x, event);\n for (const evt of globalEvents) shape.on(evt, forward(evt));\n for (const evt of shapeEvents) shape.on(evt, forward(evt));\n for (const evt of classEvents) shape.on(evt, forward(evt));\n }\n\n /**\n For a multi-point shape (Line/Area) reports the point nearest the cursor\n along the discrete axis, so every mouse event (tooltip, click, user\n handlers) reflects the hovered x rather than the whole-series aggregate.\n Non-nested shapes and legend swatches fall through to the base (aggregate)\n behavior.\n @private\n*/\n _interactionDatum(\n pick: PickResult,\n event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const node = pick.node as SceneNode & {\n interactionPoints?: InteractionPoint[];\n interactionGroup?: string;\n };\n const points = node && node.interactionPoints;\n if (\n node &&\n node.interactionGroup !== \"legend\" &&\n Array.isArray(points) &&\n points.length &&\n event &&\n Array.isArray(event.point)\n ) {\n const nearest = this._nearestInteractionPoint(points, event.point);\n if (nearest) {\n const wrapped = nearest.datum as {data?: unknown; i?: number};\n return {\n d: wrapped && wrapped.data ? wrapped.data : wrapped,\n i: typeof wrapped.i === \"number\" ? wrapped.i : nearest.index,\n x: wrapped,\n };\n }\n }\n return super._interactionDatum(pick, event);\n }\n\n /**\n Picks the interaction point closest to a surface-local cursor position\n along the discrete axis. `event.point` is post-zoom surface space while the\n points are in chart content space (under the `viz-zoom` group and then\n the chart's own `viz-chart-body` transform), so the cursor is un-zoomed\n by `_zoomTransform` and offset by `_chartTransform` before comparing.\n @private\n*/\n _nearestInteractionPoint(\n points: InteractionPoint[],\n point: [number, number],\n ): InteractionPoint | null {\n const [cx, cy] = contentPoint(this as unknown as VizInstance, point);\n const axis = this.schema.discrete === \"y\" ? \"y\" : \"x\";\n const target = axis === \"y\" ? cy : cx;\n let best: InteractionPoint | null = null;\n let bestDist = Infinity;\n for (const p of points) {\n const dist = Math.abs(p[axis] - target);\n if (dist < bestDist) {\n bestDist = dist;\n best = p;\n }\n }\n return best;\n }\n\n /**\n Drives the shared multi-series tooltip + crosshair: while the pointer is\n inside the plot area, snaps to the nearest discrete position and, when\n two or more series share it, shows them all in one tooltip (suppressing\n the single-shape tooltip). Clears on leaving the plot area or the chart.\n @private\n*/\n _sharedHover(event: SceneEvent): void {\n handleSharedHover(this as unknown as VizInstance, event);\n }\n\n /**\n Extends the draw behavior of the abstract Viz class.\n @private\n*/\n _draw(callback?: () => void) {\n return drawPlot(this as unknown as VizInstance, callback);\n }\n\n /**\n The bubble radius scale, for the size legend (see `plotSizeLegendScale`).\n @private\n */\n _sizeLegendScale() {\n return plotSizeLegendScale(this as unknown as VizInstance);\n }\n\n /**\n Paint phase: production axis rendering, shape buffer setup, and shape\n emission with event handlers. Receives all cross-phase locals from\n _draw via `pCtx` (so this method has zero coupling to _draw's local\n scope beyond the explicit context).\n */\n _paint(pCtx: PlotPaintContext) {\n // plotPaint builds the chart scene as a fresh array from the paint\n // context (data, scales, axis measurements) — emission is a pure\n // function of its inputs. `super._draw` resets `_chartScene` to []\n // before the paint phase, so the emit output IS the scene. Viz.toScene\n // wraps the collection in viz-chart-cells + zoom transform.\n const viz = this as unknown as VizInstance;\n const target = viz._zoomEventTarget || viz._container;\n this._chartScene = paintZoomablePlot(\n viz,\n pCtx,\n target && target.node() ? zoomTransform(target.node()) : undefined,\n );\n return this;\n }\n\n /**\n Zooms by rescaling the plot's linear axes instead of scaling the\n rendered picture (see `Plot/plotZoom.ts`). Returns false when no axis\n is linear, so the plot falls back to picture zoom.\n @private\n*/\n _zoomRescale(t: ZoomState, duration = 0): boolean {\n const nodes = zoomPlot(this as unknown as VizInstance, t, duration);\n if (!nodes) return false;\n this._chartScene = nodes;\n return true;\n }\n\n /**\n Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the \"shape\", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).\n\nAdditionally, each config object can also contain an optional \"layer\" key, which defines whether the annotations will be displayed in \"front\" or in \"back\" of the primary visualization shapes. This value defaults to \"back\" if not present.\n*/\n annotations(_?: unknown): this | unknown[] {\n return arguments.length\n ? ((this._annotations = _ instanceof Array ? _ : [_]), this)\n : this._annotations;\n }\n\n /**\n Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to `true` to make the axes stay consistent when the timeline changes).\n*/\n axisPersist(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._axisPersist = _), this)\n : this._axisPersist;\n }\n\n /**\n A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).\n*/\n backgroundConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._backgroundConfig = assign(this._backgroundConfig, _!)), this)\n : this._backgroundConfig;\n }\n\n /**\n Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).\n*/\n buffer(_?: boolean | Record<string, boolean>): this | Record<string, unknown> {\n if (arguments.length) {\n if (!_) this._buffer = {};\n else if (_ === true) this._buffer = defaultBuffers;\n else {\n this._buffer = assign({}, this._buffer, _);\n for (const key in this._buffer) {\n const buf = this._buffer as Record<string, unknown>;\n if (buf[key] === true) buf[key] = (defaultBuffers as Record<string, unknown>)[key];\n }\n }\n return this;\n }\n return this._buffer;\n }\n\n /**\n The confidence interval as an array of [lower, upper] bounds.\n\n@example <caption>Can be called with accessor functions or static keys:</caption>\n var data = {id: \"alpha\", value: 10, lci: 9, hci: 11};\n ...\n // Accessor functions\n .confidence([function(d) { return d.lci }, function(d) { return d.hci }])\n\n // Or static keys\n .confidence([\"lci\", \"hci\"])\n*/\n confidence(_?: unknown): this | [number, number] | false {\n if (arguments.length && _ instanceof Array) {\n this._confidence = [];\n const lower = _[0];\n this._confidence[0] =\n typeof lower === \"function\" || !lower ? lower : accessor(lower);\n const upper = _[1];\n this._confidence[1] =\n typeof upper === \"function\" || !upper ? upper : accessor(upper);\n\n return this;\n } else return this._confidence;\n }\n\n /**\n Configuration object for shapes rendered as confidence intervals.\n*/\n confidenceConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._confidenceConfig = assign(this._confidenceConfig, _!)), this)\n : this._confidenceConfig;\n }\n\n /**\n When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.\n*/\n discreteCutoff(_?: number): this | number {\n return arguments.length\n ? ((this._discreteCutoff = _), this)\n : this._discreteCutoff;\n }\n\n /**\n The pixel space between groups of bars.\n*/\n groupPadding(_?: number): this | number {\n return arguments.length\n ? ((this._groupPadding = _), this)\n : this._groupPadding;\n }\n\n /**\n The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.\n*/\n labelConnectorConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._labelConnectorConfig = assign(this._labelConnectorConfig, _!)),\n this)\n : this._labelConnectorConfig;\n }\n\n /**\n 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.\n*/\n labelPosition(\n _?: string | ((d: DataPoint, i: number) => string),\n ): this | ((d: DataPoint, i: number) => string) {\n return arguments.length\n ? ((this._labelPosition = typeof _ === \"function\" ? _ : constant(_)),\n this)\n : this._labelPosition;\n }\n\n /**\n Paint for the shared tooltip's crosshair guide line (`stroke`,\n `strokeWidth`, `strokeDasharray`, `strokeOpacity`, …). Merged into the\n current config.\n*/\n crosshairConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._crosshairConfig = assign(this._crosshairConfig, _!)), this)\n : this._crosshairConfig;\n }\n\n /**\n 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.\n*/\n trendLine(_?: TrendLineType): this | TrendLineType {\n return arguments.length\n ? ((this._trendLine = _ as TrendLineType), this)\n : this._trendLine;\n }\n\n /**\n Options for the trend lines drawn by `trendLine`, merged into the current config:\n - `group`: `\"series\"` (default) fits one line per series, colored to match it; `\"all\"` fits a single line to every point.\n - `order`: the polynomial degree when `trendLine` is `\"polynomial\"` (default `2`).\n - `confidence`: draws a confidence band around a linear fit (default `false`).\n - `confidenceLevel`: the band's confidence level (default `0.95`).\n - `confidenceConfig`: Area shape config for the band (default `{fillOpacity: 0.15}`; fill defaults to the line color).\n - `tooltip`: shows the fitted equation and R² when hovering a line (default `true`).\n - Any other key (`stroke`, `strokeWidth`, `strokeDasharray`, …) styles the Line shape.\n\nStacked charts always fit one line to the stack totals.\n*/\n trendLineConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._trendLineConfig = assign(this._trendLineConfig, _!)), this)\n : this._trendLineConfig;\n }\n\n /**\n Shape config for the Circle shapes drawn by the lineMarkers method.\n*/\n lineMarkerConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._lineMarkerConfig = assign(this._lineMarkerConfig, _!)), this)\n : this._lineMarkerConfig;\n }\n\n /**\n Draws circle markers on each vertex of a Line.\n*/\n lineMarkers(_?: boolean): this | boolean {\n return arguments.length\n ? ((this._lineMarkers = _), this)\n : this._lineMarkers;\n }\n\n /**\n Sets the size of bubbles to the given Number, data key, or function.\n*/\n size(_?: PlotAccessorArg | false): this | PlotAccessor {\n if (!arguments.length) return this._size;\n this._size = typeof _ === \"function\" || !_ ? _ : accessor(_ as string);\n this._sizeKey = typeof _ === \"string\" ? _ : undefined;\n return this;\n }\n\n /**\n Sets the vertical offset applied to stacked series. Accepts a named\n offset — `\"diverging\"` (default), `\"none\"`, `\"expand\"`, `\"silhouette\"`,\n or `\"wiggle\"` — or a custom offset function. Unknown names warn and fall\n back to `\"diverging\"`. If *value* is not specified, returns the current\n stack offset function.\n*/\n stackOffset(_?: string | StackOffsetFn): this | StackOffsetFn {\n return arguments.length\n ? ((this._stackOffset = resolveStackOffset(_!)), this)\n : (this._stackOffset as StackOffsetFn);\n }\n\n /**\n Sets the order of stacked series, from the bottom of the stack upward.\n Accepts:\n - a named order: `\"descending\"` (default) / `\"ascending\"` by summed\n value, `\"key\"` / `\"keyReverse\"` alphabetically by series key,\n `\"none\"` / `\"data\"` for input order, or d3's `\"insideOut\"`,\n `\"appearance\"`, `\"reverse\"`;\n - an Array of series keys for an explicit order;\n - a value accessor, or a `{value, order}` config, to rank series by an\n aggregate of any data field.\n\n Unknown named strings warn and fall back to `\"descending\"`. If *value*\n is not specified, returns the current stack order.\n*/\n stackOrder(_?: StackOrderInput): this | StackOrderFn | string[] {\n return arguments.length\n ? ((this._stackOrder = resolveStackOrder(_!)), this)\n : (this._stackOrder as StackOrderFn | string[]);\n }\n\n /**\n Accessor function or string key for the x-axis value of each data point.\n*/\n x(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x = _;\n else {\n this._x = accessor(_ as string);\n this._xKey = _;\n }\n return this;\n } else return this._x;\n }\n\n /**\n Accessor function or string key for the secondary x-axis value of each data point.\n*/\n x2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._x2 = _;\n else {\n this._x2 = accessor(_ as string);\n this._x2Key = _;\n }\n return this;\n } else return this._x2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n xConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._xConfig = assign(this._xConfig, _!)), this)\n : this._xConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary x-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n x2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n return arguments.length\n ? ((this._x2Config = assign(this._x2Config, _!)), this)\n : this._x2Config;\n }\n\n /**\n Accessor function or string key for the y-axis value of each data point.\n*/\n y(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y = _;\n else {\n this._y = accessor(_ as string);\n this._yKey = _;\n }\n return this;\n } else return this._y;\n }\n\n /**\n Accessor function or string key for the secondary y-axis value of each data point.\n*/\n y2(_?: PlotAccessorArg): this | PlotAccessor {\n if (arguments.length) {\n if (typeof _ === \"function\") this._y2 = _;\n else {\n this._y2 = accessor(_ as string);\n this._y2Key = _;\n }\n return this;\n } else return this._y2;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n\n*Note:* If a \"domain\" array is passed to the y-axis config, it will be reversed.\n*/\n yConfig(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._yConfig = assign(this._yConfig, _!);\n return this;\n }\n return this._yConfig;\n }\n\n /**\n A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary y-axis. Includes additional functionality where passing \"auto\" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be \"linear\" or \"log\" based on the provided data.\n*/\n y2Config(_?: Record<string, unknown>): this | Record<string, unknown> {\n if (arguments.length) {\n const cfg = _ as {domain?: unknown[]};\n if (cfg.domain) cfg.domain = cfg.domain.slice().reverse();\n this._y2Config = assign(this._y2Config, _!);\n return this;\n }\n return this._y2Config;\n }\n\n}\n"],"names":["pkg","zoomTransform","theme","openColor","colorAssign","colorContrast","assign","backgroundColor","AxisBottom","AxisLeft","AxisRight","AxisTop","accessor","constant","installFluent","plotSchema","key","coerce","plotDef","plotSizeLegendScale","drawPlot","plotShapeDefaults","resolveStackOffset","resolveStackOrder","stackOffsetDiverging","stackOrderTotalDescending","paintZoomablePlot","zoomPlot","trendLineDefaults","contentPoint","handleSharedHover","appendSharedHoverNodes","Viz","default","BarBuffer","BoxBuffer","CircleBuffer","LineBuffer","RectBuffer","defaultBuffers","Bar","Box","Circle","Line","Rect","Plot","_trendLine","defaults","trendLine","_trendLineConfig","_axisPersist","axisPersist","_annotations","annotations","_backgroundConfig","duration","fill","schema","barPadding","_buffer","_confidenceConfig","d","i","shapeConfig","stroke","s","undefined","fillOpacity","_crosshairConfig","colors","gray","strokeDasharray","strokeWidth","_discreteCutoff","discreteCutoff","_groupPadding","groupPadding","_labelConnectorConfig","_labelPosition","_lineMarkerConfig","_id","colorDefaults","r","_lineMarkers","lineMarkers","_previousAnnotations","back","front","_previousShapes","shape","call","_shapeOrder","shapeSort","a","b","indexOf","tooltipShared","sizeMax","sizeMin","sizeScale","_stackOffset","_stackOrder","timelineConfig","brushMin","_xTime","_yTime","_x2Time","_y2Time","_x","_xKey","_xAxis","align","_xConfig","gridConfig","discrete","charAt","range","position","_getPosition","bind","id","bg","_select","node","contrast","dark","xCutoff","_x2","_x2Key","_x2Axis","_x2Config","_y","_yKey","_yAxis","_yConfig","length","yCutoff","_y2","_y2Key","_y2Axis","_y2Config","_preDraw","forEach","k","str","aggs","c","v","Array","from","Set","map","title","toScene","scene","prototype","isArray","_filteredData","axisNodes","name","axis","push","type","children","root","unshift","_wirePlotShapeEvents","shapeKey","events","classEvents","filter","e","includes","globalEvents","shapeEvents","forward","evt","x","event","on","data","_interactionDatum","pick","points","interactionPoints","interactionGroup","point","nearest","_nearestInteractionPoint","wrapped","datum","index","cx","cy","target","best","bestDist","Infinity","p","dist","Math","abs","_sharedHover","_draw","callback","_sizeLegendScale","_paint","pCtx","viz","_zoomEventTarget","_container","_chartScene","_zoomRescale","t","nodes","_","arguments","backgroundConfig","buffer","buf","confidence","_confidence","lower","upper","confidenceConfig","labelConnectorConfig","labelPosition","crosshairConfig","trendLineConfig","lineMarkerConfig","size","_size","_sizeKey","stackOffset","stackOrder","x2","xConfig","x2Config","y","y2","yConfig","cfg","domain","slice","reverse","y2Config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA2B,GAE3B,aAAa;AACb,OAAOA,SAAS,2BAA2B;AAC3C,SAAQC,aAAa,QAAO,UAAU;AACtC,IAAOC,AAAOC,YAAaH,IAApBE;AAEP,SACEE,WAAW,EACXC,aAAa,QACR,gBAAgB;AACvB,SAAQC,MAAM,EAAEC,eAAe,QAAO,cAAc;AAEpD,SACEC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,OAAO,QACF,4BAA4B;AACnC,SAAQC,QAAQ,EAAEC,QAAQ,QAAO,uBAAuB;AACxD,SAAQC,aAAa,QAAO,kBAAkB;AAE9C,wEAAwE;AACxE,sEAAsE;AACtE,2EAA2E;AAC3E,wCAAwC;AACxC,IAAMC,aAAa;IACjB;QAACC,KAAK;QAAcC,QAAQ;IAAmB;IAC/C;QAACD,KAAK;QAAYC,QAAQ;IAAmB;IAC7C;QAACD,KAAK;QAAcC,QAAQ;IAAmB;IAC/C;QAACD,KAAK;QAAaC,QAAQ;IAAmB;IAC9C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAaC,QAAQ;IAAmB;IAC9C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAiBC,QAAQ;IAAmB;IAClD;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK;QAAWC,QAAQ;IAAmB;IAC5C;QAACD,KAAK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IAAI;gBACb,OAAO,OAAO,IAAI,CAAC9E,GAAG;YACxB;;;YAEA;;;;AAIF,GACEuG,KAAAA;mBAAAA,SAAAA,QAAQzB,CAA2B;gBACjC,IAAIC,UAAUjF,MAAM,EAAE;oBACpB,IAAM0G,MAAM1B;oBACZ,IAAI0B,IAAIC,MAAM,EAAED,IAAIC,MAAM,GAAGD,IAAIC,MAAM,CAACC,KAAK,GAAGC,OAAO;oBACvD,IAAI,CAAC9G,QAAQ,GAAGhI,OAAO,IAAI,CAACgI,QAAQ,EAAEiF;oBACtC,OAAO,IAAI;gBACb;gBACA,OAAO,IAAI,CAACjF,QAAQ;YACtB;;;YAEA;;AAEF,GACE+G,KAAAA;mBAAAA,SAAAA,SAAS9B,CAA2B;gBAClC,IAAIC,UAAUjF,MAAM,EAAE;oBACpB,IAAM0G,MAAM1B;oBACZ,IAAI0B,IAAIC,MAAM,EAAED,IAAIC,MAAM,GAAGD,IAAIC,MAAM,CAACC,KAAK,GAAGC,OAAO;oBACvD,IAAI,CAACxG,SAAS,GAAGtI,OAAO,IAAI,CAACsI,SAAS,EAAE2E;oBACxC,OAAO,IAAI;gBACb;gBACA,OAAO,IAAI,CAAC3E,SAAS;YACvB;;;WA3qBmB/F;EAAab;AAHlC;;AAEA,GACA,SAAqBa,kBA6qBpB"}
@@ -111,6 +111,7 @@ import { merge as d3plusMerge, unique } from "@d3plus/data";
111
111
  import * as scales from "d3-scale";
112
112
  import { deviation, extent, groups, max, mean, min, range, rollups } from "d3-array";
113
113
  import discreteBufferFn from "../plotBuffers/discreteBuffer.js";
114
+ import { isSpanAxis, spanEdges } from "./discreteSpan.js";
114
115
  import constant from "../../utils/constant.js";
115
116
  import { shapeConfigFor } from "../features/emitHelpers.js";
116
117
  import { subtitleFeature, titleFeature, totalFeature } from "../features/features.js";
@@ -142,6 +143,36 @@ var defaultChartFeatures = [
142
143
  */ var isPlottableRow = function isPlottableRow(d) {
143
144
  return !isBadAxisValue(d.x) && !isBadAxisValue(d.y) && (d.x2 === undefined || !isBadAxisValue(d.x2)) && (d.y2 === undefined || !isBadAxisValue(d.y2));
144
145
  };
146
+ /**
147
+ The bubble radius scale: `sizeScale` over the extent of `sizes`, ranging
148
+ from `sizeMin` (capped at half of `sizeMax`) to `sizeMax`. A single-value
149
+ extent maps everything to `sizeMax`.
150
+ */ export function plotSizeScale(viz, sizes) {
151
+ var rExtent = extent(sizes);
152
+ return scaleConstructors["scale".concat(viz.schema.sizeScale.charAt(0).toUpperCase()).concat(viz.schema.sizeScale.slice(1))]().domain(rExtent).range([
153
+ rExtent[0] === rExtent[1] ? viz.schema.sizeMax : min([
154
+ viz.schema.sizeMax / 2,
155
+ viz.schema.sizeMin
156
+ ]),
157
+ viz.schema.sizeMax
158
+ ]);
159
+ }
160
+ /**
161
+ Plot's size-legend scale, available before layout: the same scale
162
+ `formatPlotData` builds, over the plottable rows. Null when there's no
163
+ `size` accessor or none of those rows draws as a circle.
164
+ */ export function plotSizeLegendScale(viz) {
165
+ if (!viz._size) return null;
166
+ var rows = viz._axisPersist ? viz._data : viz._filteredData || [];
167
+ var sizes = [];
168
+ var circles = false;
169
+ rows.forEach(function(d, i) {
170
+ if (isBadAxisValue(viz._x(d, i)) || isBadAxisValue(viz._y(d, i))) return;
171
+ sizes.push(viz._size(d, i));
172
+ if (viz.schema.shape(d, i) === "Circle") circles = true;
173
+ });
174
+ return circles ? plotSizeScale(viz, sizes) : null;
175
+ }
145
176
  /**
146
177
  `formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
147
178
  time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
@@ -156,6 +187,7 @@ var defaultChartFeatures = [
156
187
  */ export var formatPlotData = function formatPlotData(param) {
157
188
  var viz = param.viz;
158
189
  if (!viz._filteredData || !viz._filteredData.length) {
190
+ viz._sizeLegendFinal = null;
159
191
  return {
160
192
  plotFormattedData: [],
161
193
  plotAxisData: [],
@@ -193,22 +225,14 @@ var defaultChartFeatures = [
193
225
  };
194
226
  var formattedData = viz._formattedData = viz._filteredData.map(prepData).filter(isPlottableRow);
195
227
  var axisData = viz._axisPersist ? viz._data.map(prepData).filter(isPlottableRow) : formattedData;
196
- if (viz._size) {
197
- var rExtent = extent(axisData, function(d) {
198
- return viz._size(d.data);
199
- });
200
- viz._sizeScaleD3 = scaleConstructors["scale".concat(viz.schema.sizeScale.charAt(0).toUpperCase()).concat(viz.schema.sizeScale.slice(1))]().domain(rExtent).range([
201
- rExtent[0] === rExtent[1] ? viz.schema.sizeMax : min([
202
- viz.schema.sizeMax / 2,
203
- viz.schema.sizeMin
204
- ]),
205
- viz.schema.sizeMax
206
- ]);
207
- } else {
208
- viz._sizeScaleD3 = function() {
209
- return viz.schema.sizeMin;
210
- };
211
- }
228
+ viz._sizeScaleD3 = viz._size ? plotSizeScale(viz, axisData.map(function(d) {
229
+ return viz._size(d.data);
230
+ })) : function() {
231
+ return viz.schema.sizeMin;
232
+ };
233
+ viz._sizeLegendFinal = viz._size && axisData.some(function(d) {
234
+ return d.shape === "Circle";
235
+ }) ? viz._sizeScaleD3 : null;
212
236
  var x2Exists = axisData.some(function(d) {
213
237
  return d.x2 !== undefined;
214
238
  });
@@ -315,7 +339,7 @@ var defaultChartFeatures = [
315
339
  if ([
316
340
  "Bar",
317
341
  "Box"
318
- ].includes(key)) {
342
+ ].includes(key) && !viz._discreteExtent) {
319
343
  discreteBufferFn(viz.schema.discrete === "x" ? x : y, data, viz.schema.discrete);
320
344
  }
321
345
  if (viz._buffer[key]) {
@@ -393,7 +417,7 @@ var defaultChartFeatures = [
393
417
  var yC = {
394
418
  data: yData,
395
419
  locale: viz.schema.locale,
396
- rounding: viz.schema.yDomain ? "none" : "outside",
420
+ rounding: viz.schema.yDomain || isSpanAxis(viz, "y") ? "none" : "outside",
397
421
  scalePadding: y.padding ? y.padding() : 0
398
422
  };
399
423
  if (!showX && showY) {
@@ -431,6 +455,7 @@ var defaultChartFeatures = [
431
455
  return typeof d === "number" || d;
432
456
  }).map(String);
433
457
  var tickFor = function tickFor(axis, axisScale) {
458
+ if (isSpanAxis(viz, axis)) return spanEdges(viz, axisData);
434
459
  var ticks = unique(axisData.map(function(d) {
435
460
  return d[axis];
436
461
  }));
@@ -471,7 +496,7 @@ var defaultChartFeatures = [
471
496
  */ export var computePlotScales = function computePlotScales(param) {
472
497
  var viz = param.viz, plotFormattedData = param.plotFormattedData, plotAxisData = param.plotAxisData, plotInitialDomains = param.plotInitialDomains;
473
498
  var domainScaleSetup = function domainScaleSetup(axis) {
474
- var scale = viz["_".concat(axis, "Time")] ? "Time" : viz.schema.discrete === axis || viz.schema["".concat(axis, "Sort")] ? "Point" : "Linear";
499
+ var scale = viz["_".concat(axis, "Time")] ? "Time" : viz.schema.discrete === axis && !isSpanAxis(viz, axis) || viz.schema["".concat(axis, "Sort")] ? "Point" : "Linear";
475
500
  var domain = viz.schema["".concat(axis, "Domain")] ? viz.schema["".concat(axis, "Domain")].slice() : domains[axis], domain2 = viz.schema["".concat(axis, "2Domain")] ? viz.schema["".concat(axis, "2Domain")].slice() : domains["".concat(axis, "2")];
476
501
  if (scale !== "Point") {
477
502
  if (domain && domain[0] === void 0) domain[0] = domains[axis][0];
@@ -604,7 +629,9 @@ export var plotDef = {
604
629
  discreteCutoff: 100,
605
630
  groupPadding: 5,
606
631
  lineMarkers: false,
607
- shape: constant("Circle")
632
+ shape: constant("Circle"),
633
+ tooltipShared: true,
634
+ trendLine: false
608
635
  },
609
636
  features: defaultChartFeatures,
610
637
  // Plot._paint populates `viz._chartScene` from `plotPaint`; no emit step.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/Plot/pipeline.ts"],"sourcesContent":["/**\n Plot's chart-specific pipeline stages + the `plotDef` value.\n\n Each `formatPlotData` / `computePlotAxisValues` / `extendPlotOppScales`\n / `preparePlotAxisLayout` / `measurePlotLineLabels` /\n `computePlotInitialDomains` / `computePlotScales` is a pure-ish\n `TransformStage` that the Plot class threads through `runStages`. The\n `plotDef` at the bottom is the ChartDefinition value Plot's subclasses\n (BarChart / AreaPlot / LinePlot / etc.) inherit defaults + features\n from.\n*/\nimport {date} from \"@d3plus/dom\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {merge as d3plusMerge, unique} from \"@d3plus/data\";\nimport * as scales from \"d3-scale\";\nimport {deviation, extent, groups, max, mean, min, range, rollups} from \"d3-array\";\n\nimport discreteBufferFn from \"../plotBuffers/discreteBuffer.js\";\nimport constant from \"../../utils/constant.js\";\nimport type {ChartDefinition} from \"../definition/ChartDefinition.js\";\nimport {shapeConfigFor} from \"../features/emitHelpers.js\";\nimport {subtitleFeature, titleFeature, totalFeature} from \"../features/features.js\";\nimport type {TransformStage} from \"../pipeline/stages.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\n\n/** d3-scale's scale constructors, indexed by the dynamic `scale<Type>` name. */\nconst scaleConstructors = scales as unknown as Record<string, () => D3Scale>;\n\n/** A domain value for any of the four axes. */\ntype DomainValue = number | string | Date;\n\nexport {computePlotInitialDomains} from \"./pipelineDomains.js\";\nexport {measurePlotLineLabels} from \"./pipelineLineLabels.js\";\n\nconst defaultChartFeatures = [\n titleFeature,\n subtitleFeature,\n totalFeature,\n];\n\n/**\n A plotted axis value that can't be turned into a pixel coordinate: a\n non-finite number (`NaN`/`±Infinity`), `null`, or the empty-array sentinel\n `merge` yields when a numeric column aggregates to no usable value. Any of\n these poisons the shape's transform or path `d` downstream — e.g.\n `translate(NaN,…)` or `…L268.75,NaN` — which the browser rejects. A bare\n `undefined` is NOT bad: it's how an unused secondary axis (x2/y2) reports\n \"no value on this row\".\n*/\nconst isBadAxisValue = (v: unknown): boolean =>\n v === null ||\n (typeof v === \"number\" && !Number.isFinite(v)) ||\n (Array.isArray(v) && v.length === 0);\n\n/**\n A formatted row is plottable when its x/y — and any *defined* x2/y2 — are\n real coordinates. Rows failing this are dropped in `formatPlotData` before\n domains, stacking, and paint ever read `_formattedData`, so a NaN measure\n no longer widens a domain, stacks as 0, or emits a broken coordinate.\n Resolves d3plus/d3plus#776.\n*/\nconst isPlottableRow = (d: Record<string, unknown>): boolean =>\n !isBadAxisValue(d.x) &&\n !isBadAxisValue(d.y) &&\n (d.x2 === undefined || !isBadAxisValue(d.x2)) &&\n (d.y2 === undefined || !isBadAxisValue(d.y2));\n\n/**\n `formatPlotData` — first stage of Plot's chart-specific pipeline. Detects\n time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the\n filtered data through `prepData` to produce the per-row PlotDatum shape\n (x/y/x2/y2 + id + group + shape + lci/hci + discrete), drops rows whose\n axis values can't be plotted (`isPlottableRow` — see #776), and constructs\n the `_sizeScaleD3` if `_size` is set.\n\n Pure compute. Returns `{formattedData, axisData, x2Exists, y2Exists}`\n for downstream stages + the paint phase. Side-effects on viz: stores\n `_formattedData`, `_xTime`/`_x2Time`/`_yTime`/`_y2Time`, `_sizeScaleD3`.\n*/\nexport const formatPlotData: TransformStage = ({viz}) => {\n if (!viz._filteredData || !viz._filteredData.length) {\n return {plotFormattedData: [], plotAxisData: [], x2Exists: false, y2Exists: false};\n }\n\n const firstElemTime = viz.schema.time ? viz.schema.time(viz._filteredData[0], 0) : false;\n const x2Time = (viz._x2Time =\n firstElemTime && viz._x2(viz._filteredData[0], 0) === firstElemTime);\n const xTime = (viz._xTime =\n firstElemTime && viz._x(viz._filteredData[0], 0) === firstElemTime);\n const y2Time = (viz._y2Time =\n firstElemTime && viz._y2(viz._filteredData[0], 0) === firstElemTime);\n const yTime = (viz._yTime =\n firstElemTime && viz._y(viz._filteredData[0], 0) === firstElemTime);\n\n const timeAxis = xTime || x2Time || yTime || y2Time;\n\n const stackGroup = (d: DataPoint, i: number) =>\n `${!timeAxis && viz.schema.time ? viz.schema.time(d, i) : \"time\"}_${\n viz.schema.stacked\n ? `${\n viz.schema.groupBy.length > 1\n ? viz._ids(d, i).slice(0, -1).join(\"_\")\n : \"group\"\n }`\n : `${viz._ids(d, i).join(\"_\")}`\n }`;\n\n const prepData = (d: DataPoint, i: number) => {\n const newD: Record<string, unknown> = {\n __d3plus__: true,\n data: d,\n group: stackGroup(d, i),\n i,\n hci:\n viz._confidence && viz._confidence[1] && viz._confidence[1](d, i),\n id: viz._ids(d, i)\n .slice(0, viz._drawDepth + 1)\n .join(\"_\"),\n lci:\n viz._confidence && viz._confidence[0] && viz._confidence[0](d, i),\n shape: viz.schema.shape(d, i),\n x: xTime ? date(viz._x(d, i)) : viz._x(d, i),\n x2: x2Time ? date(viz._x2(d, i)) : viz._x2(d, i),\n y: yTime ? date(viz._y(d, i)) : viz._y(d, i),\n y2: y2Time ? date(viz._y2(d, i)) : viz._y2(d, i),\n };\n newD.discrete =\n newD.shape === \"Bar\"\n ? `${newD[viz.schema.discrete]}_${newD.group}`\n : `${newD[viz.schema.discrete]}`;\n newD.id =\n newD.shape === \"Bar\" ? `${newD.id}_${newD[viz.schema.discrete]}` : newD.id;\n return newD;\n };\n\n const formattedData = (viz._formattedData = viz._filteredData\n .map(prepData)\n .filter(isPlottableRow));\n const axisData = viz._axisPersist\n ? viz._data.map(prepData).filter(isPlottableRow)\n : formattedData;\n\n if (viz._size) {\n const rExtent = extent(axisData, (d: Record<string, unknown>) =>\n viz._size(d.data),\n );\n viz._sizeScaleD3 = scaleConstructors[\n `scale${viz.schema.sizeScale.charAt(0).toUpperCase()}${viz.schema.sizeScale.slice(1)}`\n ]()\n .domain(rExtent as unknown as [number, number])\n .range([\n rExtent[0] === rExtent[1]\n ? viz.schema.sizeMax\n : min([viz.schema.sizeMax / 2, viz.schema.sizeMin]),\n viz.schema.sizeMax,\n ]);\n } else {\n viz._sizeScaleD3 = () => viz.schema.sizeMin;\n }\n\n const x2Exists = axisData.some((d: Record<string, unknown>) => d.x2 !== undefined);\n const y2Exists = axisData.some((d: Record<string, unknown>) => d.y2 !== undefined);\n\n return {\n plotFormattedData: formattedData,\n plotAxisData: axisData,\n x2Exists,\n y2Exists,\n plotStackGroup: stackGroup,\n };\n};\n\n/**\n `computePlotAxisValues` — second stage of Plot's pipeline. Given the\n `plotFormattedData` + `plotAxisData` from `formatPlotData`, computes\n the per-axis values arrays (`xData`/`x2Data`/`yData`/`y2Data`) used by\n the domain/scale construction downstream.\n\n Takes the axis name + the two data sources + the viz state and returns\n the sorted/unique values for that axis.\n*/\nexport const computePlotAxisValues: TransformStage = ({viz, plotFormattedData, plotAxisData}) => {\n const data = plotFormattedData || [];\n const axisData = plotAxisData || [];\n\n function getAxisValues(axis: string) {\n const timeData = viz[`_${axis}Time`];\n const localData = timeData ? data : axisData;\n\n const filteredData = localData.filter(\n (d: Record<string, unknown>) => ![NaN, undefined, false].includes(d[axis] as never),\n );\n if (!filteredData.length) return [];\n\n const numericValue = typeof filteredData[0][axis] === \"number\";\n\n let myData =\n viz.schema.discrete === axis\n ? rollups(\n filteredData,\n (leaves: Record<string, unknown>[]) =>\n leaves.length === 1\n ? leaves[0].data\n : d3plusMerge(\n leaves.map((d: Record<string, unknown>) => d.data) as DataPoint[],\n viz.schema.aggs,\n ),\n (d: Record<string, unknown>) => d[axis],\n )\n .sort((a: [unknown, unknown], b: [unknown, unknown]) => {\n if (viz.schema[`${axis}Sort`])\n return viz.schema[`${axis}Sort`](a[1], b[1]);\n const aKey =\n timeData || numericValue\n ? parseFloat(a[0] as string)\n : (a[0] as number);\n const bKey =\n timeData || numericValue\n ? parseFloat(b[0] as string)\n : (b[0] as number);\n return aKey - bKey;\n })\n .map(([key]: [unknown, unknown]) =>\n timeData\n ? date(key as string | number)\n : numericValue\n ? parseFloat(key as string)\n : key,\n )\n : unique(\n filteredData\n .sort((a: Record<string, unknown>, b: Record<string, unknown>) =>\n viz.schema[`${axis}Sort`]\n ? viz.schema[`${axis}Sort`](a.data, b.data)\n : (a[axis] as number) - (b[axis] as number),\n )\n .map((d: Record<string, unknown>) => d[axis]),\n (d: unknown) => `${d}`,\n );\n\n if (viz.schema.discrete !== axis.charAt(0) && viz._confidence) {\n if (viz._confidence[0])\n myData = myData.concat(localData.map((d: Record<string, unknown>) => d.lci));\n if (viz._confidence[1])\n myData = myData.concat(localData.map((d: Record<string, unknown>) => d.hci));\n }\n\n return myData;\n }\n\n return {\n xData: getAxisValues(\"x\"),\n x2Data: getAxisValues(\"x2\"),\n yData: getAxisValues(\"y\"),\n y2Data: getAxisValues(\"y2\"),\n };\n};\n\n/**\n `extendPlotOppScales` — sixth stage. After `computePlotScales` returns the\n initial x/y/x2/y2 scales, the opposite-axis (non-discrete) scales need to\n be extended by each shape type's buffer function (Bar/Box/Circle/Line/\n etc. — `viz._buffer[key]`) to allocate room for the shapes' widths.\n\n Reads `viz._buffer[shapeKey]({data, x, y, yScale, xScale, config, x2?,\n y2?})` and chains the returned `[x, y]` (or `[x2, y2]`) back into the\n scales. Also calls `discreteBuffer` for Bar/Box to round the discrete\n scale to integer pixels.\n\n Returns the extended scales. Side-effect-free on viz (only on the scale\n instances, which are passed through the context).\n*/\nexport const extendPlotOppScales: TransformStage = ({viz, plotFormattedData, plotAxisData, plotScales, plotConfigScales}) => {\n const data = plotFormattedData || [];\n const axisData = plotAxisData || [];\n let {x, y, x2, y2} = plotScales!;\n const {xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale} = plotConfigScales!;\n const xScale = plotScales!.xScale, yScale = plotScales!.yScale;\n\n const oppScale = viz.schema.discrete === \"x\" ? yScale : xScale;\n if (oppScale !== \"Point\") {\n const allShapeData = groups(\n axisData,\n (d: Record<string, unknown>) => d.shape as string,\n );\n allShapeData.forEach(([key, values]) => {\n if ([\"Bar\", \"Box\"].includes(key)) {\n discreteBufferFn(viz.schema.discrete === \"x\" ? x : y, data, viz.schema.discrete);\n }\n if (viz._buffer[key]) {\n const res = viz._buffer[key].bind(viz)({\n data: values,\n x,\n y,\n yScale: yConfigScale,\n xScale: xConfigScale,\n config: viz.schema.shapeConfig[key],\n });\n x = res[0];\n y = res[1];\n const res2 = viz._buffer[key].bind(viz)({\n data: values,\n x: x2,\n y: y2,\n yScale: y2ConfigScale,\n xScale: x2ConfigScale,\n x2: true,\n y2: true,\n config: viz.schema.shapeConfig[key],\n });\n x2 = res2[0];\n y2 = res2[1];\n }\n });\n }\n\n return {plotScales: {...plotScales!, x, y, x2, y2}};\n};\n\n/**\n `preparePlotAxisLayout` — final pre-paint stage. Reads the constructed\n scales and computes the per-axis display config the four axis\n `.measure()` + `.render()` calls in Plot._draw need:\n - `defaultConfig`/`defaultX2Config`/`defaultY2Config`\n - `showX`/`showY` (cutoff predicates)\n - `yC` (base y-axis config, including no-x-axis layout adjustments)\n - `barLabels` (used to suppress redundant ticks)\n - `xTicks`/`yTicks`/`x2Ticks`/`y2Ticks` (null when ticks should display,\n empty array when ticks are redundant with bar labels)\n\n Pure compute. No DOM, no side effects on viz.\n*/\nexport const preparePlotAxisLayout: TransformStage = ({viz, plotAxisData, plotScales, x2Exists, y2Exists, x2Data, y2Data, yData}) => {\n const axisData = plotAxisData || [];\n const {x, y, x2, y2, xScale, yScale, x2Scale, y2Scale} = plotScales!;\n const xDomain = x.domain() as DomainValue[];\n const x2Domain = x2.domain() as DomainValue[];\n const yDomain = y.domain() as DomainValue[];\n const y2Domain = y2.domain() as DomainValue[];\n\n const defaultConfig = {\n barConfig: {\"stroke-width\": 0},\n gridSize: 0,\n labels: [],\n title: false,\n tickSize: 0,\n };\n const defaultX2Config = x2Exists ? {data: x2Data} : defaultConfig;\n const defaultY2Config = y2Exists ? {data: y2Data} : defaultConfig;\n const showX =\n viz.schema.discrete === \"x\"\n ? viz.schema.width > viz._discreteCutoff && viz.schema.width > viz.schema.xCutoff\n : viz.schema.width > viz.schema.xCutoff;\n const showY =\n viz.schema.discrete === \"y\"\n ? viz.schema.height > viz._discreteCutoff && viz.schema.height > viz.schema.yCutoff\n : viz.schema.height > viz.schema.yCutoff;\n\n const yC: Record<string, unknown> = {\n data: yData,\n locale: viz.schema.locale,\n rounding: viz.schema.yDomain ? \"none\" : \"outside\",\n scalePadding: y.padding ? y.padding() : 0,\n };\n if (!showX && showY) {\n yC.barConfig = {stroke: \"transparent\"};\n yC.tickSize = 0;\n yC.shapeConfig = {\n labelBounds: (d: {labelBounds: {width: number; y: number}}, i: number) => {\n const {width: w, y: yy} = d.labelBounds;\n const h = viz.schema.height / 2;\n const xx = i ? -h : 0;\n return {x: xx, y: yy, width: w, height: h};\n },\n labelConfig: {padding: 0, rotate: 0},\n labelRotation: false,\n };\n }\n\n // Bar labels — used to suppress redundant axis ticks.\n const barConfig = shapeConfigFor(viz, \"Bar\");\n const barLabelFunction =\n barConfig.label !== undefined\n ? typeof barConfig.label === \"function\"\n ? barConfig.label\n : (() => barConfig.label)\n : viz._drawLabel;\n const barLabels = axisData\n .map((d: Record<string, unknown>) => barLabelFunction(d.data, d.i))\n .filter((d: unknown) => typeof d === \"number\" || d)\n .map(String);\n\n const tickFor = (axis: string, axisScale: string) => {\n const ticks = unique(axisData.map((d: Record<string, unknown>) => d[axis]));\n return axisScale === \"Point\" && ticks.every(t => barLabels.includes(`${t}`))\n ? []\n : null;\n };\n\n return {\n plotDefaultConfig: defaultConfig,\n plotDefaultX2Config: defaultX2Config,\n plotDefaultY2Config: defaultY2Config,\n plotShowX: showX,\n plotShowY: showY,\n plotYC: yC,\n plotBarLabels: barLabels,\n plotXTicks: tickFor(\"x\", xScale),\n plotX2Ticks: tickFor(\"x2\", x2Scale),\n plotYTicks: tickFor(\"y\", yScale),\n plotY2Ticks: tickFor(\"y2\", y2Scale),\n plotXDomain: xDomain,\n plotX2Domain: x2Domain,\n plotYDomain: yDomain,\n plotY2Domain: y2Domain,\n };\n};\n\n/**\n `computePlotScales` — fourth stage of Plot's pipeline. Takes the per-axis\n values + the chart's raw `domains` object (computed by the inline\n stacking/non-stacking branch) and produces the four configured d3 scale\n instances (`x`/`x2`/`y`/`y2`), the resolved scale-type strings\n (`xConfigScale` etc., returned in `plotConfigScales`), and the final\n `domains` after log/baseline adjustments.\n\n The \"initial domains\" computation (stacked vs non-stacked branch that\n fills `domains.x`, `domains.y`, etc. from data) is inline in\n `Plot._draw` — extracting that requires untangling array sorts that\n mutate `axisData` in place, which is the natural next step.\n*/\nexport const computePlotScales: TransformStage = ({viz, plotFormattedData, plotAxisData, plotInitialDomains}) => {\n const data = plotFormattedData || [];\n const axisData = plotAxisData || [];\n let domains = plotInitialDomains as Record<string, DomainValue[]>;\n const width = viz.schema.width - viz._margin.left - viz._margin.right;\n const height = viz.schema.height - viz._margin.top - viz._margin.bottom;\n const opp = viz.schema.discrete ? (viz.schema.discrete === \"x\" ? \"y\" : \"x\") : undefined;\n const opp2 = viz.schema.discrete\n ? viz.schema.discrete === \"x\" ? \"y2\" : \"x2\"\n : undefined;\n const opps = [opp, opp2].filter(d => d) as string[];\n\n function domainScaleSetup(axis: string) {\n const scale = viz[`_${axis}Time`]\n ? \"Time\"\n : viz.schema.discrete === axis || viz.schema[`${axis}Sort`]\n ? \"Point\"\n : \"Linear\";\n const domain = viz.schema[`${axis}Domain`]\n ? viz.schema[`${axis}Domain`].slice()\n : domains[axis],\n domain2 = viz.schema[`${axis}2Domain`]\n ? viz.schema[`${axis}2Domain`].slice()\n : domains[`${axis}2`];\n if (scale !== \"Point\") {\n if (domain && domain[0] === void 0) domain[0] = domains[axis][0];\n if (domain && domain[1] === void 0) domain[1] = domains[axis][1];\n if (domain2 && domain2[0] === void 0)\n domain2[0] = domains[`${axis}2`][0];\n if (domain2 && domain2[1] === void 0)\n domain2[1] = domains[`${axis}2`][1];\n }\n return [domain, scale, domain2, scale] as const;\n }\n\n const [xAutoDomain, xScale, x2AutoDomain, x2Scale] = domainScaleSetup(\"x\");\n const [yAutoDomain, yScale, y2AutoDomain, y2Scale] = domainScaleSetup(\"y\");\n\n const autoScale = (axis: string, fallback: string) => {\n const userScale = viz[`_${axis}Config`].scale;\n if (userScale === \"auto\") {\n if (viz.schema.discrete === axis) return fallback;\n const values = axisData.map((d: Record<string, unknown>) => d[axis]) as number[];\n return deviation(values)! / mean(values)! > 3 ? \"log\" : \"linear\";\n }\n return userScale || fallback;\n };\n\n const yConfigScale = autoScale(\"y\", yScale).toLowerCase();\n const y2ConfigScale = autoScale(\"y2\", y2Scale).toLowerCase();\n const xConfigScale = autoScale(\"x\", xScale).toLowerCase();\n const x2ConfigScale = autoScale(\"x2\", x2Scale).toLowerCase();\n\n // `.slice()` the fallback so domains.x2 isn't ALIASED to domains.x\n // (and same for y2 ↔ y). Without the slice, later in this function\n // the baseline-extension loop does `domains[o][0] = b` — when `o`\n // is 'y2' aliased to y, that mutation hits domains.y too, silently\n // clobbering the y-axis bottom. Sibling of the d.reverse() fix.\n domains = {\n x: xAutoDomain,\n x2: x2AutoDomain || (xAutoDomain as unknown[]).slice(),\n y: yAutoDomain,\n y2: y2AutoDomain || (yAutoDomain as unknown[]).slice(),\n };\n Object.keys(domains).forEach(axis => {\n if (viz[`_${axis}ConfigScale`] === \"log\" && domains[axis].includes(0)) {\n if ((min(domains[axis] as number[]) as unknown as number) < 0)\n domains[axis][1] = max(\n data\n .map((d: Record<string, unknown>) => d[axis])\n .filter((d: unknown) => ![NaN, undefined, false].includes(d as never)) as number[],\n ) as number;\n else\n domains[axis][0] = min(\n axisData\n .map((d: Record<string, unknown>) => d[axis])\n .filter((d: unknown) => ![NaN, undefined, false].includes(d as never)) as number[],\n ) as number;\n }\n });\n\n opps.forEach(o => {\n if (viz[`_${o}Config`].domain) {\n // `.slice()` first so we never mutate the user's config array in\n // place — on the next render the (already-reversed) array would\n // reverse back, alternating chart correctness across renders.\n const d = (viz[`_${o}Config`].domain as DomainValue[]).slice();\n if (viz.schema.discrete === \"x\") d.reverse();\n domains[o] = d;\n } else if (o && viz.schema.baseline !== void 0) {\n const b = viz.schema.baseline;\n if (domains[o] && domains[o][0] > b) domains[o][0] = b;\n else if (domains[o] && domains[o][1] < b) domains[o][1] = b;\n }\n });\n\n const x = scaleConstructors[`scale${xScale}`]()\n .domain(domains.x)\n .range(range(0, width + 1, width / (domains.x.length - 1)));\n const x2 = scaleConstructors[`scale${x2Scale}`]()\n .domain(domains.x2)\n .range(range(0, width + 1, width / (domains.x2.length - 1)));\n // `.slice().reverse()` so the domain object isn't mutated under us if\n // it came from user config (covered by the slice above) OR from\n // domains.y being aliased into the user config via the slice above.\n const y = scaleConstructors[`scale${yScale}`]()\n .domain(domains.y.slice().reverse())\n .range(range(0, height + 1, height / (domains.y.length - 1)));\n const y2 = scaleConstructors[`scale${y2Scale}`]()\n .domain(domains.y2.slice().reverse())\n .range(range(0, height + 1, height / (domains.y2.length - 1)));\n\n return {\n plotDomains: domains,\n plotScales: {x, y, x2, y2, xScale, yScale, x2Scale, y2Scale},\n plotConfigScales: {xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale},\n plotOpps: {opp, opp2, opps},\n };\n};\n\nexport const plotDef: ChartDefinition = {\n name: \"Plot\",\n defaults: {\n annotations: [],\n axisPersist: false,\n barPadding: 0,\n discreteCutoff: 100,\n groupPadding: 5,\n lineMarkers: false,\n shape: constant(\"Circle\"),\n },\n features: defaultChartFeatures,\n // Plot._paint populates `viz._chartScene` from `plotPaint`; no emit step.\n paintDriven: true,\n};\n"],"names":["date","merge","d3plusMerge","unique","scales","deviation","extent","groups","max","mean","min","range","rollups","discreteBufferFn","constant","shapeConfigFor","subtitleFeature","titleFeature","totalFeature","scaleConstructors","computePlotInitialDomains","measurePlotLineLabels","defaultChartFeatures","isBadAxisValue","v","Number","isFinite","Array","isArray","length","isPlottableRow","d","x","y","x2","undefined","y2","formatPlotData","viz","_filteredData","plotFormattedData","plotAxisData","x2Exists","y2Exists","firstElemTime","schema","time","x2Time","_x2Time","_x2","xTime","_xTime","_x","y2Time","_y2Time","_y2","yTime","_yTime","_y","timeAxis","stackGroup","i","stacked","groupBy","_ids","slice","join","prepData","newD","__d3plus__","data","group","hci","_confidence","id","_drawDepth","lci","shape","discrete","formattedData","_formattedData","map","filter","axisData","_axisPersist","_data","_size","rExtent","_sizeScaleD3","sizeScale","charAt","toUpperCase","domain","sizeMax","sizeMin","some","plotStackGroup","computePlotAxisValues","getAxisValues","axis","timeData","localData","filteredData","NaN","includes","numericValue","myData","leaves","aggs","sort","a","b","aKey","parseFloat","bKey","key","concat","xData","x2Data","yData","y2Data","extendPlotOppScales","plotScales","plotConfigScales","xConfigScale","yConfigScale","x2ConfigScale","y2ConfigScale","xScale","yScale","oppScale","allShapeData","forEach","values","_buffer","res","bind","config","shapeConfig","res2","preparePlotAxisLayout","x2Scale","y2Scale","xDomain","x2Domain","yDomain","y2Domain","defaultConfig","barConfig","gridSize","labels","title","tickSize","defaultX2Config","defaultY2Config","showX","width","_discreteCutoff","xCutoff","showY","height","yCutoff","yC","locale","rounding","scalePadding","padding","stroke","labelBounds","w","yy","h","xx","labelConfig","rotate","labelRotation","barLabelFunction","label","_drawLabel","barLabels","String","tickFor","axisScale","ticks","every","t","plotDefaultConfig","plotDefaultX2Config","plotDefaultY2Config","plotShowX","plotShowY","plotYC","plotBarLabels","plotXTicks","plotX2Ticks","plotYTicks","plotY2Ticks","plotXDomain","plotX2Domain","plotYDomain","plotY2Domain","computePlotScales","plotInitialDomains","domainScaleSetup","scale","domains","domain2","_margin","left","right","top","bottom","opp","opp2","opps","xAutoDomain","x2AutoDomain","yAutoDomain","y2AutoDomain","autoScale","fallback","userScale","toLowerCase","Object","keys","o","reverse","baseline","plotDomains","plotOpps","plotDef","name","defaults","annotations","axisPersist","barPadding","discreteCutoff","groupPadding","lineMarkers","features","paintDriven"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA,GACA,SAAQA,IAAI,QAAO,cAAc;AAEjC,SAAQC,SAASC,WAAW,EAAEC,MAAM,QAAO,eAAe;AAC1D,YAAYC,YAAY,WAAW;AACnC,SAAQC,SAAS,EAAEC,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAEC,IAAI,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,QAAO,WAAW;AAEnF,OAAOC,sBAAsB,mCAAmC;AAChE,OAAOC,cAAc,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zN;IACV,0EAA0E;IAC1E0N,aAAa;AACf,EAAE"}
1
+ {"version":3,"sources":["../../../../src/charts/Plot/pipeline.ts"],"sourcesContent":["/**\n Plot's chart-specific pipeline stages + the `plotDef` value.\n\n Each `formatPlotData` / `computePlotAxisValues` / `extendPlotOppScales`\n / `preparePlotAxisLayout` / `measurePlotLineLabels` /\n `computePlotInitialDomains` / `computePlotScales` is a pure-ish\n `TransformStage` that the Plot class threads through `runStages`. The\n `plotDef` at the bottom is the ChartDefinition value Plot's subclasses\n (BarChart / AreaPlot / LinePlot / etc.) inherit defaults + features\n from.\n*/\nimport {date} from \"@d3plus/dom\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {merge as d3plusMerge, unique} from \"@d3plus/data\";\nimport * as scales from \"d3-scale\";\nimport {deviation, extent, groups, max, mean, min, range, rollups} from \"d3-array\";\n\nimport discreteBufferFn from \"../plotBuffers/discreteBuffer.js\";\nimport {isSpanAxis, spanEdges} from \"./discreteSpan.js\";\nimport constant from \"../../utils/constant.js\";\nimport type {ChartDefinition} from \"../definition/ChartDefinition.js\";\nimport {shapeConfigFor} from \"../features/emitHelpers.js\";\nimport {subtitleFeature, titleFeature, totalFeature} from \"../features/features.js\";\nimport type {TransformStage} from \"../pipeline/stages.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\nimport type {SizeLegendScale} from \"../../components/SizeLegend/sizeLegendLayout.js\";\n\n/** d3-scale's scale constructors, indexed by the dynamic `scale<Type>` name. */\nconst scaleConstructors = scales as unknown as Record<string, () => D3Scale>;\n\n/** A domain value for any of the four axes. */\ntype DomainValue = number | string | Date;\n\nexport {computePlotInitialDomains} from \"./pipelineDomains.js\";\nexport {measurePlotLineLabels} from \"./pipelineLineLabels.js\";\n\nconst defaultChartFeatures = [\n titleFeature,\n subtitleFeature,\n totalFeature,\n];\n\n/**\n A plotted axis value that can't be turned into a pixel coordinate: a\n non-finite number (`NaN`/`±Infinity`), `null`, or the empty-array sentinel\n `merge` yields when a numeric column aggregates to no usable value. Any of\n these poisons the shape's transform or path `d` downstream — e.g.\n `translate(NaN,…)` or `…L268.75,NaN` — which the browser rejects. A bare\n `undefined` is NOT bad: it's how an unused secondary axis (x2/y2) reports\n \"no value on this row\".\n*/\nconst isBadAxisValue = (v: unknown): boolean =>\n v === null ||\n (typeof v === \"number\" && !Number.isFinite(v)) ||\n (Array.isArray(v) && v.length === 0);\n\n/**\n A formatted row is plottable when its x/y — and any *defined* x2/y2 — are\n real coordinates. Rows failing this are dropped in `formatPlotData` before\n domains, stacking, and paint ever read `_formattedData`, so a NaN measure\n no longer widens a domain, stacks as 0, or emits a broken coordinate.\n Resolves d3plus/d3plus#776.\n*/\nconst isPlottableRow = (d: Record<string, unknown>): boolean =>\n !isBadAxisValue(d.x) &&\n !isBadAxisValue(d.y) &&\n (d.x2 === undefined || !isBadAxisValue(d.x2)) &&\n (d.y2 === undefined || !isBadAxisValue(d.y2));\n\n/**\n The bubble radius scale: `sizeScale` over the extent of `sizes`, ranging\n from `sizeMin` (capped at half of `sizeMax`) to `sizeMax`. A single-value\n extent maps everything to `sizeMax`.\n*/\nexport function plotSizeScale(viz: Parameters<TransformStage>[0][\"viz\"], sizes: number[]): D3Scale {\n const rExtent = extent(sizes);\n return scaleConstructors[\n `scale${viz.schema.sizeScale.charAt(0).toUpperCase()}${viz.schema.sizeScale.slice(1)}`\n ]()\n .domain(rExtent as unknown as [number, number])\n .range([\n rExtent[0] === rExtent[1]\n ? viz.schema.sizeMax\n : min([viz.schema.sizeMax / 2, viz.schema.sizeMin]),\n viz.schema.sizeMax,\n ]);\n}\n\n/**\n Plot's size-legend scale, available before layout: the same scale\n `formatPlotData` builds, over the plottable rows. Null when there's no\n `size` accessor or none of those rows draws as a circle.\n*/\nexport function plotSizeLegendScale(viz: Parameters<TransformStage>[0][\"viz\"]): SizeLegendScale | null {\n if (!viz._size) return null;\n const rows: DataPoint[] = viz._axisPersist ? viz._data : viz._filteredData || [];\n const sizes: number[] = [];\n let circles = false;\n rows.forEach((d, i) => {\n if (isBadAxisValue(viz._x!(d, i)) || isBadAxisValue(viz._y!(d, i))) return;\n sizes.push(viz._size!(d, i));\n if (viz.schema.shape(d, i) === \"Circle\") circles = true;\n });\n return circles ? (plotSizeScale(viz, sizes) as unknown as SizeLegendScale) : null;\n}\n\n/**\n `formatPlotData` — first stage of Plot's chart-specific pipeline. Detects\n time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the\n filtered data through `prepData` to produce the per-row PlotDatum shape\n (x/y/x2/y2 + id + group + shape + lci/hci + discrete), drops rows whose\n axis values can't be plotted (`isPlottableRow` — see #776), and constructs\n the `_sizeScaleD3` if `_size` is set.\n\n Pure compute. Returns `{formattedData, axisData, x2Exists, y2Exists}`\n for downstream stages + the paint phase. Side-effects on viz: stores\n `_formattedData`, `_xTime`/`_x2Time`/`_yTime`/`_y2Time`, `_sizeScaleD3`.\n*/\nexport const formatPlotData: TransformStage = ({viz}) => {\n if (!viz._filteredData || !viz._filteredData.length) {\n viz._sizeLegendFinal = null;\n return {plotFormattedData: [], plotAxisData: [], x2Exists: false, y2Exists: false};\n }\n\n const firstElemTime = viz.schema.time ? viz.schema.time(viz._filteredData[0], 0) : false;\n const x2Time = (viz._x2Time =\n firstElemTime && viz._x2(viz._filteredData[0], 0) === firstElemTime);\n const xTime = (viz._xTime =\n firstElemTime && viz._x(viz._filteredData[0], 0) === firstElemTime);\n const y2Time = (viz._y2Time =\n firstElemTime && viz._y2(viz._filteredData[0], 0) === firstElemTime);\n const yTime = (viz._yTime =\n firstElemTime && viz._y(viz._filteredData[0], 0) === firstElemTime);\n\n const timeAxis = xTime || x2Time || yTime || y2Time;\n\n const stackGroup = (d: DataPoint, i: number) =>\n `${!timeAxis && viz.schema.time ? viz.schema.time(d, i) : \"time\"}_${\n viz.schema.stacked\n ? `${\n viz.schema.groupBy.length > 1\n ? viz._ids(d, i).slice(0, -1).join(\"_\")\n : \"group\"\n }`\n : `${viz._ids(d, i).join(\"_\")}`\n }`;\n\n const prepData = (d: DataPoint, i: number) => {\n const newD: Record<string, unknown> = {\n __d3plus__: true,\n data: d,\n group: stackGroup(d, i),\n i,\n hci:\n viz._confidence && viz._confidence[1] && viz._confidence[1](d, i),\n id: viz._ids(d, i)\n .slice(0, viz._drawDepth + 1)\n .join(\"_\"),\n lci:\n viz._confidence && viz._confidence[0] && viz._confidence[0](d, i),\n shape: viz.schema.shape(d, i),\n x: xTime ? date(viz._x(d, i)) : viz._x(d, i),\n x2: x2Time ? date(viz._x2(d, i)) : viz._x2(d, i),\n y: yTime ? date(viz._y(d, i)) : viz._y(d, i),\n y2: y2Time ? date(viz._y2(d, i)) : viz._y2(d, i),\n };\n newD.discrete =\n newD.shape === \"Bar\"\n ? `${newD[viz.schema.discrete]}_${newD.group}`\n : `${newD[viz.schema.discrete]}`;\n newD.id =\n newD.shape === \"Bar\" ? `${newD.id}_${newD[viz.schema.discrete]}` : newD.id;\n return newD;\n };\n\n const formattedData = (viz._formattedData = viz._filteredData\n .map(prepData)\n .filter(isPlottableRow));\n const axisData = viz._axisPersist\n ? viz._data.map(prepData).filter(isPlottableRow)\n : formattedData;\n\n viz._sizeScaleD3 = viz._size\n ? plotSizeScale(viz, axisData.map((d: Record<string, unknown>) => viz._size!(d.data as DataPoint)))\n : () => viz.schema.sizeMin;\n viz._sizeLegendFinal = viz._size && axisData.some((d: Record<string, unknown>) => d.shape === \"Circle\")\n ? (viz._sizeScaleD3 as unknown as SizeLegendScale)\n : null;\n\n const x2Exists = axisData.some((d: Record<string, unknown>) => d.x2 !== undefined);\n const y2Exists = axisData.some((d: Record<string, unknown>) => d.y2 !== undefined);\n\n return {\n plotFormattedData: formattedData,\n plotAxisData: axisData,\n x2Exists,\n y2Exists,\n plotStackGroup: stackGroup,\n };\n};\n\n/**\n `computePlotAxisValues` — second stage of Plot's pipeline. Given the\n `plotFormattedData` + `plotAxisData` from `formatPlotData`, computes\n the per-axis values arrays (`xData`/`x2Data`/`yData`/`y2Data`) used by\n the domain/scale construction downstream.\n\n Takes the axis name + the two data sources + the viz state and returns\n the sorted/unique values for that axis.\n*/\nexport const computePlotAxisValues: TransformStage = ({viz, plotFormattedData, plotAxisData}) => {\n const data = plotFormattedData || [];\n const axisData = plotAxisData || [];\n\n function getAxisValues(axis: string) {\n const timeData = viz[`_${axis}Time`];\n const localData = timeData ? data : axisData;\n\n const filteredData = localData.filter(\n (d: Record<string, unknown>) => ![NaN, undefined, false].includes(d[axis] as never),\n );\n if (!filteredData.length) return [];\n\n const numericValue = typeof filteredData[0][axis] === \"number\";\n\n let myData =\n viz.schema.discrete === axis\n ? rollups(\n filteredData,\n (leaves: Record<string, unknown>[]) =>\n leaves.length === 1\n ? leaves[0].data\n : d3plusMerge(\n leaves.map((d: Record<string, unknown>) => d.data) as DataPoint[],\n viz.schema.aggs,\n ),\n (d: Record<string, unknown>) => d[axis],\n )\n .sort((a: [unknown, unknown], b: [unknown, unknown]) => {\n if (viz.schema[`${axis}Sort`])\n return viz.schema[`${axis}Sort`](a[1], b[1]);\n const aKey =\n timeData || numericValue\n ? parseFloat(a[0] as string)\n : (a[0] as number);\n const bKey =\n timeData || numericValue\n ? parseFloat(b[0] as string)\n : (b[0] as number);\n return aKey - bKey;\n })\n .map(([key]: [unknown, unknown]) =>\n timeData\n ? date(key as string | number)\n : numericValue\n ? parseFloat(key as string)\n : key,\n )\n : unique(\n filteredData\n .sort((a: Record<string, unknown>, b: Record<string, unknown>) =>\n viz.schema[`${axis}Sort`]\n ? viz.schema[`${axis}Sort`](a.data, b.data)\n : (a[axis] as number) - (b[axis] as number),\n )\n .map((d: Record<string, unknown>) => d[axis]),\n (d: unknown) => `${d}`,\n );\n\n if (viz.schema.discrete !== axis.charAt(0) && viz._confidence) {\n if (viz._confidence[0])\n myData = myData.concat(localData.map((d: Record<string, unknown>) => d.lci));\n if (viz._confidence[1])\n myData = myData.concat(localData.map((d: Record<string, unknown>) => d.hci));\n }\n\n return myData;\n }\n\n return {\n xData: getAxisValues(\"x\"),\n x2Data: getAxisValues(\"x2\"),\n yData: getAxisValues(\"y\"),\n y2Data: getAxisValues(\"y2\"),\n };\n};\n\n/**\n `extendPlotOppScales` — sixth stage. After `computePlotScales` returns the\n initial x/y/x2/y2 scales, the opposite-axis (non-discrete) scales need to\n be extended by each shape type's buffer function (Bar/Box/Circle/Line/\n etc. — `viz._buffer[key]`) to allocate room for the shapes' widths.\n\n Reads `viz._buffer[shapeKey]({data, x, y, yScale, xScale, config, x2?,\n y2?})` and chains the returned `[x, y]` (or `[x2, y2]`) back into the\n scales. Also calls `discreteBuffer` for Bar/Box to round the discrete\n scale to integer pixels.\n\n Returns the extended scales. Side-effect-free on viz (only on the scale\n instances, which are passed through the context).\n*/\nexport const extendPlotOppScales: TransformStage = ({viz, plotFormattedData, plotAxisData, plotScales, plotConfigScales}) => {\n const data = plotFormattedData || [];\n const axisData = plotAxisData || [];\n let {x, y, x2, y2} = plotScales!;\n const {xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale} = plotConfigScales!;\n const xScale = plotScales!.xScale, yScale = plotScales!.yScale;\n\n const oppScale = viz.schema.discrete === \"x\" ? yScale : xScale;\n if (oppScale !== \"Point\") {\n const allShapeData = groups(\n axisData,\n (d: Record<string, unknown>) => d.shape as string,\n );\n allShapeData.forEach(([key, values]) => {\n if ([\"Bar\", \"Box\"].includes(key) && !viz._discreteExtent) {\n discreteBufferFn(viz.schema.discrete === \"x\" ? x : y, data, viz.schema.discrete);\n }\n if (viz._buffer[key]) {\n const res = viz._buffer[key].bind(viz)({\n data: values,\n x,\n y,\n yScale: yConfigScale,\n xScale: xConfigScale,\n config: viz.schema.shapeConfig[key],\n });\n x = res[0];\n y = res[1];\n const res2 = viz._buffer[key].bind(viz)({\n data: values,\n x: x2,\n y: y2,\n yScale: y2ConfigScale,\n xScale: x2ConfigScale,\n x2: true,\n y2: true,\n config: viz.schema.shapeConfig[key],\n });\n x2 = res2[0];\n y2 = res2[1];\n }\n });\n }\n\n return {plotScales: {...plotScales!, x, y, x2, y2}};\n};\n\n/**\n `preparePlotAxisLayout` — final pre-paint stage. Reads the constructed\n scales and computes the per-axis display config the four axis\n `.measure()` + `.render()` calls in Plot._draw need:\n - `defaultConfig`/`defaultX2Config`/`defaultY2Config`\n - `showX`/`showY` (cutoff predicates)\n - `yC` (base y-axis config, including no-x-axis layout adjustments)\n - `barLabels` (used to suppress redundant ticks)\n - `xTicks`/`yTicks`/`x2Ticks`/`y2Ticks` (null when ticks should display,\n empty array when ticks are redundant with bar labels)\n\n Pure compute. No DOM, no side effects on viz.\n*/\nexport const preparePlotAxisLayout: TransformStage = ({viz, plotAxisData, plotScales, x2Exists, y2Exists, x2Data, y2Data, yData}) => {\n const axisData = plotAxisData || [];\n const {x, y, x2, y2, xScale, yScale, x2Scale, y2Scale} = plotScales!;\n const xDomain = x.domain() as DomainValue[];\n const x2Domain = x2.domain() as DomainValue[];\n const yDomain = y.domain() as DomainValue[];\n const y2Domain = y2.domain() as DomainValue[];\n\n const defaultConfig = {\n barConfig: {\"stroke-width\": 0},\n gridSize: 0,\n labels: [],\n title: false,\n tickSize: 0,\n };\n const defaultX2Config = x2Exists ? {data: x2Data} : defaultConfig;\n const defaultY2Config = y2Exists ? {data: y2Data} : defaultConfig;\n const showX =\n viz.schema.discrete === \"x\"\n ? viz.schema.width > viz._discreteCutoff && viz.schema.width > viz.schema.xCutoff\n : viz.schema.width > viz.schema.xCutoff;\n const showY =\n viz.schema.discrete === \"y\"\n ? viz.schema.height > viz._discreteCutoff && viz.schema.height > viz.schema.yCutoff\n : viz.schema.height > viz.schema.yCutoff;\n\n const yC: Record<string, unknown> = {\n data: yData,\n locale: viz.schema.locale,\n rounding: viz.schema.yDomain || isSpanAxis(viz, \"y\") ? \"none\" : \"outside\",\n scalePadding: y.padding ? y.padding() : 0,\n };\n if (!showX && showY) {\n yC.barConfig = {stroke: \"transparent\"};\n yC.tickSize = 0;\n yC.shapeConfig = {\n labelBounds: (d: {labelBounds: {width: number; y: number}}, i: number) => {\n const {width: w, y: yy} = d.labelBounds;\n const h = viz.schema.height / 2;\n const xx = i ? -h : 0;\n return {x: xx, y: yy, width: w, height: h};\n },\n labelConfig: {padding: 0, rotate: 0},\n labelRotation: false,\n };\n }\n\n // Bar labels — used to suppress redundant axis ticks.\n const barConfig = shapeConfigFor(viz, \"Bar\");\n const barLabelFunction =\n barConfig.label !== undefined\n ? typeof barConfig.label === \"function\"\n ? barConfig.label\n : (() => barConfig.label)\n : viz._drawLabel;\n const barLabels = axisData\n .map((d: Record<string, unknown>) => barLabelFunction(d.data, d.i))\n .filter((d: unknown) => typeof d === \"number\" || d)\n .map(String);\n\n const tickFor = (axis: string, axisScale: string) => {\n if (isSpanAxis(viz, axis)) return spanEdges(viz, axisData);\n const ticks = unique(axisData.map((d: Record<string, unknown>) => d[axis]));\n return axisScale === \"Point\" && ticks.every(t => barLabels.includes(`${t}`))\n ? []\n : null;\n };\n\n return {\n plotDefaultConfig: defaultConfig,\n plotDefaultX2Config: defaultX2Config,\n plotDefaultY2Config: defaultY2Config,\n plotShowX: showX,\n plotShowY: showY,\n plotYC: yC,\n plotBarLabels: barLabels,\n plotXTicks: tickFor(\"x\", xScale),\n plotX2Ticks: tickFor(\"x2\", x2Scale),\n plotYTicks: tickFor(\"y\", yScale),\n plotY2Ticks: tickFor(\"y2\", y2Scale),\n plotXDomain: xDomain,\n plotX2Domain: x2Domain,\n plotYDomain: yDomain,\n plotY2Domain: y2Domain,\n };\n};\n\n/**\n `computePlotScales` — fourth stage of Plot's pipeline. Takes the per-axis\n values + the chart's raw `domains` object (computed by the inline\n stacking/non-stacking branch) and produces the four configured d3 scale\n instances (`x`/`x2`/`y`/`y2`), the resolved scale-type strings\n (`xConfigScale` etc., returned in `plotConfigScales`), and the final\n `domains` after log/baseline adjustments.\n\n The \"initial domains\" computation (stacked vs non-stacked branch that\n fills `domains.x`, `domains.y`, etc. from data) is inline in\n `Plot._draw` — extracting that requires untangling array sorts that\n mutate `axisData` in place, which is the natural next step.\n*/\nexport const computePlotScales: TransformStage = ({viz, plotFormattedData, plotAxisData, plotInitialDomains}) => {\n const data = plotFormattedData || [];\n const axisData = plotAxisData || [];\n let domains = plotInitialDomains as Record<string, DomainValue[]>;\n const width = viz.schema.width - viz._margin.left - viz._margin.right;\n const height = viz.schema.height - viz._margin.top - viz._margin.bottom;\n const opp = viz.schema.discrete ? (viz.schema.discrete === \"x\" ? \"y\" : \"x\") : undefined;\n const opp2 = viz.schema.discrete\n ? viz.schema.discrete === \"x\" ? \"y2\" : \"x2\"\n : undefined;\n const opps = [opp, opp2].filter(d => d) as string[];\n\n function domainScaleSetup(axis: string) {\n const scale = viz[`_${axis}Time`]\n ? \"Time\"\n : (viz.schema.discrete === axis && !isSpanAxis(viz, axis)) || viz.schema[`${axis}Sort`]\n ? \"Point\"\n : \"Linear\";\n const domain = viz.schema[`${axis}Domain`]\n ? viz.schema[`${axis}Domain`].slice()\n : domains[axis],\n domain2 = viz.schema[`${axis}2Domain`]\n ? viz.schema[`${axis}2Domain`].slice()\n : domains[`${axis}2`];\n if (scale !== \"Point\") {\n if (domain && domain[0] === void 0) domain[0] = domains[axis][0];\n if (domain && domain[1] === void 0) domain[1] = domains[axis][1];\n if (domain2 && domain2[0] === void 0)\n domain2[0] = domains[`${axis}2`][0];\n if (domain2 && domain2[1] === void 0)\n domain2[1] = domains[`${axis}2`][1];\n }\n return [domain, scale, domain2, scale] as const;\n }\n\n const [xAutoDomain, xScale, x2AutoDomain, x2Scale] = domainScaleSetup(\"x\");\n const [yAutoDomain, yScale, y2AutoDomain, y2Scale] = domainScaleSetup(\"y\");\n\n const autoScale = (axis: string, fallback: string) => {\n const userScale = viz[`_${axis}Config`].scale;\n if (userScale === \"auto\") {\n if (viz.schema.discrete === axis) return fallback;\n const values = axisData.map((d: Record<string, unknown>) => d[axis]) as number[];\n return deviation(values)! / mean(values)! > 3 ? \"log\" : \"linear\";\n }\n return userScale || fallback;\n };\n\n const yConfigScale = autoScale(\"y\", yScale).toLowerCase();\n const y2ConfigScale = autoScale(\"y2\", y2Scale).toLowerCase();\n const xConfigScale = autoScale(\"x\", xScale).toLowerCase();\n const x2ConfigScale = autoScale(\"x2\", x2Scale).toLowerCase();\n\n // `.slice()` the fallback so domains.x2 isn't ALIASED to domains.x\n // (and same for y2 ↔ y). Without the slice, later in this function\n // the baseline-extension loop does `domains[o][0] = b` — when `o`\n // is 'y2' aliased to y, that mutation hits domains.y too, silently\n // clobbering the y-axis bottom. Sibling of the d.reverse() fix.\n domains = {\n x: xAutoDomain,\n x2: x2AutoDomain || (xAutoDomain as unknown[]).slice(),\n y: yAutoDomain,\n y2: y2AutoDomain || (yAutoDomain as unknown[]).slice(),\n };\n Object.keys(domains).forEach(axis => {\n if (viz[`_${axis}ConfigScale`] === \"log\" && domains[axis].includes(0)) {\n if ((min(domains[axis] as number[]) as unknown as number) < 0)\n domains[axis][1] = max(\n data\n .map((d: Record<string, unknown>) => d[axis])\n .filter((d: unknown) => ![NaN, undefined, false].includes(d as never)) as number[],\n ) as number;\n else\n domains[axis][0] = min(\n axisData\n .map((d: Record<string, unknown>) => d[axis])\n .filter((d: unknown) => ![NaN, undefined, false].includes(d as never)) as number[],\n ) as number;\n }\n });\n\n opps.forEach(o => {\n if (viz[`_${o}Config`].domain) {\n // `.slice()` first so we never mutate the user's config array in\n // place — on the next render the (already-reversed) array would\n // reverse back, alternating chart correctness across renders.\n const d = (viz[`_${o}Config`].domain as DomainValue[]).slice();\n if (viz.schema.discrete === \"x\") d.reverse();\n domains[o] = d;\n } else if (o && viz.schema.baseline !== void 0) {\n const b = viz.schema.baseline;\n if (domains[o] && domains[o][0] > b) domains[o][0] = b;\n else if (domains[o] && domains[o][1] < b) domains[o][1] = b;\n }\n });\n\n const x = scaleConstructors[`scale${xScale}`]()\n .domain(domains.x)\n .range(range(0, width + 1, width / (domains.x.length - 1)));\n const x2 = scaleConstructors[`scale${x2Scale}`]()\n .domain(domains.x2)\n .range(range(0, width + 1, width / (domains.x2.length - 1)));\n // `.slice().reverse()` so the domain object isn't mutated under us if\n // it came from user config (covered by the slice above) OR from\n // domains.y being aliased into the user config via the slice above.\n const y = scaleConstructors[`scale${yScale}`]()\n .domain(domains.y.slice().reverse())\n .range(range(0, height + 1, height / (domains.y.length - 1)));\n const y2 = scaleConstructors[`scale${y2Scale}`]()\n .domain(domains.y2.slice().reverse())\n .range(range(0, height + 1, height / (domains.y2.length - 1)));\n\n return {\n plotDomains: domains,\n plotScales: {x, y, x2, y2, xScale, yScale, x2Scale, y2Scale},\n plotConfigScales: {xConfigScale, yConfigScale, x2ConfigScale, y2ConfigScale},\n plotOpps: {opp, opp2, opps},\n };\n};\n\nexport const plotDef: ChartDefinition = {\n name: \"Plot\",\n defaults: {\n annotations: [],\n axisPersist: false,\n barPadding: 0,\n discreteCutoff: 100,\n groupPadding: 5,\n lineMarkers: false,\n shape: constant(\"Circle\"),\n tooltipShared: true,\n trendLine: false,\n },\n features: defaultChartFeatures,\n // Plot._paint populates `viz._chartScene` from `plotPaint`; no emit step.\n paintDriven: true,\n};\n"],"names":["date","merge","d3plusMerge","unique","scales","deviation","extent","groups","max","mean","min","range","rollups","discreteBufferFn","isSpanAxis","spanEdges","constant","shapeConfigFor","subtitleFeature","titleFeature","totalFeature","scaleConstructors","computePlotInitialDomains","measurePlotLineLabels","defaultChartFeatures","isBadAxisValue","v","Number","isFinite","Array","isArray","length","isPlottableRow","d","x","y","x2","undefined","y2","plotSizeScale","viz","sizes","rExtent","schema","sizeScale","charAt","toUpperCase","slice","domain","sizeMax","sizeMin","plotSizeLegendScale","_size","rows","_axisPersist","_data","_filteredData","circles","forEach","i","_x","_y","push","shape","formatPlotData","_sizeLegendFinal","plotFormattedData","plotAxisData","x2Exists","y2Exists","firstElemTime","time","x2Time","_x2Time","_x2","xTime","_xTime","y2Time","_y2Time","_y2","yTime","_yTime","timeAxis","stackGroup","stacked","groupBy","_ids","join","prepData","newD","__d3plus__","data","group","hci","_confidence","id","_drawDepth","lci","discrete","formattedData","_formattedData","map","filter","axisData","_sizeScaleD3","some","plotStackGroup","computePlotAxisValues","getAxisValues","axis","timeData","localData","filteredData","NaN","includes","numericValue","myData","leaves","aggs","sort","a","b","aKey","parseFloat","bKey","key","concat","xData","x2Data","yData","y2Data","extendPlotOppScales","plotScales","plotConfigScales","xConfigScale","yConfigScale","x2ConfigScale","y2ConfigScale","xScale","yScale","oppScale","allShapeData","values","_discreteExtent","_buffer","res","bind","config","shapeConfig","res2","preparePlotAxisLayout","x2Scale","y2Scale","xDomain","x2Domain","yDomain","y2Domain","defaultConfig","barConfig","gridSize","labels","title","tickSize","defaultX2Config","defaultY2Config","showX","width","_discreteCutoff","xCutoff","showY","height","yCutoff","yC","locale","rounding","scalePadding","padding","stroke","labelBounds","w","yy","h","xx","labelConfig","rotate","labelRotation","barLabelFunction","label","_drawLabel","barLabels","String","tickFor","axisScale","ticks","every","t","plotDefaultConfig","plotDefaultX2Config","plotDefaultY2Config","plotShowX","plotShowY","plotYC","plotBarLabels","plotXTicks","plotX2Ticks","plotYTicks","plotY2Ticks","plotXDomain","plotX2Domain","plotYDomain","plotY2Domain","computePlotScales","plotInitialDomains","domainScaleSetup","scale","domains","domain2","_margin","left","right","top","bottom","opp","opp2","opps","xAutoDomain","x2AutoDomain","yAutoDomain","y2AutoDomain","autoScale","fallback","userScale","toLowerCase","Object","keys","o","reverse","baseline","plotDomains","plotOpps","plotDef","name","defaults","annotations","axisPersist","barPadding","discreteCutoff","groupPadding","lineMarkers","tooltipShared","trendLine","features","paintDriven"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA,GACA,SAAQA,IAAI,QAAO,cAAc;AAEjC,SAAQC,SAASC,WAAW,EAAEC,MAAM,QAAO,eAAe;AAC1D,YAAYC,YAAY,WAAW;AACnC,SAAQC,SAAS,EAAEC,MAAM,EAAEC,MAAM,EAAEC,G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