@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,148 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
declare const VizBaseConfig_base: any;
|
|
3
|
+
/**
|
|
4
|
+
First half of the fluent config accessors shared by every Viz chart
|
|
5
|
+
(`active` through `legendTooltip`). Split from `VizBase` purely so each
|
|
6
|
+
file stays under the `max-lines` budget; the methods remain real prototype
|
|
7
|
+
methods, so `BaseClass.config()` reflection and polymorphic `this` chaining
|
|
8
|
+
are unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export default class VizBaseConfig extends VizBaseConfig_base {
|
|
11
|
+
/**
|
|
12
|
+
The active callback function for highlighting shapes.
|
|
13
|
+
*/
|
|
14
|
+
active(_?: ((d: DataPoint, i: number) => boolean) | false): this | ((d: DataPoint, i: number) => boolean) | false;
|
|
15
|
+
/**
|
|
16
|
+
Custom aggregation methods for each data key.
|
|
17
|
+
*/
|
|
18
|
+
aggs(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
Sets text to be shown positioned absolute on top of the visualization in the bottom-right corner. This is most often used in Geomaps to display the copyright of map tiles. The text is rendered as HTML, so any valid HTML string will render as expected (eg. anchor links work).
|
|
21
|
+
*/
|
|
22
|
+
attribution(_?: string | boolean): this | string | boolean;
|
|
23
|
+
/**
|
|
24
|
+
Configuration object for the attribution style.
|
|
25
|
+
*/
|
|
26
|
+
attributionStyle(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
Configuration object for the back button.
|
|
29
|
+
*/
|
|
30
|
+
backConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
Defines the main color to be used for each data point in a visualization. Can be either an accessor function or a string key to reference in each data point. If a color value is returned, it will be used as is. If a string is returned, a unique color will be assigned based on the string.
|
|
33
|
+
*/
|
|
34
|
+
color(_?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | false): this | string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | false;
|
|
35
|
+
/**
|
|
36
|
+
Defines the value to be used for a color scale. Can be either an accessor function or a string key to reference in each data point.
|
|
37
|
+
*/
|
|
38
|
+
colorScale(_?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | false): this | string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | false;
|
|
39
|
+
/**
|
|
40
|
+
A pass-through to the config method of ColorScale.
|
|
41
|
+
*/
|
|
42
|
+
colorScaleConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
Tells the colorScale whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the colorScale appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
45
|
+
*/
|
|
46
|
+
colorScalePadding(_?: boolean | (() => boolean)): this | boolean | (() => boolean);
|
|
47
|
+
/**
|
|
48
|
+
Defines which side of the visualization to anchor the color scale. Acceptable values are `"top"`, `"bottom"`, `"left"`, `"right"`, and `false`. A `false` value will cause the color scale to not be displayed, but will still color shapes based on the scale.
|
|
49
|
+
*/
|
|
50
|
+
colorScalePosition(_?: string | boolean | (() => string | boolean)): this | string | boolean | (() => string | boolean);
|
|
51
|
+
/**
|
|
52
|
+
The maximum pixel size for drawing the color scale: width for horizontal scales and height for vertical scales.
|
|
53
|
+
*/
|
|
54
|
+
colorScaleMaxSize(_?: number): this | number;
|
|
55
|
+
/**
|
|
56
|
+
The primary data array used to draw the visualization. The value passed should be an *Array* of objects or a *String* representing a filepath or URL to be loaded. The following filetypes are supported: `csv`, `tsv`, `txt`, and `json`.
|
|
57
|
+
|
|
58
|
+
If your data URL needs specific headers to be set, an Object with "url" and "headers" keys may also be passed.
|
|
59
|
+
|
|
60
|
+
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final array of obejcts to be used as the primary data array. For example, some JSON APIs return the headers split from the data values to save bandwidth. These would need be joined using a custom formatter.
|
|
61
|
+
|
|
62
|
+
If you would like to specify certain configuration options based on the yet-to-be-loaded data, you can also return a full `config` object from the data formatter (including the new `data` array as a key in the object).
|
|
63
|
+
|
|
64
|
+
Defaults to an empty array (`[]`).
|
|
65
|
+
@param f The data array or a URL string to load data from.
|
|
66
|
+
*/
|
|
67
|
+
data(_?: DataPoint[] | string | {
|
|
68
|
+
url: string;
|
|
69
|
+
headers: Record<string, string>;
|
|
70
|
+
}, f?: (data: DataPoint[]) => DataPoint[] | Record<string, unknown>): this | DataPoint[];
|
|
71
|
+
/**
|
|
72
|
+
If the width and/or height of a Viz is not user-defined, it is determined by the size of it's parent element. When this method is set to `true`, the Viz will listen for the `window.onresize` event and adjust it's dimensions accordingly.
|
|
73
|
+
*/
|
|
74
|
+
detectResize(_?: boolean): this | boolean;
|
|
75
|
+
/**
|
|
76
|
+
When resizing the browser window, this is the millisecond delay to trigger the resize event.
|
|
77
|
+
*/
|
|
78
|
+
detectResizeDelay(_?: number): this | number;
|
|
79
|
+
/**
|
|
80
|
+
Toggles whether or not the Viz should try to detect if it visible in the current viewport. When this method is set to `true`, the Viz will only be rendered when it has entered the viewport either through scrolling or if it's display or visibility is changed.
|
|
81
|
+
*/
|
|
82
|
+
detectVisible(_?: boolean): this | boolean;
|
|
83
|
+
/**
|
|
84
|
+
The interval, in milliseconds, for checking if the visualization is visible on the page.
|
|
85
|
+
*/
|
|
86
|
+
detectVisibleInterval(_?: number): this | number;
|
|
87
|
+
/**
|
|
88
|
+
Shows a button that allows for downloading the current visualization.
|
|
89
|
+
*/
|
|
90
|
+
downloadButton(_?: boolean): this | boolean;
|
|
91
|
+
/**
|
|
92
|
+
Sets specific options of the saveElement function used when downloading the visualization.
|
|
93
|
+
*/
|
|
94
|
+
downloadConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
95
|
+
/**
|
|
96
|
+
Defines which control group to add the download button into.
|
|
97
|
+
*/
|
|
98
|
+
downloadPosition(_?: string): this | string;
|
|
99
|
+
/**
|
|
100
|
+
The font family used throughout the visualization.
|
|
101
|
+
*/
|
|
102
|
+
fontFamily(_?: string | string[]): this | string | string[];
|
|
103
|
+
/**
|
|
104
|
+
Defines the mapping between data and shape. The value can be a String matching a key in each data point (default is "id"), or an accessor Function that returns a unique value for each data point. Additionally, an Array of these values may be provided if the visualization supports nested hierarchies.
|
|
105
|
+
*/
|
|
106
|
+
groupBy(_?: string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]) | (string | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint]))[]): this | ((d: DataPoint, i: number) => DataPoint[keyof DataPoint])[];
|
|
107
|
+
/**
|
|
108
|
+
Defines the color used for legend shapes when the corresponding grouping is hidden from display (by clicking on the legend).
|
|
109
|
+
*/
|
|
110
|
+
hiddenColor(_?: string | ((d: DataPoint, i: number) => string)): this | string | ((d: DataPoint, i: number) => string);
|
|
111
|
+
/**
|
|
112
|
+
Defines the opacity used for legend labels when the corresponding grouping is hidden from display (by clicking on the legend).
|
|
113
|
+
*/
|
|
114
|
+
hiddenOpacity(_?: number | ((d: DataPoint, i: number) => number)): this | number | ((d: DataPoint, i: number) => number);
|
|
115
|
+
/**
|
|
116
|
+
The hover callback function for highlighting shapes on mouseover.
|
|
117
|
+
*/
|
|
118
|
+
hover(_?: ((d: DataPoint, i: number) => boolean) | false): this;
|
|
119
|
+
/**
|
|
120
|
+
Accessor function or string key for the label of each data point.
|
|
121
|
+
*/
|
|
122
|
+
label(_?: string | ((d: DataPoint, i: number) => string)): this | string | ((d: DataPoint, i: number) => string);
|
|
123
|
+
/**
|
|
124
|
+
Whether to display the legend.
|
|
125
|
+
*/
|
|
126
|
+
legend(_?: boolean | ((config: Record<string, unknown>, arr: DataPoint[]) => boolean)): this | boolean | ((config: Record<string, unknown>, arr: DataPoint[]) => boolean);
|
|
127
|
+
/**
|
|
128
|
+
Configuration object passed to the legend's config method.
|
|
129
|
+
*/
|
|
130
|
+
legendConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
131
|
+
/**
|
|
132
|
+
Defines the click functionality of categorical legend squares. When set to false, clicking will hide that category and shift+clicking will solo that category. When set to true, clicking with solo that category and shift+clicking will hide that category.
|
|
133
|
+
*/
|
|
134
|
+
legendFilterInvert(_?: boolean | (() => boolean)): this | boolean | (() => boolean);
|
|
135
|
+
/**
|
|
136
|
+
Tells the legend whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the legend appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
137
|
+
*/
|
|
138
|
+
legendPadding(_?: boolean | (() => boolean)): this | boolean | (() => boolean);
|
|
139
|
+
/**
|
|
140
|
+
Defines which side of the visualization to anchor the legend. Expected values are `"top"`, `"bottom"`, `"left"`, and `"right"`.
|
|
141
|
+
*/
|
|
142
|
+
legendPosition(_?: string | (() => string)): this | string | (() => string);
|
|
143
|
+
/**
|
|
144
|
+
Configuration object for the legend tooltip.
|
|
145
|
+
*/
|
|
146
|
+
legendTooltip(_?: Record<string, unknown>): this | Record<string, unknown>;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`applyDefinition(viz, def)` — wire a ChartDefinition into a Viz instance.
|
|
3
|
+
|
|
4
|
+
Seeds `viz.ctx` from `def.ctx`, seeds `_<key>` slots from
|
|
5
|
+
`def.defaults` (charts that declare scalar defaults there), and installs
|
|
6
|
+
fluent accessors from `def.fields` (which write into `viz.schema`). All config defaults
|
|
7
|
+
— `shapeConfig`, `tooltipConfig`, `legendSort`, `legend`, etc. — live
|
|
8
|
+
in `fields` and use `factory` / `merge` for viz-bound and merge
|
|
9
|
+
semantics.
|
|
10
|
+
*/
|
|
11
|
+
import type { ChartDefinition } from "./ChartDefinition.js";
|
|
12
|
+
import type { VizInstance } from "./vizTypes.js";
|
|
13
|
+
export declare function applyDefinition(viz: VizInstance, def: ChartDefinition): void;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The Plot-family axes module: the production-axis render + joint range
|
|
3
|
+
solve, factored out of the Plot paint phase so any viz that lays out
|
|
4
|
+
against d3plus `Axis` instances can reuse it.
|
|
5
|
+
|
|
6
|
+
Plot's four axes (`x`/`x2`/`y`/`y2`) are NOT four independent margin
|
|
7
|
+
claims — they are a single coupled solve. The y-axis label width sets
|
|
8
|
+
where the x range starts (`xOffsetLeft = max([yWidth, …])`); the
|
|
9
|
+
x2-axis height shifts the y range's top and the whole chart transform;
|
|
10
|
+
the x range start in turn moves where the y axis sits (`xTrans`). So
|
|
11
|
+
this module owns the joint solve internally and reports one unit, rather
|
|
12
|
+
than exposing four separable features.
|
|
13
|
+
|
|
14
|
+
The module exposes the joint solve as two halves:
|
|
15
|
+
|
|
16
|
+
- `measureAxes` — the MEASURE half: throwaway test axes measure label
|
|
17
|
+
widths/heights, the coupled offsets are solved
|
|
18
|
+
(`xOffsetLeft = max([yWidth, …])`, `x2Height`, `topOffset`,
|
|
19
|
+
`xHeight`), and the four-side claim is written to `viz._padding.*`
|
|
20
|
+
and returned. Runs BEFORE the base `Viz` draw finalizes margins.
|
|
21
|
+
The line-label width measure interleaves mid-solve via an injected
|
|
22
|
+
callback (it is Plot-pipeline-specific, so the axes module doesn't
|
|
23
|
+
own it).
|
|
24
|
+
- `renderAxes` — the EMIT half: runs AFTER margins are finalized,
|
|
25
|
+
rendering the production axes
|
|
26
|
+
(`viz._xAxis`/`_yAxis`/`_x2Axis`/`_y2Axis`) in compute mode against
|
|
27
|
+
the final ranges, setting `viz._xFunc`/`_yFunc` (with their
|
|
28
|
+
log-scale zero handling), and queueing the axis scene nodes for the
|
|
29
|
+
caller to drain after the shape loop (so axes layer above shapes).
|
|
30
|
+
|
|
31
|
+
Both halves degrade to a single axis (or any subset) through the
|
|
32
|
+
`showX`/`showY`/`x2Exists`/`y2Exists` guards: a consumer that wants only
|
|
33
|
+
an x-axis passes the other sides' flags as `false`, and the `max([…])`
|
|
34
|
+
offsets collapse accordingly.
|
|
35
|
+
|
|
36
|
+
@module
|
|
37
|
+
*/
|
|
38
|
+
import type Axis from "../components/Axis.js";
|
|
39
|
+
import type { LabelWidth, PlotMeasureResult, PlotPaintContext } from "./plotPaint.js";
|
|
40
|
+
import type { VizInstance as Viz } from "./vizTypes.js";
|
|
41
|
+
/** A measured axis's outer bounding box. */
|
|
42
|
+
type AxisBounds = {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
The line-label measurement the joint solve interleaves between the first
|
|
50
|
+
and second x-axis measure passes. Plot supplies this via a callback that
|
|
51
|
+
runs the `measurePlotLineLabels` pipeline stage; a consumer with no line
|
|
52
|
+
labels returns empty widths and an undefined `xRangeMax`.
|
|
53
|
+
*/
|
|
54
|
+
export interface LineLabelMeasurement {
|
|
55
|
+
labelWidths: LabelWidth[];
|
|
56
|
+
largestLabel: number | undefined;
|
|
57
|
+
xRangeMax: number | undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
The stable per-draw inputs the joint margin solve reads — exactly the
|
|
61
|
+
values the Plot pipeline stages (`computePlotScales`,
|
|
62
|
+
`preparePlotAxisLayout`) already produce. The four `*Test` axes are
|
|
63
|
+
throwaway instances the caller allocates per draw; `measureAxes`
|
|
64
|
+
configures and measures them, then the caller discards them.
|
|
65
|
+
*/
|
|
66
|
+
export interface AxisMeasureInputs {
|
|
67
|
+
xTest: Axis;
|
|
68
|
+
yTest: Axis;
|
|
69
|
+
x2Test: Axis;
|
|
70
|
+
y2Test: Axis;
|
|
71
|
+
xDomain: number[];
|
|
72
|
+
x2Domain: number[];
|
|
73
|
+
yDomain: number[];
|
|
74
|
+
y2Domain: number[];
|
|
75
|
+
xTicks: unknown[] | null;
|
|
76
|
+
x2Ticks: unknown[] | null;
|
|
77
|
+
yTicks: unknown[] | null;
|
|
78
|
+
y2Ticks: unknown[] | null;
|
|
79
|
+
xConfigScale: string;
|
|
80
|
+
x2ConfigScale: string;
|
|
81
|
+
yConfigScale: string;
|
|
82
|
+
y2ConfigScale: string;
|
|
83
|
+
defaultX2Config: Record<string, unknown>;
|
|
84
|
+
defaultY2Config: Record<string, unknown>;
|
|
85
|
+
yC: Record<string, unknown>;
|
|
86
|
+
showX: boolean;
|
|
87
|
+
showY: boolean;
|
|
88
|
+
x2Exists: boolean;
|
|
89
|
+
y2Exists: boolean;
|
|
90
|
+
height: number;
|
|
91
|
+
width: number;
|
|
92
|
+
xData: unknown[];
|
|
93
|
+
/** `x.padding()` when the x scale is banded, else 0 — feeds the x config. */
|
|
94
|
+
xScalePadding: number;
|
|
95
|
+
}
|
|
96
|
+
/** The four-side margin claim + offsets the joint solve produces. */
|
|
97
|
+
export interface AxisMeasureResult {
|
|
98
|
+
yBounds: AxisBounds;
|
|
99
|
+
y2Bounds: AxisBounds;
|
|
100
|
+
yWidth: number | undefined;
|
|
101
|
+
y2Width: number | undefined;
|
|
102
|
+
xC: Record<string, unknown>;
|
|
103
|
+
xRangeMax: number | undefined;
|
|
104
|
+
labelWidths: LabelWidth[];
|
|
105
|
+
largestLabel: number | undefined;
|
|
106
|
+
xTestRange: number[];
|
|
107
|
+
x2TestRange: number[];
|
|
108
|
+
x2Height: number;
|
|
109
|
+
xOffsetLeft: number;
|
|
110
|
+
xOffsetRight: number;
|
|
111
|
+
topOffset: number;
|
|
112
|
+
xHeight: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
MEASURE half of the joint axis solve. Configures + measures the four
|
|
116
|
+
throwaway test axes, solves the coupled offsets, writes the resulting
|
|
117
|
+
four-side claim to `viz._padding.*`, and returns the offsets + the
|
|
118
|
+
measured bounds + the line-label measurement for the paint phase.
|
|
119
|
+
|
|
120
|
+
`measureLineLabels` is invoked once, after the first x-axis measure and
|
|
121
|
+
before the re-measure, so its `xRangeMax` can re-bound the x range.
|
|
122
|
+
*/
|
|
123
|
+
export declare function measureAxes(viz: Viz, inputs: AxisMeasureInputs, measureLineLabels: () => LineLabelMeasurement): AxisMeasureResult;
|
|
124
|
+
/**
|
|
125
|
+
Render the production axes and solve the final ranges/offsets.
|
|
126
|
+
|
|
127
|
+
Reads `pCtx`, runs each production-mode axis through
|
|
128
|
+
`renderMode("compute").select(null).render()`, computes the final
|
|
129
|
+
`xRange`/`yRange` + offsets, sets `viz._xFunc` / `viz._yFunc` accessors,
|
|
130
|
+
bumps the line labels, and queues axis scenes for the emit phase.
|
|
131
|
+
Returns everything `plotEmit` needs to consume.
|
|
132
|
+
*/
|
|
133
|
+
export declare function renderAxes(viz: Viz, pCtx: PlotPaintContext): PlotMeasureResult;
|
|
134
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Shared geometry helpers for chart `_draw` methods and layout stages.
|
|
3
|
+
|
|
4
|
+
Three patterns repeat across every chart subclass + layout stage:
|
|
5
|
+
|
|
6
|
+
1. Compute the margin-adjusted chart-area width/height.
|
|
7
|
+
2. Compute the chart's `_chartTransform` (where the chart-cells
|
|
8
|
+
group sits relative to the svg origin).
|
|
9
|
+
3. Pull the nested data slice for the current draw depth.
|
|
10
|
+
|
|
11
|
+
Centralizing these into one module:
|
|
12
|
+
- removes 14+ lines of duplication across the codebase
|
|
13
|
+
- gives one place to fix coord-system bugs
|
|
14
|
+
- makes the chart classes' `_draw` bodies easier to scan
|
|
15
|
+
- removes the temptation to inline a slightly-different variant
|
|
16
|
+
|
|
17
|
+
@module
|
|
18
|
+
*/
|
|
19
|
+
import type { Transform } from "@d3plus/render";
|
|
20
|
+
import type { VizInstance as Viz } from "./vizTypes.js";
|
|
21
|
+
/**
|
|
22
|
+
Margin-adjusted chart-area dimensions. Replaces the pattern:
|
|
23
|
+
|
|
24
|
+
const height = viz.schema.height - viz._margin.top - viz._margin.bottom;
|
|
25
|
+
const width = viz.schema.width - viz._margin.left - viz._margin.right;
|
|
26
|
+
*/
|
|
27
|
+
export declare function chartBounds(viz: Viz): {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
Build a `_chartTransform` that places the chart-cells group at the
|
|
33
|
+
margin origin. Replaces the pattern:
|
|
34
|
+
|
|
35
|
+
this._chartTransform = {x: this._margin.left, y: this._margin.top};
|
|
36
|
+
|
|
37
|
+
Used by Tree, Network, Rings, Sankey, Treemap, etc. — every
|
|
38
|
+
rectangular chart whose data lays out from the top-left of the
|
|
39
|
+
chart area.
|
|
40
|
+
*/
|
|
41
|
+
export declare function marginOriginTransform(viz: Viz): Transform;
|
|
42
|
+
/**
|
|
43
|
+
Build a `_chartTransform` that centers the chart-cells group within
|
|
44
|
+
the chart area. Replaces the pattern:
|
|
45
|
+
|
|
46
|
+
this._chartTransform = {
|
|
47
|
+
x: this._margin.left + width / 2,
|
|
48
|
+
y: this._margin.top + height / 2,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
Used by Pie, Donut, RadialMatrix, Radar — every chart whose data
|
|
52
|
+
lays out around a center point (polar / circular geometry).
|
|
53
|
+
|
|
54
|
+
Width and height are the margin-adjusted chart-area dimensions —
|
|
55
|
+
callers usually have them on hand from `chartBounds(viz)` or from
|
|
56
|
+
fields a stage stashed (e.g. `_pieWidth` / `_radialMatrixWidth`).
|
|
57
|
+
*/
|
|
58
|
+
export declare function centerChartTransform(viz: Viz, width: number, height: number): Transform;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`ChartDefinition` — charts as *values*, not classes.
|
|
3
|
+
|
|
4
|
+
A chart in v4 is the def value `{name, fields?, ctx?, features, stages,
|
|
5
|
+
layoutStage?, emit, chartTransform?, setup?, thresholdFunction?}`. Each
|
|
6
|
+
chart's def lives next to its applyLayout + emit in `./<ChartName>/`;
|
|
7
|
+
`makeChart(def, Base?)` produces the chart class from the def.
|
|
8
|
+
*/
|
|
9
|
+
import type { DataPoint } from "@d3plus/data";
|
|
10
|
+
import type { SceneNode } from "@d3plus/render";
|
|
11
|
+
import type { FeatureModule } from "../features/features.js";
|
|
12
|
+
import type { TransformStage, VizContext } from "../pipeline/stages.js";
|
|
13
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
14
|
+
interface ChartDefinitionBase {
|
|
15
|
+
/** Stable name for tagging and class generation. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Chart-internal scratch seeded onto `viz.ctx.<key>` at construction. */
|
|
18
|
+
ctx?: Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
Scalar defaults seeded onto `viz._<key>` at construction. Defs that
|
|
21
|
+
need instance slots keep them here; user-facing values otherwise go
|
|
22
|
+
in `fields[].default` and chart-internal scratch in `ctx`.
|
|
23
|
+
*/
|
|
24
|
+
defaults?: Record<string, unknown>;
|
|
25
|
+
/** Fluent accessor declarations; `makeChart` installs each as `viz.<key>()`. */
|
|
26
|
+
fields?: import("../../fluent.js").ConfigField[];
|
|
27
|
+
/** Chart-level features composed in; order is layout order. */
|
|
28
|
+
features: FeatureModule[];
|
|
29
|
+
/**
|
|
30
|
+
Chart-specific layout stage run in `_draw` after the shared chart-shell
|
|
31
|
+
prep (`vizPreDrawPure`). If absent, `makeChart` doesn't invoke
|
|
32
|
+
`runChartDraw` — the chart relies on its parent's `_draw` only.
|
|
33
|
+
*/
|
|
34
|
+
layoutStage?: TransformStage;
|
|
35
|
+
/** Optional pure threshold algorithm (replaces `Viz._thresholdFunction`). */
|
|
36
|
+
thresholdFunction?: (viz: VizInstance, data: unknown[]) => unknown[];
|
|
37
|
+
/**
|
|
38
|
+
Optional chart-specific `_chartTransform` builder. Receives the viz
|
|
39
|
+
after the layout stage runs; returns the transform applied to the
|
|
40
|
+
chart scene. Default: margin-origin translation.
|
|
41
|
+
*/
|
|
42
|
+
chartTransform?: (viz: VizInstance) => import("@d3plus/render").Transform | undefined;
|
|
43
|
+
/**
|
|
44
|
+
Optional fixed clip region for the chart-cells group (a window in absolute
|
|
45
|
+
scene coordinates that the chart content is clipped to). Geomap uses this to
|
|
46
|
+
contain projected geography within the map rectangle so it can't spill under
|
|
47
|
+
the legend/timeline; the clip stays put while pan/zoom moves content beneath
|
|
48
|
+
it. Only meaningful for charts whose `chartTransform` is undefined.
|
|
49
|
+
*/
|
|
50
|
+
chartClip?: (viz: VizInstance) => import("@d3plus/render").ClipShape | undefined;
|
|
51
|
+
/**
|
|
52
|
+
Imperative per-instance setup hook — runs once after `applyDefinition`
|
|
53
|
+
seeds the chart. Use for event handler overrides and shadowed methods
|
|
54
|
+
that don't fit the declarative `fields`/`ctx` surface.
|
|
55
|
+
*/
|
|
56
|
+
setup?: (viz: VizInstance) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
A data-driven chart's emit: a pure function from a chart context (with
|
|
60
|
+
optional laid-out `shapeData`) to the scene nodes for one frame.
|
|
61
|
+
*/
|
|
62
|
+
export type ChartEmit = (ctx: VizContext & {
|
|
63
|
+
shapeData?: DataPoint[];
|
|
64
|
+
}) => SceneNode[];
|
|
65
|
+
/** Data-driven chart: `emit(ctx)` produces the scene nodes. */
|
|
66
|
+
export interface DataDrivenChartDefinition extends ChartDefinitionBase {
|
|
67
|
+
paintDriven?: false;
|
|
68
|
+
emit: ChartEmit;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
Paint-driven chart: `Plot._paint` populates `viz._chartScene` by calling
|
|
72
|
+
`plotPaint`, which builds the scene from the paint context assembled in
|
|
73
|
+
`drawPlot`. There is no `emit` step — `runChartDraw` refuses to drive
|
|
74
|
+
paint-driven defs (see runChartDraw.ts), so the scene is produced entirely
|
|
75
|
+
inside the Plot draw flow.
|
|
76
|
+
*/
|
|
77
|
+
export interface PaintDrivenChartDefinition extends ChartDefinitionBase {
|
|
78
|
+
paintDriven: true;
|
|
79
|
+
}
|
|
80
|
+
/** Discriminated union; use `isPaintDriven` to narrow. */
|
|
81
|
+
export type ChartDefinition = DataDrivenChartDefinition | PaintDrivenChartDefinition;
|
|
82
|
+
/** Type guard for the paint-driven variant. */
|
|
83
|
+
export declare function isPaintDriven(def: ChartDefinition): def is PaintDrivenChartDefinition;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
`applyDefinition(viz, def)` — wire a ChartDefinition into a Viz instance.
|
|
3
|
+
|
|
4
|
+
Seeds `viz.ctx` from `def.ctx`, seeds `_<key>` slots from
|
|
5
|
+
`def.defaults` (charts that declare scalar defaults there), and installs
|
|
6
|
+
fluent accessors from `def.fields` (which write into `viz.schema`). All config defaults
|
|
7
|
+
— `shapeConfig`, `tooltipConfig`, `legendSort`, `legend`, etc. — live
|
|
8
|
+
in `fields` and use `factory` / `merge` for viz-bound and merge
|
|
9
|
+
semantics.
|
|
10
|
+
*/
|
|
11
|
+
import type { ChartDefinition } from "./ChartDefinition.js";
|
|
12
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
13
|
+
export declare function applyDefinition(viz: VizInstance, def: ChartDefinition): void;
|
|
@@ -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 {};
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { FeatureModule } from "../features/features.js";
|
|
2
2
|
/**
|
|
3
|
-
@name
|
|
4
|
-
Sets up
|
|
5
|
-
|
|
3
|
+
@name zoomFeature
|
|
4
|
+
Sets up zoom + brush event behaviors and the zoom-control buttons.
|
|
5
|
+
|
|
6
|
+
Runs as a post-draw `FeatureModule`: `runVizPipeline` invokes it via
|
|
7
|
+
`runLayout` *after* `_draw()` has rendered the chart body and
|
|
8
|
+
`ensureZoomDom` has mounted `viz._container` / `viz._zoomGroup`. It
|
|
9
|
+
claims zero margin (positioning itself inside the existing
|
|
10
|
+
`viz._margin`) and emits no layout panel — instead it does two things
|
|
11
|
+
the margin-negotiation features don't:
|
|
12
|
+
|
|
13
|
+
1. Installs stateful D3 zoom + brush behaviors (`viz._zoomBehavior`,
|
|
14
|
+
`viz._zoomBrush`) and wires `viz._zoomToBounds`. d3-zoom binds to
|
|
15
|
+
the SVG element directly via `viz._container.call(zoomBehavior)`.
|
|
16
|
+
2. Returns the four control buttons (in/out/reset/brush) as an
|
|
17
|
+
`htmlOverlay` scene-node panel; `runVizPipeline` appends it to
|
|
18
|
+
`viz._featurePanels`. `onMount` is
|
|
19
|
+
the scene's interactive-HTML escape hook: it wires the click/hover
|
|
20
|
+
handlers + applies the user's zoomControl style configs. `onMount`
|
|
21
|
+
fires ONCE per host element (after innerHTML is written, so the
|
|
22
|
+
`.zoom-in` / `.zoom-out` querySelectors below resolve), not per
|
|
23
|
+
draw — the html string is constant, so listeners attached here
|
|
24
|
+
survive every subsequent draw (renderers only rewrite innerHTML
|
|
25
|
+
when it differs from the current value).
|
|
6
26
|
*/
|
|
7
|
-
export
|
|
27
|
+
export declare const zoomFeature: FeatureModule;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Helpers for `ChartDefinition.emit` functions.
|
|
3
|
+
|
|
4
|
+
Most chart-as-data emits follow the same shape-compute pattern:
|
|
5
|
+
instantiate a Shape (Rect/Circle/Path/…) in `renderMode("compute")`,
|
|
6
|
+
feed it the laid-out data + per-emit config + viz-level shapeConfig,
|
|
7
|
+
call `render()` (which short-circuits before DOM mutation in compute
|
|
8
|
+
mode but populates internal state), then extract:
|
|
9
|
+
|
|
10
|
+
- the shape's own scene via `shape.toScene().children`
|
|
11
|
+
- its labels via `shape._labelClass.toScene().children`
|
|
12
|
+
|
|
13
|
+
These two helpers reduce that boilerplate to a single call and
|
|
14
|
+
centralize the `configPrep.bind(viz)(viz.schema.shapeConfig, "shape", key)`
|
|
15
|
+
incantation. The helpers swallow exceptions (returning `[]`) to
|
|
16
|
+
preserve the existing pure-Node fallback: tests that run without
|
|
17
|
+
loading the shape registry continue to see an empty emit instead
|
|
18
|
+
of crashing.
|
|
19
|
+
|
|
20
|
+
@module
|
|
21
|
+
*/
|
|
22
|
+
import type { DataPoint } from "@d3plus/data";
|
|
23
|
+
import type { GroupNode, SceneNode } from "@d3plus/render";
|
|
24
|
+
import * as shapes from "../shapes/index.js";
|
|
25
|
+
/** Construct a shape instance by its registry key (e.g. "Bar", "Line"). */
|
|
26
|
+
export declare const makeShape: (key: string) => shapes.Shape;
|
|
27
|
+
/**
|
|
28
|
+
Structural minimum a Shape (or shape-like component: TextBox, Axis)
|
|
29
|
+
must satisfy for the helpers below to work with it. Captures only the
|
|
30
|
+
members the helpers touch — `render()`, optional `toScene()`, and an
|
|
31
|
+
optional inner `_labelClass` with its own `toScene()`.
|
|
32
|
+
|
|
33
|
+
Replaces the previous `shape: any` parameter on `collectComputed` and
|
|
34
|
+
`absorbShapeIntoChartScene` — both helpers consume the same surface
|
|
35
|
+
regardless of whether the actual instance is a `Shape` subclass, a
|
|
36
|
+
`TextBox`, an `Axis`, or anything else that exposes these members.
|
|
37
|
+
*/
|
|
38
|
+
export interface ShapeLike {
|
|
39
|
+
render(): unknown;
|
|
40
|
+
toScene?: () => GroupNode | null | undefined;
|
|
41
|
+
_labelClass?: {
|
|
42
|
+
toScene?: () => GroupNode | null | undefined;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
Structural minimum a Viz instance must satisfy for these helpers to
|
|
47
|
+
work. Each chart subclass has many more fields; the helpers only need
|
|
48
|
+
`_chartScene` (mutated by `absorbShapeIntoChartScene`) and
|
|
49
|
+
`schema.shapeConfig` (read by `shapeConfigFor`'s default-config branch).
|
|
50
|
+
*/
|
|
51
|
+
export interface VizLike {
|
|
52
|
+
_chartScene?: SceneNode[];
|
|
53
|
+
schema: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
Resolve a per-datum accessor — either a function `(d, i) => T` or a bare
|
|
57
|
+
value. The pattern repeats in every flat-data emit (Treemap, Pack, Pie,
|
|
58
|
+
Priestley, …). Centralized here so each emit doesn't need its own copy.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveAccessor<T>(val: unknown, d: DataPoint, i: number | undefined): T | undefined;
|
|
61
|
+
/**
|
|
62
|
+
Resolve the standard paint properties (`fill`, `stroke`, `strokeWidth`,
|
|
63
|
+
`opacity`) from a shape-config record for a single datum. Returns a
|
|
64
|
+
`Paint`-shaped object compatible with `SceneNode.paint`. `fill` is
|
|
65
|
+
forced to `string | undefined` to match `Paint.fill` (texture/object
|
|
66
|
+
fills fall through to `undefined`; the existing flat-data emits already
|
|
67
|
+
do this same coercion).
|
|
68
|
+
*/
|
|
69
|
+
export declare function paintFromShapeConfig(sc: Record<string, unknown>, d: DataPoint, i: number | undefined): {
|
|
70
|
+
fill?: string;
|
|
71
|
+
stroke?: string;
|
|
72
|
+
strokeWidth?: number;
|
|
73
|
+
opacity?: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
Apply a shape-config object to a chart-specific shape key, returning the
|
|
77
|
+
configPrep-massaged object suitable for `.config(...)`. Equivalent to
|
|
78
|
+
`(configPrep as any).bind(viz)(config, "shape", key)`. When `config` is
|
|
79
|
+
omitted it defaults to `viz.schema.shapeConfig` (the common case — 11 sites);
|
|
80
|
+
callers that compose a transient config object (e.g. Plot's confidence
|
|
81
|
+
bands) pass it explicitly.
|
|
82
|
+
|
|
83
|
+
`kind` is the second `configPrep` argument (the property to filter by).
|
|
84
|
+
Defaults to `"shape"` — the standard call shape. Network's link config
|
|
85
|
+
uses `"edge"` instead.
|
|
86
|
+
*/
|
|
87
|
+
export declare function shapeConfigFor(viz: VizLike, shapeKey: string, config?: Record<string, unknown>, kind?: string): Record<string, unknown>;
|
|
88
|
+
/**
|
|
89
|
+
Run `shape.render()` in compute mode and collect the resulting scene
|
|
90
|
+
nodes — shape children and/or label children — in a single flat array.
|
|
91
|
+
Returns `[]` if `shape` is missing or rendering throws (pure-Node
|
|
92
|
+
fallback for tests that don't load the shape registry).
|
|
93
|
+
|
|
94
|
+
@param shape A shape instance already configured (data, accessors,
|
|
95
|
+
config) and set to `renderMode("compute")`.
|
|
96
|
+
@param opts.shape Include `shape.toScene().children` (default true).
|
|
97
|
+
@param opts.labels Include `shape._labelClass.toScene().children`
|
|
98
|
+
(default true).
|
|
99
|
+
*/
|
|
100
|
+
export declare function collectComputed(shape: ShapeLike | null | undefined, opts?: {
|
|
101
|
+
shape?: boolean;
|
|
102
|
+
labels?: boolean;
|
|
103
|
+
}): SceneNode[];
|
|
104
|
+
/**
|
|
105
|
+
Push a compute-mode shape's scene nodes onto `viz._chartScene`. Used
|
|
106
|
+
inside chart-specific layout stages that need to mount axis decorations,
|
|
107
|
+
background rects, or other helper geometry alongside the main shape
|
|
108
|
+
emit. The shape MUST already be in `renderMode("compute")`; this helper
|
|
109
|
+
calls `shape.render()` and then absorbs both the shape and label scenes.
|
|
110
|
+
|
|
111
|
+
Lives here (not in Plot.ts) so any chart stage can call it. Optionally
|
|
112
|
+
wraps the absorbed nodes in a group with the given key + transform,
|
|
113
|
+
useful when the decoration needs its own coordinate system that's
|
|
114
|
+
distinct from the chart-wide `_chartTransform`.
|
|
115
|
+
*/
|
|
116
|
+
export declare function absorbShapeIntoChartScene(viz: VizLike, shape: ShapeLike | null | undefined, wrap?: {
|
|
117
|
+
key: string;
|
|
118
|
+
transform?: {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
};
|
|
122
|
+
}): void;
|