@d3plus/core 3.1.6 → 4.1.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.
- package/README.md +9924 -78528
- package/es/index.js +8 -0
- package/es/index.js.map +1 -1
- package/es/internal.js +54 -0
- package/es/internal.js.map +1 -0
- package/es/src/charts/AreaPlot/index.js +36 -0
- package/es/src/charts/AreaPlot/index.js.map +1 -0
- package/es/src/charts/BarChart/index.js +48 -0
- package/es/src/charts/BarChart/index.js.map +1 -0
- package/es/src/charts/BoxWhisker/index.js +52 -0
- package/es/src/charts/BoxWhisker/index.js.map +1 -0
- package/es/src/charts/BumpChart/index.js +81 -0
- package/es/src/charts/BumpChart/index.js.map +1 -0
- package/es/src/charts/Donut/index.js +42 -0
- package/es/src/charts/Donut/index.js.map +1 -0
- package/es/src/charts/Geomap/applyLayout.js +208 -0
- package/es/src/charts/Geomap/applyLayout.js.map +1 -0
- package/es/src/charts/Geomap/emit.js +169 -0
- package/es/src/charts/Geomap/emit.js.map +1 -0
- package/es/src/charts/Geomap/index.js +521 -0
- package/es/src/charts/Geomap/index.js.map +1 -0
- package/es/src/charts/LinePlot/index.js +32 -0
- package/es/src/charts/LinePlot/index.js.map +1 -0
- package/es/src/charts/Matrix/applyLayout.js +92 -0
- package/es/src/charts/Matrix/applyLayout.js.map +1 -0
- package/es/src/charts/Matrix/emit.js +44 -0
- package/es/src/charts/Matrix/emit.js.map +1 -0
- package/es/src/charts/Matrix/index.js +154 -0
- package/es/src/charts/Matrix/index.js.map +1 -0
- package/es/src/charts/Network/applyLayout.js +322 -0
- package/es/src/charts/Network/applyLayout.js.map +1 -0
- package/es/src/charts/Network/emit.js +273 -0
- package/es/src/charts/Network/emit.js.map +1 -0
- package/es/src/charts/Network/index.js +422 -0
- package/es/src/charts/Network/index.js.map +1 -0
- package/es/src/charts/Pack/applyLayout.js +46 -0
- package/es/src/charts/Pack/applyLayout.js.map +1 -0
- package/es/src/charts/Pack/emit.js +116 -0
- package/es/src/charts/Pack/emit.js.map +1 -0
- package/es/src/charts/Pack/index.js +194 -0
- package/es/src/charts/Pack/index.js.map +1 -0
- package/es/src/charts/Pack/recursionCircles.js +18 -0
- package/es/src/charts/Pack/recursionCircles.js.map +1 -0
- package/es/src/charts/Pie/applyLayout.js +44 -0
- package/es/src/charts/Pie/applyLayout.js.map +1 -0
- package/es/src/charts/Pie/emit.js +111 -0
- package/es/src/charts/Pie/emit.js.map +1 -0
- package/es/src/charts/Pie/index.js +134 -0
- package/es/src/charts/Pie/index.js.map +1 -0
- package/es/src/charts/Plot/draw.js +424 -0
- package/es/src/charts/Plot/draw.js.map +1 -0
- package/es/src/charts/Plot/index.js +827 -0
- package/es/src/charts/Plot/index.js.map +1 -0
- package/es/src/charts/Plot/labelPlacement.js +36 -0
- package/es/src/charts/Plot/labelPlacement.js.map +1 -0
- package/es/src/charts/Plot/pipeline.js +594 -0
- package/es/src/charts/Plot/pipeline.js.map +1 -0
- package/es/src/charts/Plot/pipelineDomains.js +254 -0
- package/es/src/charts/Plot/pipelineDomains.js.map +1 -0
- package/es/src/charts/Plot/pipelineLineLabels.js +210 -0
- package/es/src/charts/Plot/pipelineLineLabels.js.map +1 -0
- package/es/src/charts/Plot/shapeDefaults.js +189 -0
- package/es/src/charts/Plot/shapeDefaults.js.map +1 -0
- package/es/src/charts/Plot/stackHelpers.js +52 -0
- package/es/src/charts/Plot/stackHelpers.js.map +1 -0
- package/es/src/charts/Priestley/applyLayout.js +121 -0
- package/es/src/charts/Priestley/applyLayout.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +129 -0
- package/es/src/charts/Priestley/emit.js.map +1 -0
- package/es/src/charts/Priestley/index.js +97 -0
- package/es/src/charts/Priestley/index.js.map +1 -0
- package/es/src/charts/Radar/applyLayout.js +326 -0
- package/es/src/charts/Radar/applyLayout.js.map +1 -0
- package/es/src/charts/Radar/emit.js +28 -0
- package/es/src/charts/Radar/emit.js.map +1 -0
- package/es/src/charts/Radar/index.js +98 -0
- package/es/src/charts/Radar/index.js.map +1 -0
- package/es/src/charts/RadialMatrix/applyLayout.js +132 -0
- package/es/src/charts/RadialMatrix/applyLayout.js.map +1 -0
- package/es/src/charts/RadialMatrix/emit.js +33 -0
- package/es/src/charts/RadialMatrix/emit.js.map +1 -0
- package/es/src/charts/RadialMatrix/index.js +144 -0
- package/es/src/charts/RadialMatrix/index.js.map +1 -0
- package/es/src/charts/Rings/applyLayout.js +508 -0
- package/es/src/charts/Rings/applyLayout.js.map +1 -0
- package/es/src/charts/Rings/emit.js +222 -0
- package/es/src/charts/Rings/emit.js.map +1 -0
- package/es/src/charts/Rings/index.js +245 -0
- package/es/src/charts/Rings/index.js.map +1 -0
- package/es/src/charts/Sankey/applyLayout.js +107 -0
- package/es/src/charts/Sankey/applyLayout.js.map +1 -0
- package/es/src/charts/Sankey/emit.js +134 -0
- package/es/src/charts/Sankey/emit.js.map +1 -0
- package/es/src/charts/Sankey/index.js +219 -0
- package/es/src/charts/Sankey/index.js.map +1 -0
- package/es/src/charts/StackedArea/index.js +27 -0
- package/es/src/charts/StackedArea/index.js.map +1 -0
- package/es/src/charts/Tree/applyLayout.js +233 -0
- package/es/src/charts/Tree/applyLayout.js.map +1 -0
- package/es/src/charts/Tree/emit.js +257 -0
- package/es/src/charts/Tree/emit.js.map +1 -0
- package/es/src/charts/Tree/index.js +105 -0
- package/es/src/charts/Tree/index.js.map +1 -0
- package/es/src/charts/Treemap/applyLayout.js +85 -0
- package/es/src/charts/Treemap/applyLayout.js.map +1 -0
- package/es/src/charts/Treemap/emit.js +141 -0
- package/es/src/charts/Treemap/emit.js.map +1 -0
- package/es/src/charts/Treemap/index.js +177 -0
- package/es/src/charts/Treemap/index.js.map +1 -0
- package/es/src/charts/Treemap/thresholdFunction.js +112 -0
- package/es/src/charts/Treemap/thresholdFunction.js.map +1 -0
- package/es/src/charts/definition/ChartDefinition.js +12 -0
- package/es/src/charts/definition/ChartDefinition.js.map +1 -0
- package/es/src/charts/definition/applyDefinition.js +107 -0
- package/es/src/charts/definition/applyDefinition.js.map +1 -0
- package/es/src/charts/definition/makeChart.js +153 -0
- package/es/src/charts/definition/makeChart.js.map +1 -0
- package/es/src/charts/drawSteps/zoomControls.js +231 -96
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/events/click.legend.js +2 -2
- package/es/src/charts/events/click.legend.js.map +1 -1
- package/es/src/charts/events/click.shape.js +5 -5
- package/es/src/charts/events/click.shape.js.map +1 -1
- package/es/src/charts/events/mouseenter.js +20 -1
- package/es/src/charts/events/mouseenter.js.map +1 -1
- package/es/src/charts/events/mouseleave.js +19 -4
- package/es/src/charts/events/mouseleave.js.map +1 -1
- package/es/src/charts/events/mousemove.legend.js +10 -10
- package/es/src/charts/events/mousemove.legend.js.map +1 -1
- package/es/src/charts/events/mousemove.shape.js +14 -8
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/events/touchstart.body.js.map +1 -1
- package/es/src/charts/features/axes.js +432 -0
- package/es/src/charts/features/axes.js.map +1 -0
- package/es/src/charts/features/chartGeometry.js +66 -0
- package/es/src/charts/features/chartGeometry.js.map +1 -0
- package/es/src/charts/features/colorScaleBucket.js +92 -0
- package/es/src/charts/features/colorScaleBucket.js.map +1 -0
- package/es/src/charts/features/emitHelpers.js +217 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -0
- package/es/src/charts/features/ensureZoomDom.js +71 -0
- package/es/src/charts/features/ensureZoomDom.js.map +1 -0
- package/es/src/charts/features/features.js +650 -0
- package/es/src/charts/features/features.js.map +1 -0
- package/es/src/charts/features/featuresLegend.js +180 -0
- package/es/src/charts/features/featuresLegend.js.map +1 -0
- package/es/src/charts/features/legendLabel.js +12 -0
- package/es/src/charts/features/legendLabel.js.map +1 -0
- package/es/src/charts/features/lineLabels.js +154 -0
- package/es/src/charts/features/lineLabels.js.map +1 -0
- package/es/src/charts/features/plotPaint.js +512 -0
- package/es/src/charts/features/plotPaint.js.map +1 -0
- package/es/src/charts/features/shapeEmit.js +273 -0
- package/es/src/charts/features/shapeEmit.js.map +1 -0
- package/es/src/charts/helpers/matrixData.js +3 -3
- package/es/src/charts/helpers/matrixData.js.map +1 -1
- package/es/src/charts/index.js +21 -21
- package/es/src/charts/index.js.map +1 -1
- package/es/src/charts/pipeline/resolveSpec.js +44 -0
- package/es/src/charts/pipeline/resolveSpec.js.map +1 -0
- package/es/src/charts/pipeline/runChartDraw.js +109 -0
- package/es/src/charts/pipeline/runChartDraw.js.map +1 -0
- package/es/src/charts/pipeline/runVizPipeline.js +84 -0
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -0
- package/es/src/charts/pipeline/stages.js +103 -0
- package/es/src/charts/pipeline/stages.js.map +1 -0
- package/es/src/charts/pipeline/vizContext.js +29 -0
- package/es/src/charts/pipeline/vizContext.js.map +1 -0
- package/es/src/charts/pipeline/vizDraw.js +37 -0
- package/es/src/charts/pipeline/vizDraw.js.map +1 -0
- package/es/src/charts/pipeline/vizDrawPure.js +174 -0
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -0
- package/es/src/charts/pipeline/vizPreDraw.js +145 -0
- package/es/src/charts/pipeline/vizPreDraw.js.map +1 -0
- package/es/src/charts/pipeline/vizPreDrawPure.js +279 -0
- package/es/src/charts/pipeline/vizPreDrawPure.js.map +1 -0
- package/es/src/charts/plotBuffers/Bar.js +4 -4
- package/es/src/charts/plotBuffers/Bar.js.map +1 -1
- package/es/src/charts/plotBuffers/Box.js +4 -4
- package/es/src/charts/plotBuffers/Box.js.map +1 -1
- package/es/src/charts/plotBuffers/Circle.js +2 -2
- package/es/src/charts/plotBuffers/Circle.js.map +1 -1
- package/es/src/charts/plotBuffers/Line.js +5 -5
- package/es/src/charts/plotBuffers/Line.js.map +1 -1
- package/es/src/charts/plotBuffers/Rect.js +2 -2
- package/es/src/charts/plotBuffers/Rect.js.map +1 -1
- package/es/src/charts/plotBuffers/discreteBuffer.js +1 -2
- package/es/src/charts/plotBuffers/discreteBuffer.js.map +1 -1
- package/es/src/charts/plotBuffers/numericBuffer.js +1 -2
- package/es/src/charts/plotBuffers/numericBuffer.js.map +1 -1
- package/es/src/charts/viz/Viz.js +985 -0
- package/es/src/charts/viz/Viz.js.map +1 -0
- package/es/src/charts/viz/VizBase.js +447 -0
- package/es/src/charts/viz/VizBase.js.map +1 -0
- package/es/src/charts/viz/VizBaseConfig.js +504 -0
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -0
- package/es/src/charts/viz/interactionOpacity.js +247 -0
- package/es/src/charts/viz/interactionOpacity.js.map +1 -0
- package/es/src/charts/viz/ordinalColor.js +71 -0
- package/es/src/charts/viz/ordinalColor.js.map +1 -0
- package/es/src/charts/viz/trailCatchup.js +127 -0
- package/es/src/charts/viz/trailCatchup.js.map +1 -0
- package/es/src/charts/viz/vizDefaults.js +602 -0
- package/es/src/charts/viz/vizDefaults.js.map +1 -0
- package/es/src/charts/viz/vizRender.js +251 -0
- package/es/src/charts/viz/vizRender.js.map +1 -0
- package/es/src/charts/viz/vizTypes.js +28 -0
- package/es/src/charts/viz/vizTypes.js.map +1 -0
- package/es/src/components/Axis/Axis.js +691 -0
- package/es/src/components/Axis/Axis.js.map +1 -0
- package/es/src/components/Axis/AxisBottom.js.map +1 -0
- package/es/src/components/Axis/AxisLeft.js.map +1 -0
- package/es/src/components/Axis/AxisRight.js.map +1 -0
- package/es/src/components/Axis/AxisTop.js.map +1 -0
- package/es/src/components/Axis/axisLayout.js +208 -0
- package/es/src/components/Axis/axisLayout.js.map +1 -0
- package/es/src/components/Axis/axisLayoutLabels.js +177 -0
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -0
- package/es/src/components/Axis/axisLayoutScale.js +374 -0
- package/es/src/components/Axis/axisLayoutScale.js.map +1 -0
- package/es/src/components/Axis/axisRender.js +535 -0
- package/es/src/components/Axis/axisRender.js.map +1 -0
- package/es/src/components/ColorScale/ColorScale.js +506 -0
- package/es/src/components/ColorScale/ColorScale.js.map +1 -0
- package/es/src/components/ColorScale/colorScaleRender.js +277 -0
- package/es/src/components/ColorScale/colorScaleRender.js.map +1 -0
- package/es/src/components/ColorScale/colorScaleScale.js +274 -0
- package/es/src/components/ColorScale/colorScaleScale.js.map +1 -0
- package/es/src/components/Legend/Legend.js +445 -0
- package/es/src/components/Legend/Legend.js.map +1 -0
- package/es/src/components/Legend/legendConfig.js +87 -0
- package/es/src/components/Legend/legendConfig.js.map +1 -0
- package/es/src/components/Legend/legendRender.js +245 -0
- package/es/src/components/Legend/legendRender.js.map +1 -0
- package/es/src/components/Message.js.map +1 -1
- package/es/src/components/TextBox.js +655 -453
- package/es/src/components/TextBox.js.map +1 -1
- package/es/src/components/Timeline/Timeline.js +674 -0
- package/es/src/components/Timeline/Timeline.js.map +1 -0
- package/es/src/components/Timeline/timelineConfig.js +115 -0
- package/es/src/components/Timeline/timelineConfig.js.map +1 -0
- package/es/src/components/Timeline/timelineRender.js +267 -0
- package/es/src/components/Timeline/timelineRender.js.map +1 -0
- package/es/src/components/Tooltip.js +288 -249
- package/es/src/components/Tooltip.js.map +1 -1
- package/es/src/components/index.js +8 -8
- package/es/src/components/index.js.map +1 -1
- package/es/src/fluent.js +265 -0
- package/es/src/fluent.js.map +1 -0
- package/es/src/shapes/Area.js +96 -114
- package/es/src/shapes/Area.js.map +1 -1
- package/es/src/shapes/Bar.js +71 -86
- package/es/src/shapes/Bar.js.map +1 -1
- package/es/src/shapes/Box.js +295 -190
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Circle.js +84 -35
- package/es/src/shapes/Circle.js.map +1 -1
- package/es/src/shapes/Image.js +164 -85
- package/es/src/shapes/Image.js.map +1 -1
- package/es/src/shapes/Line.js +51 -94
- package/es/src/shapes/Line.js.map +1 -1
- package/es/src/shapes/Path.js +33 -41
- package/es/src/shapes/Path.js.map +1 -1
- package/es/src/shapes/Rect.js +86 -37
- package/es/src/shapes/Rect.js.map +1 -1
- package/es/src/shapes/Shape.js +655 -678
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +156 -61
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/buildLabelData.js +125 -0
- package/es/src/shapes/buildLabelData.js.map +1 -0
- package/es/src/shapes/emitLabels.js +84 -0
- package/es/src/shapes/emitLabels.js.map +1 -0
- package/es/src/shapes/hitAreaNode.js +37 -0
- package/es/src/shapes/hitAreaNode.js.map +1 -0
- package/es/src/shapes/sceneSort.js +57 -0
- package/es/src/shapes/sceneSort.js.map +1 -0
- package/es/src/shapes/shapeConfig.js +31 -0
- package/es/src/shapes/shapeConfig.js.map +1 -0
- package/es/src/utils/BaseClass.js +35 -19
- package/es/src/utils/BaseClass.js.map +1 -1
- package/es/src/utils/D3Scale.js +16 -0
- package/es/src/utils/D3Scale.js.map +1 -0
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/es/src/utils/configPrep.js +8 -3
- package/es/src/utils/configPrep.js.map +1 -1
- package/es/src/utils/getProp.js +1 -1
- package/es/src/utils/getProp.js.map +1 -1
- package/es/src/utils/index.js +1 -0
- package/es/src/utils/index.js.map +1 -1
- package/es/src/utils/paintComponentScene.js +59 -0
- package/es/src/utils/paintComponentScene.js.map +1 -0
- package/es/umd-entry.js +16 -0
- package/es/umd-entry.js.map +1 -0
- package/package.json +15 -10
- package/types/index.d.ts +3 -1
- package/types/internal.d.ts +54 -0
- package/types/src/charts/AreaPlot/index.d.ts +10 -0
- package/types/src/charts/BarChart/index.d.ts +10 -0
- package/types/src/charts/BoxWhisker/index.d.ts +11 -0
- package/types/src/charts/BumpChart/index.d.ts +11 -0
- package/types/src/charts/ChartDefinition.d.ts +75 -0
- package/types/src/charts/Donut/index.d.ts +13 -0
- package/types/src/charts/Geomap/applyLayout.d.ts +7 -0
- package/types/src/charts/Geomap/emit.d.ts +7 -0
- package/types/src/charts/Geomap/index.d.ts +14 -0
- package/types/src/charts/Geomap.d.ts +6 -0
- package/types/src/charts/LinePlot/index.d.ts +10 -0
- package/types/src/charts/Matrix/applyLayout.d.ts +9 -0
- package/types/src/charts/Matrix/emit.d.ts +6 -0
- package/types/src/charts/Matrix/index.d.ts +14 -0
- package/types/src/charts/Matrix.d.ts +0 -26
- package/types/src/charts/Network/applyLayout.d.ts +10 -0
- package/types/src/charts/Network/emit.d.ts +6 -0
- package/types/src/charts/Network/index.d.ts +7 -0
- package/types/src/charts/Network.d.ts +0 -24
- package/types/src/charts/Pack/applyLayout.d.ts +16 -0
- package/types/src/charts/Pack/emit.d.ts +6 -0
- package/types/src/charts/Pack/index.d.ts +15 -0
- package/types/src/charts/Pack/recursionCircles.d.ts +7 -0
- package/types/src/charts/Pack.d.ts +0 -13
- package/types/src/charts/Pie/applyLayout.d.ts +8 -0
- package/types/src/charts/Pie/emit.d.ts +5 -0
- package/types/src/charts/Pie/index.d.ts +14 -0
- package/types/src/charts/Pie.d.ts +0 -27
- package/types/src/charts/Plot/draw.d.ts +2 -0
- package/types/src/charts/Plot/index.d.ts +167 -0
- package/types/src/charts/Plot/labelPlacement.d.ts +15 -0
- package/types/src/charts/Plot/pipeline.d.ts +70 -0
- package/types/src/charts/Plot/pipelineDomains.d.ts +2 -0
- package/types/src/charts/Plot/pipelineLineLabels.d.ts +2 -0
- package/types/src/charts/Plot/shapeDefaults.d.ts +64 -0
- package/types/src/charts/Plot/stackHelpers.d.ts +24 -0
- package/types/src/charts/Plot.d.ts +23 -72
- package/types/src/charts/Priestley/applyLayout.d.ts +21 -0
- package/types/src/charts/Priestley/emit.d.ts +6 -0
- package/types/src/charts/Priestley/index.d.ts +14 -0
- package/types/src/charts/Radar/applyLayout.d.ts +10 -0
- package/types/src/charts/Radar/emit.d.ts +7 -0
- package/types/src/charts/Radar/index.d.ts +14 -0
- package/types/src/charts/RadialMatrix/applyLayout.d.ts +11 -0
- package/types/src/charts/RadialMatrix/emit.d.ts +6 -0
- package/types/src/charts/RadialMatrix/index.d.ts +14 -0
- package/types/src/charts/RadialMatrix.d.ts +0 -15
- package/types/src/charts/Rings/applyLayout.d.ts +2 -0
- package/types/src/charts/Rings/emit.d.ts +7 -0
- package/types/src/charts/Rings/index.d.ts +15 -0
- package/types/src/charts/Rings.d.ts +0 -13
- package/types/src/charts/Sankey/applyLayout.d.ts +7 -0
- package/types/src/charts/Sankey/emit.d.ts +6 -0
- package/types/src/charts/Sankey/index.d.ts +7 -0
- package/types/src/charts/Sankey.d.ts +0 -4
- package/types/src/charts/StackedArea/index.d.ts +10 -0
- package/types/src/charts/Tree/applyLayout.d.ts +2 -0
- package/types/src/charts/Tree/emit.d.ts +7 -0
- package/types/src/charts/Tree/index.d.ts +14 -0
- package/types/src/charts/Tree.d.ts +0 -16
- package/types/src/charts/Treemap/applyLayout.d.ts +16 -0
- package/types/src/charts/Treemap/emit.d.ts +6 -0
- package/types/src/charts/Treemap/index.d.ts +18 -0
- package/types/src/charts/Treemap/thresholdFunction.d.ts +25 -0
- package/types/src/charts/Treemap.d.ts +4 -13
- package/types/src/charts/Viz.d.ts +49 -361
- package/types/src/charts/VizBase.d.ts +158 -0
- package/types/src/charts/VizBaseConfig.d.ts +148 -0
- package/types/src/charts/applyDefinition.d.ts +13 -0
- package/types/src/charts/axes.d.ts +134 -0
- package/types/src/charts/chartGeometry.d.ts +58 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +84 -0
- package/types/src/charts/definition/applyDefinition.d.ts +13 -0
- package/types/src/charts/definition/makeChart.d.ts +22 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +25 -5
- package/types/src/charts/emitHelpers.d.ts +122 -0
- package/types/src/charts/ensureZoomDom.d.ts +39 -0
- package/types/src/charts/events/click.legend.d.ts +1 -1
- package/types/src/charts/events/click.shape.d.ts +1 -1
- package/types/src/charts/events/mouseenter.d.ts +1 -1
- package/types/src/charts/events/mouseleave.d.ts +1 -1
- package/types/src/charts/events/mousemove.legend.d.ts +1 -1
- package/types/src/charts/events/mousemove.shape.d.ts +1 -1
- package/types/src/charts/events/touchstart.body.d.ts +1 -1
- package/types/src/charts/factories.d.ts +73 -0
- package/types/src/charts/features/axes.d.ts +134 -0
- package/types/src/charts/features/chartGeometry.d.ts +58 -0
- package/types/src/charts/features/colorScaleBucket.d.ts +43 -0
- package/types/src/charts/features/colorScaleBucketShare.d.ts +16 -0
- package/types/src/charts/features/emitHelpers.d.ts +123 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +39 -0
- package/types/src/charts/features/features.d.ts +152 -0
- package/types/src/charts/features/featuresLegend.d.ts +12 -0
- package/types/src/charts/features/legendLabel.d.ts +11 -0
- package/types/src/charts/features/lineLabels.d.ts +40 -0
- package/types/src/charts/features/plotPaint.d.ts +233 -0
- package/types/src/charts/features/shapeEmit.d.ts +61 -0
- package/types/src/charts/features.d.ts +152 -0
- package/types/src/charts/featuresLegend.d.ts +12 -0
- package/types/src/charts/helpers/matrixData.d.ts +1 -1
- package/types/src/charts/index.d.ts +21 -21
- package/types/src/charts/legendLabel.d.ts +11 -0
- package/types/src/charts/lineLabels.d.ts +40 -0
- package/types/src/charts/makeChart.d.ts +22 -0
- package/types/src/charts/pipeline/resolveSpec.d.ts +51 -0
- package/types/src/charts/pipeline/runChartDraw.d.ts +38 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +31 -0
- package/types/src/charts/pipeline/stages.d.ts +160 -0
- package/types/src/charts/pipeline/vizContext.d.ts +45 -0
- package/types/src/charts/pipeline/vizDraw.d.ts +25 -0
- package/types/src/charts/pipeline/vizDrawPure.d.ts +46 -0
- package/types/src/charts/pipeline/vizPreDraw.d.ts +22 -0
- package/types/src/charts/pipeline/vizPreDrawPure.d.ts +68 -0
- package/types/src/charts/plotBuffers/Bar.d.ts +6 -5
- package/types/src/charts/plotBuffers/Box.d.ts +6 -5
- package/types/src/charts/plotBuffers/Circle.d.ts +6 -5
- package/types/src/charts/plotBuffers/Line.d.ts +6 -5
- package/types/src/charts/plotBuffers/Rect.d.ts +6 -5
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +2 -1
- package/types/src/charts/plotBuffers/numericBuffer.d.ts +2 -1
- package/types/src/charts/plotPaint.d.ts +233 -0
- package/types/src/charts/resolveSpec.d.ts +50 -0
- package/types/src/charts/runChartDraw.d.ts +38 -0
- package/types/src/charts/runVizPipeline.d.ts +31 -0
- package/types/src/charts/shapeEmit.d.ts +61 -0
- package/types/src/charts/stages.d.ts +117 -0
- package/types/src/charts/viz/Viz.d.ts +111 -0
- package/types/src/charts/viz/VizBase.d.ts +160 -0
- package/types/src/charts/viz/VizBaseConfig.d.ts +157 -0
- package/types/src/charts/viz/interactionOpacity.d.ts +23 -0
- package/types/src/charts/viz/ordinalColor.d.ts +14 -0
- package/types/src/charts/viz/trailCatchup.d.ts +14 -0
- package/types/src/charts/viz/vizDefaults.d.ts +8 -0
- package/types/src/charts/viz/vizRender.d.ts +8 -0
- package/types/src/charts/viz/vizTypes.d.ts +250 -0
- package/types/src/charts/vizContext.d.ts +46 -0
- package/types/src/charts/vizDefaults.d.ts +8 -0
- package/types/src/charts/vizDraw.d.ts +25 -0
- package/types/src/charts/vizDrawPure.d.ts +17 -0
- package/types/src/charts/vizPreDraw.d.ts +22 -0
- package/types/src/charts/vizPreDrawPure.d.ts +40 -0
- package/types/src/charts/vizRender.d.ts +8 -0
- package/types/src/charts/vizTypes.d.ts +202 -0
- package/types/src/components/Axis/Axis.d.ts +182 -0
- package/types/src/components/Axis/AxisBottom.d.ts +11 -0
- package/types/src/components/Axis/AxisLeft.d.ts +11 -0
- package/types/src/components/Axis/AxisRight.d.ts +11 -0
- package/types/src/components/Axis/AxisTop.d.ts +11 -0
- package/types/src/components/Axis/axisLayout.d.ts +29 -0
- package/types/src/components/Axis/axisLayoutLabels.d.ts +70 -0
- package/types/src/components/Axis/axisLayoutScale.d.ts +14 -0
- package/types/src/components/Axis/axisRender.d.ts +68 -0
- package/types/src/components/Axis.d.ts +68 -194
- package/types/src/components/ColorScale/ColorScale.d.ts +100 -0
- package/types/src/components/ColorScale/colorScaleRender.d.ts +15 -0
- package/types/src/components/ColorScale/colorScaleScale.d.ts +19 -0
- package/types/src/components/ColorScale.d.ts +1 -129
- package/types/src/components/Legend/Legend.d.ts +95 -0
- package/types/src/components/Legend/legendConfig.d.ts +7 -0
- package/types/src/components/Legend/legendRender.d.ts +16 -0
- package/types/src/components/Legend.d.ts +9 -73
- package/types/src/components/TextBox.d.ts +25 -218
- package/types/src/components/Timeline/Timeline.d.ts +118 -0
- package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
- package/types/src/components/Timeline/timelineRender.d.ts +24 -0
- package/types/src/components/Timeline.d.ts +7 -81
- package/types/src/components/Tooltip.d.ts +20 -200
- package/types/src/components/axisLayout.d.ts +27 -0
- package/types/src/components/axisLayoutLabels.d.ts +42 -0
- package/types/src/components/axisLayoutScale.d.ts +12 -0
- package/types/src/components/axisRender.d.ts +65 -0
- package/types/src/components/colorScaleRender.d.ts +15 -0
- package/types/src/components/colorScaleScale.d.ts +19 -0
- package/types/src/components/index.d.ts +8 -8
- package/types/src/components/legendConfig.d.ts +7 -0
- package/types/src/components/legendRender.d.ts +16 -0
- package/types/src/components/timelineConfig.d.ts +6 -0
- package/types/src/components/timelineRender.d.ts +14 -0
- package/types/src/fluent.d.ts +94 -0
- package/types/src/shapes/Area.d.ts +15 -27
- package/types/src/shapes/Bar.d.ts +13 -33
- package/types/src/shapes/Box.d.ts +17 -56
- package/types/src/shapes/Circle.d.ts +11 -17
- package/types/src/shapes/Image.d.ts +18 -84
- package/types/src/shapes/Line.d.ts +12 -22
- package/types/src/shapes/Path.d.ts +12 -19
- package/types/src/shapes/Rect.d.ts +11 -27
- package/types/src/shapes/Shape.d.ts +46 -257
- package/types/src/shapes/Whisker.d.ts +15 -42
- package/types/src/shapes/buildLabelData.d.ts +50 -0
- package/types/src/shapes/emitLabels.d.ts +16 -0
- package/types/src/shapes/hitAreaNode.d.ts +19 -0
- package/types/src/shapes/sceneSort.d.ts +20 -0
- package/types/src/shapes/shapeConfig.d.ts +226 -0
- package/types/src/utils/BaseClass.d.ts +13 -7
- package/types/src/utils/D3Scale.d.ts +48 -0
- package/types/src/utils/D3plusConfig.d.ts +270 -15
- package/types/src/utils/configPrep.d.ts +7 -4
- package/types/src/utils/getProp.d.ts +3 -1
- package/types/src/utils/index.d.ts +3 -1
- package/types/src/utils/paintComponentScene.d.ts +28 -0
- package/types/umd-entry.d.ts +15 -0
- package/umd/d3plus-core.full.js +30966 -19051
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5400 -2949
- package/umd/d3plus-core.js +17364 -10534
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3494 -1877
- package/es/src/charts/AreaPlot.js +0 -85
- package/es/src/charts/AreaPlot.js.map +0 -1
- package/es/src/charts/BarChart.js +0 -92
- package/es/src/charts/BarChart.js.map +0 -1
- package/es/src/charts/BoxWhisker.js +0 -92
- package/es/src/charts/BoxWhisker.js.map +0 -1
- package/es/src/charts/BumpChart.js +0 -147
- package/es/src/charts/BumpChart.js.map +0 -1
- package/es/src/charts/Donut.js +0 -84
- package/es/src/charts/Donut.js.map +0 -1
- package/es/src/charts/Geomap.js +0 -766
- package/es/src/charts/Geomap.js.map +0 -1
- package/es/src/charts/LinePlot.js +0 -83
- package/es/src/charts/LinePlot.js.map +0 -1
- package/es/src/charts/Matrix.js +0 -341
- package/es/src/charts/Matrix.js.map +0 -1
- package/es/src/charts/Network.js +0 -796
- package/es/src/charts/Network.js.map +0 -1
- package/es/src/charts/Pack.js +0 -308
- package/es/src/charts/Pack.js.map +0 -1
- package/es/src/charts/Pie.js +0 -232
- package/es/src/charts/Pie.js.map +0 -1
- package/es/src/charts/Plot.js +0 -2114
- package/es/src/charts/Plot.js.map +0 -1
- package/es/src/charts/Priestley.js +0 -296
- package/es/src/charts/Priestley.js.map +0 -1
- package/es/src/charts/Radar.js +0 -420
- package/es/src/charts/Radar.js.map +0 -1
- package/es/src/charts/RadialMatrix.js +0 -383
- package/es/src/charts/RadialMatrix.js.map +0 -1
- package/es/src/charts/Rings.js +0 -788
- package/es/src/charts/Rings.js.map +0 -1
- package/es/src/charts/Sankey.js +0 -461
- package/es/src/charts/Sankey.js.map +0 -1
- package/es/src/charts/StackedArea.js +0 -80
- package/es/src/charts/StackedArea.js.map +0 -1
- package/es/src/charts/Tree.js +0 -347
- package/es/src/charts/Tree.js.map +0 -1
- package/es/src/charts/Treemap.js +0 -454
- package/es/src/charts/Treemap.js.map +0 -1
- package/es/src/charts/Viz.js +0 -1832
- package/es/src/charts/Viz.js.map +0 -1
- package/es/src/charts/drawSteps/drawAttribution.js +0 -16
- package/es/src/charts/drawSteps/drawAttribution.js.map +0 -1
- package/es/src/charts/drawSteps/drawBack.js +0 -24
- package/es/src/charts/drawSteps/drawBack.js.map +0 -1
- package/es/src/charts/drawSteps/drawColorScale.js +0 -75
- package/es/src/charts/drawSteps/drawColorScale.js.map +0 -1
- package/es/src/charts/drawSteps/drawLegend.js +0 -122
- package/es/src/charts/drawSteps/drawLegend.js.map +0 -1
- package/es/src/charts/drawSteps/drawSubtitle.js +0 -31
- package/es/src/charts/drawSteps/drawSubtitle.js.map +0 -1
- package/es/src/charts/drawSteps/drawTimeline.js +0 -85
- package/es/src/charts/drawSteps/drawTimeline.js.map +0 -1
- package/es/src/charts/drawSteps/drawTitle.js +0 -31
- package/es/src/charts/drawSteps/drawTitle.js.map +0 -1
- package/es/src/charts/drawSteps/drawTotal.js +0 -32
- package/es/src/charts/drawSteps/drawTotal.js.map +0 -1
- package/es/src/components/Axis.js +0 -1457
- package/es/src/components/Axis.js.map +0 -1
- package/es/src/components/AxisBottom.js.map +0 -1
- package/es/src/components/AxisLeft.js.map +0 -1
- package/es/src/components/AxisRight.js.map +0 -1
- package/es/src/components/AxisTop.js.map +0 -1
- package/es/src/components/ColorScale.js +0 -843
- package/es/src/components/ColorScale.js.map +0 -1
- package/es/src/components/Legend.js +0 -622
- package/es/src/components/Legend.js.map +0 -1
- package/es/src/components/Timeline.js +0 -695
- package/es/src/components/Timeline.js.map +0 -1
- /package/es/src/components/{AxisBottom.js → Axis/AxisBottom.js} +0 -0
- /package/es/src/components/{AxisLeft.js → Axis/AxisLeft.js} +0 -0
- /package/es/src/components/{AxisRight.js → Axis/AxisRight.js} +0 -0
- /package/es/src/components/{AxisTop.js → Axis/AxisTop.js} +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { SceneNode } from "@d3plus/render";
|
|
2
|
+
import type { VizContext } from "../pipeline/stages.js";
|
|
3
|
+
/** A margin claim, in pixels along each side. Unclaimed sides default to 0. */
|
|
4
|
+
export interface MarginClaim {
|
|
5
|
+
top?: number;
|
|
6
|
+
right?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
}
|
|
10
|
+
/** The shape a `layout` step returns: optional panel node + margin claim + optional viz writebacks. */
|
|
11
|
+
export interface FeatureLayout {
|
|
12
|
+
panel: SceneNode | null;
|
|
13
|
+
margin: MarginClaim;
|
|
14
|
+
/**
|
|
15
|
+
v4 purity: features that need to publish CROSS-FEATURE state — a
|
|
16
|
+
write that a DIFFERENT feature or downstream stage will read — return
|
|
17
|
+
those writes here as declarative key→value pairs. `runLayout`
|
|
18
|
+
applies them to viz after the layout call so the next feature in
|
|
19
|
+
the chain sees them.
|
|
20
|
+
|
|
21
|
+
Key convention: keys are auto-prefixed with `_` to match viz's
|
|
22
|
+
internal field convention. Return `{drawDepth: 2}` to write
|
|
23
|
+
`viz._drawDepth`; explicitly-underscored keys (`{_drawDepth: 2}`)
|
|
24
|
+
pass through unchanged for the rare case where the engine
|
|
25
|
+
shouldn't prepend. This rule exists because a leading underscore
|
|
26
|
+
is easy to forget and writing `viz.drawDepth` (no underscore) is
|
|
27
|
+
almost never what callers want.
|
|
28
|
+
|
|
29
|
+
Intra-feature local writes (a feature setting state that its OWN
|
|
30
|
+
component instance reads inside the same `layout()` body) are
|
|
31
|
+
legitimate direct mutations on viz — `vizUpdate` would defer the
|
|
32
|
+
write past the local read. legendFeature's `_legendDepth` is an
|
|
33
|
+
example of an intra-feature local; timelineFeature's
|
|
34
|
+
`_timelineSelection` similarly mutates from its event handler
|
|
35
|
+
context. The contract is about CROSS-feature mutation, not all
|
|
36
|
+
mutation.
|
|
37
|
+
*/
|
|
38
|
+
vizUpdate?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
@interface FeatureModule
|
|
42
|
+
A chart-level component (title, subtitle, total, legend, timeline,
|
|
43
|
+
colorScale, back, attribution) expressed as a pure value. Each feature:
|
|
44
|
+
- contributes config keys to the chart's schema (`configFields`),
|
|
45
|
+
- optionally derives extra fields onto the pipeline context (`derive`),
|
|
46
|
+
- optionally claims a margin region + emits its panel scene (`layout`),
|
|
47
|
+
- optionally registers event reducers (`events`).
|
|
48
|
+
*/
|
|
49
|
+
export interface FeatureModule {
|
|
50
|
+
name: string;
|
|
51
|
+
/** Keys the chart's config inherits from this feature (used by E4 fluent gen). */
|
|
52
|
+
configFields?: string[];
|
|
53
|
+
/** Extra derivations to add into the pipeline context. */
|
|
54
|
+
derive?: (ctx: VizContext) => Partial<VizContext>;
|
|
55
|
+
/**
|
|
56
|
+
Pure layout: read the (possibly updated-by-earlier-features) context and
|
|
57
|
+
return the panel scene + margin this feature claims. The layoutEngine
|
|
58
|
+
threads the margin claims through `ctx.layoutMargin` so a feature can
|
|
59
|
+
read what earlier features already took.
|
|
60
|
+
*/
|
|
61
|
+
layout?: (ctx: VizContext & {
|
|
62
|
+
layoutMargin: Required<MarginClaim>;
|
|
63
|
+
}) => FeatureLayout;
|
|
64
|
+
/**
|
|
65
|
+
Event reducers `(ctx, event) => Partial<VizConfig>`. Fire when a
|
|
66
|
+
user interaction occurs on a node tagged with this feature's name.
|
|
67
|
+
*/
|
|
68
|
+
events?: Record<string, (ctx: VizContext, event: unknown) => unknown>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
Result of running a list of features through the layout engine.
|
|
72
|
+
*/
|
|
73
|
+
export interface LayoutResult {
|
|
74
|
+
/** Panel nodes in feature order, ready to compose into the scene root. */
|
|
75
|
+
panels: SceneNode[];
|
|
76
|
+
/** Final margin after every feature claimed its space. */
|
|
77
|
+
margin: Required<MarginClaim>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
The allowed values for `legendPosition` and `colorScalePosition`.
|
|
81
|
+
`false` means "hidden" (the feature still runs to tear down DOM); the
|
|
82
|
+
four strings are the four sides.
|
|
83
|
+
*/
|
|
84
|
+
export type PanelPosition = false | "top" | "right" | "bottom" | "left";
|
|
85
|
+
/**
|
|
86
|
+
Canonical sanitizer for `legendPosition` / `colorScalePosition`.
|
|
87
|
+
Falls back to `"bottom"` when the user-supplied accessor returns
|
|
88
|
+
something outside the allowed set. Single source of truth — used by
|
|
89
|
+
`vizDrawPure` (for sanitized ctx publication) and by `legendFeature`
|
|
90
|
+
+ `colorScaleFeature` (for their internal positioning math).
|
|
91
|
+
*/
|
|
92
|
+
export declare function sanitizePosition(raw: unknown): PanelPosition;
|
|
93
|
+
/**
|
|
94
|
+
Runs each feature's `layout` in order, accumulating margin claims so that
|
|
95
|
+
later features see the space already taken by earlier ones. The order of
|
|
96
|
+
`features` is the layout order — this is how implicit `this._margin +=`
|
|
97
|
+
side effects become *explicit* data flow.
|
|
98
|
+
|
|
99
|
+
Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,
|
|
100
|
+
`drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,
|
|
101
|
+
`drawTimeline`) should be ported verbatim as the default sequence — port
|
|
102
|
+
the math first, then improve.
|
|
103
|
+
*/
|
|
104
|
+
export declare function runLayout(ctx: VizContext, features: FeatureModule[], baseMargin?: Required<MarginClaim>): LayoutResult;
|
|
105
|
+
/**
|
|
106
|
+
Title as a FeatureModule. Uses `_titleClass._textData()` for height
|
|
107
|
+
(pure compute, no DOM) and returns the margin claim explicitly.
|
|
108
|
+
*/
|
|
109
|
+
export declare const titleFeature: FeatureModule;
|
|
110
|
+
/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */
|
|
111
|
+
export declare const subtitleFeature: FeatureModule;
|
|
112
|
+
/**
|
|
113
|
+
Converts `drawBack.ts` to a FeatureModule. Visible only when there are
|
|
114
|
+
drill-down history entries; emits a "← Back" TextNode at the chart's
|
|
115
|
+
top-left and claims its line height + padding × 2 from `margin.top`.
|
|
116
|
+
*/
|
|
117
|
+
export declare const backFeature: FeatureModule;
|
|
118
|
+
export { legendFeature } from "./featuresLegend.js";
|
|
119
|
+
/**
|
|
120
|
+
Converts `drawTimeline.ts` to a FeatureModule.
|
|
121
|
+
|
|
122
|
+
Visible only when `_time` is set, `_timeline` is truthy, and there is more
|
|
123
|
+
than one distinct tick. Renders the chart's `_timelineClass` Timeline
|
|
124
|
+
instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's
|
|
125
|
+
components collection) and claims `margin.bottom` from its outerBounds.
|
|
126
|
+
*/
|
|
127
|
+
export declare const timelineFeature: FeatureModule;
|
|
128
|
+
/**
|
|
129
|
+
Converts `drawColorScale.ts` to a FeatureModule.
|
|
130
|
+
|
|
131
|
+
Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves
|
|
132
|
+
to a side. Renders the chart's `_colorScaleClass` ColorScale instance and
|
|
133
|
+
claims margin along its position side.
|
|
134
|
+
*/
|
|
135
|
+
export declare const colorScaleFeature: FeatureModule;
|
|
136
|
+
/**
|
|
137
|
+
Converts `drawAttribution.ts` to a FeatureModule.
|
|
138
|
+
|
|
139
|
+
Attribution is an HTML `<div>` overlay positioned absolutely outside the SVG
|
|
140
|
+
plane — it doesn't fit naturally as a SceneNode in the chart scene graph.
|
|
141
|
+
Rather than encode an HTML overlay into the scene graph, this feature runs
|
|
142
|
+
the DOM-creating side effect imperatively from inside `layout()`, so
|
|
143
|
+
invocation is funneled through `runLayout` for consistency with the
|
|
144
|
+
other features. It claims zero margin and emits no panel.
|
|
145
|
+
*/
|
|
146
|
+
export declare const attributionFeature: FeatureModule;
|
|
147
|
+
/**
|
|
148
|
+
Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/
|
|
149
|
+
subtitle: the text comes from `sum()` over the filtered data when `_total`
|
|
150
|
+
is a function, or from `sum(data.map(_size))` when `_total === true`.
|
|
151
|
+
*/
|
|
152
|
+
export declare const totalFeature: FeatureModule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FeatureModule } from "./features.js";
|
|
2
|
+
/**
|
|
3
|
+
Converts `drawLegend.ts` to a FeatureModule.
|
|
4
|
+
|
|
5
|
+
Layout responsibility: roll filtered data up by paint attributes, configure
|
|
6
|
+
+ render the chart's `_legendClass` Legend instance (compute mode — Legend
|
|
7
|
+
contributes to the scene via its `toScene()` collected on Viz.toScene),
|
|
8
|
+
and return the margin claim corresponding to its outerBounds + padding.
|
|
9
|
+
No panel SceneNode is emitted — Legend is a component, not a panel; the
|
|
10
|
+
scene composition for Legend happens via Viz.toScene's `components` array.
|
|
11
|
+
*/
|
|
12
|
+
export declare const legendFeature: FeatureModule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type Viz from "../viz/Viz.js";
|
|
3
|
+
/**
|
|
4
|
+
Default label function for the legend. Bound to a Viz instance; forwards
|
|
5
|
+
to `viz._drawLabel` at the legend's group-depth.
|
|
6
|
+
|
|
7
|
+
Lived in drawSteps/drawLegend.ts until the panel drawSteps were retired
|
|
8
|
+
in favor of FeatureModules; this is the only piece of that file with
|
|
9
|
+
surviving call sites (Viz, Tree, events/mousemove.legend).
|
|
10
|
+
*/
|
|
11
|
+
export declare function legendLabel(this: Viz, d: DataPoint, i: number): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Line-label collision resolution + connector emit for the Plot paint phase.
|
|
3
|
+
|
|
4
|
+
Plot's `lineLabels` feature draws a label at the end of each series line.
|
|
5
|
+
When several series end at nearby y positions the labels overlap, so they
|
|
6
|
+
are "bumped" apart into discrete y buckets; a thin connector line then
|
|
7
|
+
links each bumped label back to its true series position.
|
|
8
|
+
|
|
9
|
+
The measure half (which series get labels + their widths) lives upstream
|
|
10
|
+
as the `measurePlotLineLabels` pipeline stage. This module owns the two
|
|
11
|
+
remaining pieces:
|
|
12
|
+
|
|
13
|
+
- `bumpLineLabels` — resolve overlaps, returning the id→bumped-y map.
|
|
14
|
+
- `emitLineLabelConnectors` — draw the connector lines for bumped labels.
|
|
15
|
+
|
|
16
|
+
This is Plot-family-specific (it depends on Line series + the rendered
|
|
17
|
+
y-axis position function), not a generic cross-viz feature.
|
|
18
|
+
|
|
19
|
+
@module
|
|
20
|
+
*/
|
|
21
|
+
import type { SceneNode } from "@d3plus/render";
|
|
22
|
+
import type { LabelWidth } from "./plotPaint.js";
|
|
23
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
24
|
+
/**
|
|
25
|
+
Resolve label overlaps within each x-group by bumping colliding labels
|
|
26
|
+
into discrete y buckets (capped at 1/8 of the range so a label never
|
|
27
|
+
travels too far from its series). Mutates each `LabelWidth`'s `newY`/
|
|
28
|
+
`defaultY` in place and returns the id→bumped-y map the Line emitter and
|
|
29
|
+
connector emit read. Must run AFTER the production y-axis has rendered —
|
|
30
|
+
`bumpPrevious` reads `viz._yAxis._getPosition`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function bumpLineLabels(viz: Viz, labelWidths: LabelWidth[], yRange: number[]): Record<string, number>;
|
|
33
|
+
/**
|
|
34
|
+
Emit the connector lines for labels that were bumped (`newY` set). Each
|
|
35
|
+
connector runs from the label's true series position to its bumped
|
|
36
|
+
position. Returns the compute-mode scene nodes (empty when nothing was
|
|
37
|
+
bumped). Coords are relative to `_chartTransform`, which the chart-cells
|
|
38
|
+
group applies.
|
|
39
|
+
*/
|
|
40
|
+
export declare function emitLineLabelConnectors(viz: Viz, labelWidths: LabelWidth[]): SceneNode[];
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`plotPaint(viz, pCtx)` — the Plot paint phase as a free function.
|
|
3
|
+
|
|
4
|
+
An architectural seam, sibling to `runVizPipeline(viz)`.
|
|
5
|
+
The paint phase (production axis rendering, shape buffer setup, and
|
|
6
|
+
shape emission with event handlers) runs here; `Plot._paint` is a
|
|
7
|
+
thin shim that concats the returned nodes onto `viz._chartScene`.
|
|
8
|
+
|
|
9
|
+
@param viz The Plot instance (or any subclass: BarChart, LinePlot, …).
|
|
10
|
+
@param pCtx Cross-phase locals produced by `Plot._draw` — see the
|
|
11
|
+
destructure block below for the full schema.
|
|
12
|
+
*/
|
|
13
|
+
import type { DataPoint } from "@d3plus/data";
|
|
14
|
+
import type { SceneNode } from "@d3plus/render";
|
|
15
|
+
import type Axis from "../../components/Axis/Axis.js";
|
|
16
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
17
|
+
/** An axis position function: maps a domain value to a pixel coordinate. */
|
|
18
|
+
export type PlotAxisFn = (d: unknown, axis?: string) => number;
|
|
19
|
+
/**
|
|
20
|
+
A line-label measurement record produced upstream by
|
|
21
|
+
`measurePlotLineLabels` and consumed here to bump overlapping labels
|
|
22
|
+
apart and draw their connector lines.
|
|
23
|
+
*/
|
|
24
|
+
export interface LabelWidth {
|
|
25
|
+
id: string | number;
|
|
26
|
+
xValue: unknown;
|
|
27
|
+
value: unknown;
|
|
28
|
+
fontSize: number;
|
|
29
|
+
padding: number;
|
|
30
|
+
fontColor?: string;
|
|
31
|
+
/** Bumped y position (set when this label collided with a neighbor). */
|
|
32
|
+
newY?: number;
|
|
33
|
+
/** Unbumped y position (the raw axis position of `value`). */
|
|
34
|
+
defaultY?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
The wrapped datum a compute-mode shape passes to its config accessors:
|
|
38
|
+
the original `data` row plus the layout-assigned coordinate/group slots.
|
|
39
|
+
The index signature covers the dynamic `d[discrete]` / `d[opp]` reads.
|
|
40
|
+
*/
|
|
41
|
+
export interface PlotDatum {
|
|
42
|
+
data: DataPoint;
|
|
43
|
+
i: number;
|
|
44
|
+
id: string | number;
|
|
45
|
+
discrete?: string | number;
|
|
46
|
+
group?: string | number;
|
|
47
|
+
x?: number;
|
|
48
|
+
y?: number;
|
|
49
|
+
x2?: number;
|
|
50
|
+
y2?: number;
|
|
51
|
+
lci?: number;
|
|
52
|
+
hci?: number;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
Cross-phase locals threaded from `Plot._draw` (and its extracted pipeline
|
|
57
|
+
stages) into `plotPaint` — the contract any consumer of `plotPaint` must
|
|
58
|
+
supply.
|
|
59
|
+
|
|
60
|
+
Grouped by what populates them:
|
|
61
|
+
- **Data + domain** (formatPlotData / computePlotInitialDomains):
|
|
62
|
+
`data`, `shapeData`, `axisData`, `domains`, `discreteKeys`,
|
|
63
|
+
`stackData`, `stackKeys`, `xData/yData/x2Data/y2Data`,
|
|
64
|
+
`xDomain/yDomain/x2Domain/y2Domain`.
|
|
65
|
+
- **Accessors + scales** (computePlotScales):
|
|
66
|
+
`x`, `y`, `x2`, `y2`, `xScale`/`yScale`/`x2Scale`/`y2Scale`,
|
|
67
|
+
`xConfigScale`/`yConfigScale`/`x2ConfigScale`/`y2ConfigScale`.
|
|
68
|
+
`x` and `y` are reassigned during paint (`viz._xFunc = x = ...`).
|
|
69
|
+
- **Axis configs + visibility** (preparePlotAxisLayout):
|
|
70
|
+
`defaultConfig`, `defaultX2Config`, `defaultY2Config`,
|
|
71
|
+
`showX`, `showY`, `x2Exists`, `y2Exists`, `xC`, `yC`.
|
|
72
|
+
- **Axis measurements** (preparePlotAxisLayout + measurePlotLineLabels):
|
|
73
|
+
`xTicks`/`yTicks`/`x2Ticks`/`y2Ticks`, `labelWidths`, `largestLabel`,
|
|
74
|
+
`xRangeMax`, `xTest`/`yTest`/`x2Test`/`y2Test` (transient axis
|
|
75
|
+
instances), `xTestRange`/`x2TestRange`.
|
|
76
|
+
- **Layout offsets + viewport** (preparePlotAxisLayout):
|
|
77
|
+
`yBounds`/`yWidth`/`xOffsetLeft`/`y2Bounds`/`y2Width`/`xOffsetRight`
|
|
78
|
+
(REASSIGNED by paint from production axes), `xHeight`, `x2Height`,
|
|
79
|
+
`topOffset`, `height`, `width`, `horizontalMargin`, `verticalMargin`.
|
|
80
|
+
- **Paint plumbing** (Plot._draw): `opp`, `barLabels`,
|
|
81
|
+
`showLineLabels`, `stackGroup`.
|
|
82
|
+
*/
|
|
83
|
+
export interface PlotPaintContext {
|
|
84
|
+
data: DataPoint[];
|
|
85
|
+
shapeData: [string, DataPoint[]][];
|
|
86
|
+
axisData: DataPoint[];
|
|
87
|
+
domains: Record<string, number[]>;
|
|
88
|
+
discreteKeys: unknown[];
|
|
89
|
+
stackData: number[][][];
|
|
90
|
+
stackKeys: unknown[];
|
|
91
|
+
xData: unknown[];
|
|
92
|
+
yData: unknown[];
|
|
93
|
+
x2Data: unknown[];
|
|
94
|
+
y2Data: unknown[];
|
|
95
|
+
xDomain: number[];
|
|
96
|
+
yDomain: number[];
|
|
97
|
+
x2Domain: number[];
|
|
98
|
+
y2Domain: number[];
|
|
99
|
+
x: PlotAxisFn;
|
|
100
|
+
y: PlotAxisFn;
|
|
101
|
+
x2: PlotAxisFn;
|
|
102
|
+
y2: PlotAxisFn;
|
|
103
|
+
xScale: string;
|
|
104
|
+
yScale: string;
|
|
105
|
+
xConfigScale: string;
|
|
106
|
+
yConfigScale: string;
|
|
107
|
+
x2ConfigScale: string;
|
|
108
|
+
y2ConfigScale: string;
|
|
109
|
+
defaultConfig: Record<string, unknown>;
|
|
110
|
+
defaultX2Config: Record<string, unknown>;
|
|
111
|
+
defaultY2Config: Record<string, unknown>;
|
|
112
|
+
showX: boolean;
|
|
113
|
+
showY: boolean;
|
|
114
|
+
x2Exists: boolean;
|
|
115
|
+
y2Exists: boolean;
|
|
116
|
+
xC: Record<string, unknown>;
|
|
117
|
+
yC: Record<string, unknown>;
|
|
118
|
+
xTicks: unknown[];
|
|
119
|
+
yTicks: unknown[];
|
|
120
|
+
x2Ticks: unknown[];
|
|
121
|
+
y2Ticks: unknown[];
|
|
122
|
+
labelWidths: LabelWidth[];
|
|
123
|
+
largestLabel: number;
|
|
124
|
+
xRangeMax: number;
|
|
125
|
+
xTest: Axis;
|
|
126
|
+
yTest: Axis;
|
|
127
|
+
x2Test: Axis;
|
|
128
|
+
y2Test: Axis;
|
|
129
|
+
xTestRange: number[];
|
|
130
|
+
x2TestRange: number[];
|
|
131
|
+
yBounds: {
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
};
|
|
137
|
+
y2Bounds: {
|
|
138
|
+
width: number;
|
|
139
|
+
height: number;
|
|
140
|
+
x: number;
|
|
141
|
+
y: number;
|
|
142
|
+
};
|
|
143
|
+
yWidth: number | undefined;
|
|
144
|
+
y2Width: number | undefined;
|
|
145
|
+
xOffsetLeft: number;
|
|
146
|
+
xOffsetRight: number;
|
|
147
|
+
xHeight: number;
|
|
148
|
+
x2Height: number;
|
|
149
|
+
topOffset: number;
|
|
150
|
+
height: number;
|
|
151
|
+
width: number;
|
|
152
|
+
horizontalMargin: number;
|
|
153
|
+
verticalMargin: number;
|
|
154
|
+
opp: "x" | "y" | undefined;
|
|
155
|
+
barLabels: string[];
|
|
156
|
+
showLineLabels: boolean;
|
|
157
|
+
stackGroup: unknown;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
Result of the MEASURE phase of plotPaint. Captures everything the EMIT
|
|
161
|
+
phase needs to know that was computed/reassigned during measure:
|
|
162
|
+
- `x`/`y`: the production-axis accessor closures (reassigned by
|
|
163
|
+
measure onto `viz._xFunc`/`viz._yFunc`).
|
|
164
|
+
- `xRange`/`yRange`: recomputed from the production axes' outer
|
|
165
|
+
bounds.
|
|
166
|
+
- `xOffsetLeft`/`xOffsetRight`/`yWidth`/`y2Width`/`yBounds`/`y2Bounds`:
|
|
167
|
+
production-axis bounds (the pCtx values were throwaway test-axis
|
|
168
|
+
measurements; these are the real ones).
|
|
169
|
+
- `axisSceneQueue`: deferred axis scenes, populated during measure
|
|
170
|
+
and drained at the END of emit (so axes layer above shapes).
|
|
171
|
+
- `yOffset`: half the x-axis bar stroke width — used to nudge
|
|
172
|
+
annotation and shape y0/y1 baselines so shapes don't visually
|
|
173
|
+
overlap the axis stroke.
|
|
174
|
+
- `labelPositions`: map of line-label id → bumped y position
|
|
175
|
+
(computed from `labelWidths`); read by the line-label
|
|
176
|
+
`labelBounds` config in emit.
|
|
177
|
+
*/
|
|
178
|
+
export interface PlotMeasureResult {
|
|
179
|
+
x: PlotAxisFn;
|
|
180
|
+
y: PlotAxisFn;
|
|
181
|
+
xRange: number[];
|
|
182
|
+
yRange: number[];
|
|
183
|
+
xOffsetLeft: number;
|
|
184
|
+
xOffsetRight: number;
|
|
185
|
+
yWidth: number | undefined;
|
|
186
|
+
y2Width: number | undefined;
|
|
187
|
+
yBounds: {
|
|
188
|
+
width: number;
|
|
189
|
+
height: number;
|
|
190
|
+
x: number;
|
|
191
|
+
y: number;
|
|
192
|
+
};
|
|
193
|
+
y2Bounds: {
|
|
194
|
+
width: number;
|
|
195
|
+
height: number;
|
|
196
|
+
x: number;
|
|
197
|
+
y: number;
|
|
198
|
+
};
|
|
199
|
+
axisSceneQueue: {
|
|
200
|
+
key: string;
|
|
201
|
+
transform: {
|
|
202
|
+
x: number;
|
|
203
|
+
y: number;
|
|
204
|
+
};
|
|
205
|
+
axis: Axis;
|
|
206
|
+
}[];
|
|
207
|
+
yOffset: number;
|
|
208
|
+
labelPositions: Record<string, number>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
EMIT phase of plotPaint. Takes the `PlotMeasureResult` from
|
|
212
|
+
`renderAxes` and produces ALL the scene nodes: background rect,
|
|
213
|
+
connector lines, back/front annotations, the main shape loop, line
|
|
214
|
+
markers, and the deferred axis scenes (drained from the queue).
|
|
215
|
+
Returns the flat `SceneNode[]` array that the caller (`Plot._paint`)
|
|
216
|
+
merges into `_chartScene`.
|
|
217
|
+
*/
|
|
218
|
+
export declare function plotEmit(viz: Viz, pCtx: PlotPaintContext, mCtx: PlotMeasureResult): SceneNode[];
|
|
219
|
+
/**
|
|
220
|
+
Plot paint phase as a free function — orchestrates the axis render +
|
|
221
|
+
EMIT.
|
|
222
|
+
|
|
223
|
+
`renderAxes` (in `./axes.js`) renders the production axes, solves the
|
|
224
|
+
final ranges/offsets, and sets `viz._xFunc`/`viz._yFunc`; `plotEmit`
|
|
225
|
+
then produces the scene nodes (background rect → connectors → back
|
|
226
|
+
annotations → shape loop → line markers → front annotations → axis
|
|
227
|
+
scenes). `Plot._paint` is a thin shim that concats the returned nodes
|
|
228
|
+
onto `viz._chartScene`.
|
|
229
|
+
|
|
230
|
+
@param viz The Plot instance (or any subclass: BarChart, LinePlot, …).
|
|
231
|
+
@param pCtx Cross-phase locals produced by `Plot._draw`.
|
|
232
|
+
*/
|
|
233
|
+
export declare function plotPaint(viz: Viz, pCtx: PlotPaintContext): SceneNode[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Per-shape emit registry for the Plot paint phase.
|
|
3
|
+
|
|
4
|
+
The Plot paint loop walks the grouped `shapeData` and, for each shape
|
|
5
|
+
key, produces the scene nodes for that shape's data. Most shapes follow
|
|
6
|
+
the same path (instantiate compute-mode → wire events → apply user
|
|
7
|
+
config → render → collect). Bar and Line carry extra geometry — bar
|
|
8
|
+
spacing/grouping, line confidence bands + end-labels + markers — so they
|
|
9
|
+
get dedicated emitters. Everything else (and stacked Area) flows through
|
|
10
|
+
the generic emitter.
|
|
11
|
+
|
|
12
|
+
A chart "uses only some shapes" purely by which keys appear in its
|
|
13
|
+
`shapeData` (driven by the chart's `shape` accessor default). The
|
|
14
|
+
registry stays complete; the dispatch only ever calls the emitters whose
|
|
15
|
+
keys are present.
|
|
16
|
+
|
|
17
|
+
@module
|
|
18
|
+
*/
|
|
19
|
+
import type { DataPoint } from "@d3plus/data";
|
|
20
|
+
import type { SceneNode } from "@d3plus/render";
|
|
21
|
+
import type { LabelWidth, PlotAxisFn } from "./plotPaint.js";
|
|
22
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
23
|
+
/**
|
|
24
|
+
The cross-phase locals a shape emitter reads. Assembled once per draw by
|
|
25
|
+
the Plot paint loop and passed to each emitter alongside the shape key.
|
|
26
|
+
The stack math (`stackData`/`stackKeyIndex`/`discreteKeyIndex`) is
|
|
27
|
+
computed upstream once per draw — emitters consume it, never recompute.
|
|
28
|
+
*/
|
|
29
|
+
export interface ShapeEmitContext {
|
|
30
|
+
viz: Viz;
|
|
31
|
+
/** The data rows for this shape group. */
|
|
32
|
+
values: DataPoint[];
|
|
33
|
+
/** The base shape config shared across every shape in the loop. */
|
|
34
|
+
shapeConfig: Record<string, unknown>;
|
|
35
|
+
/** Event names registered on the viz (`Object.keys(viz.schema.on)`). */
|
|
36
|
+
events: string[];
|
|
37
|
+
x: PlotAxisFn;
|
|
38
|
+
y: PlotAxisFn;
|
|
39
|
+
xScale: string;
|
|
40
|
+
yScale: string;
|
|
41
|
+
xDomain: number[];
|
|
42
|
+
yDomain: number[];
|
|
43
|
+
xRange: number[];
|
|
44
|
+
yRange: number[];
|
|
45
|
+
opp: "x" | "y" | undefined;
|
|
46
|
+
domains: Record<string, number[]>;
|
|
47
|
+
stackData: number[][][];
|
|
48
|
+
stackKeyIndex: Map<unknown, number>;
|
|
49
|
+
discreteKeyIndex: Map<unknown, number>;
|
|
50
|
+
showLineLabels: boolean;
|
|
51
|
+
labelWidths: LabelWidth[];
|
|
52
|
+
largestLabel: number;
|
|
53
|
+
labelPositions: Record<string, number>;
|
|
54
|
+
width: number;
|
|
55
|
+
}
|
|
56
|
+
/** An emitter: produces the scene nodes for one shape group. */
|
|
57
|
+
export type ShapeEmitter = (ctx: ShapeEmitContext, key: string) => SceneNode[];
|
|
58
|
+
/** Shape key → dedicated emitter. Keys absent here use `genericEmit`. */
|
|
59
|
+
export declare const shapeEmitters: Record<string, ShapeEmitter>;
|
|
60
|
+
/** Dispatch a shape group to its emitter (falling back to the generic path). */
|
|
61
|
+
export declare function emitShape(ctx: ShapeEmitContext, key: string): SceneNode[];
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { SceneNode } from "@d3plus/render";
|
|
2
|
+
import type { VizContext } from "./stages.js";
|
|
3
|
+
/** A margin claim, in pixels along each side. Unclaimed sides default to 0. */
|
|
4
|
+
export interface MarginClaim {
|
|
5
|
+
top?: number;
|
|
6
|
+
right?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
}
|
|
10
|
+
/** The shape a `layout` step returns: optional panel node + margin claim + optional viz writebacks. */
|
|
11
|
+
export interface FeatureLayout {
|
|
12
|
+
panel: SceneNode | null;
|
|
13
|
+
margin: MarginClaim;
|
|
14
|
+
/**
|
|
15
|
+
v4 purity: features that need to publish CROSS-FEATURE state — a
|
|
16
|
+
write that a DIFFERENT feature or downstream stage will read — return
|
|
17
|
+
those writes here as declarative key→value pairs. `runLayout`
|
|
18
|
+
applies them to viz after the layout call so the next feature in
|
|
19
|
+
the chain sees them.
|
|
20
|
+
|
|
21
|
+
Key convention: keys are auto-prefixed with `_` to match viz's
|
|
22
|
+
internal field convention. Return `{drawDepth: 2}` to write
|
|
23
|
+
`viz._drawDepth`; explicitly-underscored keys (`{_drawDepth: 2}`)
|
|
24
|
+
pass through unchanged for the rare case where the engine
|
|
25
|
+
shouldn't prepend. This rule exists because a leading underscore
|
|
26
|
+
is easy to forget and writing `viz.drawDepth` (no underscore) is
|
|
27
|
+
almost never what callers want.
|
|
28
|
+
|
|
29
|
+
Intra-feature local writes (a feature setting state that its OWN
|
|
30
|
+
component instance reads inside the same `layout()` body) are
|
|
31
|
+
legitimate direct mutations on viz — `vizUpdate` would defer the
|
|
32
|
+
write past the local read. legendFeature's `_legendDepth` is an
|
|
33
|
+
example of an intra-feature local; timelineFeature's
|
|
34
|
+
`_timelineSelection` similarly mutates from its event handler
|
|
35
|
+
context. The contract is about CROSS-feature mutation, not all
|
|
36
|
+
mutation.
|
|
37
|
+
*/
|
|
38
|
+
vizUpdate?: Record<string, any>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
@interface FeatureModule
|
|
42
|
+
A chart-level component (title, subtitle, total, legend, timeline,
|
|
43
|
+
colorScale, back, attribution) expressed as a pure value. Each feature:
|
|
44
|
+
- contributes config keys to the chart's schema (`configFields`),
|
|
45
|
+
- optionally derives extra fields onto the pipeline context (`derive`),
|
|
46
|
+
- optionally claims a margin region + emits its panel scene (`layout`),
|
|
47
|
+
- optionally registers event reducers (`events`).
|
|
48
|
+
*/
|
|
49
|
+
export interface FeatureModule {
|
|
50
|
+
name: string;
|
|
51
|
+
/** Keys the chart's config inherits from this feature (used by E4 fluent gen). */
|
|
52
|
+
configFields?: string[];
|
|
53
|
+
/** Extra derivations to add into the pipeline context. */
|
|
54
|
+
derive?: (ctx: VizContext) => Partial<VizContext>;
|
|
55
|
+
/**
|
|
56
|
+
Pure layout: read the (possibly updated-by-earlier-features) context and
|
|
57
|
+
return the panel scene + margin this feature claims. The layoutEngine
|
|
58
|
+
threads the margin claims through `ctx.layoutMargin` so a feature can
|
|
59
|
+
read what earlier features already took.
|
|
60
|
+
*/
|
|
61
|
+
layout?: (ctx: VizContext & {
|
|
62
|
+
layoutMargin: Required<MarginClaim>;
|
|
63
|
+
}) => FeatureLayout;
|
|
64
|
+
/**
|
|
65
|
+
Event reducers `(ctx, event) => Partial<VizConfig>`. Fire when a
|
|
66
|
+
user interaction occurs on a node tagged with this feature's name.
|
|
67
|
+
*/
|
|
68
|
+
events?: Record<string, (ctx: VizContext, event: unknown) => unknown>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
Result of running a list of features through the layout engine.
|
|
72
|
+
*/
|
|
73
|
+
export interface LayoutResult {
|
|
74
|
+
/** Panel nodes in feature order, ready to compose into the scene root. */
|
|
75
|
+
panels: SceneNode[];
|
|
76
|
+
/** Final margin after every feature claimed its space. */
|
|
77
|
+
margin: Required<MarginClaim>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
The allowed values for `legendPosition` and `colorScalePosition`.
|
|
81
|
+
`false` means "hidden" (the feature still runs to tear down DOM); the
|
|
82
|
+
four strings are the four sides.
|
|
83
|
+
*/
|
|
84
|
+
export type PanelPosition = false | "top" | "right" | "bottom" | "left";
|
|
85
|
+
/**
|
|
86
|
+
Canonical sanitizer for `legendPosition` / `colorScalePosition`.
|
|
87
|
+
Falls back to `"bottom"` when the user-supplied accessor returns
|
|
88
|
+
something outside the allowed set. Single source of truth — used by
|
|
89
|
+
`vizDrawPure` (for sanitized ctx publication) and by `legendFeature`
|
|
90
|
+
+ `colorScaleFeature` (for their internal positioning math).
|
|
91
|
+
*/
|
|
92
|
+
export declare function sanitizePosition(raw: unknown): PanelPosition;
|
|
93
|
+
/**
|
|
94
|
+
Runs each feature's `layout` in order, accumulating margin claims so that
|
|
95
|
+
later features see the space already taken by earlier ones. The order of
|
|
96
|
+
`features` is the layout order — this is how implicit `this._margin +=`
|
|
97
|
+
side effects become *explicit* data flow.
|
|
98
|
+
|
|
99
|
+
Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,
|
|
100
|
+
`drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,
|
|
101
|
+
`drawTimeline`) should be ported verbatim as the default sequence — port
|
|
102
|
+
the math first, then improve.
|
|
103
|
+
*/
|
|
104
|
+
export declare function runLayout(ctx: VizContext, features: FeatureModule[], baseMargin?: Required<MarginClaim>): LayoutResult;
|
|
105
|
+
/**
|
|
106
|
+
Title as a FeatureModule. Uses `_titleClass._textData()` for height
|
|
107
|
+
(pure compute, no DOM) and returns the margin claim explicitly.
|
|
108
|
+
*/
|
|
109
|
+
export declare const titleFeature: FeatureModule;
|
|
110
|
+
/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */
|
|
111
|
+
export declare const subtitleFeature: FeatureModule;
|
|
112
|
+
/**
|
|
113
|
+
Converts `drawBack.ts` to a FeatureModule. Visible only when there are
|
|
114
|
+
drill-down history entries; emits a "← Back" TextNode at the chart's
|
|
115
|
+
top-left and claims its line height + padding × 2 from `margin.top`.
|
|
116
|
+
*/
|
|
117
|
+
export declare const backFeature: FeatureModule;
|
|
118
|
+
export { legendFeature } from "./featuresLegend.js";
|
|
119
|
+
/**
|
|
120
|
+
Converts `drawTimeline.ts` to a FeatureModule.
|
|
121
|
+
|
|
122
|
+
Visible only when `_time` is set, `_timeline` is truthy, and there is more
|
|
123
|
+
than one distinct tick. Renders the chart's `_timelineClass` Timeline
|
|
124
|
+
instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's
|
|
125
|
+
components collection) and claims `margin.bottom` from its outerBounds.
|
|
126
|
+
*/
|
|
127
|
+
export declare const timelineFeature: FeatureModule;
|
|
128
|
+
/**
|
|
129
|
+
Converts `drawColorScale.ts` to a FeatureModule.
|
|
130
|
+
|
|
131
|
+
Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves
|
|
132
|
+
to a side. Renders the chart's `_colorScaleClass` ColorScale instance and
|
|
133
|
+
claims margin along its position side.
|
|
134
|
+
*/
|
|
135
|
+
export declare const colorScaleFeature: FeatureModule;
|
|
136
|
+
/**
|
|
137
|
+
Converts `drawAttribution.ts` to a FeatureModule.
|
|
138
|
+
|
|
139
|
+
Attribution is an HTML `<div>` overlay positioned absolutely outside the SVG
|
|
140
|
+
plane — it doesn't fit naturally as a SceneNode in the chart scene graph.
|
|
141
|
+
Rather than encode an HTML overlay into the scene graph, this feature runs
|
|
142
|
+
the DOM-creating side effect imperatively from inside `layout()`, so
|
|
143
|
+
invocation is funneled through `runLayout` for consistency with the
|
|
144
|
+
other features. It claims zero margin and emits no panel.
|
|
145
|
+
*/
|
|
146
|
+
export declare const attributionFeature: FeatureModule;
|
|
147
|
+
/**
|
|
148
|
+
Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/
|
|
149
|
+
subtitle: the text comes from `sum()` over the filtered data when `_total`
|
|
150
|
+
is a function, or from `sum(data.map(_size))` when `_total === true`.
|
|
151
|
+
*/
|
|
152
|
+
export declare const totalFeature: FeatureModule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FeatureModule } from "./features.js";
|
|
2
|
+
/**
|
|
3
|
+
Converts `drawLegend.ts` to a FeatureModule.
|
|
4
|
+
|
|
5
|
+
Layout responsibility: roll filtered data up by paint attributes, configure
|
|
6
|
+
+ render the chart's `_legendClass` Legend instance (compute mode — Legend
|
|
7
|
+
contributes to the scene via its `toScene()` collected on Viz.toScene),
|
|
8
|
+
and return the margin claim corresponding to its outerBounds + padding.
|
|
9
|
+
No panel SceneNode is emitted — Legend is a component, not a panel; the
|
|
10
|
+
scene composition for Legend happens via Viz.toScene's `components` array.
|
|
11
|
+
*/
|
|
12
|
+
export declare const legendFeature: FeatureModule;
|