@d3plus/core 3.1.6 → 4.0.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 +9922 -78537
- 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 +639 -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 +72 -31
- 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 +70 -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 +14 -9
- 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 +156 -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 +230 -3
- 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 +31148 -19484
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5309 -2944
- package/umd/d3plus-core.js +17379 -10578
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3470 -1876
- 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
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { default as AreaPlot } from "./AreaPlot.js";
|
|
2
|
-
export { default as BarChart } from "./BarChart.js";
|
|
3
|
-
export { default as BoxWhisker } from "./BoxWhisker.js";
|
|
4
|
-
export { default as BumpChart } from "./BumpChart.js";
|
|
5
|
-
export { default as Donut } from "./Donut.js";
|
|
6
|
-
export { default as Geomap } from "./Geomap.js";
|
|
7
|
-
export { default as LinePlot } from "./LinePlot.js";
|
|
8
|
-
export { default as Matrix } from "./Matrix.js";
|
|
9
|
-
export { default as Network } from "./Network.js";
|
|
10
|
-
export { default as Pack } from "./Pack.js";
|
|
11
|
-
export { default as Pie } from "./Pie.js";
|
|
12
|
-
export { default as Plot } from "./Plot.js";
|
|
13
|
-
export { default as Priestley } from "./Priestley.js";
|
|
14
|
-
export { default as Radar } from "./Radar.js";
|
|
15
|
-
export { default as RadialMatrix } from "./RadialMatrix.js";
|
|
16
|
-
export { default as Rings } from "./Rings.js";
|
|
17
|
-
export { default as Sankey } from "./Sankey.js";
|
|
18
|
-
export { default as StackedArea } from "./StackedArea.js";
|
|
19
|
-
export { default as Tree } from "./Tree.js";
|
|
20
|
-
export { default as Treemap } from "./Treemap.js";
|
|
21
|
-
export { default as Viz } from "./Viz.js";
|
|
1
|
+
export { default as AreaPlot } from "./AreaPlot/index.js";
|
|
2
|
+
export { default as BarChart } from "./BarChart/index.js";
|
|
3
|
+
export { default as BoxWhisker } from "./BoxWhisker/index.js";
|
|
4
|
+
export { default as BumpChart } from "./BumpChart/index.js";
|
|
5
|
+
export { default as Donut } from "./Donut/index.js";
|
|
6
|
+
export { default as Geomap } from "./Geomap/index.js";
|
|
7
|
+
export { default as LinePlot } from "./LinePlot/index.js";
|
|
8
|
+
export { default as Matrix } from "./Matrix/index.js";
|
|
9
|
+
export { default as Network } from "./Network/index.js";
|
|
10
|
+
export { default as Pack } from "./Pack/index.js";
|
|
11
|
+
export { default as Pie } from "./Pie/index.js";
|
|
12
|
+
export { default as Plot } from "./Plot/index.js";
|
|
13
|
+
export { default as Priestley } from "./Priestley/index.js";
|
|
14
|
+
export { default as Radar } from "./Radar/index.js";
|
|
15
|
+
export { default as RadialMatrix } from "./RadialMatrix/index.js";
|
|
16
|
+
export { default as Rings } from "./Rings/index.js";
|
|
17
|
+
export { default as Sankey } from "./Sankey/index.js";
|
|
18
|
+
export { default as StackedArea } from "./StackedArea/index.js";
|
|
19
|
+
export { default as Tree } from "./Tree/index.js";
|
|
20
|
+
export { default as Treemap } from "./Treemap/index.js";
|
|
21
|
+
export { default as Viz } from "./viz/Viz.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type Viz from "./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 "./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,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`makeChart(def)` — produce a Viz-extending chart class from a
|
|
3
|
+
ChartDefinition value.
|
|
4
|
+
|
|
5
|
+
The class is identical for every chart: its constructor runs
|
|
6
|
+
`applyDefinition(this, def)`, its `_draw` runs the shared Viz pipeline
|
|
7
|
+
then the chart's own layout stage via `runChartDraw`, and its
|
|
8
|
+
`_thresholdFunction` delegates to `def.thresholdFunction` if present.
|
|
9
|
+
|
|
10
|
+
A chart's `index.ts` becomes literally `export default makeChart(def)`.
|
|
11
|
+
*/
|
|
12
|
+
import type { ChartDefinition } from "./ChartDefinition.js";
|
|
13
|
+
type AnyViz = any;
|
|
14
|
+
type VizCtor = new () => AnyViz;
|
|
15
|
+
/**
|
|
16
|
+
`makeChart(def, Base?)` — produce a chart class from a def value.
|
|
17
|
+
|
|
18
|
+
`Base` defaults to `Viz`; pass an existing chart class to inherit a
|
|
19
|
+
specialization (e.g. `makeChart(donutDef, Pie)` for Donut).
|
|
20
|
+
*/
|
|
21
|
+
export declare function makeChart(def: ChartDefinition, Base?: VizCtor): VizCtor;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`ResolvedSpec` + `resolveSpec(viz)` — the boundary between
|
|
3
|
+
"config the user supplied" and "context the pipeline transforms."
|
|
4
|
+
|
|
5
|
+
Today the chart's class instance holds both: every `this._foo` slot is
|
|
6
|
+
either a config the user can set (via accessors) or a derived value the
|
|
7
|
+
pipeline writes back during `_preDraw` / `_draw` / `_paint`. The clean
|
|
8
|
+
split is:
|
|
9
|
+
|
|
10
|
+
ResolvedSpec <- user config (frozen, immutable, serializable)
|
|
11
|
+
↓
|
|
12
|
+
VizContext <- pipeline-derived state (filteredData, drawDepth,
|
|
13
|
+
legendData, _chartScene, etc.)
|
|
14
|
+
|
|
15
|
+
`resolveSpec(viz)` returns a frozen snapshot of every user-settable
|
|
16
|
+
config key for the given viz instance. The free functions
|
|
17
|
+
`vizPreDraw(viz)` / `vizDraw(viz)` / `runVizPipeline(viz)` /
|
|
18
|
+
`plotPaint(viz, ctx)` all take a live viz instance — the
|
|
19
|
+
contract that's currently shipping. `resolveSpec` is provided as a
|
|
20
|
+
public seam so callers (custom drivers, tests, future refactors)
|
|
21
|
+
can pin a config snapshot independently of any draw cycle. The
|
|
22
|
+
spec type is the contract.
|
|
23
|
+
|
|
24
|
+
The spec is a READONLY view: mutating it is a programming error. The
|
|
25
|
+
type uses `Readonly<>` to discourage in-place writes; runtime
|
|
26
|
+
freezing happens in `resolveSpec()`.
|
|
27
|
+
*/
|
|
28
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
29
|
+
/**
|
|
30
|
+
All user-settable configuration keys on a chart, frozen.
|
|
31
|
+
|
|
32
|
+
Generated by stripping the `_` prefix from every Viz/Plot/chart-subclass
|
|
33
|
+
instance field that has a matching accessor method. Accessor reflection
|
|
34
|
+
is handled by `BaseClass.config()`; this type is the static shape.
|
|
35
|
+
|
|
36
|
+
A `Record<string, unknown>` keyed by config name — chart subclasses add
|
|
37
|
+
their own fields and the `installFluent`-installed accessors don't carry
|
|
38
|
+
static type info. As schemas gain types, this can narrow to per-field
|
|
39
|
+
unions.
|
|
40
|
+
*/
|
|
41
|
+
export type ResolvedSpec = Readonly<Record<string, unknown>>;
|
|
42
|
+
/**
|
|
43
|
+
Snapshot every config key from a viz instance into a frozen spec.
|
|
44
|
+
|
|
45
|
+
Reads the same keys `BaseClass.config()` reflects — strips the `_`
|
|
46
|
+
prefix from every instance field whose name matches a method on the
|
|
47
|
+
prototype (the v3/v4 config-method-is-also-the-storage-slot pattern).
|
|
48
|
+
Returns a frozen object so consumers can't accidentally mutate it
|
|
49
|
+
upstream of the chart.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveSpec(viz: VizInstance): ResolvedSpec;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`runChartDraw(viz, def, stage, transform?)` — collapses the canonical
|
|
3
|
+
chart-subclass `_draw` body into a single call.
|
|
4
|
+
|
|
5
|
+
Every Viz-extending chart subclass (Tree, Pie, Pack, Treemap, Matrix,
|
|
6
|
+
RadialMatrix, Priestley, Network, Rings, Geomap, Radar) has the same
|
|
7
|
+
three-line sequence after `super._draw(callback)`:
|
|
8
|
+
|
|
9
|
+
const {shapeData} = runStages({viz: this}, [layoutStage]);
|
|
10
|
+
this._chartScene = def.emit({viz: this, shapeData});
|
|
11
|
+
this._chartTransform = { ... };
|
|
12
|
+
|
|
13
|
+
This helper inlines that. The chart's `_draw` becomes:
|
|
14
|
+
|
|
15
|
+
_draw(callback) {
|
|
16
|
+
super._draw(callback);
|
|
17
|
+
runChartDraw(this, myDef, applyMyLayout);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
For charts that compute a non-default `_chartTransform` (Pie centers,
|
|
22
|
+
Radar centers, etc.), pass a third arg that returns the transform.
|
|
23
|
+
|
|
24
|
+
Doesn't reach into chart-specific stash patterns (e.g. Pack writes
|
|
25
|
+
`_packOffsetX`/`_packOffsetY` from its stage; the transform fn can
|
|
26
|
+
read those off `viz` if needed).
|
|
27
|
+
|
|
28
|
+
@param viz The chart instance (`this` from `_draw`).
|
|
29
|
+
@param def The chart's `ChartDefinition` (e.g. `treeDef`, `pieDef`).
|
|
30
|
+
@param stage The chart-specific layout `TransformStage`.
|
|
31
|
+
@param transformFn Optional builder for `_chartTransform`. Default:
|
|
32
|
+
margin-origin (`{x: margin.left, y: margin.top}`).
|
|
33
|
+
*/
|
|
34
|
+
import type { Transform } from "@d3plus/render";
|
|
35
|
+
import type { ChartDefinition } from "../definition/ChartDefinition.js";
|
|
36
|
+
import type { TransformStage } from "./stages.js";
|
|
37
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
38
|
+
export declare function runChartDraw(viz: Viz, def: ChartDefinition, stage: TransformStage, transformFn?: (viz: Viz) => Transform | undefined): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`runVizPipeline(viz)` — the chart pipeline as a free function.
|
|
3
|
+
|
|
4
|
+
Draws the boundary between "lifecycle/DOM/data-loading" (which lives on
|
|
5
|
+
`Viz.render()`, inherently instance-bound) and
|
|
6
|
+
"transform-the-data-into-a-scene" (callable without the lifecycle). The
|
|
7
|
+
transform side isn't fully pure yet — `_preDraw`/`_draw` still mutate
|
|
8
|
+
`this` rather than threading an explicit context
|
|
9
|
+
(`UserConfig → ResolvedSpec → transform stages → SceneGraph → renderer`).
|
|
10
|
+
|
|
11
|
+
Calling this function on a Viz instance runs the same four steps
|
|
12
|
+
`Viz.render()` previously inlined inside its `Promise.all().then()`
|
|
13
|
+
callback:
|
|
14
|
+
|
|
15
|
+
1. `viz._preDraw()` — data filtering + legend-data + drawDepth
|
|
16
|
+
2. `viz._draw()` — chart-specific layout + scene absorption
|
|
17
|
+
3. `zoomControls(viz)` — zoom HTML overlay (architectural carve-out)
|
|
18
|
+
4. `attributionFeature.layout(viz)` — bottom-right attribution panel
|
|
19
|
+
5. `viz._drawSceneToTarget()` — paint scene via SvgRenderer/CanvasRenderer
|
|
20
|
+
|
|
21
|
+
Future work:
|
|
22
|
+
- Extract a `ResolvedSpec` so step 1 takes (config) not (this).
|
|
23
|
+
- Decouple step 2 so it takes (ctx) not (this); stages already follow
|
|
24
|
+
this pattern but `_draw` itself doesn't.
|
|
25
|
+
- Replace step 5's `this._sceneRenderer` slot with a returned handle
|
|
26
|
+
so callers can pick/destroy/diff without instance lookup.
|
|
27
|
+
|
|
28
|
+
@param viz A Viz instance (or any subclass: Plot, Treemap, Pack, …).
|
|
29
|
+
*/
|
|
30
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
31
|
+
export declare function runVizPipeline(viz: Viz): void;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`runStages` folds a list of `TransformStage`s into a context, plus the
|
|
3
|
+
`VizContext` / `TransformStage` types they share and `discreteNestKeys`,
|
|
4
|
+
the rollup nest-key helper.
|
|
5
|
+
|
|
6
|
+
`runStages` is the engine for the per-chart layout stages
|
|
7
|
+
(`applyTreemapLayout` etc.) that `runChartDraw` and the Plot pipeline
|
|
8
|
+
invoke. Its progressive writeback copies each stage's outputs onto
|
|
9
|
+
`this` so downstream consumers read the values the prior stage produced
|
|
10
|
+
(writeback is progressive, not after all stages, because
|
|
11
|
+
`Treemap._thresholdFunction` reads `this._drawDepth` mid-pipeline).
|
|
12
|
+
|
|
13
|
+
The chart-shell data prep (draw-depth, id accessors, time/user
|
|
14
|
+
filtering, rollup, threshold, large-data adjustment, empty-data
|
|
15
|
+
detection) runs through the imperative `vizPreDrawPure` (see
|
|
16
|
+
`vizPreDrawPure.ts`), which is the single source of truth for it.
|
|
17
|
+
*/
|
|
18
|
+
import type { DataPoint } from "@d3plus/data";
|
|
19
|
+
import type { Axis, TextBox } from "../../components/index.js";
|
|
20
|
+
import type Shape from "../../shapes/Shape.js";
|
|
21
|
+
import type { D3Scale } from "../../utils/index.js";
|
|
22
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
23
|
+
/** The four configured d3 scales plus their resolved scale-type strings. */
|
|
24
|
+
export interface PlotScales {
|
|
25
|
+
x: D3Scale;
|
|
26
|
+
y: D3Scale;
|
|
27
|
+
x2: D3Scale;
|
|
28
|
+
y2: D3Scale;
|
|
29
|
+
xScale: string;
|
|
30
|
+
yScale: string;
|
|
31
|
+
x2Scale: string;
|
|
32
|
+
y2Scale: string;
|
|
33
|
+
}
|
|
34
|
+
/** Resolved (lower-cased) scale-type strings for each axis. */
|
|
35
|
+
export interface PlotConfigScales {
|
|
36
|
+
xConfigScale: string;
|
|
37
|
+
yConfigScale: string;
|
|
38
|
+
x2ConfigScale: string;
|
|
39
|
+
y2ConfigScale: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
@interface VizContext
|
|
43
|
+
The value that flows through the chart pipeline. Each stage reads from it
|
|
44
|
+
and returns the fields it derives. The runner (`Viz._preDraw`) folds the
|
|
45
|
+
stages together and writes the result back onto the Viz instance so
|
|
46
|
+
consumers (`_draw`, drawSteps, components) see the same shape.
|
|
47
|
+
*/
|
|
48
|
+
export interface VizContext {
|
|
49
|
+
/**
|
|
50
|
+
The chart instance. Stages read configuration from it. Deliberately
|
|
51
|
+
`any`: this is the pipeline's dynamic bag — stages reach into chart-,
|
|
52
|
+
axis-, and family-specific fields by computed name (`_${axis}Time`,
|
|
53
|
+
`_${o}Config`, …) that a single structural type can't enumerate. Free
|
|
54
|
+
functions that take a single chart use the `VizInstance` contract; this
|
|
55
|
+
bag field stays loose by design (same rationale as `BaseClass.schema`).
|
|
56
|
+
*/
|
|
57
|
+
viz: any;
|
|
58
|
+
drawDepth?: number;
|
|
59
|
+
id?: (d: DataPoint, i: number) => unknown;
|
|
60
|
+
ids?: (d: DataPoint, i: number) => string[];
|
|
61
|
+
drawLabel?: (d: DataPoint, i: number, depth?: number) => string;
|
|
62
|
+
timeFilter?: (d: DataPoint, i?: number) => boolean;
|
|
63
|
+
filteredData?: DataPoint[];
|
|
64
|
+
legendData?: DataPoint[];
|
|
65
|
+
/** Adjustments to `viz.schema.shapeConfig` deferred until writeback. */
|
|
66
|
+
shapeConfigOverrides?: {
|
|
67
|
+
hoverOpacity?: number;
|
|
68
|
+
duration?: number;
|
|
69
|
+
};
|
|
70
|
+
/** True when no data passes filters and the noData message should display. */
|
|
71
|
+
displayNoData?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
Chart-specific layout output (e.g. Treemap's d3-hierarchy result). Produced
|
|
74
|
+
by `applyTreemapLayout` and consumed by Treemap's `_draw` to drive the
|
|
75
|
+
Rect emit. Generic on purpose — each chart's layout stage shapes it
|
|
76
|
+
(d3-hierarchy nodes, pie arcs, sankey nodes, …); `ChartEmit` narrows it
|
|
77
|
+
to `DataPoint[]` at the emit boundary.
|
|
78
|
+
*/
|
|
79
|
+
shapeData?: unknown[];
|
|
80
|
+
/**
|
|
81
|
+
Plot's chart-specific staged outputs. `formatPlotData` produces them;
|
|
82
|
+
downstream Plot stages (and Plot._draw's paint phase) read them.
|
|
83
|
+
*/
|
|
84
|
+
plotFormattedData?: Record<string, unknown>[];
|
|
85
|
+
plotAxisData?: Record<string, unknown>[];
|
|
86
|
+
x2Exists?: boolean;
|
|
87
|
+
y2Exists?: boolean;
|
|
88
|
+
/** Closure used by Plot's stacked branch to compute fillerPoint groups. */
|
|
89
|
+
plotStackGroup?: (d: DataPoint, i: number) => string;
|
|
90
|
+
/** Per-axis unique values arrays (output of `computePlotAxisValues`). */
|
|
91
|
+
xData?: unknown[];
|
|
92
|
+
x2Data?: unknown[];
|
|
93
|
+
yData?: unknown[];
|
|
94
|
+
y2Data?: unknown[];
|
|
95
|
+
/** Initial domains from the stacked/non-stacked branch (output of `computePlotInitialDomains`). */
|
|
96
|
+
plotInitialDomains?: Record<string, (number | string | Date)[]>;
|
|
97
|
+
/** Stacked-mode bookkeeping (output of `computePlotInitialDomains`). */
|
|
98
|
+
plotDiscreteKeys?: unknown[];
|
|
99
|
+
plotStackData?: unknown[];
|
|
100
|
+
plotStackKeys?: unknown[];
|
|
101
|
+
/** Final domains after log/baseline adjustments (output of `computePlotScales`). */
|
|
102
|
+
plotDomains?: Record<string, (number | string | Date)[]>;
|
|
103
|
+
/** Four configured d3 scale instances + their scale-type strings. */
|
|
104
|
+
plotScales?: PlotScales;
|
|
105
|
+
plotConfigScales?: PlotConfigScales;
|
|
106
|
+
plotOpps?: {
|
|
107
|
+
opp?: string;
|
|
108
|
+
opp2?: string;
|
|
109
|
+
opps: string[];
|
|
110
|
+
};
|
|
111
|
+
/** Pre-measured test axes + label-test shapes for `measurePlotLineLabels`. */
|
|
112
|
+
plotTestAxes?: {
|
|
113
|
+
xTest: Axis;
|
|
114
|
+
yTest: Axis;
|
|
115
|
+
};
|
|
116
|
+
plotLineLabelTest?: {
|
|
117
|
+
testLineShape: Shape;
|
|
118
|
+
testTextBox: TextBox;
|
|
119
|
+
};
|
|
120
|
+
/** Outputs of `measurePlotLineLabels`. */
|
|
121
|
+
plotLabelWidths?: unknown[];
|
|
122
|
+
plotLargestLabel?: number;
|
|
123
|
+
plotXRangeMax?: number;
|
|
124
|
+
/** Outputs of `preparePlotAxisLayout`. */
|
|
125
|
+
plotDefaultConfig?: Record<string, unknown>;
|
|
126
|
+
plotDefaultX2Config?: Record<string, unknown>;
|
|
127
|
+
plotDefaultY2Config?: Record<string, unknown>;
|
|
128
|
+
plotShowX?: boolean;
|
|
129
|
+
plotShowY?: boolean;
|
|
130
|
+
plotYC?: Record<string, unknown>;
|
|
131
|
+
plotBarLabels?: string[];
|
|
132
|
+
plotXTicks?: unknown[] | null;
|
|
133
|
+
plotX2Ticks?: unknown[] | null;
|
|
134
|
+
plotYTicks?: unknown[] | null;
|
|
135
|
+
plotY2Ticks?: unknown[] | null;
|
|
136
|
+
plotXDomain?: (number | string | Date)[];
|
|
137
|
+
plotX2Domain?: (number | string | Date)[];
|
|
138
|
+
plotYDomain?: (number | string | Date)[];
|
|
139
|
+
plotY2Domain?: (number | string | Date)[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
@type TransformStage
|
|
143
|
+
A pipeline stage: pure function from a context to the fields it derives.
|
|
144
|
+
Stages never mutate the input; the runner merges the returned partial.
|
|
145
|
+
*/
|
|
146
|
+
export type TransformStage = (ctx: VizContext) => Partial<VizContext>;
|
|
147
|
+
/**
|
|
148
|
+
Discrete-axis nest keys for the rollup. Plot stores its discrete accessor
|
|
149
|
+
on `viz._x`/`viz._y`; fluent-schema charts (Radar/RadialMatrix `metric`)
|
|
150
|
+
store it on `viz.schema.<discrete>`. Resolve from either so the rollup
|
|
151
|
+
nests by the discrete dimension regardless of where the accessor lives —
|
|
152
|
+
without it, per-metric rows collapse into one aggregated row per group.
|
|
153
|
+
*/
|
|
154
|
+
type NestKey = (d: DataPoint, i: number) => DataPoint[keyof DataPoint];
|
|
155
|
+
export declare function discreteNestKeys(viz: VizInstance): NestKey[];
|
|
156
|
+
/**
|
|
157
|
+
Run a stage pipeline and accumulate the partial outputs into one context.
|
|
158
|
+
*/
|
|
159
|
+
export declare function runStages(initial: VizContext, stages: TransformStage[]): VizContext;
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`VizContext` — the pipeline-derived state companion to `ResolvedSpec`.
|
|
3
|
+
|
|
4
|
+
This boundary splits a chart's runtime data into two halves:
|
|
5
|
+
|
|
6
|
+
ResolvedSpec <- user config (frozen, immutable; see resolveSpec.ts)
|
|
7
|
+
↓
|
|
8
|
+
VizContext <- pipeline-derived state (filteredData, drawDepth,
|
|
9
|
+
legendData, _id closures, …)
|
|
10
|
+
|
|
11
|
+
`vizPreDrawPure(spec, prevCtx) → Partial<VizContext>` is the contract:
|
|
12
|
+
given a frozen spec and any prior context, return the keys the stage
|
|
13
|
+
computed. Callers compose this with their `prevCtx` via spread:
|
|
14
|
+
|
|
15
|
+
const next = {...prevCtx, ...vizPreDrawPure(spec, prevCtx)};
|
|
16
|
+
|
|
17
|
+
Same for `vizDrawPure(spec, ctx) → Partial<VizContext>`.
|
|
18
|
+
|
|
19
|
+
The class `Viz._preDraw()` / `Viz._draw()` stay as imperative shims
|
|
20
|
+
that wrap the pure functions + write results back to `this` (for back-
|
|
21
|
+
compat with subclass overrides that read `this._filteredData` etc.).
|
|
22
|
+
Direct callers of the pure functions get the architectural seam.
|
|
23
|
+
*/
|
|
24
|
+
import type { DataPoint } from "@d3plus/data";
|
|
25
|
+
/**
|
|
26
|
+
The shape of every field vizPreDraw + vizDraw can populate. The
|
|
27
|
+
`Record<string, unknown>` base covers chart-specific stash slots that
|
|
28
|
+
aren't enumerated below; named fields type the common pipeline outputs.
|
|
29
|
+
*/
|
|
30
|
+
export interface VizContext extends Record<string, unknown> {
|
|
31
|
+
/** Effective draw depth (capped to groupBy.length - 1). */
|
|
32
|
+
drawDepth?: number;
|
|
33
|
+
/** Unique-id-per-datum accessor (depth-scoped). */
|
|
34
|
+
id?: (d: DataPoint, i: number) => string | number;
|
|
35
|
+
/** Array-of-ids-per-datum accessor. */
|
|
36
|
+
ids?: (d: DataPoint, i: number) => string[];
|
|
37
|
+
/** Human-readable label-per-datum accessor (handles aggregation labels). */
|
|
38
|
+
drawLabel?: (d: DataPoint, i: number, depth?: number) => string;
|
|
39
|
+
/** Data after filter + timeFilter + threshold are applied. */
|
|
40
|
+
filteredData?: DataPoint[];
|
|
41
|
+
/** Per-id rank order used by legend + treemap label sorting. */
|
|
42
|
+
legendData?: DataPoint[];
|
|
43
|
+
/** Whether a "no data" message should currently be visible. */
|
|
44
|
+
noDataMessage?: boolean;
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`vizDraw(viz)` — the imperative shim wrapping `vizDrawPure`.
|
|
3
|
+
|
|
4
|
+
The pure function (`vizDrawPure(viz, prevCtx) → Partial<VizDrawCtx>`)
|
|
5
|
+
computes the chart-shell layout — margin deltas + reset signals +
|
|
6
|
+
feature panels — at the outer level. Inner FeatureModule.layout()
|
|
7
|
+
calls still write through to `viz` directly (component mounts,
|
|
8
|
+
intra-feature accessor writes); that's intentional — `vizUpdate` is
|
|
9
|
+
the cross-feature publishing channel, but a feature's OWN intra-body
|
|
10
|
+
state lives on viz directly because the feature's component instance
|
|
11
|
+
(`Legend`, `Timeline`) is a stateful object whose configuration calls
|
|
12
|
+
happen inline.
|
|
13
|
+
|
|
14
|
+
`vizDrawPure` threads its margin accumulator locally and returns the
|
|
15
|
+
per-side deltas in `marginDelta`; it no longer writes `viz._margin`.
|
|
16
|
+
This shim applies those deltas to the instance once, so the
|
|
17
|
+
post-layout consumers (axes, chartGeometry, plotPaint, ensureZoomDom,
|
|
18
|
+
attribution) read the final margin off `viz._margin`.
|
|
19
|
+
|
|
20
|
+
Note: Plot (and other Viz subclasses) OVERRIDE `_draw` and call
|
|
21
|
+
`super._draw(callback)` — that still works through this shim, which
|
|
22
|
+
in turn invokes `vizDraw(this)` with `this` bound to the subclass.
|
|
23
|
+
*/
|
|
24
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
25
|
+
export declare function vizDraw(viz: Viz): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`vizDrawPure(viz, prevCtx)` — the returning form of `vizDraw`.
|
|
3
|
+
|
|
4
|
+
NAMING CAVEAT: the suffix `Pure` here means **"returns a Partial<
|
|
5
|
+
VizContext> describing the layout intent"**, not "free of side effects
|
|
6
|
+
in the FP sense." The OUTER orchestration (margin computation,
|
|
7
|
+
legendPosition resolution, panel aggregation, reset signals) is pure
|
|
8
|
+
in the returned-ctx sense — its observable output is the ctx. The
|
|
9
|
+
inner `runLayout([features])` calls write through to viz directly:
|
|
10
|
+
- reset writes (`viz._featurePanels = []`, `viz._chartScene = []`,
|
|
11
|
+
`viz._chartTransform = undefined`, `viz._shapes = []`)
|
|
12
|
+
- margin claims (`viz._margin.X += claim.margin.X`) so the next
|
|
13
|
+
runLayout sees the updated margins
|
|
14
|
+
- FeatureModule layouts that mount/measure their components
|
|
15
|
+
These writes are part of the contract: subclasses and feature
|
|
16
|
+
modules consume live viz state during the layout body, and the shim
|
|
17
|
+
pattern (`vizDraw` calling `vizDrawPure`) is what bridges the
|
|
18
|
+
free-function surface to the class instances that still hold the
|
|
19
|
+
components.
|
|
20
|
+
|
|
21
|
+
The shim (`vizDraw`) wraps this and serves as the public surface.
|
|
22
|
+
|
|
23
|
+
Returns a context with:
|
|
24
|
+
- `marginDelta` (top/bottom/left/right) — total added to viz._margin
|
|
25
|
+
- `featurePanels` — final aggregated panel list
|
|
26
|
+
- `resetChartScene`/`resetChartTransform`/`resetShapes` (always true)
|
|
27
|
+
- `legendPosition`/`colorScalePosition` — sanitized values
|
|
28
|
+
*/
|
|
29
|
+
import type { SceneNode } from "@d3plus/render";
|
|
30
|
+
import type { VizContext } from "./vizContext.js";
|
|
31
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
32
|
+
export interface VizDrawCtx extends VizContext {
|
|
33
|
+
marginDelta?: {
|
|
34
|
+
top: number;
|
|
35
|
+
bottom: number;
|
|
36
|
+
left: number;
|
|
37
|
+
right: number;
|
|
38
|
+
};
|
|
39
|
+
featurePanels?: SceneNode[];
|
|
40
|
+
legendPosition?: string | false;
|
|
41
|
+
colorScalePosition?: string | false;
|
|
42
|
+
resetChartScene?: boolean;
|
|
43
|
+
resetChartTransform?: boolean;
|
|
44
|
+
resetShapes?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare function vizDrawPure(viz: Viz, _prevCtx?: Partial<VizContext>): Partial<VizDrawCtx>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`vizPreDraw(viz)` — the imperative shim wrapping `vizPreDrawPure`.
|
|
3
|
+
|
|
4
|
+
The pure function (`vizPreDrawPure(viz, prevCtx) → Partial<VizContext>`)
|
|
5
|
+
computes the data-prep results without mutating viz. This shim:
|
|
6
|
+
1. calls the pure function;
|
|
7
|
+
2. writes the returned ctx fields back to viz (so subclass methods
|
|
8
|
+
that read `this._drawDepth` / `this._filteredData` see them);
|
|
9
|
+
3. invokes `viz._thresholdFunction(filteredData, tree)` — this is
|
|
10
|
+
an instance method that needs `this`-bound state populated by
|
|
11
|
+
step 2;
|
|
12
|
+
4. recomputes hover-cutoff overrides + no-data flag against the
|
|
13
|
+
threshold-applied data (via `vizPostThresholdCtx`);
|
|
14
|
+
5. applies the deferred DOM side effects (no-data message mount,
|
|
15
|
+
opacity fade).
|
|
16
|
+
|
|
17
|
+
`Viz._preDraw()` calls this shim so subclass overrides + the existing
|
|
18
|
+
test surface remain unchanged. Direct consumers of the architectural
|
|
19
|
+
seam should use `vizPreDrawPure` (exported from the package index).
|
|
20
|
+
*/
|
|
21
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
22
|
+
export declare function vizPreDraw(viz: Viz): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`vizPreDrawPure(viz, prevCtx)` — the pure form of `vizPreDraw`.
|
|
3
|
+
|
|
4
|
+
Contract: `(spec, prevCtx) → Partial<VizContext>`. This
|
|
5
|
+
function reads from the viz instance (treating it as a spec snapshot —
|
|
6
|
+
only accessor-settable fields) and returns the computed context
|
|
7
|
+
fields without mutating the viz. Callers (the imperative `vizPreDraw`
|
|
8
|
+
shim, or any future pipeline driver) compose the result via spread:
|
|
9
|
+
|
|
10
|
+
const next = {...prevCtx, ...vizPreDrawPure(viz, prevCtx)};
|
|
11
|
+
|
|
12
|
+
Side-effect carve-out: the "no-data message" path mounts DOM via
|
|
13
|
+
`viz._messageClass.render({container, html, mask, style})` and runs a
|
|
14
|
+
`viz._select.transition()...attr("opacity", 0)` transition. Those are
|
|
15
|
+
deferred to the imperative shim — the pure function only returns
|
|
16
|
+
`noDataMessage: true/false` so the shim can act on it.
|
|
17
|
+
|
|
18
|
+
Closure carve-out: `id`/`ids` snapshot `viz.schema.groupBy` / `viz.schema.label` /
|
|
19
|
+
`viz.schema.thresholdName` / `viz.schema.locale` at construction time;
|
|
20
|
+
`drawLabel` snapshots the same set but live-reads `viz._drawDepth` so
|
|
21
|
+
intra-render depth mutations (legend drill-down, subclass overrides)
|
|
22
|
+
are reflected. Callers needing referential transparency on depth
|
|
23
|
+
should pass it explicitly; the public closures are stable for the
|
|
24
|
+
snapshot set, which is the contract today and into the foreseeable
|
|
25
|
+
architectural evolution.
|
|
26
|
+
*/
|
|
27
|
+
import type { DataPoint } from "@d3plus/data";
|
|
28
|
+
import type { VizContext } from "./vizContext.js";
|
|
29
|
+
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
30
|
+
/**
|
|
31
|
+
The shape `vizPreDrawPure` returns: a `Partial<VizContext>` plus the
|
|
32
|
+
two pure-function carve-outs.
|
|
33
|
+
|
|
34
|
+
- `_thresholdTree` is the d3-array `rollup` result that
|
|
35
|
+
`viz._thresholdFunction(filteredData, tree)` needs to walk. The
|
|
36
|
+
threshold function is a subclass instance method (Treemap.ts has
|
|
37
|
+
the override) that reads from `this`; calling it pure would require
|
|
38
|
+
moving subclass logic out of the class, which is out of scope.
|
|
39
|
+
Returning the tree lets the shim apply threshold after writing
|
|
40
|
+
`drawDepth` back.
|
|
41
|
+
- `computedTimeFilter` is the time-filter function the pure version
|
|
42
|
+
synthesized (when `_time` is set but `_timeFilter` isn't). The
|
|
43
|
+
shim feeds it to `filteredData` but does NOT write it onto
|
|
44
|
+
`viz.schema.timeFilter` — pinning the synthesized filter (which
|
|
45
|
+
captures `latestTime` at synthesis) would make a later render
|
|
46
|
+
with newer data skip re-synthesis.
|
|
47
|
+
*/
|
|
48
|
+
/** The d3-array `rollup` result; opaque here — only passed back to
|
|
49
|
+
`_thresholdFunction(data, tree)`, which accepts it as `unknown`. */
|
|
50
|
+
type ThresholdTree = unknown;
|
|
51
|
+
type TimeFilterFn = ((d: DataPoint, i: number) => boolean) | (() => boolean);
|
|
52
|
+
export interface VizPreDrawResult extends Partial<VizContext> {
|
|
53
|
+
/** Internal: d3-array rollup tree, consumed by the shim's threshold step. */
|
|
54
|
+
_thresholdTree?: ThresholdTree;
|
|
55
|
+
/** Internal: synthesized time-filter for the shim to back-assign. */
|
|
56
|
+
computedTimeFilter?: TimeFilterFn;
|
|
57
|
+
}
|
|
58
|
+
export declare function vizPreDrawPure(viz: Viz, _prevCtx?: Partial<VizContext>): VizPreDrawResult;
|
|
59
|
+
export declare function vizPostThresholdCtx(viz: Viz, filteredData: DataPoint[], id: (d: DataPoint, i: number) => string | number): {
|
|
60
|
+
hoverOverride?: {
|
|
61
|
+
hoverOpacity: number;
|
|
62
|
+
duration: number;
|
|
63
|
+
stashOriginals?: boolean;
|
|
64
|
+
restoreOriginals?: boolean;
|
|
65
|
+
};
|
|
66
|
+
noDataMessage: boolean;
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type Plot from "../Plot.js";
|
|
1
|
+
import type Plot from "../Plot/index.js";
|
|
2
|
+
import type { D3Scale } from "../../utils/index.js";
|
|
2
3
|
/**
|
|
3
4
|
@module barBuffer
|
|
4
5
|
Adds a buffer to either side of the non-discrete axis.
|
|
@@ -8,9 +9,9 @@ import type Plot from "../Plot.js";
|
|
|
8
9
|
*/
|
|
9
10
|
export default function (this: Plot, { data, x, y, x2, y2, buffer, }: {
|
|
10
11
|
data: Record<string, unknown>[];
|
|
11
|
-
x:
|
|
12
|
-
y:
|
|
13
|
-
x2?:
|
|
14
|
-
y2?:
|
|
12
|
+
x: D3Scale;
|
|
13
|
+
y: D3Scale;
|
|
14
|
+
x2?: D3Scale;
|
|
15
|
+
y2?: D3Scale;
|
|
15
16
|
buffer?: number;
|
|
16
17
|
}): [unknown, unknown];
|