@d3plus/core 4.3.0 → 4.6.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 +7406 -3676
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/internal.js +13 -2
- package/es/internal.js.map +1 -1
- package/es/src/charts/AreaPlot/index.js +1 -2
- package/es/src/charts/AreaPlot/index.js.map +1 -1
- package/es/src/charts/BarChart/index.js +9 -3
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +6 -2
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/BumpChart/index.js +1 -2
- package/es/src/charts/BumpChart/index.js.map +1 -1
- package/es/src/charts/Chord/applyLayout.js +205 -0
- package/es/src/charts/Chord/applyLayout.js.map +1 -0
- package/es/src/charts/Chord/emit.js +220 -0
- package/es/src/charts/Chord/emit.js.map +1 -0
- package/es/src/charts/Chord/index.js +249 -0
- package/es/src/charts/Chord/index.js.map +1 -0
- package/es/src/charts/Geomap/applyLayout.js +17 -10
- package/es/src/charts/Geomap/applyLayout.js.map +1 -1
- package/es/src/charts/Geomap/basemapTheme.js +78 -0
- package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
- package/es/src/charts/Geomap/emit.js +18 -9
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +74 -105
- 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/LinePlot/index.js +1 -2
- package/es/src/charts/LinePlot/index.js.map +1 -1
- package/es/src/charts/Matrix/emit.js +6 -0
- package/es/src/charts/Matrix/emit.js.map +1 -1
- package/es/src/charts/Matrix/index.js +1 -2
- package/es/src/charts/Matrix/index.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 +61 -27
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +40 -55
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +40 -2
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +14 -2
- 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 +277 -32
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +47 -3
- 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 +152 -17
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +48 -22
- 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/plotZoom.js +278 -0
- package/es/src/charts/Plot/plotZoom.js.map +1 -0
- 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 +431 -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 +163 -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 +367 -0
- package/es/src/charts/Plot/trendLines.js.map +1 -0
- package/es/src/charts/Plot/trendScene.js +220 -0
- package/es/src/charts/Plot/trendScene.js.map +1 -0
- package/es/src/charts/Plot/trendTooltip.js +160 -0
- package/es/src/charts/Plot/trendTooltip.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +36 -3
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Priestley/index.js +1 -2
- package/es/src/charts/Priestley/index.js.map +1 -1
- package/es/src/charts/Radar/emit.js +4 -1
- package/es/src/charts/Radar/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +16 -4
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +6 -0
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +18 -3
- 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 +75 -10
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +24 -5
- 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/emit.js +55 -11
- package/es/src/charts/Sankey/emit.js.map +1 -1
- package/es/src/charts/Sankey/index.js +8 -2
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/StackedArea/index.js +9 -3
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +10 -4
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +6 -5
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/emit.js +56 -3
- package/es/src/charts/Treemap/emit.js.map +1 -1
- package/es/src/charts/Treemap/index.js +1 -2
- package/es/src/charts/Treemap/index.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/definition/makeChart.js +8 -1
- package/es/src/charts/definition/makeChart.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +85 -0
- package/es/src/charts/drawSteps/backControl.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControls.js +193 -0
- package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +161 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +395 -0
- package/es/src/charts/drawSteps/minimap.js.map +1 -0
- package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
- package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/searchControls.js +358 -0
- package/es/src/charts/drawSteps/searchControls.js.map +1 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/tableView.js +173 -0
- package/es/src/charts/drawSteps/tableView.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewControl.js +39 -0
- package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControls.js +73 -0
- package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/zoomControls.js +317 -175
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
- package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
- 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 +2 -0
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/features/attributionFeature.js +137 -0
- package/es/src/charts/features/attributionFeature.js.map +1 -0
- package/es/src/charts/features/axes.js +24 -9
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/chartGeometry.js +16 -2
- package/es/src/charts/features/chartGeometry.js.map +1 -1
- package/es/src/charts/features/edgeArrows.js +155 -0
- package/es/src/charts/features/edgeArrows.js.map +1 -0
- package/es/src/charts/features/emitHelpers.js +32 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/ensureZoomDom.js +63 -12
- package/es/src/charts/features/ensureZoomDom.js.map +1 -1
- package/es/src/charts/features/features.js +89 -112
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresLegend.js +53 -17
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/plotPaint.js +81 -29
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/shapeEmit.js +20 -2
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/features/zoomExtent.js +185 -0
- package/es/src/charts/features/zoomExtent.js.map +1 -0
- package/es/src/charts/helpers/tileAttributions.js +26 -0
- package/es/src/charts/helpers/tileAttributions.js.map +1 -1
- package/es/src/charts/index.js +2 -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/runChartDraw.js +35 -1
- package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
- package/es/src/charts/pipeline/runVizPipeline.js +49 -15
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +52 -6
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +103 -59
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +186 -5
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +41 -3
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/ordinalColor.js +2 -2
- package/es/src/charts/viz/ordinalColor.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +270 -58
- 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 +18 -9
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +2 -1
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
- package/es/src/components/Axis/axisRender.js +5 -1
- package/es/src/components/Axis/axisRender.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 +87 -21
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/components/Legend/legendRender.js +29 -22
- 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/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/Box.js +4 -2
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Shape.js +1 -1
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +3 -2
- package/es/src/shapes/Whisker.js.map +1 -1
- 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 +13 -11
- package/types/index.d.ts +4 -4
- package/types/internal.d.ts +16 -2
- package/types/src/charts/BarChart/index.d.ts +2 -1
- package/types/src/charts/Chord/applyLayout.d.ts +43 -0
- package/types/src/charts/Chord/emit.d.ts +10 -0
- package/types/src/charts/Chord/index.d.ts +19 -0
- package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
- package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
- 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 +51 -3
- package/types/src/charts/Plot/pipeline.d.ts +14 -0
- package/types/src/charts/Plot/plotZoom.d.ts +65 -0
- package/types/src/charts/Plot/sharedHover.d.ts +79 -0
- package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +26 -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 +70 -0
- package/types/src/charts/Plot/trendScene.d.ts +18 -0
- package/types/src/charts/Plot/trendTooltip.d.ts +19 -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 +33 -1
- package/types/src/charts/definition/makeChart.d.ts +2 -1
- package/types/src/charts/drawSteps/backControl.d.ts +29 -0
- package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
- package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +108 -0
- package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
- package/types/src/charts/drawSteps/minimap.d.ts +19 -0
- package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
- package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
- package/types/src/charts/drawSteps/tableView.d.ts +23 -0
- package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
- package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
- package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
- package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
- package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
- package/types/src/charts/features/attributionFeature.d.ts +21 -0
- package/types/src/charts/features/axes.d.ts +1 -1
- package/types/src/charts/features/chartGeometry.d.ts +9 -3
- package/types/src/charts/features/edgeArrows.d.ts +92 -0
- package/types/src/charts/features/emitHelpers.d.ts +19 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
- package/types/src/charts/features/features.d.ts +32 -17
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/plotPaint.d.ts +40 -2
- package/types/src/charts/features/zoomExtent.d.ts +25 -0
- package/types/src/charts/index.d.ts +2 -0
- package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +14 -3
- package/types/src/charts/viz/Viz.d.ts +18 -1
- package/types/src/charts/viz/VizBase.d.ts +99 -4
- package/types/src/charts/viz/VizBaseConfig.d.ts +25 -3
- package/types/src/charts/viz/vizDefaults.d.ts +155 -0
- package/types/src/charts/viz/vizTypes.d.ts +204 -4
- package/types/src/charts/viz/vizVisibility.d.ts +34 -0
- package/types/src/components/Axis/Axis.d.ts +2 -0
- package/types/src/components/Legend/legendRender.d.ts +8 -2
- package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
- package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
- package/types/src/components/Tooltip.d.ts +18 -3
- package/types/src/components/index.d.ts +1 -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 +200 -8
- 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 +44507 -35766
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +7073 -4410
- package/umd/d3plus-core.js +16718 -9634
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +4615 -2322
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
}
|
|
18
|
+
/** A fitted trend line, ready to paint. */
|
|
19
|
+
export interface TrendFit {
|
|
20
|
+
/** Stable key: the series id, or "all". */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Tooltip title: the series label, or the translated "Trend Line". */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Line stroke (and band fill). */
|
|
25
|
+
color: string;
|
|
26
|
+
/** The independent axis the fit runs along. */
|
|
27
|
+
axis: Axis;
|
|
28
|
+
fit: RegressionResult;
|
|
29
|
+
samples: TrendSample[];
|
|
30
|
+
/** A source row of the series, so hover dimming treats the line as part of it. */
|
|
31
|
+
row?: DataPoint;
|
|
32
|
+
}
|
|
33
|
+
/** The values `trendLine` accepts: a regression type, `true` (linear), or `false` (off). */
|
|
34
|
+
export type TrendLineType = boolean | RegressionType;
|
|
35
|
+
/** The default `trendLineConfig`. */
|
|
36
|
+
export declare function trendLineDefaults(): Record<string, unknown>;
|
|
37
|
+
/** Resolves the `trendLine` setting to a regression type, or null when off. */
|
|
38
|
+
export declare function resolveTrendType(value: unknown): RegressionType | null;
|
|
39
|
+
/**
|
|
40
|
+
The axis a trend line runs along: the discrete axis when one is set (so a
|
|
41
|
+
horizontal bar chart fits along y), otherwise x.
|
|
42
|
+
*/
|
|
43
|
+
export declare function trendAxis(discrete: unknown): Axis;
|
|
44
|
+
/**
|
|
45
|
+
Maps independent-axis values to numbers for fitting, and back again for
|
|
46
|
+
plotting: Dates by timestamp, numbers as-is, and anything else (category
|
|
47
|
+
names) by its position in the axis's ordered values.
|
|
48
|
+
*/
|
|
49
|
+
export declare function trendNumberScale(order: unknown[]): {
|
|
50
|
+
toNumber: (v: unknown) => number;
|
|
51
|
+
fromNumber: (n: number) => unknown;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
The independent-axis positions to sample a fit at, within its extent: one
|
|
55
|
+
per category on a point scale (in-between positions can't be placed), or
|
|
56
|
+
evenly spaced points on a continuous axis.
|
|
57
|
+
*/
|
|
58
|
+
export declare function trendSamplePositions(extent: [number, number], categories: number[] | null, count?: number): number[];
|
|
59
|
+
/** Fits the trend lines for the current data; empty when `trendLine` is off. */
|
|
60
|
+
export declare function computeTrendFits(viz: VizInstance, rows: Row[], order: unknown[]): TrendFit[];
|
|
61
|
+
/** The dependent-axis values a set of fits plots, including band bounds. */
|
|
62
|
+
export declare function trendDomainValues(fits: TrendFit[]): number[];
|
|
63
|
+
/**
|
|
64
|
+
`computePlotTrendFits` — runs after `computePlotAxisValues`: fits the
|
|
65
|
+
trend lines onto `viz._trendFits` and appends their values to the
|
|
66
|
+
dependent axis's values, so the non-stacked domain covers them (the
|
|
67
|
+
stacked domain reads `viz._trendFits` directly).
|
|
68
|
+
*/
|
|
69
|
+
export declare const computePlotTrendFits: TransformStage;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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, in one
|
|
4
|
+
stably-keyed group so frames tween rather than re-enter.
|
|
5
|
+
*/
|
|
6
|
+
import type { SceneNode } from "@d3plus/render";
|
|
7
|
+
import type { PlotAxisFn } from "../features/plotPaint.js";
|
|
8
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
9
|
+
import type { TrendFit } from "./trendLines.js";
|
|
10
|
+
/** Scene-node fields the trend line stamps for hover routing. */
|
|
11
|
+
export type TrendNode = SceneNode & {
|
|
12
|
+
interactive?: boolean;
|
|
13
|
+
interactionGroup?: string;
|
|
14
|
+
trendFit?: TrendFit;
|
|
15
|
+
children?: SceneNode[];
|
|
16
|
+
};
|
|
17
|
+
/** The scene groups for every fitted trend line, painted behind the marks. */
|
|
18
|
+
export declare function emitTrendLines(viz: VizInstance, x: PlotAxisFn, y: PlotAxisFn): SceneNode[];
|
|
@@ -0,0 +1,19 @@
|
|
|
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 } 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
|
+
/** The tooltip rows for a fit: type, equation, R², and observations. */
|
|
17
|
+
export declare function trendTooltipRows(viz: VizInstance, trend: TrendFit): string[][];
|
|
18
|
+
/** Renders the trend tooltip at the pointer. */
|
|
19
|
+
export declare function renderTrendTooltip(viz: VizInstance, trend: TrendFit, event: SceneEvent): 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;
|
|
@@ -11,6 +11,7 @@ import type { SceneNode } from "@d3plus/render";
|
|
|
11
11
|
import type { FeatureModule } from "../features/features.js";
|
|
12
12
|
import type { TransformStage, VizContext } from "../pipeline/stages.js";
|
|
13
13
|
import type { VizInstance } from "../viz/vizTypes.js";
|
|
14
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
14
15
|
interface ChartDefinitionBase {
|
|
15
16
|
/** Stable name for tagging and class generation. */
|
|
16
17
|
name: string;
|
|
@@ -32,6 +33,19 @@ interface ChartDefinitionBase {
|
|
|
32
33
|
`runChartDraw` — the chart relies on its parent's `_draw` only.
|
|
33
34
|
*/
|
|
34
35
|
layoutStage?: TransformStage;
|
|
36
|
+
/**
|
|
37
|
+
Optional size-legend scale, called before layout so the bottom-right
|
|
38
|
+
corner panel can reserve room: the value → pixel-radius scale the chart
|
|
39
|
+
will draw with, for a chart area of `available` px (the area before the
|
|
40
|
+
legend's own reservation, so any area-dependent radius only shrinks
|
|
41
|
+
from here). Return null when nothing is sized. The chart's layout
|
|
42
|
+
stores the scale it actually drew with on `viz._sizeLegendFinal`, which
|
|
43
|
+
is what the legend paints.
|
|
44
|
+
*/
|
|
45
|
+
sizeLegendScale?: (viz: VizInstance, available: {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
}) => SizeLegendScale | null;
|
|
35
49
|
/** Optional pure threshold algorithm (replaces `Viz._thresholdFunction`). */
|
|
36
50
|
thresholdFunction?: (viz: VizInstance, data: unknown[]) => unknown[];
|
|
37
51
|
/**
|
|
@@ -45,9 +59,27 @@ interface ChartDefinitionBase {
|
|
|
45
59
|
scene coordinates that the chart content is clipped to). Geomap uses this to
|
|
46
60
|
contain projected geography within the map rectangle so it can't spill under
|
|
47
61
|
the legend/timeline; the clip stays put while pan/zoom moves content beneath
|
|
48
|
-
it.
|
|
62
|
+
it. The chart-cells group is untransformed (`chartTransform` applies to a
|
|
63
|
+
group inside it), so the clip is in surface coordinates. Zoomable charts
|
|
64
|
+
without one are clipped to the chart area.
|
|
49
65
|
*/
|
|
50
66
|
chartClip?: (viz: VizInstance) => import("@d3plus/render").ClipShape | undefined;
|
|
67
|
+
/**
|
|
68
|
+
Optional chart-specific "local body rect" — the box the drill-down morph
|
|
69
|
+
transition (`enterFrom`/`exitTo`) measures its fractions against. Read
|
|
70
|
+
directly off `def` by `runChartDraw` (same pattern as `chartClip`), after
|
|
71
|
+
the layout stage runs. Default: the margin-adjusted chart area at local
|
|
72
|
+
origin (0,0), i.e. `{x: 0, y: 0, ...chartBounds(viz)}` — correct for any
|
|
73
|
+
chart whose emitted nodes sit inside the `chartTransform`-wrapped body
|
|
74
|
+
group at that same local origin (Treemap; Pack overrides this, since its
|
|
75
|
+
body is a diameter-sized square, not the full chart area).
|
|
76
|
+
*/
|
|
77
|
+
chartBodyRect?: (viz: VizInstance) => {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
};
|
|
51
83
|
/**
|
|
52
84
|
Imperative per-instance setup hook — runs once after `applyDefinition`
|
|
53
85
|
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` delegate to
|
|
9
|
+
`def.thresholdFunction` / `def.sizeLegendScale` if present.
|
|
9
10
|
|
|
10
11
|
A chart's `index.ts` becomes literally `export default makeChart(def)`.
|
|
11
12
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The "← Back" control's contribution to the shared top-left controls
|
|
3
|
+
panel (`topLeftControls.ts`) — visible only when the chart has
|
|
4
|
+
drill-down history to pop. Styled like the zoom/search controls: a real
|
|
5
|
+
`<button>` at the same 20px height, an SVG arrow icon (not a text
|
|
6
|
+
glyph), and no default background/border/color — a plain
|
|
7
|
+
browser-appearance button that lets native/host-page button chrome
|
|
8
|
+
show through, restylable via `.backControlStyle()`/
|
|
9
|
+
`.backControlClassName()` the same way zoom/search are.
|
|
10
|
+
|
|
11
|
+
Previously `backFeature` rendered "← Back" as an SVG text scene node in
|
|
12
|
+
its own margin-claiming row, with its click routed through
|
|
13
|
+
`Viz._routeSceneEvent`'s `interactionGroup === "back"` special case —
|
|
14
|
+
the only way to attach a click handler to a plain scene text node. As a
|
|
15
|
+
real button inside the shared `htmlOverlay` panel, its click instead
|
|
16
|
+
rides the same declarative delegated-events map every other top-left/
|
|
17
|
+
zoom control uses, and it claims no margin of its own — like zoom, it
|
|
18
|
+
floats over whatever's there, and content that needs to avoid it insets
|
|
19
|
+
around the whole panel via `topLeftControlsInset`.
|
|
20
|
+
|
|
21
|
+
@module
|
|
22
|
+
*/
|
|
23
|
+
import type Viz from "../viz/Viz.js";
|
|
24
|
+
import type { Contribution } from "./topLeftControlsMarkup.js";
|
|
25
|
+
/** Paints the back button's inline style. There's no active/hover override — unlike zoom/search it's not a toggle, so it relies on the browser's native `:hover`, like their own hover default (`false`) already does. */
|
|
26
|
+
export declare function paintBackButton(viz: Viz, btn: HTMLElement): void;
|
|
27
|
+
/** The back button's markup: a real `<button>` (icon + visible "Back" text), so host-page button styling applies through the cascade once `backControlClassName` auto-disables the inline default. */
|
|
28
|
+
export declare function backControlsHtml(viz: Viz): string;
|
|
29
|
+
export declare function backContribution(viz: Viz): Contribution | null;
|
|
@@ -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,108 @@
|
|
|
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
|
+
items: BottomRightContribution[];
|
|
54
|
+
}
|
|
55
|
+
/** Horizontal gap between items, and between the panel and content inset around it. */
|
|
56
|
+
export declare const BOTTOM_RIGHT_GAP = 6;
|
|
57
|
+
/** Lays contributions out in a row, right to left: the panel's total width and height. */
|
|
58
|
+
export declare function measureBottomRight(items: BottomRightContribution[]): {
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
};
|
|
62
|
+
/** The panel reserved for this draw, or null when nothing is showing there. */
|
|
63
|
+
export declare function bottomRightControlsBox(viz: VizInstance): BottomRightBox | null;
|
|
64
|
+
/**
|
|
65
|
+
How far content in the bottom band must pull in its right edge to clear
|
|
66
|
+
the panel: content whose bottom edge sits `bottom` px above the chart's
|
|
67
|
+
bottom edge and whose right edge sits `right` px in from the chart's
|
|
68
|
+
right edge. Zero when nothing is showing or the content starts above the
|
|
69
|
+
panel.
|
|
70
|
+
*/
|
|
71
|
+
export declare function bottomRightControlsInset(viz: VizInstance, bottom: number, right: number): number;
|
|
72
|
+
/**
|
|
73
|
+
How much content in the right column, whose bottom edge sits `bottom` px
|
|
74
|
+
above the chart's bottom edge, must shorten to end above the panel. Zero
|
|
75
|
+
when nothing is showing.
|
|
76
|
+
*/
|
|
77
|
+
export declare function bottomRightControlsDrop(viz: VizInstance, bottom: number): number;
|
|
78
|
+
/**
|
|
79
|
+
How a legend or colorScale at `position` clears the panel: a bottom one
|
|
80
|
+
pulls its right edge in by `inset`, a left/right one shortens by `drop`.
|
|
81
|
+
`bottom`/`right` are its edges' distances from the chart's bottom/right.
|
|
82
|
+
*/
|
|
83
|
+
export declare function bottomRightClearance(viz: VizInstance, position: string | false, bottom: number, right: number): {
|
|
84
|
+
inset: number;
|
|
85
|
+
drop: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
How much taller the bottom margin must grow so the chart body, ending
|
|
89
|
+
`bottom` px above the chart's bottom edge, stays clear of a bottom-side
|
|
90
|
+
panel. Zero for a right-side panel.
|
|
91
|
+
*/
|
|
92
|
+
export declare function bottomRightControlsShortfall(viz: VizInstance, bottom: number): number;
|
|
93
|
+
/**
|
|
94
|
+
How much wider the right margin must grow so the chart body, ending
|
|
95
|
+
`right` px in from the chart's right edge, stays clear of a right-side
|
|
96
|
+
panel. Zero for a bottom-side panel.
|
|
97
|
+
*/
|
|
98
|
+
export declare function bottomRightControlsRightShortfall(viz: VizInstance, right: number): number;
|
|
99
|
+
/**
|
|
100
|
+
The panel's scene: each item painted from its final state, bottom-right
|
|
101
|
+
aligned in the slot it reserved. Null when nothing paints.
|
|
102
|
+
*/
|
|
103
|
+
export declare function buildBottomRightPanel(viz: VizInstance, box: BottomRightBox): SceneNode | null;
|
|
104
|
+
/**
|
|
105
|
+
Repaints the panel in place for the current zoom — called on every zoom
|
|
106
|
+
event, which repaints the scene without re-running the pipeline.
|
|
107
|
+
*/
|
|
108
|
+
export declare function refreshBottomRightPanel(viz: VizInstance): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Shared mechanics for a chart-chrome button's base/active/hover inline
|
|
3
|
+
styling — the resolve-and-paint algorithm zoom/search/back controls all
|
|
4
|
+
use identically. Each control still owns its OWN default style VALUES
|
|
5
|
+
and schema keys (`zoomControlStyle*` vs `searchControlStyle*` vs
|
|
6
|
+
`backControlStyle`) in its own module, so restyling one doesn't affect
|
|
7
|
+
another — only the mechanical part (which was three copy-pasted near-
|
|
8
|
+
duplicates) lives here.
|
|
9
|
+
|
|
10
|
+
@module
|
|
11
|
+
*/
|
|
12
|
+
export type StyleObject = Record<string, string | number | undefined | null | false>;
|
|
13
|
+
export type ControlStyleValue = StyleObject | false | null | undefined;
|
|
14
|
+
/** `alignItems` / `align-items` → `align-items`, for `style.setProperty`. */
|
|
15
|
+
export declare const kebab: (key: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
Fallbacks for CSS system colors a browser may not support yet: an
|
|
18
|
+
active-button default uses the OS accent color (Firefox, Safari), and
|
|
19
|
+
Chromium falls back to the text-selection highlight.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SYSTEM_COLOR_FALLBACKS: Record<string, string>;
|
|
22
|
+
/** Sets one style property, swapping an unsupported system color for its fallback. */
|
|
23
|
+
export declare function setControlStyle(el: HTMLElement, key: string, value: string): void;
|
|
24
|
+
/**
|
|
25
|
+
Resolves a `*ControlStyle`/`Active`/`Hover` value for painting. Setting
|
|
26
|
+
the matching `*ControlClassName` auto-disables whichever of the three is
|
|
27
|
+
still the untouched built-in default (identified by reference — the
|
|
28
|
+
caller's own default constant) so a host page's own button styling can
|
|
29
|
+
apply through the cascade without also requiring `.xControlStyle(false)`.
|
|
30
|
+
An explicit custom style object (a different reference) always wins,
|
|
31
|
+
className or not.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveControlStyle(value: ControlStyleValue, defaultValue: ControlStyleValue, classNameSet: boolean): StyleObject;
|
|
34
|
+
/**
|
|
35
|
+
Paints a control button's inline style for its current state: the base
|
|
36
|
+
style, then the hover style while hovered, then the active style while
|
|
37
|
+
its mode is on (so an active button reads as active even under the
|
|
38
|
+
cursor). Every property any of the three styles sets is cleared first,
|
|
39
|
+
so leaving a state fully undoes it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function paintControlButton(btn: HTMLElement, styles: {
|
|
42
|
+
base: StyleObject;
|
|
43
|
+
active?: StyleObject;
|
|
44
|
+
hover?: StyleObject;
|
|
45
|
+
}, hovered: boolean, isActive: boolean): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FeatureModule } from "../features/features.js";
|
|
2
|
+
/**
|
|
3
|
+
@name minimapFeature
|
|
4
|
+
A small overview of the full scene, underneath the zoom-control panel,
|
|
5
|
+
with a draggable box showing the current viewport and a zoom-level
|
|
6
|
+
label — hidden at the chart's natural 1x view, shown once zoomed in.
|
|
7
|
+
|
|
8
|
+
Runs as a post-draw `FeatureModule` right after `zoomFeature` (needs its
|
|
9
|
+
`_zoomBehavior.translateExtent()`/`scaleExtent()` already configured for
|
|
10
|
+
this draw). Claims zero margin, like `zoomFeature` — it floats over the
|
|
11
|
+
existing chart area rather than pushing content around. The panel is
|
|
12
|
+
ALWAYS mounted whenever zoom + minimap are both enabled, regardless of
|
|
13
|
+
the current zoom level: the "hidden at 1x" gate lives inside the panel's
|
|
14
|
+
`onUpdate`, reading the LIVE transform on every repaint, so it hides/
|
|
15
|
+
shows correctly during any live pan/zoom gesture — not just on the next
|
|
16
|
+
full `.render()` (dragging the minimap itself, wheel-zooming, clicking a
|
|
17
|
+
zoom button, and brush-zooming all repaint outside the layout pipeline).
|
|
18
|
+
*/
|
|
19
|
+
export declare const minimapFeature: FeatureModule;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Markup, styling, and formatting for the minimap panel — mirrors
|
|
3
|
+
`zoomControlsMarkup.ts`'s shape for the zoom-control buttons.
|
|
4
|
+
|
|
5
|
+
@module
|
|
6
|
+
*/
|
|
7
|
+
import type Viz from "../viz/Viz.js";
|
|
8
|
+
export type StyleObject = Record<string, string | number | undefined | null | false>;
|
|
9
|
+
/** The resolved outer / viewport / viewport-active / label styles for a chart. */
|
|
10
|
+
export declare function minimapStyles(viz: Viz): {
|
|
11
|
+
outer: StyleObject;
|
|
12
|
+
viewport: StyleObject;
|
|
13
|
+
viewportActive: StyleObject;
|
|
14
|
+
label: StyleObject;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
Paints one or more style layers onto an element, clearing the union of
|
|
18
|
+
their keys first so leaving a state (e.g. no longer dragging) fully
|
|
19
|
+
undoes it. Mirrors `paintZoomButton`'s clear-then-apply pattern in
|
|
20
|
+
`zoomControlsMarkup.ts`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function paintMinimapStyle(el: HTMLElement, ...layers: StyleObject[]): void;
|
|
23
|
+
/** Formats a zoom scale as a short label: `"2x"`, `"4.4x"`. */
|
|
24
|
+
export declare function formatZoomLabel(k: number): string;
|
|
25
|
+
/**
|
|
26
|
+
The minimap's static HTML skeleton — no baked-in geometry; `onUpdate`
|
|
27
|
+
positions the viewport box and label live on every repaint (see
|
|
28
|
+
`minimap.ts`), the same reason `zoomControlsHtml` bakes in everything
|
|
29
|
+
that CAN change (locale, className) but nothing here changes per-tick.
|
|
30
|
+
The viewport box is `tabindex="0"` so it's keyboard-focusable — arrow
|
|
31
|
+
keys nudge the pan, matching what the `aria-label` describes. No ARIA
|
|
32
|
+
`role`: a 2D pan target doesn't map onto any single widget role (a
|
|
33
|
+
`slider` is one-dimensional), so a plain focusable, labeled element is
|
|
34
|
+
the more honest choice over one implying unmet role semantics.
|
|
35
|
+
|
|
36
|
+
`minimapClassName` (documented as applying to all three elements — the
|
|
37
|
+
outer box, viewport box, and label) is appended to the viewport/label
|
|
38
|
+
classes here; the outer box gets it separately, in `minimap.ts`'s panel
|
|
39
|
+
`className`, since that one isn't part of this inner HTML string.
|
|
40
|
+
*/
|
|
41
|
+
export declare function minimapHtml(viz: Viz): string;
|
|
42
|
+
/** Right inset shared with the zoom-control panel, so the two clusters' right edges line up. */
|
|
43
|
+
export declare const MINIMAP_RIGHT_INSET = 4;
|
|
44
|
+
/** Vertical gap between the zoom-control panel and the minimap beneath it. */
|
|
45
|
+
export declare const MINIMAP_GAP = 4;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Markup, styling, and event handlers for the search control (a toggle
|
|
3
|
+
button + an expanding text input) — the top-left counterpart to the
|
|
4
|
+
zoom-controls panel's buttons, contributed into the shared top-left
|
|
5
|
+
controls panel (`topLeftControls.ts`) alongside the back button. Kept as
|
|
6
|
+
its own module rather than folded into `zoomControlsMarkup.ts`/
|
|
7
|
+
`topLeftControlsMarkup.ts`: search is independent chrome a chart can mix
|
|
8
|
+
and match with zoom/back, so its styling knobs stay uncoupled from
|
|
9
|
+
theirs (matching the convention `zoomControlsMarkup.ts` itself notes for
|
|
10
|
+
why zoom and table-view don't share styling code).
|
|
11
|
+
|
|
12
|
+
@module
|
|
13
|
+
*/
|
|
14
|
+
import type { DataPoint } from "@d3plus/data";
|
|
15
|
+
import type { SceneNode } from "@d3plus/render";
|
|
16
|
+
import type Viz from "../viz/Viz.js";
|
|
17
|
+
import { type StyleObject } from "./controlButtonStyle.js";
|
|
18
|
+
/** Search-open state is per-chart, read/written via `viz._searchOpen`. */
|
|
19
|
+
export declare function isSearchOpen(viz: Viz): boolean;
|
|
20
|
+
/** The resolved base / active / hover button styles for a chart — also the cheap, non-DOM basis for `searchContribution`'s `styleSignature` (see `Contribution.styleSignature`). */
|
|
21
|
+
export declare function searchButtonStyles(viz: Viz): {
|
|
22
|
+
base: StyleObject;
|
|
23
|
+
active: StyleObject;
|
|
24
|
+
hover: StyleObject;
|
|
25
|
+
};
|
|
26
|
+
/** Paints the search toggle button's inline style for its current state. Mirrors `paintZoomButton`. */
|
|
27
|
+
export declare function paintSearchButton(viz: Viz, btn: HTMLElement, hovered?: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
The input's inline style at rest (closed) vs. open — set directly by the
|
|
30
|
+
toggle click handler, never regenerated mid-typing. Open's right padding
|
|
31
|
+
reserves room for the clear button, which sits absolutely-positioned
|
|
32
|
+
INSIDE the input's own box (see `SEARCH_CLEAR_STYLE_SHOWN`) rather than
|
|
33
|
+
beside it, so typed text wraps short of it instead of running underneath.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SEARCH_INPUT_STYLE_CLOSED: Record<string, string>;
|
|
36
|
+
export declare const SEARCH_INPUT_STYLE_OPEN: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
The wrapper `.search-input-wrap` is the positioning context for both the
|
|
39
|
+
clear button (absolute, inside the input's own box) and the match-count
|
|
40
|
+
feedback (absolute, below it) — an `inline-block` with no explicit width
|
|
41
|
+
of its own, so it always shrink-wraps to the input's CURRENT width
|
|
42
|
+
(0 closed, 120px open) and the count box (`width: 100%`) automatically
|
|
43
|
+
matches it.
|
|
44
|
+
*/
|
|
45
|
+
export declare const SEARCH_INPUT_WRAP_STYLE: Record<string, string>;
|
|
46
|
+
/** Applies the open/closed inline style directly to the input DOM node — no panel rebuild, so focus/cursor survive. */
|
|
47
|
+
export declare function applySearchInputOpenState(input: HTMLInputElement, open: boolean): void;
|
|
48
|
+
/** Shows/hides the clear button, directly on the DOM node — same no-rebuild pattern as the input's open state. */
|
|
49
|
+
export declare function applySearchClearVisible(btn: HTMLElement, visible: boolean): void;
|
|
50
|
+
/** Writes the match-count feedback's text/visibility directly onto the DOM node — visible whenever there's a term, regardless of whether it matched anything ("No Matches" is itself useful feedback). */
|
|
51
|
+
export declare function applySearchCount(viz: Viz, el: HTMLElement, hasTerm: boolean, index: number | undefined, total: number): void;
|
|
52
|
+
/**
|
|
53
|
+
The search control's markup: a toggle `<button>`, an `<input>`, a clear
|
|
54
|
+
(×) button, and a match-count span — all real elements so host-page
|
|
55
|
+
button/input styling applies through the cascade the same way zoom's
|
|
56
|
+
buttons do. Term/open state is baked in from `viz._searchTerm`/
|
|
57
|
+
`_searchOpen` so a full re-render (e.g. a resize or data change)
|
|
58
|
+
preserves whatever the user was doing — typing itself never regenerates
|
|
59
|
+
this markup (see `searchControls.ts`).
|
|
60
|
+
|
|
61
|
+
The count span is left EMPTY here on purpose — its text is written by
|
|
62
|
+
`searchContribution`'s `onUpdate` instead (see there), not baked into
|
|
63
|
+
this string. `onUpdate` runs on every draw regardless of whether this
|
|
64
|
+
html string changed, while the match count itself depends on the
|
|
65
|
+
CHART's data/scene, not on the search box's own state — baking its text
|
|
66
|
+
in here would make this contribution's own html change (and its DOM,
|
|
67
|
+
including the live `<input>`, get torn down and rebuilt) every time the
|
|
68
|
+
chart's data changes for a reason that has nothing to do with search,
|
|
69
|
+
e.g. drilling down while the box is open and focused.
|
|
70
|
+
*/
|
|
71
|
+
export declare function searchControlsHtml(viz: Viz): string;
|
|
72
|
+
/**
|
|
73
|
+
Builds the predicate `.highlight()` drives from the current search term
|
|
74
|
+
— see `matchesSearchNeedle` for the match rule. Empty term restores
|
|
75
|
+
whatever `.highlight()` predicate (if any) was active before the search
|
|
76
|
+
box opened.
|
|
77
|
+
*/
|
|
78
|
+
export declare function searchHighlightPredicate(viz: Viz, term: string): ((d: DataPoint, i: number) => boolean) | false;
|
|
79
|
+
/** One matching mark: its scene node (for `.key`/geometry), the unwrapped source row, and its index. */
|
|
80
|
+
export interface SearchMatch {
|
|
81
|
+
node: SceneNode;
|
|
82
|
+
row: DataPoint;
|
|
83
|
+
index: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
Every currently-rendered mark matching the given term, in scene order.
|
|
87
|
+
Walks `viz._chartScene` (the actual painted scene, post-layout) rather
|
|
88
|
+
than the raw data array, unwrapping each node's datum the same way
|
|
89
|
+
`applyInteractionOpacity` does, so a grouped/aggregated chart matches by
|
|
90
|
+
rendered mark, not by raw input row — and de-dupes by datum reference so
|
|
91
|
+
a mark's separate label node doesn't double-count it. An empty term
|
|
92
|
+
matches nothing (there's no "everything" state to jump through).
|
|
93
|
+
*/
|
|
94
|
+
export declare function searchMatches(viz: Viz, term: string): SearchMatch[];
|
|
95
|
+
/**
|
|
96
|
+
Formats the match-count feedback as a readable, localized phrase:
|
|
97
|
+
"No Matches" with nothing found, "6 Matches"/"1 Match" once there's a
|
|
98
|
+
count but the user hasn't stepped to one yet (Enter/Shift+Enter), and
|
|
99
|
+
"Match 2/6" once they have — the translated noun for context, plus a
|
|
100
|
+
compact numeric position rather than a translated "of" connector, since
|
|
101
|
+
a fixed English word order ("Match 2 of 6") wouldn't read naturally in
|
|
102
|
+
every locale, while a number pair after a noun does. `index` is 0-based
|
|
103
|
+
(`viz._searchMatchIndex`); `total` is `searchMatches(...).length`. Text
|
|
104
|
+
and label are the same string — both visible and accessible.
|
|
105
|
+
*/
|
|
106
|
+
export declare function formatMatchCount(viz: Viz, index: number | undefined, total: number): {
|
|
107
|
+
text: string;
|
|
108
|
+
label: string;
|
|
109
|
+
};
|
|
110
|
+
/** Whether a chart shows the search control. */
|
|
111
|
+
export declare function showsSearchControls(viz: Viz): boolean;
|