@d3plus/core 3.1.5 → 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 +17 -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 -19470
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5315 -2939
- package/umd/d3plus-core.js +17379 -10575
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3470 -1873
- 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 -1454
- 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,650 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
FeatureModule + layout engine. The chart-level features (title,
|
|
55
|
+
subtitle, total, legend, timeline, colorScale, back) are
|
|
56
|
+
`FeatureModule` values composed by `runLayout`, which performs
|
|
57
|
+
**explicit margin negotiation** — each feature returns a `MarginClaim`
|
|
58
|
+
+ optional `panel` scene node + optional declarative `vizUpdate`
|
|
59
|
+
writes, and the engine accumulates margins across features in order.
|
|
60
|
+
|
|
61
|
+
Every Plot-family + chart-shell feature here is wired into
|
|
62
|
+
`vizDrawPure` via `runLayout(ctx, [...features])`.
|
|
63
|
+
*/ import { extent, min, rollup, sum } from "d3-array";
|
|
64
|
+
import { select } from "d3-selection";
|
|
65
|
+
import { merge, unique } from "@d3plus/data";
|
|
66
|
+
import { date, elem, stylize } from "@d3plus/dom";
|
|
67
|
+
import { resolveSpec } from "../pipeline/resolveSpec.js";
|
|
68
|
+
var VALID_POSITIONS = new Set([
|
|
69
|
+
false,
|
|
70
|
+
"top",
|
|
71
|
+
"right",
|
|
72
|
+
"bottom",
|
|
73
|
+
"left"
|
|
74
|
+
]);
|
|
75
|
+
/**
|
|
76
|
+
Canonical sanitizer for `legendPosition` / `colorScalePosition`.
|
|
77
|
+
Falls back to `"bottom"` when the user-supplied accessor returns
|
|
78
|
+
something outside the allowed set. Single source of truth — used by
|
|
79
|
+
`vizDrawPure` (for sanitized ctx publication) and by `legendFeature`
|
|
80
|
+
+ `colorScaleFeature` (for their internal positioning math).
|
|
81
|
+
*/ export function sanitizePosition(raw) {
|
|
82
|
+
return VALID_POSITIONS.has(raw) ? raw : "bottom";
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
Runs each feature's `layout` in order, accumulating margin claims so that
|
|
86
|
+
later features see the space already taken by earlier ones. The order of
|
|
87
|
+
`features` is the layout order — this is how implicit `this._margin +=`
|
|
88
|
+
side effects become *explicit* data flow.
|
|
89
|
+
|
|
90
|
+
Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,
|
|
91
|
+
`drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,
|
|
92
|
+
`drawTimeline`) should be ported verbatim as the default sequence — port
|
|
93
|
+
the math first, then improve.
|
|
94
|
+
*/ export function runLayout(ctx, features) {
|
|
95
|
+
var baseMargin = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
96
|
+
top: 0,
|
|
97
|
+
right: 0,
|
|
98
|
+
bottom: 0,
|
|
99
|
+
left: 0
|
|
100
|
+
};
|
|
101
|
+
// `claims` is this call's accumulated margin (the returned delta).
|
|
102
|
+
// `layoutMargin` handed to each feature is the running TOTAL —
|
|
103
|
+
// `baseMargin` (margin already taken by prior runLayout calls in the same
|
|
104
|
+
// draw) plus the claims taken so far in this call — so a feature reads
|
|
105
|
+
// the true current margin without touching viz._margin.
|
|
106
|
+
var claims = {
|
|
107
|
+
top: 0,
|
|
108
|
+
right: 0,
|
|
109
|
+
bottom: 0,
|
|
110
|
+
left: 0
|
|
111
|
+
};
|
|
112
|
+
var panels = [];
|
|
113
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
114
|
+
try {
|
|
115
|
+
for(var _iterator = features[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
116
|
+
var f = _step.value;
|
|
117
|
+
var _claim_top, _claim_right, _claim_bottom, _claim_left;
|
|
118
|
+
if (!f.layout) continue;
|
|
119
|
+
var layoutMargin = {
|
|
120
|
+
top: baseMargin.top + claims.top,
|
|
121
|
+
right: baseMargin.right + claims.right,
|
|
122
|
+
bottom: baseMargin.bottom + claims.bottom,
|
|
123
|
+
left: baseMargin.left + claims.left
|
|
124
|
+
};
|
|
125
|
+
var result = f.layout(_object_spread_props(_object_spread({}, ctx), {
|
|
126
|
+
layoutMargin: layoutMargin
|
|
127
|
+
}));
|
|
128
|
+
var panel = result.panel, claim = result.margin, vizUpdate = result.vizUpdate;
|
|
129
|
+
if (panel) panels.push(panel);
|
|
130
|
+
claims.top += (_claim_top = claim.top) !== null && _claim_top !== void 0 ? _claim_top : 0;
|
|
131
|
+
claims.right += (_claim_right = claim.right) !== null && _claim_right !== void 0 ? _claim_right : 0;
|
|
132
|
+
claims.bottom += (_claim_bottom = claim.bottom) !== null && _claim_bottom !== void 0 ? _claim_bottom : 0;
|
|
133
|
+
claims.left += (_claim_left = claim.left) !== null && _claim_left !== void 0 ? _claim_left : 0;
|
|
134
|
+
// v4 purity: features publish cross-feature viz writes declaratively
|
|
135
|
+
// via `vizUpdate`. The engine applies them — features don't mutate
|
|
136
|
+
// viz directly from layout(). Skips own component-instance config
|
|
137
|
+
// calls (those are local mutation, not cross-feature). Use
|
|
138
|
+
// `Object.keys` (not `for...in`) so inherited enumerable properties
|
|
139
|
+
// on a class-instance vizUpdate don't leak onto viz.
|
|
140
|
+
//
|
|
141
|
+
// Key convention: keys are auto-prefixed with `_` to land on the
|
|
142
|
+
// viz's internal field convention (`viz._drawDepth`, `viz._legendDepth`).
|
|
143
|
+
// Features should return UNPREFIXED keys (`{drawDepth: 2}`); the
|
|
144
|
+
// engine normalizes — so feature authors can't accidentally write
|
|
145
|
+
// `viz.drawDepth` (a different non-underscore property) instead of
|
|
146
|
+
// `viz._drawDepth`. Keys that already start with `_` are passed
|
|
147
|
+
// through unchanged so future explicit-internal writes still work.
|
|
148
|
+
if (vizUpdate && ctx.viz) {
|
|
149
|
+
var target = ctx.viz;
|
|
150
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
151
|
+
try {
|
|
152
|
+
for(var _iterator1 = Object.keys(vizUpdate)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
153
|
+
var k = _step1.value;
|
|
154
|
+
var key = k.startsWith("_") ? k : "_".concat(k);
|
|
155
|
+
target[key] = vizUpdate[k];
|
|
156
|
+
}
|
|
157
|
+
} catch (err) {
|
|
158
|
+
_didIteratorError1 = true;
|
|
159
|
+
_iteratorError1 = err;
|
|
160
|
+
} finally{
|
|
161
|
+
try {
|
|
162
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
163
|
+
_iterator1.return();
|
|
164
|
+
}
|
|
165
|
+
} finally{
|
|
166
|
+
if (_didIteratorError1) {
|
|
167
|
+
throw _iteratorError1;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} catch (err) {
|
|
174
|
+
_didIteratorError = true;
|
|
175
|
+
_iteratorError = err;
|
|
176
|
+
} finally{
|
|
177
|
+
try {
|
|
178
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
179
|
+
_iterator.return();
|
|
180
|
+
}
|
|
181
|
+
} finally{
|
|
182
|
+
if (_didIteratorError) {
|
|
183
|
+
throw _iteratorError;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
panels: panels,
|
|
189
|
+
margin: claims
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/* --------------------------- text-block features --------------------------- */ /**
|
|
193
|
+
Shared layout logic for any "single line of text claiming margin.top" feature
|
|
194
|
+
(title, subtitle, total). Each feature passes the viz fields that source its
|
|
195
|
+
text + TextBox + config; the helper computes the panel + margin claim using
|
|
196
|
+
the TextBox's pure `_textData()` (no DOM).
|
|
197
|
+
*/ function textBlockLayout(ctx, opts) {
|
|
198
|
+
var _ref;
|
|
199
|
+
var _viz_schema_opts_configKey;
|
|
200
|
+
var viz = ctx.viz, layoutMargin = ctx.layoutMargin;
|
|
201
|
+
var text = opts.getText(viz);
|
|
202
|
+
if (!text) return {
|
|
203
|
+
panel: null,
|
|
204
|
+
margin: {}
|
|
205
|
+
};
|
|
206
|
+
var usesPadding = viz.schema[opts.paddingMethod]();
|
|
207
|
+
var padding = usesPadding ? viz._padding : {
|
|
208
|
+
top: 0,
|
|
209
|
+
right: 0,
|
|
210
|
+
bottom: 0,
|
|
211
|
+
left: 0
|
|
212
|
+
};
|
|
213
|
+
var width = viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right);
|
|
214
|
+
var textClass = viz[opts.textClassKey];
|
|
215
|
+
textClass.data([
|
|
216
|
+
{
|
|
217
|
+
text: text
|
|
218
|
+
}
|
|
219
|
+
]).locale(viz.schema.locale).width(width).config(viz.schema[opts.configKey]);
|
|
220
|
+
var boxes = textClass._textData();
|
|
221
|
+
if (!boxes.length) return {
|
|
222
|
+
panel: null,
|
|
223
|
+
margin: {}
|
|
224
|
+
};
|
|
225
|
+
var box = boxes[0];
|
|
226
|
+
var x = layoutMargin.left + padding.left;
|
|
227
|
+
var y = layoutMargin.top;
|
|
228
|
+
var lineHeight = box.lH;
|
|
229
|
+
var blockPadding = (_ref = (_viz_schema_opts_configKey = viz.schema[opts.configKey]) === null || _viz_schema_opts_configKey === void 0 ? void 0 : _viz_schema_opts_configKey.padding) !== null && _ref !== void 0 ? _ref : 0;
|
|
230
|
+
var height = box.lines.length * lineHeight + blockPadding * 2;
|
|
231
|
+
var lines = box.lines.map(function(str, i) {
|
|
232
|
+
var _ref;
|
|
233
|
+
var _box_widths;
|
|
234
|
+
return {
|
|
235
|
+
text: str,
|
|
236
|
+
x: box.tA === "middle" ? width / 2 : box.tA === "end" ? width : 0,
|
|
237
|
+
y: (i + 1) * lineHeight - (lineHeight - box.fS),
|
|
238
|
+
width: (_ref = (_box_widths = box.widths) === null || _box_widths === void 0 ? void 0 : _box_widths[i]) !== null && _ref !== void 0 ? _ref : 0
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
var panel = {
|
|
242
|
+
type: "text",
|
|
243
|
+
key: opts.panelKey,
|
|
244
|
+
x: 0,
|
|
245
|
+
y: 0,
|
|
246
|
+
lines: lines,
|
|
247
|
+
font: {
|
|
248
|
+
family: box.fF,
|
|
249
|
+
size: box.fS,
|
|
250
|
+
anchor: box.tA === "middle" || box.tA === "end" || box.tA === "start" ? box.tA : "start",
|
|
251
|
+
baseline: "alphabetic"
|
|
252
|
+
},
|
|
253
|
+
paint: {
|
|
254
|
+
fill: box.fC,
|
|
255
|
+
opacity: box.fO
|
|
256
|
+
},
|
|
257
|
+
transform: {
|
|
258
|
+
x: x,
|
|
259
|
+
y: y
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
return {
|
|
263
|
+
panel: panel,
|
|
264
|
+
margin: {
|
|
265
|
+
top: height
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
Title as a FeatureModule. Uses `_titleClass._textData()` for height
|
|
271
|
+
(pure compute, no DOM) and returns the margin claim explicitly.
|
|
272
|
+
*/ export var titleFeature = {
|
|
273
|
+
name: "title",
|
|
274
|
+
configFields: [
|
|
275
|
+
"title",
|
|
276
|
+
"titleConfig",
|
|
277
|
+
"titlePadding"
|
|
278
|
+
],
|
|
279
|
+
layout: function layout(ctx) {
|
|
280
|
+
return textBlockLayout(ctx, {
|
|
281
|
+
panelKey: "viz-title",
|
|
282
|
+
getText: function getText(viz) {
|
|
283
|
+
return viz.schema.title ? viz.schema.title(viz._filteredData || []) : false;
|
|
284
|
+
},
|
|
285
|
+
textClassKey: "_titleClass",
|
|
286
|
+
configKey: "titleConfig",
|
|
287
|
+
paddingMethod: "titlePadding"
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */ export var subtitleFeature = {
|
|
292
|
+
name: "subtitle",
|
|
293
|
+
configFields: [
|
|
294
|
+
"subtitle",
|
|
295
|
+
"subtitleConfig",
|
|
296
|
+
"subtitlePadding"
|
|
297
|
+
],
|
|
298
|
+
layout: function layout(ctx) {
|
|
299
|
+
return textBlockLayout(ctx, {
|
|
300
|
+
panelKey: "viz-subtitle",
|
|
301
|
+
getText: function getText(viz) {
|
|
302
|
+
return viz.schema.subtitle ? viz.schema.subtitle(viz._filteredData || []) : false;
|
|
303
|
+
},
|
|
304
|
+
textClassKey: "_subtitleClass",
|
|
305
|
+
configKey: "subtitleConfig",
|
|
306
|
+
paddingMethod: "subtitlePadding"
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
Converts `drawBack.ts` to a FeatureModule. Visible only when there are
|
|
312
|
+
drill-down history entries; emits a "← Back" TextNode at the chart's
|
|
313
|
+
top-left and claims its line height + padding × 2 from `margin.top`.
|
|
314
|
+
*/ export var backFeature = {
|
|
315
|
+
name: "back",
|
|
316
|
+
configFields: [
|
|
317
|
+
"backConfig"
|
|
318
|
+
],
|
|
319
|
+
layout: function layout(param) {
|
|
320
|
+
var viz = param.viz, layoutMargin = param.layoutMargin;
|
|
321
|
+
if (!viz._history || !viz._history.length) return {
|
|
322
|
+
panel: null,
|
|
323
|
+
margin: {}
|
|
324
|
+
};
|
|
325
|
+
var text = "← ".concat(viz.schema.translate("Back"));
|
|
326
|
+
viz._backClass.data([
|
|
327
|
+
{
|
|
328
|
+
text: text,
|
|
329
|
+
x: 0,
|
|
330
|
+
y: 0
|
|
331
|
+
}
|
|
332
|
+
]).config(viz.schema.backConfig);
|
|
333
|
+
var boxes = viz._backClass._textData();
|
|
334
|
+
// _backClass might have a fontSize/padding only style (no wrapping data),
|
|
335
|
+
// in which case _textData may be empty; fall back to direct accessor reads
|
|
336
|
+
// for the margin claim to match drawBack's math precisely.
|
|
337
|
+
var fontSize = viz._backClass.fontSize()();
|
|
338
|
+
var padding = viz._backClass.padding()();
|
|
339
|
+
var height = fontSize + padding * 2;
|
|
340
|
+
if (!boxes.length) {
|
|
341
|
+
return {
|
|
342
|
+
panel: null,
|
|
343
|
+
margin: {
|
|
344
|
+
top: height
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
var box = boxes[0];
|
|
349
|
+
var panel = {
|
|
350
|
+
type: "text",
|
|
351
|
+
key: "viz-back",
|
|
352
|
+
x: 0,
|
|
353
|
+
y: 0,
|
|
354
|
+
lines: box.lines.map(function(str, i) {
|
|
355
|
+
var _ref;
|
|
356
|
+
var _box_widths;
|
|
357
|
+
return {
|
|
358
|
+
text: str,
|
|
359
|
+
x: 0,
|
|
360
|
+
y: (i + 1) * box.lH - (box.lH - box.fS),
|
|
361
|
+
width: (_ref = (_box_widths = box.widths) === null || _box_widths === void 0 ? void 0 : _box_widths[i]) !== null && _ref !== void 0 ? _ref : 0
|
|
362
|
+
};
|
|
363
|
+
}),
|
|
364
|
+
font: {
|
|
365
|
+
family: box.fF,
|
|
366
|
+
size: box.fS,
|
|
367
|
+
baseline: "alphabetic"
|
|
368
|
+
},
|
|
369
|
+
paint: {
|
|
370
|
+
fill: box.fC,
|
|
371
|
+
opacity: box.fO
|
|
372
|
+
},
|
|
373
|
+
transform: {
|
|
374
|
+
x: layoutMargin.left,
|
|
375
|
+
y: layoutMargin.top
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
return {
|
|
379
|
+
panel: panel,
|
|
380
|
+
margin: {
|
|
381
|
+
top: height
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
/* -------------------------------- Legend --------------------------------- */ export { legendFeature } from "./featuresLegend.js";
|
|
387
|
+
/* -------------------------------- Timeline ------------------------------- */ /**
|
|
388
|
+
Helper mirroring drawTimeline's `setTimeFilter`. Triggers a re-render when
|
|
389
|
+
the brush selection changes — kept here so the feature owns its event flow.
|
|
390
|
+
*/ function setTimeFilter(viz, s) {
|
|
391
|
+
if (!Array.isArray(s)) s = [
|
|
392
|
+
s,
|
|
393
|
+
s
|
|
394
|
+
];
|
|
395
|
+
if (JSON.stringify(s) !== JSON.stringify(viz._timelineSelection)) {
|
|
396
|
+
viz._timelineSelection = s;
|
|
397
|
+
var nums = s.map(Number);
|
|
398
|
+
viz.timeFilter(function(d) {
|
|
399
|
+
var ms = date(viz.schema.time(d)).getTime();
|
|
400
|
+
return ms >= nums[0] && ms <= nums[1];
|
|
401
|
+
}).render();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
Converts `drawTimeline.ts` to a FeatureModule.
|
|
406
|
+
|
|
407
|
+
Visible only when `_time` is set, `_timeline` is truthy, and there is more
|
|
408
|
+
than one distinct tick. Renders the chart's `_timelineClass` Timeline
|
|
409
|
+
instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's
|
|
410
|
+
components collection) and claims `margin.bottom` from its outerBounds.
|
|
411
|
+
*/ export var timelineFeature = {
|
|
412
|
+
name: "timeline",
|
|
413
|
+
configFields: [
|
|
414
|
+
"timeline",
|
|
415
|
+
"timelineConfig",
|
|
416
|
+
"timelinePadding"
|
|
417
|
+
],
|
|
418
|
+
layout: function layout(param) {
|
|
419
|
+
var viz = param.viz, layoutMargin = param.layoutMargin;
|
|
420
|
+
var timelinePossible = viz.schema.time && viz.schema.timeline;
|
|
421
|
+
var ticks = timelinePossible ? unique(viz._data.map(viz.schema.time)).map(function(d) {
|
|
422
|
+
return date(d);
|
|
423
|
+
}) : [];
|
|
424
|
+
timelinePossible = timelinePossible && ticks.length > 1;
|
|
425
|
+
var padding = viz.schema.timelinePadding() ? viz._padding : {
|
|
426
|
+
top: 0,
|
|
427
|
+
right: 0,
|
|
428
|
+
bottom: 0,
|
|
429
|
+
left: 0
|
|
430
|
+
};
|
|
431
|
+
var transform = {
|
|
432
|
+
transform: "translate(".concat(layoutMargin.left + padding.left, ", 0)")
|
|
433
|
+
};
|
|
434
|
+
var timelineGroup = elem("g.d3plus-viz-timeline", {
|
|
435
|
+
condition: timelinePossible,
|
|
436
|
+
enter: transform,
|
|
437
|
+
parent: viz._select,
|
|
438
|
+
duration: viz.schema.duration,
|
|
439
|
+
update: transform
|
|
440
|
+
}).node();
|
|
441
|
+
if (!timelinePossible) return {
|
|
442
|
+
panel: null,
|
|
443
|
+
margin: {}
|
|
444
|
+
};
|
|
445
|
+
var timeline = viz._timelineClass.renderMode("compute").domain(extent(ticks)).duration(viz.schema.duration).height(viz.schema.height - layoutMargin.bottom).locale(viz.schema.locale).select(timelineGroup).ticks(ticks.sort(function(a, b) {
|
|
446
|
+
return +a - +b;
|
|
447
|
+
})).width(viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right));
|
|
448
|
+
// Clamp bound = the full time range (every tick); it never goes stale
|
|
449
|
+
// mid-render. Clamping to `viz._filteredData`'s extent instead collapsed a
|
|
450
|
+
// freshly-committed range down to the previous selection — the release
|
|
451
|
+
// snap-back (e.g. [2017,2024] clamped to a stale [2022,2022]).
|
|
452
|
+
var fullExtent = extent(ticks);
|
|
453
|
+
if (!viz._timelineSelection) {
|
|
454
|
+
// First render only: default to the *filtered* extent, which the
|
|
455
|
+
// synthesized default timeFilter pins to the latest period (see
|
|
456
|
+
// vizPreDraw) — the historical default. `timelineDefault` overrides it.
|
|
457
|
+
var filtered = extent((viz._filteredData || []).map(viz.schema.time).map(function(d) {
|
|
458
|
+
return date(d);
|
|
459
|
+
}));
|
|
460
|
+
viz._timelineSelection = viz.schema.timelineDefault || (filtered[0] ? filtered : fullExtent);
|
|
461
|
+
} else {
|
|
462
|
+
if (viz._timelineSelection[0] < fullExtent[0]) viz._timelineSelection[0] = fullExtent[0];
|
|
463
|
+
if (viz._timelineSelection[1] > fullExtent[1]) viz._timelineSelection[1] = fullExtent[1];
|
|
464
|
+
}
|
|
465
|
+
timeline.selection(viz._timelineSelection);
|
|
466
|
+
// Repaint the scene when playback toggles without moving the selection
|
|
467
|
+
// (e.g. a manual pause), so the play/pause glyph refreshes immediately.
|
|
468
|
+
timeline._onPlayToggle = function() {
|
|
469
|
+
return viz._scheduleSceneRepaint();
|
|
470
|
+
};
|
|
471
|
+
var config = viz.schema.timelineConfig;
|
|
472
|
+
timeline.config(config).on("brush", function(s) {
|
|
473
|
+
// Filter on "end", not on every brush move. Re-rendering the whole Viz
|
|
474
|
+
// mid-drag re-creates the d3-brush (and starts a brush transition),
|
|
475
|
+
// which fights the active gesture and can make the selection snap back
|
|
476
|
+
// on release — and it re-lays-out the chart on every pixel of the drag,
|
|
477
|
+
// which is costly for large data. The brush still tracks the cursor
|
|
478
|
+
// live; the chart updates when the drag finishes. User `on.brush`
|
|
479
|
+
// callbacks still fire for custom live behavior.
|
|
480
|
+
if (config.on && config.on.brush) config.on.brush(s);
|
|
481
|
+
}).on("end", function(s) {
|
|
482
|
+
setTimeFilter(viz, s);
|
|
483
|
+
if (config.on && config.on.end) config.on.end(s);
|
|
484
|
+
}).render();
|
|
485
|
+
return {
|
|
486
|
+
panel: null,
|
|
487
|
+
margin: {
|
|
488
|
+
bottom: timeline.outerBounds().height + timeline.padding() * 2
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
/* ------------------------------- ColorScale ------------------------------ */ /**
|
|
494
|
+
Converts `drawColorScale.ts` to a FeatureModule.
|
|
495
|
+
|
|
496
|
+
Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves
|
|
497
|
+
to a side. Renders the chart's `_colorScaleClass` ColorScale instance and
|
|
498
|
+
claims margin along its position side.
|
|
499
|
+
*/ export var colorScaleFeature = {
|
|
500
|
+
name: "colorScale",
|
|
501
|
+
configFields: [
|
|
502
|
+
"colorScale",
|
|
503
|
+
"colorScaleConfig",
|
|
504
|
+
"colorScaleMaxSize",
|
|
505
|
+
"colorScalePadding",
|
|
506
|
+
"colorScalePosition"
|
|
507
|
+
],
|
|
508
|
+
layout: function layout(param) {
|
|
509
|
+
var viz = param.viz, layoutMargin = param.layoutMargin;
|
|
510
|
+
var data = Array.from(rollup(viz._data, function(leaves) {
|
|
511
|
+
return merge(leaves, viz.schema.aggs);
|
|
512
|
+
}, function(d, i) {
|
|
513
|
+
return "".concat(viz.schema.time ? viz.schema.time(d, i) : "all", "-").concat(viz._ids(d, i).join("_"));
|
|
514
|
+
}).values());
|
|
515
|
+
var position = sanitizePosition(viz.schema.colorScalePosition.bind(viz)(resolveSpec(viz)));
|
|
516
|
+
var wide = [
|
|
517
|
+
"top",
|
|
518
|
+
"bottom"
|
|
519
|
+
].includes(position);
|
|
520
|
+
var showColorScale = viz.schema.colorScale && position;
|
|
521
|
+
var padding = viz.schema.colorScalePadding() ? viz._padding : {
|
|
522
|
+
top: 0,
|
|
523
|
+
right: 0,
|
|
524
|
+
bottom: 0,
|
|
525
|
+
left: 0
|
|
526
|
+
};
|
|
527
|
+
var availableWidth = viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right);
|
|
528
|
+
var width = wide ? min([
|
|
529
|
+
viz.schema.colorScaleMaxSize,
|
|
530
|
+
availableWidth
|
|
531
|
+
]) : viz.schema.width - (layoutMargin.left + layoutMargin.right);
|
|
532
|
+
var availableHeight = viz.schema.height - (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top);
|
|
533
|
+
var height = !wide ? min([
|
|
534
|
+
viz.schema.colorScaleMaxSize,
|
|
535
|
+
availableHeight
|
|
536
|
+
]) : viz.schema.height - (layoutMargin.bottom + layoutMargin.top);
|
|
537
|
+
var transform = {
|
|
538
|
+
opacity: position ? 1 : 0,
|
|
539
|
+
transform: "translate(".concat(wide ? layoutMargin.left + padding.left + (availableWidth - width) / 2 : layoutMargin.left, ", ").concat(wide ? layoutMargin.top : layoutMargin.top + padding.top + (availableHeight - height) / 2, ")")
|
|
540
|
+
};
|
|
541
|
+
var scaleGroup = elem("g.d3plus-viz-colorScale", {
|
|
542
|
+
condition: showColorScale && !viz.schema.colorScaleConfig.select,
|
|
543
|
+
enter: transform,
|
|
544
|
+
parent: viz._select,
|
|
545
|
+
duration: viz.schema.duration,
|
|
546
|
+
update: transform
|
|
547
|
+
}).node();
|
|
548
|
+
if (!viz.schema.colorScale) return {
|
|
549
|
+
panel: null,
|
|
550
|
+
margin: {}
|
|
551
|
+
};
|
|
552
|
+
var scaleData = data.filter(function(d, i) {
|
|
553
|
+
var c = viz.schema.colorScale(d, i);
|
|
554
|
+
return c !== undefined && c !== null;
|
|
555
|
+
});
|
|
556
|
+
// Discrete (bucket/jenks/quantile) colorScales render their swatches via an
|
|
557
|
+
// internal Legend, which composes cleanly through the Viz scene — so run
|
|
558
|
+
// them in compute mode (like the legend) so the Viz's toScene owns them and
|
|
559
|
+
// hover/active dimming applies. Without this they render full-mode, where
|
|
560
|
+
// paintComponentScene paints a full-opacity copy that overlays and defeats
|
|
561
|
+
// the dimming. The smooth-gradient variant stays full-mode: its gradient
|
|
562
|
+
// fill is materialized through paintComponentScene, not the Viz scene.
|
|
563
|
+
var csCfg = viz.schema.colorScaleConfig || {};
|
|
564
|
+
var csDiscrete = !csCfg.bucketAxis && [
|
|
565
|
+
"buckets",
|
|
566
|
+
"jenks",
|
|
567
|
+
"quantile"
|
|
568
|
+
].includes(typeof csCfg.scale === "string" ? csCfg.scale : "");
|
|
569
|
+
viz._colorScaleClass.renderMode(csDiscrete ? "compute" : "full").align({
|
|
570
|
+
bottom: "end",
|
|
571
|
+
left: "start",
|
|
572
|
+
right: "end",
|
|
573
|
+
top: "start"
|
|
574
|
+
}[position] || "bottom").duration(viz.schema.duration).data(scaleData).height(height).locale(viz.schema.locale).orient(position).select(scaleGroup).value(viz.schema.colorScale).width(width).config(viz.schema.colorScaleConfig).render();
|
|
575
|
+
var margin = {};
|
|
576
|
+
if (showColorScale) {
|
|
577
|
+
var scaleBounds = viz._colorScaleClass.outerBounds();
|
|
578
|
+
if (!viz.schema.colorScaleConfig.select && scaleBounds.height) {
|
|
579
|
+
// Use the colorScale's OWN padding for its margin claim — not the
|
|
580
|
+
// legend's, so a custom legendPadding doesn't shift the
|
|
581
|
+
// colorScale's claim when the legend is hidden. The colorScale
|
|
582
|
+
// class is the source of truth.
|
|
583
|
+
var csPadding = typeof viz._colorScaleClass.padding === "function" ? viz._colorScaleClass.padding() : viz._legendClass.padding();
|
|
584
|
+
if (wide) margin[position] = scaleBounds.height + csPadding * 2;
|
|
585
|
+
else margin[position] = scaleBounds.width + csPadding * 2;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return {
|
|
589
|
+
panel: null,
|
|
590
|
+
margin: margin
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
/* ------------------------------ Attribution ------------------------------ */ /**
|
|
595
|
+
Converts `drawAttribution.ts` to a FeatureModule.
|
|
596
|
+
|
|
597
|
+
Attribution is an HTML `<div>` overlay positioned absolutely outside the SVG
|
|
598
|
+
plane — it doesn't fit naturally as a SceneNode in the chart scene graph.
|
|
599
|
+
Rather than encode an HTML overlay into the scene graph, this feature runs
|
|
600
|
+
the DOM-creating side effect imperatively from inside `layout()`, so
|
|
601
|
+
invocation is funneled through `runLayout` for consistency with the
|
|
602
|
+
other features. It claims zero margin and emits no panel.
|
|
603
|
+
*/ export var attributionFeature = {
|
|
604
|
+
name: "attribution",
|
|
605
|
+
configFields: [
|
|
606
|
+
"attribution",
|
|
607
|
+
"attributionStyle"
|
|
608
|
+
],
|
|
609
|
+
layout: function layout(param) {
|
|
610
|
+
var viz = param.viz;
|
|
611
|
+
var attr = select(viz._select.node().parentNode).selectAll("div.d3plus-attribution").data(viz.schema.attribution ? [
|
|
612
|
+
0
|
|
613
|
+
] : []);
|
|
614
|
+
var attrEnter = attr.enter().append("div").attr("class", "d3plus-attribution");
|
|
615
|
+
attr.exit().remove();
|
|
616
|
+
attr = attr.merge(attrEnter).style("position", "absolute").html(viz.schema.attribution).style("right", "".concat(viz._margin.right, "px")).style("bottom", "".concat(viz._margin.bottom, "px")).call(stylize, viz.schema.attributionStyle);
|
|
617
|
+
return {
|
|
618
|
+
panel: null,
|
|
619
|
+
margin: {}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/
|
|
625
|
+
subtitle: the text comes from `sum()` over the filtered data when `_total`
|
|
626
|
+
is a function, or from `sum(data.map(_size))` when `_total === true`.
|
|
627
|
+
*/ export var totalFeature = {
|
|
628
|
+
name: "total",
|
|
629
|
+
configFields: [
|
|
630
|
+
"total",
|
|
631
|
+
"totalConfig",
|
|
632
|
+
"totalFormat",
|
|
633
|
+
"totalPadding"
|
|
634
|
+
],
|
|
635
|
+
layout: function layout(ctx) {
|
|
636
|
+
return textBlockLayout(ctx, {
|
|
637
|
+
panelKey: "viz-total",
|
|
638
|
+
getText: function getText(viz) {
|
|
639
|
+
var data = viz._filteredData || [];
|
|
640
|
+
var total = typeof viz.schema.total === "function" ? sum(data.map(viz.schema.total)) : viz.schema.total === true && viz._size ? sum(data.map(viz._size)) : false;
|
|
641
|
+
return total ? viz.schema.totalFormat(total) : false;
|
|
642
|
+
},
|
|
643
|
+
textClassKey: "_totalClass",
|
|
644
|
+
configKey: "totalConfig",
|
|
645
|
+
paddingMethod: "totalPadding"
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
//# sourceMappingURL=features.js.map
|