@d3plus/core 4.5.0 → 4.7.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 +3930 -2032
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/internal.js +11 -1
- package/es/internal.js.map +1 -1
- package/es/src/charts/BarChart/index.js +8 -1
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +5 -0
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/Chord/emit.js +55 -3
- package/es/src/charts/Chord/emit.js.map +1 -1
- package/es/src/charts/Chord/index.js +17 -0
- package/es/src/charts/Chord/index.js.map +1 -1
- package/es/src/charts/Geomap/applyLayout.js +20 -11
- package/es/src/charts/Geomap/applyLayout.js.map +1 -1
- package/es/src/charts/Geomap/index.js +8 -2
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/Histogram/binData.js +225 -0
- package/es/src/charts/Histogram/binData.js.map +1 -0
- package/es/src/charts/Histogram/index.js +271 -0
- package/es/src/charts/Histogram/index.js.map +1 -0
- package/es/src/charts/Matrix/emit.js +5 -4
- package/es/src/charts/Matrix/emit.js.map +1 -1
- package/es/src/charts/Network/applyLayout.js +52 -4
- package/es/src/charts/Network/applyLayout.js.map +1 -1
- package/es/src/charts/Network/emit.js +4 -4
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +10 -1
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +42 -7
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +15 -0
- package/es/src/charts/Pack/index.js.map +1 -1
- package/es/src/charts/Pie/applyLayout.js +20 -2
- package/es/src/charts/Pie/applyLayout.js.map +1 -1
- package/es/src/charts/Pie/emit.js +275 -35
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +48 -1
- package/es/src/charts/Pie/index.js.map +1 -1
- package/es/src/charts/Plot/discreteSpan.js +42 -0
- package/es/src/charts/Plot/discreteSpan.js.map +1 -0
- package/es/src/charts/Plot/draw.js +3 -1
- package/es/src/charts/Plot/draw.js.map +1 -1
- package/es/src/charts/Plot/index.js +143 -14
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/insetRegion.js +21 -0
- package/es/src/charts/Plot/insetRegion.js.map +1 -0
- package/es/src/charts/Plot/pipeline.js +47 -20
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/Plot/pipelineDomains.js +84 -8
- package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
- package/es/src/charts/Plot/shapeDefaults.js +3 -3
- package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
- package/es/src/charts/Plot/sharedHover.js +532 -0
- package/es/src/charts/Plot/sharedHover.js.map +1 -0
- package/es/src/charts/Plot/sharedHoverScene.js +230 -0
- package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
- package/es/src/charts/Plot/sharedTooltip.js +183 -0
- package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
- package/es/src/charts/Plot/stackShareLabels.js +137 -0
- package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
- package/es/src/charts/Plot/stackShareTooltip.js +31 -0
- package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
- package/es/src/charts/Plot/trendLines.js +469 -0
- package/es/src/charts/Plot/trendLines.js.map +1 -0
- package/es/src/charts/Plot/trendProjection.js +120 -0
- package/es/src/charts/Plot/trendProjection.js.map +1 -0
- package/es/src/charts/Plot/trendScene.js +234 -0
- package/es/src/charts/Plot/trendScene.js.map +1 -0
- package/es/src/charts/Plot/trendTooltip.js +222 -0
- package/es/src/charts/Plot/trendTooltip.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +34 -6
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +15 -2
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +4 -4
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +17 -1
- package/es/src/charts/RadialMatrix/index.js.map +1 -1
- package/es/src/charts/Rings/applyLayout.js +72 -116
- package/es/src/charts/Rings/applyLayout.js.map +1 -1
- package/es/src/charts/Rings/emit.js +2 -3
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +18 -3
- package/es/src/charts/Rings/index.js.map +1 -1
- package/es/src/charts/Rings/ringsSizing.js +189 -0
- package/es/src/charts/Rings/ringsSizing.js.map +1 -0
- package/es/src/charts/Sankey/index.js +2 -0
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/StackedArea/index.js +8 -1
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +2 -2
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +7 -3
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/emit.js +58 -6
- package/es/src/charts/Treemap/emit.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/definition/makeChart.js +14 -1
- package/es/src/charts/definition/makeChart.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +17 -2
- package/es/src/charts/drawSteps/backControl.js.map +1 -1
- package/es/src/charts/drawSteps/bottomRightControls.js +196 -0
- package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +292 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +34 -9
- package/es/src/charts/drawSteps/minimap.js.map +1 -1
- package/es/src/charts/drawSteps/searchControlsMarkup.js +15 -38
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControls.js +3 -0
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/events/click.legend.js +10 -5
- package/es/src/charts/events/click.legend.js.map +1 -1
- package/es/src/charts/events/click.shape.js +24 -1
- package/es/src/charts/events/click.shape.js.map +1 -1
- package/es/src/charts/events/mouseenter.js +3 -0
- package/es/src/charts/events/mouseenter.js.map +1 -1
- package/es/src/charts/events/mouseleave.js +3 -0
- package/es/src/charts/events/mouseleave.js.map +1 -1
- package/es/src/charts/events/mousemove.shape.js +10 -1
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/features/axes.js +4 -1
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/emitHelpers.js +43 -5
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/features.js +3 -104
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresColorScale.js +161 -0
- package/es/src/charts/features/featuresColorScale.js.map +1 -0
- package/es/src/charts/features/featuresLegend.js +155 -34
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/insetState.js +174 -0
- package/es/src/charts/features/insetState.js.map +1 -0
- package/es/src/charts/features/plotPaint.js +51 -24
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/sceneBounds.js +271 -0
- package/es/src/charts/features/sceneBounds.js.map +1 -0
- package/es/src/charts/features/shapeEmit.js +20 -2
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/features/tooltipSwatch.js +73 -0
- package/es/src/charts/features/tooltipSwatch.js.map +1 -0
- package/es/src/charts/index.js +1 -0
- package/es/src/charts/index.js.map +1 -1
- package/es/src/charts/pipeline/drillMorph.js +159 -0
- package/es/src/charts/pipeline/drillMorph.js.map +1 -0
- package/es/src/charts/pipeline/insetPlacement.js +406 -0
- package/es/src/charts/pipeline/insetPlacement.js.map +1 -0
- package/es/src/charts/pipeline/runChartDraw.js +35 -1
- package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
- package/es/src/charts/pipeline/runVizPipeline.js +22 -3
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +20 -0
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +82 -11
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +29 -1
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +25 -21
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/interactionOpacity.js +21 -13
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/linkGroup.js +386 -0
- package/es/src/charts/viz/linkGroup.js.map +1 -0
- package/es/src/charts/viz/ordinalColor.js +2 -2
- package/es/src/charts/viz/ordinalColor.js.map +1 -1
- package/es/src/charts/viz/sceneRows.js +33 -0
- package/es/src/charts/viz/sceneRows.js.map +1 -0
- package/es/src/charts/viz/vizDefaults.js +39 -15
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +54 -4
- package/es/src/charts/viz/vizRender.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/charts/viz/vizVisibility.js +145 -0
- package/es/src/charts/viz/vizVisibility.js.map +1 -0
- package/es/src/components/Axis/Axis.js +8 -8
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/Axis/AxisBottom.js +1 -1
- package/es/src/components/Axis/AxisBottom.js.map +1 -1
- package/es/src/components/Axis/AxisLeft.js +1 -1
- package/es/src/components/Axis/AxisLeft.js.map +1 -1
- package/es/src/components/Axis/AxisRight.js +1 -1
- package/es/src/components/Axis/AxisRight.js.map +1 -1
- package/es/src/components/Axis/AxisTop.js +1 -1
- package/es/src/components/Axis/AxisTop.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +13 -1
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
- package/es/src/components/ColorScale/ColorScale.js +11 -11
- package/es/src/components/ColorScale/ColorScale.js.map +1 -1
- package/es/src/components/ColorScale/colorScaleScale.js +22 -10
- package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
- package/es/src/components/Legend/Legend.js +8 -5
- package/es/src/components/Legend/Legend.js.map +1 -1
- package/es/src/components/Legend/legendConfig.js +3 -2
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/components/Legend/legendRender.js +70 -26
- package/es/src/components/Legend/legendRender.js.map +1 -1
- package/es/src/components/SizeLegend/SizeLegend.js +411 -0
- package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
- package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
- package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
- package/es/src/components/TextBox.js +1 -1
- package/es/src/components/TextBox.js.map +1 -1
- package/es/src/components/Timeline/timelineConfig.js +8 -4
- package/es/src/components/Timeline/timelineConfig.js.map +1 -1
- package/es/src/components/Timeline/timelineRender.js +1 -2
- package/es/src/components/Timeline/timelineRender.js.map +1 -1
- package/es/src/components/Tooltip.js +27 -7
- package/es/src/components/Tooltip.js.map +1 -1
- package/es/src/components/index.js +1 -0
- package/es/src/components/index.js.map +1 -1
- package/es/src/shapes/Bar.js +1 -1
- package/es/src/shapes/Bar.js.map +1 -1
- package/es/src/shapes/Box.js +5 -3
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Rect.js +1 -1
- package/es/src/shapes/Rect.js.map +1 -1
- package/es/src/shapes/Shape.js +10 -37
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +4 -3
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/textureKey.js +104 -0
- package/es/src/shapes/textureKey.js.map +1 -0
- package/es/src/shapes/validateShapeConfig.js +141 -0
- package/es/src/shapes/validateShapeConfig.js.map +1 -0
- package/es/src/utils/BaseClass.js +134 -4
- package/es/src/utils/BaseClass.js.map +1 -1
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/es/src/utils/configDefault.js +17 -0
- package/es/src/utils/configDefault.js.map +1 -0
- package/es/src/utils/configPrep.js +2 -1
- package/es/src/utils/configPrep.js.map +1 -1
- package/es/src/utils/configWarnings.js +37 -0
- package/es/src/utils/configWarnings.js.map +1 -0
- package/es/src/utils/index.js +1 -0
- package/es/src/utils/index.js.map +1 -1
- package/package.json +12 -10
- package/types/index.d.ts +5 -4
- package/types/internal.d.ts +15 -1
- package/types/src/charts/BarChart/index.d.ts +2 -1
- package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
- package/types/src/charts/Histogram/binData.d.ts +37 -0
- package/types/src/charts/Histogram/index.d.ts +14 -0
- package/types/src/charts/Network/applyLayout.d.ts +8 -0
- package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
- package/types/src/charts/Plot/index.d.ts +47 -0
- package/types/src/charts/Plot/insetRegion.d.ts +4 -0
- package/types/src/charts/Plot/pipeline.d.ts +14 -0
- package/types/src/charts/Plot/sharedHover.d.ts +84 -0
- package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +36 -0
- package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
- package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
- package/types/src/charts/Plot/trendLines.d.ts +90 -0
- package/types/src/charts/Plot/trendProjection.d.ts +28 -0
- package/types/src/charts/Plot/trendScene.d.ts +19 -0
- package/types/src/charts/Plot/trendTooltip.d.ts +30 -0
- package/types/src/charts/Rings/applyLayout.d.ts +9 -0
- package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
- package/types/src/charts/StackedArea/index.d.ts +2 -1
- package/types/src/charts/definition/ChartDefinition.d.ts +39 -0
- package/types/src/charts/definition/makeChart.d.ts +2 -1
- package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
- package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +110 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +7 -5
- package/types/src/charts/features/emitHelpers.d.ts +18 -4
- package/types/src/charts/features/features.d.ts +1 -8
- package/types/src/charts/features/featuresColorScale.d.ts +24 -0
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/insetState.d.ts +95 -0
- package/types/src/charts/features/plotPaint.d.ts +25 -0
- package/types/src/charts/features/sceneBounds.d.ts +18 -0
- package/types/src/charts/features/tooltipSwatch.d.ts +31 -0
- package/types/src/charts/index.d.ts +1 -0
- package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
- package/types/src/charts/pipeline/insetPlacement.d.ts +45 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +10 -1
- package/types/src/charts/viz/Viz.d.ts +27 -2
- package/types/src/charts/viz/VizBase.d.ts +13 -0
- package/types/src/charts/viz/VizBaseConfig.d.ts +11 -11
- package/types/src/charts/viz/linkGroup.d.ts +96 -0
- package/types/src/charts/viz/sceneRows.d.ts +13 -0
- package/types/src/charts/viz/vizTypes.d.ts +164 -3
- package/types/src/charts/viz/vizVisibility.d.ts +34 -0
- package/types/src/components/Axis/AxisBottom.d.ts +1 -1
- package/types/src/components/Axis/AxisLeft.d.ts +1 -1
- package/types/src/components/Axis/AxisRight.d.ts +1 -1
- package/types/src/components/Axis/AxisTop.d.ts +1 -1
- package/types/src/components/ColorScale/ColorScale.d.ts +4 -4
- package/types/src/components/Legend/legendRender.d.ts +9 -3
- package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
- package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
- package/types/src/components/TextBox.d.ts +1 -1
- package/types/src/components/Tooltip.d.ts +18 -3
- package/types/src/components/index.d.ts +1 -0
- package/types/src/shapes/Bar.d.ts +1 -1
- package/types/src/shapes/Box.d.ts +1 -1
- package/types/src/shapes/Rect.d.ts +1 -1
- package/types/src/shapes/Whisker.d.ts +1 -1
- package/types/src/shapes/textureKey.d.ts +9 -0
- package/types/src/shapes/validateShapeConfig.d.ts +10 -0
- package/types/src/utils/BaseClass.d.ts +15 -1
- package/types/src/utils/D3plusConfig.d.ts +139 -0
- package/types/src/utils/configDefault.d.ts +11 -0
- package/types/src/utils/configWarnings.d.ts +28 -0
- package/types/src/utils/index.d.ts +2 -1
- package/umd/d3plus-core.full.js +9325 -3024
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +3348 -1727
- package/umd/d3plus-core.js +5412 -831
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +2199 -948
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InsetRegion } from "../features/insetState.js";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
/** The plot area in surface coordinates, with its marks (not its axes) as obstacles; null before layout. */
|
|
4
|
+
export declare function plotInsetRegion(viz: VizInstance): InsetRegion | null;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { ChartDefinition } from "../definition/ChartDefinition.js";
|
|
2
2
|
import type { TransformStage } from "../pipeline/stages.js";
|
|
3
|
+
import type { D3Scale } from "../../utils/index.js";
|
|
4
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
3
5
|
export { computePlotInitialDomains } from "./pipelineDomains.js";
|
|
4
6
|
export { measurePlotLineLabels } from "./pipelineLineLabels.js";
|
|
7
|
+
/**
|
|
8
|
+
The bubble radius scale: `sizeScale` over the extent of `sizes`, ranging
|
|
9
|
+
from `sizeMin` (capped at half of `sizeMax`) to `sizeMax`. A single-value
|
|
10
|
+
extent maps everything to `sizeMax`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function plotSizeScale(viz: Parameters<TransformStage>[0]["viz"], sizes: number[]): D3Scale;
|
|
13
|
+
/**
|
|
14
|
+
Plot's size-legend scale, available before layout: the same scale
|
|
15
|
+
`formatPlotData` builds, over the plottable rows. Null when there's no
|
|
16
|
+
`size` accessor or none of those rows draws as a circle.
|
|
17
|
+
*/
|
|
18
|
+
export declare function plotSizeLegendScale(viz: Parameters<TransformStage>[0]["viz"]): SizeLegendScale | null;
|
|
5
19
|
/**
|
|
6
20
|
`formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
|
|
7
21
|
time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Shared multi-series tooltip + crosshair for Plot charts (#779): while the
|
|
3
|
+
pointer is over the plot area, snap to the nearest discrete-axis position
|
|
4
|
+
and list every series' value there in one tooltip, with a guide line drawn
|
|
5
|
+
through that position.
|
|
6
|
+
*/
|
|
7
|
+
import type { DataPoint } from "@d3plus/data";
|
|
8
|
+
import type { InteractionPoint, SceneEvent, SceneNode } from "@d3plus/render";
|
|
9
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
10
|
+
/** One series' entry in the shared tooltip. */
|
|
11
|
+
export interface SharedRow {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
value: number;
|
|
15
|
+
color?: string;
|
|
16
|
+
/** The mark's shape type, which picks the row's swatch (dot vs. square). */
|
|
17
|
+
shape?: string;
|
|
18
|
+
datum: DataPoint;
|
|
19
|
+
index: number;
|
|
20
|
+
/** A trend line's projected value, not a plotted one: its band bounds, when drawn. */
|
|
21
|
+
projected?: {
|
|
22
|
+
lci?: number;
|
|
23
|
+
hci?: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
The resolved shared hover: the snapped discrete position (pixel + data
|
|
28
|
+
value) and its rows. `stack` holds the column's stacked-bar rows
|
|
29
|
+
(highlighted together) and every stacked-bar row in the chart, when the
|
|
30
|
+
column has bars; `markers` the column's Line points; `layer` puts the
|
|
31
|
+
crosshair in front of the marks when the chart has areas, else behind.
|
|
32
|
+
*/
|
|
33
|
+
export interface SharedHover {
|
|
34
|
+
/** "shared": every series at the column; "single": one hovered mark. */
|
|
35
|
+
mode: "shared" | "single";
|
|
36
|
+
axis: "x" | "y";
|
|
37
|
+
px: number;
|
|
38
|
+
value: unknown;
|
|
39
|
+
rows: SharedRow[];
|
|
40
|
+
markers: {
|
|
41
|
+
datum: DataPoint;
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
}[];
|
|
45
|
+
layer: "back" | "front";
|
|
46
|
+
stack?: {
|
|
47
|
+
rows: Set<DataPoint>;
|
|
48
|
+
bars: Set<DataPoint>;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export type ShapeNode = SceneNode & {
|
|
52
|
+
shapeType?: string;
|
|
53
|
+
interactionGroup?: string;
|
|
54
|
+
interactionPoints?: InteractionPoint[];
|
|
55
|
+
interactive?: boolean;
|
|
56
|
+
datum?: DataPoint;
|
|
57
|
+
paint?: {
|
|
58
|
+
stroke?: unknown;
|
|
59
|
+
fill?: unknown;
|
|
60
|
+
};
|
|
61
|
+
children?: SceneNode[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
Converts a surface-local pointer position into chart content space: undoes
|
|
65
|
+
the `viz-zoom` group's `_zoomTransform`, then the `viz-chart-body` group's
|
|
66
|
+
`_chartTransform`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function contentPoint(viz: VizInstance, point: [number, number]): [number, number];
|
|
69
|
+
/**
|
|
70
|
+
Whether a scene node is a data mark the shared tooltip reads: Line/Area
|
|
71
|
+
series and other single marks, but Bars only when stacked (side-by-side
|
|
72
|
+
bars keep the single-bar tooltip).
|
|
73
|
+
*/
|
|
74
|
+
export declare function sharedMark(viz: VizInstance, node: ShapeNode): boolean;
|
|
75
|
+
/** Whether the chart scene holds any mark the shared tooltip reads. */
|
|
76
|
+
export declare function hasSharedMarks(viz: VizInstance): boolean;
|
|
77
|
+
/**
|
|
78
|
+
Plot's `_sharedHover`: snaps the tooltip to the hovered discrete position
|
|
79
|
+
(see `resolveHover`), hiding its arrow and drawing a crosshair through it —
|
|
80
|
+
one tooltip for every series ("shared"), or the hovered mark's x/y values
|
|
81
|
+
("single"). Replaces the default shape tooltip while active; clears on
|
|
82
|
+
leaving the plot area (or the mark) or the chart.
|
|
83
|
+
*/
|
|
84
|
+
export declare function handleSharedHover(viz: VizInstance, event: SceneEvent): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Scene } from "@d3plus/render";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
Adds the snapped hover's scene nodes to the chart body group (content
|
|
5
|
+
space, so they track zoom): with `tooltipShared`, a transparent hover
|
|
6
|
+
surface behind the marks, so the SVG backend receives pointer events over
|
|
7
|
+
empty plot space; and — while a hover is active — the crosshair and the
|
|
8
|
+
hovered Line markers, inside the zoom-clipped plot content when the chart
|
|
9
|
+
is zoomable.
|
|
10
|
+
*/
|
|
11
|
+
export declare function appendSharedHoverNodes(viz: VizInstance, scene: Scene): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SceneEvent } from "@d3plus/render";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
import type { SharedHover } from "./sharedHover.js";
|
|
4
|
+
type Axis = "x" | "y";
|
|
5
|
+
/** An axis's display name: its configured title, else its data key. */
|
|
6
|
+
export declare function axisName(viz: VizInstance, k: Axis): string;
|
|
7
|
+
/**
|
|
8
|
+
Formats a value for an axis: the axis's `tickFormat` when set, else dates
|
|
9
|
+
through d3plus's date formatter, continuous-axis numbers abbreviated, and
|
|
10
|
+
anything else (e.g. a numeric year on the discrete axis) as-is.
|
|
11
|
+
*/
|
|
12
|
+
export declare function axisValue(viz: VizInstance, k: Axis, value: unknown): string;
|
|
13
|
+
/**
|
|
14
|
+
Holds the tooltip's own arrow/thead/tbody to restore once the snapped
|
|
15
|
+
hover ends (see `restoreTooltip`), so the next legend or default tooltip
|
|
16
|
+
isn't left with these rows — and resets thead/tbody to them before each
|
|
17
|
+
render so rows never accumulate.
|
|
18
|
+
*/
|
|
19
|
+
export declare function prepareTooltip(viz: VizInstance): any;
|
|
20
|
+
/** Puts back what `prepareTooltip` held. */
|
|
21
|
+
export declare function restoreTooltip(viz: VizInstance): void;
|
|
22
|
+
/**
|
|
23
|
+
The shared tooltip: title from the continuous axis, a header row naming
|
|
24
|
+
the hovered discrete value, then one `[name, value]` row per series, the
|
|
25
|
+
name led by a swatch in its series stroke. User `tooltipConfig` styles
|
|
26
|
+
apply first; the shared title/rows win.
|
|
27
|
+
*/
|
|
28
|
+
export declare function renderSharedTooltip(viz: VizInstance, hover: SharedHover, event: SceneEvent): void;
|
|
29
|
+
/**
|
|
30
|
+
The single-mark tooltip (one series, `tooltipShared(false)`, or a
|
|
31
|
+
side-by-side bar): the default title (the mark's label, unless
|
|
32
|
+
`tooltipConfig` sets one), its x and y values, then any rows the chart's
|
|
33
|
+
`tooltipConfig` adds.
|
|
34
|
+
*/
|
|
35
|
+
export declare function renderSingleTooltip(viz: VizInstance, hover: SharedHover, event: SceneEvent): void;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Shape } from "../../shapes/index.js";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
/** A label bounds box, as returned by a shape's `labelBounds`. */
|
|
4
|
+
interface Box {
|
|
5
|
+
height: number;
|
|
6
|
+
width: number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
Splits a label box into a name box and a share band beneath it. Their
|
|
12
|
+
padding overlaps so the bottom-aligned name and top-aligned share meet at
|
|
13
|
+
one line. Returns null when the box is too short to split.
|
|
14
|
+
*/
|
|
15
|
+
export declare function splitShareBox(b: Box, padding: number): [Box, Box] | null;
|
|
16
|
+
/**
|
|
17
|
+
Adds a share line to each stacked Bar label on `s`. Labels a user
|
|
18
|
+
already returns as an array (their own multi-line layout) are left alone.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyStackShareLabels(viz: VizInstance, s: Shape): void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
A `tooltipConfig` default whose `tbody` resolves per hover, so the Share
|
|
5
|
+
row only appears while the chart is stacked.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stackShareTooltipConfig(viz: VizInstance): {
|
|
8
|
+
tbody: () => ((() => any) | ((_d: DataPoint, _i: number, x: Record<string, unknown>) => string))[][];
|
|
9
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { RegressionResult, RegressionType } from "@d3plus/math";
|
|
3
|
+
import type { TransformStage } from "../pipeline/stages.js";
|
|
4
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
5
|
+
type Row = Record<string, unknown>;
|
|
6
|
+
type Axis = "x" | "y";
|
|
7
|
+
/** The regression types `trendLine` accepts. */
|
|
8
|
+
export declare const trendTypes: RegressionType[];
|
|
9
|
+
/** One point along a fitted trend line, in plot data space. */
|
|
10
|
+
export interface TrendSample {
|
|
11
|
+
x: unknown;
|
|
12
|
+
y: unknown;
|
|
13
|
+
/** Lower confidence bound on the dependent axis. */
|
|
14
|
+
lci?: number;
|
|
15
|
+
/** Upper confidence bound on the dependent axis. */
|
|
16
|
+
hci?: number;
|
|
17
|
+
/** Whether the point lies in the projection past the fitted data. */
|
|
18
|
+
projected?: boolean;
|
|
19
|
+
/** Whether the point sits on one of the projection's axis positions (the ones hover snaps to). */
|
|
20
|
+
step?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** A fitted trend line, ready to paint. */
|
|
23
|
+
export interface TrendFit {
|
|
24
|
+
/** Stable key: the series id, or "all". */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Tooltip title: the series label, or the translated "Trend Line". */
|
|
27
|
+
label: string;
|
|
28
|
+
/** Line stroke (and band fill). */
|
|
29
|
+
color: string;
|
|
30
|
+
/** The independent axis the fit runs along. */
|
|
31
|
+
axis: Axis;
|
|
32
|
+
fit: RegressionResult;
|
|
33
|
+
samples: TrendSample[];
|
|
34
|
+
/** A source row of the series, so hover dimming treats the line as part of it. */
|
|
35
|
+
row?: DataPoint;
|
|
36
|
+
}
|
|
37
|
+
/** The values `trendLine` accepts: a regression type, `true` (linear), or `false` (off). */
|
|
38
|
+
export type TrendLineType = boolean | RegressionType;
|
|
39
|
+
/** The default `trendLineConfig`. */
|
|
40
|
+
export declare function trendLineDefaults(): Record<string, unknown>;
|
|
41
|
+
/** Resolves the `trendLine` setting to a regression type, or null when off. */
|
|
42
|
+
export declare function resolveTrendType(value: unknown): RegressionType | null;
|
|
43
|
+
/**
|
|
44
|
+
The axis a trend line runs along: the discrete axis when one is set (so a
|
|
45
|
+
horizontal bar chart fits along y), otherwise x.
|
|
46
|
+
*/
|
|
47
|
+
export declare function trendAxis(discrete: unknown): Axis;
|
|
48
|
+
/**
|
|
49
|
+
Maps independent-axis values to numbers for fitting, and back again for
|
|
50
|
+
plotting: Dates by timestamp, numbers as-is, and anything else (category
|
|
51
|
+
names) by its position in the axis's ordered values.
|
|
52
|
+
*/
|
|
53
|
+
export declare function trendNumberScale(order: unknown[]): {
|
|
54
|
+
toNumber: (v: unknown) => number;
|
|
55
|
+
fromNumber: (n: number) => unknown;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
The independent-axis positions to sample a fit at, within its extent: one
|
|
59
|
+
per category on a point scale (in-between positions can't be placed), or
|
|
60
|
+
evenly spaced points on a continuous axis.
|
|
61
|
+
*/
|
|
62
|
+
export declare function trendSamplePositions(extent: [number, number], categories: number[] | null, count?: number): number[];
|
|
63
|
+
/**
|
|
64
|
+
The independent-axis positions to sample a fit's projection at, past the
|
|
65
|
+
end of its data: each projected category on a point scale, or on a
|
|
66
|
+
continuous axis evenly spaced points (as dense as the fitted stretch)
|
|
67
|
+
together with every projected step. The first position is the fit's last
|
|
68
|
+
value, where the projection starts.
|
|
69
|
+
@param extent The fit's `[min, max]` independent values.
|
|
70
|
+
@param steps The axis positions the projection passes through, as numbers.
|
|
71
|
+
@param categories The point scale's positions, or null on a continuous axis.
|
|
72
|
+
*/
|
|
73
|
+
export declare function trendProjectionPositions(extent: [number, number], steps: number[], categories: number[] | null): number[];
|
|
74
|
+
/**
|
|
75
|
+
Fits the trend lines for the current data; empty when `trendLine` is off.
|
|
76
|
+
`projected` lists future independent-axis positions (from
|
|
77
|
+
`projectionPositions`) each line extends to, past the end of its data.
|
|
78
|
+
*/
|
|
79
|
+
export declare function computeTrendFits(viz: VizInstance, rows: Row[], order: unknown[], projected?: unknown[]): TrendFit[];
|
|
80
|
+
/** The dependent-axis values a set of fits plots, including band bounds. */
|
|
81
|
+
export declare function trendDomainValues(fits: TrendFit[]): number[];
|
|
82
|
+
/**
|
|
83
|
+
`computePlotTrendFits` — runs after `computePlotAxisValues`: fits the
|
|
84
|
+
trend lines onto `viz._trendFits` and appends their values to the
|
|
85
|
+
dependent axis's values, so the non-stacked domain covers them (the
|
|
86
|
+
stacked domain reads `viz._trendFits` directly). A projection's future
|
|
87
|
+
positions join the independent axis's values, widening it to fit.
|
|
88
|
+
*/
|
|
89
|
+
export declare const computePlotTrendFits: TransformStage;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The `projection` setting: a number of steps past the last value, or an
|
|
3
|
+
end value to step up to (a number, or on a time axis a Date or anything
|
|
4
|
+
`date` parses, such as a year).
|
|
5
|
+
*/
|
|
6
|
+
export type TrendProjection = number | {
|
|
7
|
+
to: number | string | Date;
|
|
8
|
+
};
|
|
9
|
+
/** Steps `k` intervals past a value along the independent axis. */
|
|
10
|
+
export type TrendOffset = (value: unknown, k: number) => unknown;
|
|
11
|
+
/**
|
|
12
|
+
How to step along an independent axis: numbers by the median gap between
|
|
13
|
+
distinct values; dates by the coarsest calendar interval every date lands
|
|
14
|
+
on (years, months, days, …) times the median number of those intervals
|
|
15
|
+
between dates, falling back to the median gap in milliseconds. Null for a
|
|
16
|
+
category axis or fewer than two distinct values.
|
|
17
|
+
@param order The independent axis's values.
|
|
18
|
+
*/
|
|
19
|
+
export declare function trendStep(order: unknown[]): TrendOffset | null;
|
|
20
|
+
/**
|
|
21
|
+
The future independent-axis positions a projection adds after the last
|
|
22
|
+
value of `order`: `projection` steps, or every step up to and including
|
|
23
|
+
`projection.to`. Empty when off, on a category axis, or when the end
|
|
24
|
+
isn't past the last value.
|
|
25
|
+
@param order The independent axis's values.
|
|
26
|
+
@param projection The `trendLineConfig.projection` setting.
|
|
27
|
+
*/
|
|
28
|
+
export declare function projectionPositions(order: unknown[], projection: unknown): unknown[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Paints the fitted trend lines (`viz._trendFits`) behind the plot's marks:
|
|
3
|
+
per fit, an optional confidence band and the line itself (plus its
|
|
4
|
+
projection past the data, styled by `projectionConfig`), in one
|
|
5
|
+
stably-keyed group so frames tween rather than re-enter.
|
|
6
|
+
*/
|
|
7
|
+
import type { SceneNode } from "@d3plus/render";
|
|
8
|
+
import type { PlotAxisFn } from "../features/plotPaint.js";
|
|
9
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
10
|
+
import type { TrendFit } from "./trendLines.js";
|
|
11
|
+
/** Scene-node fields the trend line stamps for hover routing. */
|
|
12
|
+
export type TrendNode = SceneNode & {
|
|
13
|
+
interactive?: boolean;
|
|
14
|
+
interactionGroup?: string;
|
|
15
|
+
trendFit?: TrendFit;
|
|
16
|
+
children?: SceneNode[];
|
|
17
|
+
};
|
|
18
|
+
/** The scene groups for every fitted trend line, painted behind the marks. */
|
|
19
|
+
export declare function emitTrendLines(viz: VizInstance, x: PlotAxisFn, y: PlotAxisFn): SceneNode[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RegressionResult } from "@d3plus/math";
|
|
2
|
+
import type { SceneEvent } from "@d3plus/render";
|
|
3
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
4
|
+
import type { TrendFit, TrendSample } from "./trendLines.js";
|
|
5
|
+
/** Display names for each regression type, as translation keys. */
|
|
6
|
+
export declare const trendTypeNames: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
The fitted equation as display text, e.g. `y = 1.24x + 3.41k` or
|
|
9
|
+
`y = 2e^(0.3x)`. `x` and `y` name the independent and dependent axes, and
|
|
10
|
+
swap for a fit along the y axis (a horizontal chart).
|
|
11
|
+
@param fit The regression result.
|
|
12
|
+
@param format Formats each coefficient.
|
|
13
|
+
@param axis The independent axis the fit runs along.
|
|
14
|
+
*/
|
|
15
|
+
export declare function trendEquation(fit: Pick<RegressionResult, "type" | "coefficients">, format?: (n: number) => string, axis?: "x" | "y"): string;
|
|
16
|
+
/**
|
|
17
|
+
The tooltip rows for a fit: type, equation, R², and observations. Given a
|
|
18
|
+
projected sample, it leads with that projection: its independent-axis
|
|
19
|
+
value (marked "Projected") and its predicted value, with the band's
|
|
20
|
+
bounds when drawn.
|
|
21
|
+
*/
|
|
22
|
+
export declare function trendTooltipRows(viz: VizInstance, trend: TrendFit, sample?: TrendSample): string[][];
|
|
23
|
+
/**
|
|
24
|
+
The projected step nearest a content-space pointer along the fit's
|
|
25
|
+
independent axis, when the pointer is over the projection; undefined over
|
|
26
|
+
the fitted stretch (or for a fit with no projection).
|
|
27
|
+
*/
|
|
28
|
+
export declare function nearestProjectedSample(viz: VizInstance, trend: TrendFit, cursor: [number, number]): TrendSample | undefined;
|
|
29
|
+
/** Renders the trend tooltip at the pointer, leading with the nearest projected value when over the projection. */
|
|
30
|
+
export declare function renderTrendTooltip(viz: VizInstance, trend: TrendFit, event: SceneEvent, cursor?: [number, number]): void;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import type { TransformStage } from "../pipeline/stages.js";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
4
|
+
/**
|
|
5
|
+
Rings' size-legend scale for a chart area of `width` × `height`: places a
|
|
6
|
+
scratch copy of the node graph exactly as the layout does and returns the
|
|
7
|
+
radius scale it sized with. The ring geometry only shrinks as the area
|
|
8
|
+
does, so the layout's final radii never exceed this estimate's.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ringsSizeLegendScale(v: VizInstance, width: number, height: number): SizeLegendScale | null;
|
|
2
11
|
export declare const applyRingsLayout: TransformStage;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
4
|
+
/** The fields of a laid-out Rings node that sizing reads and writes. */
|
|
5
|
+
interface SizedNode {
|
|
6
|
+
data: DataPoint;
|
|
7
|
+
i: number;
|
|
8
|
+
r?: number;
|
|
9
|
+
ring?: 1 | 2;
|
|
10
|
+
size?: number;
|
|
11
|
+
}
|
|
12
|
+
type RadiusScale = SizeLegendScale & ((n: number) => number);
|
|
13
|
+
/** Ring geometry derived from the chart bounds. */
|
|
14
|
+
export interface RingGeometry {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
ringWidth: number;
|
|
18
|
+
primaryRing: number;
|
|
19
|
+
secondaryRing: number;
|
|
20
|
+
}
|
|
21
|
+
/** Ring geometry for a chart area: the center plus two rings, each a third of the radius apart. */
|
|
22
|
+
export declare function ringsGeometry(width: number, height: number): RingGeometry;
|
|
23
|
+
/**
|
|
24
|
+
Assigns each ring node its `ring` + `r`, and `center.r`. Sized charts
|
|
25
|
+
(`size` set) run every node, center included, through one
|
|
26
|
+
`ringsSizeScale`, and return it; unsized charts use the fixed ring radii
|
|
27
|
+
and return null.
|
|
28
|
+
*/
|
|
29
|
+
export declare function sizeRingsNodes(v: VizInstance, center: SizedNode, geom: RingGeometry, slots: number, primaries: SizedNode[], secondaries: SizedNode[]): RadiusScale | null;
|
|
30
|
+
/**
|
|
31
|
+
Where the center node's label goes. Unsized, the center circle is always
|
|
32
|
+
large, so the label fills the inner ring's square as before. Sized, the
|
|
33
|
+
center can be small: the label goes inside only if its longest word fits
|
|
34
|
+
the circle's inscribed square at a legible size; otherwise it sits below
|
|
35
|
+
the circle (`inside: false`), where it reads against the background
|
|
36
|
+
rather than the circle's fill.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ringsCenterLabel(v: VizInstance, center: SizedNode & {
|
|
39
|
+
r?: number;
|
|
40
|
+
}, geom: RingGeometry, text: string, fontFamily: string | string[]): {
|
|
41
|
+
bounds: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
};
|
|
47
|
+
inside: boolean;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import type { ChartDefinition } from "../definition/ChartDefinition.js";
|
|
5
5
|
export declare const stackedAreaDef: ChartDefinition;
|
|
6
6
|
/**
|
|
7
|
-
Creates a stacked area plot based on an array of data.
|
|
7
|
+
Creates a stacked area plot based on an array of data. Each point's
|
|
8
|
+
fraction of its stack total is available to tooltip accessors as `share`.
|
|
8
9
|
*/
|
|
9
10
|
declare const _default: new () => any;
|
|
10
11
|
export default _default;
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
import type { DataPoint } from "@d3plus/data";
|
|
10
10
|
import type { SceneNode } from "@d3plus/render";
|
|
11
11
|
import type { FeatureModule } from "../features/features.js";
|
|
12
|
+
import type { InsetRegion } from "../features/insetState.js";
|
|
12
13
|
import type { TransformStage, VizContext } from "../pipeline/stages.js";
|
|
13
14
|
import type { VizInstance } from "../viz/vizTypes.js";
|
|
15
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
14
16
|
interface ChartDefinitionBase {
|
|
15
17
|
/** Stable name for tagging and class generation. */
|
|
16
18
|
name: string;
|
|
@@ -32,6 +34,27 @@ interface ChartDefinitionBase {
|
|
|
32
34
|
`runChartDraw` — the chart relies on its parent's `_draw` only.
|
|
33
35
|
*/
|
|
34
36
|
layoutStage?: TransformStage;
|
|
37
|
+
/**
|
|
38
|
+
Optional size-legend scale, called before layout so the bottom-right
|
|
39
|
+
corner panel can reserve room: the value → pixel-radius scale the chart
|
|
40
|
+
will draw with, for a chart area of `available` px (the area before the
|
|
41
|
+
legend's own reservation, so any area-dependent radius only shrinks
|
|
42
|
+
from here). Return null when nothing is sized. The chart's layout
|
|
43
|
+
stores the scale it actually drew with on `viz._sizeLegendFinal`, which
|
|
44
|
+
is what the legend paints.
|
|
45
|
+
*/
|
|
46
|
+
sizeLegendScale?: (viz: VizInstance, available: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
}) => SizeLegendScale | null;
|
|
50
|
+
/**
|
|
51
|
+
Optional region for drawing chart chrome (the size legend, legend, or
|
|
52
|
+
colorScale) inside the chart's negative space, called after layout:
|
|
53
|
+
the area chrome may occupy plus the boxes of the chart's marks, in
|
|
54
|
+
surface coordinates (see `sceneInsetRegion`). Return null when the
|
|
55
|
+
chart has no room to offer.
|
|
56
|
+
*/
|
|
57
|
+
insetRegion?: (viz: VizInstance) => InsetRegion | null;
|
|
35
58
|
/** Optional pure threshold algorithm (replaces `Viz._thresholdFunction`). */
|
|
36
59
|
thresholdFunction?: (viz: VizInstance, data: unknown[]) => unknown[];
|
|
37
60
|
/**
|
|
@@ -50,6 +73,22 @@ interface ChartDefinitionBase {
|
|
|
50
73
|
without one are clipped to the chart area.
|
|
51
74
|
*/
|
|
52
75
|
chartClip?: (viz: VizInstance) => import("@d3plus/render").ClipShape | undefined;
|
|
76
|
+
/**
|
|
77
|
+
Optional chart-specific "local body rect" — the box the drill-down morph
|
|
78
|
+
transition (`enterFrom`/`exitTo`) measures its fractions against. Read
|
|
79
|
+
directly off `def` by `runChartDraw` (same pattern as `chartClip`), after
|
|
80
|
+
the layout stage runs. Default: the margin-adjusted chart area at local
|
|
81
|
+
origin (0,0), i.e. `{x: 0, y: 0, ...chartBounds(viz)}` — correct for any
|
|
82
|
+
chart whose emitted nodes sit inside the `chartTransform`-wrapped body
|
|
83
|
+
group at that same local origin (Treemap; Pack overrides this, since its
|
|
84
|
+
body is a diameter-sized square, not the full chart area).
|
|
85
|
+
*/
|
|
86
|
+
chartBodyRect?: (viz: VizInstance) => {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
};
|
|
53
92
|
/**
|
|
54
93
|
Imperative per-instance setup hook — runs once after `applyDefinition`
|
|
55
94
|
seeds the chart. Use for event handler overrides and shadowed methods
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
The class is identical for every chart: its constructor runs
|
|
6
6
|
`applyDefinition(this, def)`, its `_draw` runs the shared Viz pipeline
|
|
7
7
|
then the chart's own layout stage via `runChartDraw`, and its
|
|
8
|
-
`_thresholdFunction`
|
|
8
|
+
`_thresholdFunction` / `_sizeLegendScale` / `_insetRegion` delegate to
|
|
9
|
+
`def.thresholdFunction` / `def.sizeLegendScale` / `def.insetRegion` if present.
|
|
9
10
|
|
|
10
11
|
A chart's `index.ts` becomes literally `export default makeChart(def)`.
|
|
11
12
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FeatureModule } from "../features/features.js";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
import type { BottomRightContribution } from "./bottomRightControlsMarkup.js";
|
|
4
|
+
/** The chart area a contribution may size itself against, before layout. */
|
|
5
|
+
export interface BottomRightAvailable {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
The size legend's contribution: sized from the chart's pre-layout scale
|
|
11
|
+
estimate, painted from the scale the chart's layout actually drew with.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sizeLegendContribution(viz: VizInstance, available: BottomRightAvailable): BottomRightContribution | null;
|
|
14
|
+
/**
|
|
15
|
+
Ordered contributors to the bottom-right panel, right to left.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BOTTOM_RIGHT_CONTRIBUTORS: Array<(viz: VizInstance, available: BottomRightAvailable) => BottomRightContribution | null>;
|
|
18
|
+
/**
|
|
19
|
+
Measures the panel for this draw and stores it on `viz._bottomRightBox`
|
|
20
|
+
(null when nothing contributes). `bottom` is how far above the chart's
|
|
21
|
+
bottom edge the panel sits (below it: the timeline); `available` is the
|
|
22
|
+
chart area left after the claims made so far. `sizeLegendPosition`
|
|
23
|
+
picks the margin it claims (see `BottomRightBox.side`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function reserveBottomRight(viz: VizInstance, bottom: number, available: BottomRightAvailable): void;
|
|
26
|
+
export declare const bottomRightControlsFeature: FeatureModule;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Layout for the bottom-right corner panel — the bottom-corner counterpart
|
|
3
|
+
of the top-right zoom-control panel. Its items (the size legend, today)
|
|
4
|
+
are scene nodes rather than HTML, so the panel exports with the chart.
|
|
5
|
+
|
|
6
|
+
The panel is measured before the chart lays out (`reserveBottomRight`,
|
|
7
|
+
called from `vizDrawPure`), and the result is stored on
|
|
8
|
+
`viz._bottomRightBox` so content sharing the bottom band (a bottom
|
|
9
|
+
legend or colorScale) can inset around it via `bottomRightControlsInset`,
|
|
10
|
+
and content in the right column can stop short of it via
|
|
11
|
+
`bottomRightControlsDrop`. It paints after the chart lays out
|
|
12
|
+
(`bottomRightControlsFeature`), from each item's final state.
|
|
13
|
+
|
|
14
|
+
Kept separate from `bottomRightControls.ts` (the `FeatureModule` + the
|
|
15
|
+
contributor list) so the legend/colorScale features can import the inset
|
|
16
|
+
helpers without depending on the contributors.
|
|
17
|
+
|
|
18
|
+
@module
|
|
19
|
+
*/
|
|
20
|
+
import type { SceneNode } from "@d3plus/render";
|
|
21
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
22
|
+
/**
|
|
23
|
+
One item's contribution to the bottom-right panel: its size as reserved
|
|
24
|
+
before layout, and a `paint` that builds its scene after layout (its
|
|
25
|
+
top-left at the origin) along with the size it actually drew at, which
|
|
26
|
+
must not exceed the reservation. `zoom` is the scale the chart's picture
|
|
27
|
+
is currently zoomed by (1 unzoomed; charts that zoom by rescaling axes,
|
|
28
|
+
like Plot, always paint at 1).
|
|
29
|
+
*/
|
|
30
|
+
export interface BottomRightContribution {
|
|
31
|
+
key: string;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
paint: (zoom: number) => {
|
|
35
|
+
node: SceneNode;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
} | null;
|
|
39
|
+
}
|
|
40
|
+
/** The measured panel, as stored on `viz._bottomRightBox`. */
|
|
41
|
+
export interface BottomRightBox {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
/** Offset of the panel's bottom edge from the chart's bottom edge (the timeline sits below it). */
|
|
45
|
+
bottom: number;
|
|
46
|
+
/**
|
|
47
|
+
The margin the panel claims: `"right"` widens the right margin so the
|
|
48
|
+
chart body ends left of it (it shares the right column, below any
|
|
49
|
+
right legend/colorScale); `"bottom"` deepens the bottom margin so the
|
|
50
|
+
body ends above it (bottom legends/colorScales sit beside it).
|
|
51
|
+
*/
|
|
52
|
+
side: "right" | "bottom";
|
|
53
|
+
/** Drawn inside the chart's negative space instead (see `pipeline/insetPlacement.ts`): claims no margin and nothing insets around it. */
|
|
54
|
+
inset?: boolean;
|
|
55
|
+
items: BottomRightContribution[];
|
|
56
|
+
}
|
|
57
|
+
/** Horizontal gap between items, and between the panel and content inset around it. */
|
|
58
|
+
export declare const BOTTOM_RIGHT_GAP = 6;
|
|
59
|
+
/** Lays contributions out in a row, right to left: the panel's total width and height. */
|
|
60
|
+
export declare function measureBottomRight(items: BottomRightContribution[]): {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
64
|
+
/** The panel reserved for this draw, or null when nothing is showing there. */
|
|
65
|
+
export declare function bottomRightControlsBox(viz: VizInstance): BottomRightBox | null;
|
|
66
|
+
/**
|
|
67
|
+
How far content in the bottom band must pull in its right edge to clear
|
|
68
|
+
the panel: content whose bottom edge sits `bottom` px above the chart's
|
|
69
|
+
bottom edge and whose right edge sits `right` px in from the chart's
|
|
70
|
+
right edge. Zero when nothing is showing or the content starts above the
|
|
71
|
+
panel.
|
|
72
|
+
*/
|
|
73
|
+
export declare function bottomRightControlsInset(viz: VizInstance, bottom: number, right: number): number;
|
|
74
|
+
/**
|
|
75
|
+
How much content in the right column, whose bottom edge sits `bottom` px
|
|
76
|
+
above the chart's bottom edge, must shorten to end above the panel. Zero
|
|
77
|
+
when nothing is showing.
|
|
78
|
+
*/
|
|
79
|
+
export declare function bottomRightControlsDrop(viz: VizInstance, bottom: number): number;
|
|
80
|
+
/**
|
|
81
|
+
How a legend or colorScale at `position` clears the panel: a bottom one
|
|
82
|
+
pulls its right edge in by `inset`, a left/right one shortens by `drop`.
|
|
83
|
+
`bottom`/`right` are its edges' distances from the chart's bottom/right.
|
|
84
|
+
*/
|
|
85
|
+
export declare function bottomRightClearance(viz: VizInstance, position: string | false, bottom: number, right: number): {
|
|
86
|
+
inset: number;
|
|
87
|
+
drop: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
How much taller the bottom margin must grow so the chart body, ending
|
|
91
|
+
`bottom` px above the chart's bottom edge, stays clear of a bottom-side
|
|
92
|
+
panel. Zero for a right-side panel.
|
|
93
|
+
*/
|
|
94
|
+
export declare function bottomRightControlsShortfall(viz: VizInstance, bottom: number): number;
|
|
95
|
+
/**
|
|
96
|
+
How much wider the right margin must grow so the chart body, ending
|
|
97
|
+
`right` px in from the chart's right edge, stays clear of a right-side
|
|
98
|
+
panel. Zero for a bottom-side panel.
|
|
99
|
+
*/
|
|
100
|
+
export declare function bottomRightControlsRightShortfall(viz: VizInstance, right: number): number;
|
|
101
|
+
/**
|
|
102
|
+
The panel's scene: each item painted from its final state, bottom-right
|
|
103
|
+
aligned in the slot it reserved. Null when nothing paints.
|
|
104
|
+
*/
|
|
105
|
+
export declare function buildBottomRightPanel(viz: VizInstance, box: BottomRightBox): SceneNode | null;
|
|
106
|
+
/**
|
|
107
|
+
Repaints the panel in place for the current zoom — called on every zoom
|
|
108
|
+
event, which repaints the scene without re-running the pipeline.
|
|
109
|
+
*/
|
|
110
|
+
export declare function refreshBottomRightPanel(viz: VizInstance): void;
|