@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,96 @@
|
|
|
1
|
+
import type { ColorDefaults } from "@d3plus/color";
|
|
2
|
+
import type { DataPoint } from "@d3plus/data";
|
|
3
|
+
import type { VizInstance } from "./vizTypes.js";
|
|
4
|
+
type Predicate = (d: DataPoint, i: number) => boolean;
|
|
5
|
+
/** The interaction states a link group mirrors through a predicate. */
|
|
6
|
+
export type LinkKind = "hover" | "active" | "highlight";
|
|
7
|
+
/** The object form of the `link` config: a group name plus the key and interactions to mirror. */
|
|
8
|
+
export interface LinkConfig {
|
|
9
|
+
/** Charts that share a group name are linked. */
|
|
10
|
+
group: string;
|
|
11
|
+
/** The value two charts' rows match on. A string is a data key. Defaults to the chart's own id. */
|
|
12
|
+
by?: string | ((d: DataPoint, i: number) => unknown);
|
|
13
|
+
/** Mirror hover. Defaults to `true`. */
|
|
14
|
+
hover?: boolean;
|
|
15
|
+
/** Mirror `active`. Defaults to `true`. */
|
|
16
|
+
active?: boolean;
|
|
17
|
+
/** Mirror `highlight` (including the search box). Defaults to `true`. */
|
|
18
|
+
highlight?: boolean;
|
|
19
|
+
/** Mirror legend hide/solo clicks. Defaults to `true`. */
|
|
20
|
+
legend?: boolean;
|
|
21
|
+
/** Share categorical color assignments, so a value gets the same color in every linked chart. Defaults to `true`; a chart that sets its own `colorDefaults.scale` keeps it. */
|
|
22
|
+
color?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** `link` as a group name, the full object form, or `false` for unlinked. */
|
|
25
|
+
export type LinkOption = string | false | LinkConfig;
|
|
26
|
+
/** A chart's `link` config with defaults filled in and `by` resolved to a function. */
|
|
27
|
+
export interface ResolvedLink {
|
|
28
|
+
group: string;
|
|
29
|
+
by: (d: DataPoint, i: number) => unknown;
|
|
30
|
+
hover: boolean;
|
|
31
|
+
active: boolean;
|
|
32
|
+
highlight: boolean;
|
|
33
|
+
legend: boolean;
|
|
34
|
+
color: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** The parts of a chart `resolveLink` and `linkedColorDefaults` read. */
|
|
37
|
+
type LinkTarget = Pick<VizInstance, "schema"> & Partial<Pick<VizInstance, "_id" | "_linkGroup" | "_autoColorScale">>;
|
|
38
|
+
/** Normalizes a chart's `link` config, or returns null when it isn't linked. */
|
|
39
|
+
export declare function resolveLink(viz: LinkTarget): ResolvedLink | null;
|
|
40
|
+
/** Adds the chart to its `link` group, leaving any group it was in before. */
|
|
41
|
+
export declare function registerLink(viz: VizInstance): void;
|
|
42
|
+
/** Removes the chart from its `link` group, if any. */
|
|
43
|
+
export declare function unregisterLink(viz: VizInstance): void;
|
|
44
|
+
/** The charts currently registered under a group name. */
|
|
45
|
+
export declare function linkMembers(group: string): VizInstance[];
|
|
46
|
+
/**
|
|
47
|
+
The color defaults `viz` assigns categorical colors from. A linked chart
|
|
48
|
+
still on its own default scale (`viz._autoColorScale`) shares one scale
|
|
49
|
+
with the rest of its group, so each value takes the same color in every
|
|
50
|
+
chart however the charts order their data; the first chart to join seeds
|
|
51
|
+
the group's palette. A chart given its own `colorDefaults.scale`, or linked
|
|
52
|
+
with `color: false`, keeps its own.
|
|
53
|
+
*/
|
|
54
|
+
export declare function linkedColorDefaults(viz: LinkTarget): ColorDefaults;
|
|
55
|
+
/**
|
|
56
|
+
Flattens a `by` value into comparable string keys: arrays (from
|
|
57
|
+
aggregated rows whose members disagree) contribute every entry, Dates
|
|
58
|
+
compare by time, and null/undefined contribute nothing.
|
|
59
|
+
*/
|
|
60
|
+
export declare function linkKeys(value: unknown): string[];
|
|
61
|
+
/**
|
|
62
|
+
The `by` keys of every row in `viz` that `predicate` matches. Evaluates
|
|
63
|
+
over the painted marks (`_chartScene`), which are the rows the predicate
|
|
64
|
+
was written against; before a first paint it falls back to the filtered
|
|
65
|
+
data.
|
|
66
|
+
*/
|
|
67
|
+
export declare function linkValues(viz: VizInstance, by: (d: DataPoint, i: number) => unknown, predicate: Predicate): Set<string>;
|
|
68
|
+
/**
|
|
69
|
+
A predicate matching the rows whose `by` keys include one of `values`. An
|
|
70
|
+
empty set matches nothing, so a chart without the linked value dims
|
|
71
|
+
entirely.
|
|
72
|
+
*/
|
|
73
|
+
export declare function linkPredicate(link: ResolvedLink, values: Set<string>): Predicate;
|
|
74
|
+
/**
|
|
75
|
+
Overrides which rows the next broadcast from `viz` treats as matched,
|
|
76
|
+
for an interaction whose own predicate also matches marks it doesn't
|
|
77
|
+
mean to emphasize (Plot's stacked column hover keeps non-bar marks
|
|
78
|
+
bright). Consumed by the next `broadcastLink` call.
|
|
79
|
+
*/
|
|
80
|
+
export declare function linkAs(viz: VizInstance, predicate: Predicate): void;
|
|
81
|
+
/**
|
|
82
|
+
Mirrors `viz`'s new hover/active/highlight state onto the rest of its link
|
|
83
|
+
group. A predicate becomes a match on its rows' `by` values; `false`
|
|
84
|
+
clears the same state everywhere.
|
|
85
|
+
*/
|
|
86
|
+
export declare function broadcastLink(viz: VizInstance, kind: LinkKind, predicate: unknown): void;
|
|
87
|
+
/**
|
|
88
|
+
Mirrors `viz`'s legend hide/solo state onto the rest of its link group,
|
|
89
|
+
then re-renders each chart that changed. Matching goes through `by`, so
|
|
90
|
+
charts with different legend groupings still line up: a target legend item
|
|
91
|
+
is solo'd when any of its keys is solo'd in the source, and hidden when all
|
|
92
|
+
of its keys are hidden there. A target that hasn't drawn its legend yet is
|
|
93
|
+
skipped.
|
|
94
|
+
*/
|
|
95
|
+
export declare function broadcastLegend(viz: VizInstance): void;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { SceneNode } from "@d3plus/render";
|
|
3
|
+
/** Scene mark types that carry a datum hover/active/highlight/search apply to. */
|
|
4
|
+
export declare const MARK_TYPES: Set<string>;
|
|
5
|
+
/**
|
|
6
|
+
Calls `fn` once per painted data mark in `nodes`, with the mark's source
|
|
7
|
+
row and index. The row is unwrapped one level (`datum.data ?? datum`) and
|
|
8
|
+
the index resolved `node.index` → `row.i` → 0, the same way
|
|
9
|
+
`applyInteractionOpacity` evaluates its predicates, so a predicate sees the
|
|
10
|
+
same arguments here as it does when the scene is dimmed. Rows are de-duped
|
|
11
|
+
by reference, so a mark's separate label node doesn't visit it twice.
|
|
12
|
+
*/
|
|
13
|
+
export declare function forEachSceneRow(nodes: SceneNode[], fn: (row: DataPoint, i: number, node: SceneNode) => void): void;
|
|
@@ -21,11 +21,15 @@
|
|
|
21
21
|
@module
|
|
22
22
|
*/
|
|
23
23
|
import type { PlotZoomBase, ZoomState } from "../Plot/plotZoom.js";
|
|
24
|
+
import type { TrendFit, TrendLineType } from "../Plot/trendLines.js";
|
|
24
25
|
import type { ZoomControlIconKey } from "../drawSteps/zoomControlsMarkup.js";
|
|
26
|
+
import type { BottomRightBox } from "../drawSteps/bottomRightControlsMarkup.js";
|
|
25
27
|
import type { ZoomTransform } from "d3-zoom";
|
|
26
28
|
import type { DataPoint } from "@d3plus/data";
|
|
27
|
-
import type { ClipShape, SceneNode, Transform } from "@d3plus/render";
|
|
28
|
-
import type { Axis, ColorScale, Legend, Message, TextBox, Timeline, Tooltip } from "../../components/index.js";
|
|
29
|
+
import type { ClipShape, SceneNode, Transform, TransitionRect } from "@d3plus/render";
|
|
30
|
+
import type { Axis, ColorScale, Legend, Message, SizeLegend, TextBox, Timeline, Tooltip } from "../../components/index.js";
|
|
31
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
32
|
+
import type { InsetKey, InsetPlacement, InsetRegion } from "../features/insetState.js";
|
|
29
33
|
import type Shape from "../../shapes/Shape.js";
|
|
30
34
|
import type { D3plusConfig, D3Scale } from "../../utils/index.js";
|
|
31
35
|
import type { PlotPaintContext } from "../features/plotPaint.js";
|
|
@@ -43,6 +47,15 @@ export interface Padding {
|
|
|
43
47
|
left: number;
|
|
44
48
|
right: number;
|
|
45
49
|
}
|
|
50
|
+
/** One entry on the drill-down history stack (`Viz._history`), pushed by a click.shape drill-down and popped by Back. */
|
|
51
|
+
export interface DrillDownHistoryEntry {
|
|
52
|
+
depth: number;
|
|
53
|
+
filter?: (d: DataPoint, i: number) => boolean;
|
|
54
|
+
/** `groupBy[groupDepth]`'s value for the clicked node — identifies the reunion node the Back morph grows back into. */
|
|
55
|
+
groupId?: unknown;
|
|
56
|
+
/** The groupBy index `groupId` was read at (== `_drawDepth` when the node was clicked). */
|
|
57
|
+
groupDepth?: number;
|
|
58
|
+
}
|
|
46
59
|
/**
|
|
47
60
|
D3-style selection — deliberately loose. d3-selection's element/datum
|
|
48
61
|
generics are invariant, so a single typed alias can't accept every
|
|
@@ -116,6 +129,8 @@ export interface VizInstance {
|
|
|
116
129
|
_y2?: (d: DataPoint, i: number) => number | Date | string;
|
|
117
130
|
_shape: (d: DataPoint, i: number) => string;
|
|
118
131
|
_size?: (d: DataPoint, i?: number) => number;
|
|
132
|
+
/** The data key `size` was set to, when it was set with a string; the size legend's default title. */
|
|
133
|
+
_sizeKey?: string;
|
|
119
134
|
_value?: (d: DataPoint, i: number) => number;
|
|
120
135
|
_time?: (d: DataPoint, i: number) => string | number | Date;
|
|
121
136
|
_sort?: ((a: DataPoint, b: DataPoint) => number) | null;
|
|
@@ -169,6 +184,10 @@ export interface VizInstance {
|
|
|
169
184
|
/** True while the current hover came from a colorScale bucket swatch. */
|
|
170
185
|
_hoverBucket?: boolean;
|
|
171
186
|
_highlight?: ((d: DataPoint, i?: number) => boolean) | false;
|
|
187
|
+
/** The `link` group this chart is registered under (see `linkGroup.ts`). */
|
|
188
|
+
_linkGroup?: string;
|
|
189
|
+
/** The categorical scale `initColorDefaults` created; linked charts still using it share their group's instead. */
|
|
190
|
+
_autoColorScale?: unknown;
|
|
172
191
|
/** Whether the search control's input is currently open. */
|
|
173
192
|
_searchOpen?: boolean;
|
|
174
193
|
/** The search control's current (lowercased) search term. */
|
|
@@ -179,6 +198,8 @@ export interface VizInstance {
|
|
|
179
198
|
_searchMatchIndex?: number;
|
|
180
199
|
_ordinalColorScale?: ((value: string) => string) | undefined;
|
|
181
200
|
_hoverDatum?: DataPoint | null;
|
|
201
|
+
/** Epoch ms until which an animated transition is in flight (pointer routing pauses). */
|
|
202
|
+
_transitionEndsAt?: number;
|
|
182
203
|
_userHover?: number;
|
|
183
204
|
_userDuration?: number;
|
|
184
205
|
_dataCutoff: number;
|
|
@@ -207,7 +228,80 @@ export interface VizInstance {
|
|
|
207
228
|
/** The user-set data, retained to detect changes across `.data()` calls. */
|
|
208
229
|
_userData?: DataPoint[] | string;
|
|
209
230
|
/** Drill-down history stack (back button). */
|
|
210
|
-
_history?:
|
|
231
|
+
_history?: DrillDownHistoryEntry[];
|
|
232
|
+
/**
|
|
233
|
+
The local, chart-family-defined "body rect" flip-morph fractions are
|
|
234
|
+
measured against — e.g. Treemap/Pack's margin-adjusted chart area at
|
|
235
|
+
local origin, or Plot's measured axis plot rect. Set by `runChartDraw`
|
|
236
|
+
(via `ChartDefinition.chartBodyRect`) or by Plot's own paint pipeline.
|
|
237
|
+
*/
|
|
238
|
+
_bodyRect?: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
width: number;
|
|
242
|
+
height: number;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
One-shot: the clicked node's rect, captured at click time and
|
|
246
|
+
normalized as fractions of the *pre-click* `_bodyRect`, armed by
|
|
247
|
+
`clickShape`. Resolved into `_resolvedEnterFrom` (against the *new*
|
|
248
|
+
draw's `_bodyRect`) and cleared by `resolveDrillMorph`. Also carries:
|
|
249
|
+
`key`, the clicked node's own scene key, resolved into
|
|
250
|
+
`_resolvedInstantExitKey` so its own exit (now filtered out of the new
|
|
251
|
+
scene) is removed instantly instead of animating on top of the
|
|
252
|
+
children that replace it; and, when the clicked node carried them
|
|
253
|
+
(currently only Pie/Donut wedges), `parentStartAngle`/`parentEndAngle`
|
|
254
|
+
— its angular range, read by the next draw's `pieEmit` to build each
|
|
255
|
+
entering child wedge's `flipFromArc` (a real arc confined within that
|
|
256
|
+
range, at full radius) via the actual arc generator.
|
|
257
|
+
*/
|
|
258
|
+
_pendingEnterOrigin?: {
|
|
259
|
+
fx: number;
|
|
260
|
+
fy: number;
|
|
261
|
+
fw: number;
|
|
262
|
+
fh: number;
|
|
263
|
+
key?: string | number;
|
|
264
|
+
parentStartAngle?: number;
|
|
265
|
+
parentEndAngle?: number;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
One-shot: the group id/depth being un-filtered by a Back click, armed by
|
|
269
|
+
the two Back-click sites — plus the OLD (pre-render) `_bodyRect`,
|
|
270
|
+
captured at the same moment, so the exiting siblings' own (frozen)
|
|
271
|
+
geometry can be read as proportions of the frame they were actually
|
|
272
|
+
laid out in. Resolved into `_resolvedExitTo`/`_resolvedExitToBody` (by
|
|
273
|
+
finding the matching node in the *new* `_chartScene`) and cleared by
|
|
274
|
+
`resolveDrillMorph`.
|
|
275
|
+
*/
|
|
276
|
+
_pendingExitReunion?: {
|
|
277
|
+
groupId: unknown;
|
|
278
|
+
groupDepth: number;
|
|
279
|
+
body?: {
|
|
280
|
+
x: number;
|
|
281
|
+
y: number;
|
|
282
|
+
width: number;
|
|
283
|
+
height: number;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
The drill-down morph's resolved enter/exit boxes for the upcoming
|
|
288
|
+
`drawScene` call, plus each one's "body" reference box (the full
|
|
289
|
+
layout entering/exiting nodes' own geometry is proportional within —
|
|
290
|
+
see `DrawOptions.enterFromBody`/`exitToBody`). Set by
|
|
291
|
+
`resolveDrillMorph`, read and one-shot cleared by `_drawSceneToTarget`.
|
|
292
|
+
*/
|
|
293
|
+
_resolvedEnterFrom?: TransitionRect;
|
|
294
|
+
_resolvedEnterFromBody?: TransitionRect;
|
|
295
|
+
_resolvedExitTo?: TransitionRect;
|
|
296
|
+
_resolvedExitToBody?: TransitionRect;
|
|
297
|
+
/** See `DrawOptions.instantExitKey` — the clicked node's own key, resolved from `_pendingEnterOrigin.key`. */
|
|
298
|
+
_resolvedInstantExitKey?: string | number;
|
|
299
|
+
/** See `DrawOptions.reunionEnterKey` — the Back click's reunion node's own key, resolved when `resolveDrillMorph` finds a match. */
|
|
300
|
+
_resolvedReunionEnterKey?: string | number;
|
|
301
|
+
/** See `DrawOptions.reunionEnterFrom` — the OLD (pre-Back) body rect, the full size the reunion node's former children occupied. */
|
|
302
|
+
_resolvedReunionEnterFrom?: TransitionRect;
|
|
303
|
+
/** See `DrawOptions.instantExitAll` — set alongside `_resolvedReunionEnterKey`, when a reunion match was found. */
|
|
304
|
+
_resolvedInstantExitAll?: boolean;
|
|
211
305
|
/** Cached measured size of the shared top-left controls panel (back/table-view/search). `measurement` is `topLeftControlsMarkup.ts`-internal (per-item positions); `signature` is the cache key (each contribution's html + resolved style). */
|
|
212
306
|
_topLeftControlsBox?: {
|
|
213
307
|
width: number;
|
|
@@ -219,10 +313,62 @@ export interface VizInstance {
|
|
|
219
313
|
_yAxis?: Axis;
|
|
220
314
|
_x2Axis?: Axis;
|
|
221
315
|
_y2Axis?: Axis;
|
|
316
|
+
/** The x/y data keys, when set by string (Plot's default axis titles). */
|
|
317
|
+
_xKey?: string;
|
|
318
|
+
_yKey?: string;
|
|
222
319
|
_xFunc?: (d: DataPoint, axis?: string) => number;
|
|
223
320
|
_yFunc?: (d: DataPoint, axis?: string) => number;
|
|
321
|
+
/** The plot area (inside the axes) in chart content space, set by the paint phase. */
|
|
322
|
+
_plotArea?: {
|
|
323
|
+
x: number;
|
|
324
|
+
y: number;
|
|
325
|
+
width: number;
|
|
326
|
+
height: number;
|
|
327
|
+
};
|
|
328
|
+
/** Crosshair guide-line paint for the shared tooltip. */
|
|
329
|
+
_crosshairConfig?: Record<string, unknown>;
|
|
330
|
+
/**
|
|
331
|
+
The active shared-tooltip hover, if any: the snapped discrete position
|
|
332
|
+
(pixel + data value), the hovered Line points to mark, and which side of
|
|
333
|
+
the marks the crosshair draws on.
|
|
334
|
+
*/
|
|
335
|
+
_sharedHoverState?: {
|
|
336
|
+
mode: "shared" | "single";
|
|
337
|
+
axis: "x" | "y";
|
|
338
|
+
px: number;
|
|
339
|
+
value: unknown;
|
|
340
|
+
markers: {
|
|
341
|
+
datum: DataPoint;
|
|
342
|
+
x: number;
|
|
343
|
+
y: number;
|
|
344
|
+
}[];
|
|
345
|
+
layer: "back" | "front";
|
|
346
|
+
} | null;
|
|
347
|
+
/** True while the shared multi-series tooltip owns the tooltip. */
|
|
348
|
+
_sharedHoverActive?: boolean;
|
|
349
|
+
/** The tooltip's own `arrow`/`thead`/`tbody`, held while the shared tooltip replaces them. */
|
|
350
|
+
_sharedTooltipSaved?: {
|
|
351
|
+
arrow: unknown;
|
|
352
|
+
thead: unknown;
|
|
353
|
+
tbody: unknown;
|
|
354
|
+
};
|
|
224
355
|
/** Internal size scale built in Plot's pipeline; maps `_size` → pixel radius. */
|
|
225
356
|
_sizeScaleD3?: D3Scale;
|
|
357
|
+
/** The radius scale the chart's layout actually drew with; the size legend paints from it. Null when nothing is sized. */
|
|
358
|
+
_sizeLegendFinal?: SizeLegendScale | null;
|
|
359
|
+
/** Size-legend component, rendered in the bottom-right corner panel. */
|
|
360
|
+
_sizeLegendClass?: SizeLegend;
|
|
361
|
+
/** The bottom-right corner panel reserved in `vizDrawPure` for this draw (see `bottomRightControlsMarkup.ts`). */
|
|
362
|
+
_bottomRightBox?: BottomRightBox | null;
|
|
363
|
+
/** Chrome being laid out for the chart's interior this pass, which claims no margin (see `pipeline/insetPlacement.ts`). */
|
|
364
|
+
_insetPending?: Set<InsetKey> | null;
|
|
365
|
+
/** The chrome drawn inside the chart's negative space this draw, and where. */
|
|
366
|
+
_insetPlacement?: InsetPlacement | null;
|
|
367
|
+
/** The default `legendPosition`/`colorScalePosition` accessors; a different one means the user picked a side. */
|
|
368
|
+
_insetAutoPositions?: {
|
|
369
|
+
legend: unknown;
|
|
370
|
+
colorScale: unknown;
|
|
371
|
+
};
|
|
226
372
|
/** Per-axis "is this axis time-valued" flags, set by `formatPlotData`. */
|
|
227
373
|
_xTime?: boolean;
|
|
228
374
|
_x2Time?: boolean;
|
|
@@ -244,9 +390,16 @@ export interface VizInstance {
|
|
|
244
390
|
_labelConnectorConfig?: Record<string, unknown>;
|
|
245
391
|
_lineMarkerConfig?: Record<string, unknown>;
|
|
246
392
|
_confidenceConfig?: Record<string, unknown>;
|
|
393
|
+
/** The `trendLine` setting: a regression type, `true` (linear), or `false`. */
|
|
394
|
+
_trendLine?: TrendLineType;
|
|
395
|
+
_trendLineConfig?: Record<string, unknown>;
|
|
396
|
+
/** The trend lines fit by `computePlotTrendFits` for the current draw. */
|
|
397
|
+
_trendFits?: TrendFit[];
|
|
247
398
|
_xCutoff?: number;
|
|
248
399
|
_yCutoff?: number;
|
|
249
400
|
_discreteCutoff?: number;
|
|
401
|
+
/** Per-datum `[start, end]` along the discrete axis; makes that axis continuous (see Plot/discreteSpan.ts). */
|
|
402
|
+
_discreteExtent?: (d: DataPoint) => [number, number];
|
|
250
403
|
_buffer?: Record<string, unknown>;
|
|
251
404
|
_legendClass?: Legend;
|
|
252
405
|
_colorScaleClass?: ColorScale;
|
|
@@ -315,10 +468,18 @@ export interface VizInstance {
|
|
|
315
468
|
_scheduleSceneRepaint(): void;
|
|
316
469
|
_sceneRepaintRAF?: number;
|
|
317
470
|
_thresholdFunction?(data: DataPoint[], tree?: unknown): DataPoint[];
|
|
471
|
+
/** The chart's size-legend radius scale, estimated before layout for the given chart area (see `ChartDefinition.sizeLegendScale`). */
|
|
472
|
+
_sizeLegendScale?(available: {
|
|
473
|
+
width: number;
|
|
474
|
+
height: number;
|
|
475
|
+
}): SizeLegendScale | null;
|
|
476
|
+
/** The region chart chrome may be drawn inside, with the chart's marks as obstacles (see `ChartDefinition.insetRegion`). */
|
|
477
|
+
_insetRegion?(): InsetRegion | null;
|
|
318
478
|
toScene?(): SceneNode;
|
|
319
479
|
config?(_?: D3plusConfig): D3plusConfig | this;
|
|
320
480
|
active?(_?: unknown): unknown;
|
|
321
481
|
hover?(_?: unknown): unknown;
|
|
482
|
+
highlight?(_?: unknown): unknown;
|
|
322
483
|
timeFilter?(_?: ((d: DataPoint, i: number) => boolean) | false): VizInstance;
|
|
323
484
|
render?(callback?: () => void): VizInstance;
|
|
324
485
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type Viz from "./Viz.js";
|
|
2
|
+
/**
|
|
3
|
+
Whether viewport observation is available (false in JSDOM/SSR, where the
|
|
4
|
+
scroll-polling fallback in `vizRender` is used instead).
|
|
5
|
+
@private
|
|
6
|
+
*/
|
|
7
|
+
export declare function canObserveVisibility(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
Observes `el` against `scrollContainer` through one IntersectionObserver
|
|
10
|
+
shared by every viz using that root. `onVisible` runs once `el` has stayed in
|
|
11
|
+
view for `delay` ms, so elements scrolled past quickly never fire; leaving
|
|
12
|
+
view cancels the pending call and runs `onHidden`, if given. Returns a function
|
|
13
|
+
that stops observing.
|
|
14
|
+
@private
|
|
15
|
+
*/
|
|
16
|
+
export declare function observeVisibility(el: Element, scrollContainer: unknown, onVisible: () => void, delay?: number, onHidden?: () => void): () => void;
|
|
17
|
+
/**
|
|
18
|
+
Releases a chart's DOM/scene while it is off-screen. The `<svg>` and its
|
|
19
|
+
size stay in place so the page doesn't reflow; data and config are kept, so
|
|
20
|
+
`vizReload` can redraw it without refetching.
|
|
21
|
+
@private
|
|
22
|
+
*/
|
|
23
|
+
export declare function vizUnload(viz: Viz): void;
|
|
24
|
+
/**
|
|
25
|
+
Redraws an unloaded chart without an entrance animation.
|
|
26
|
+
@private
|
|
27
|
+
*/
|
|
28
|
+
export declare function vizReload(viz: Viz): void;
|
|
29
|
+
/**
|
|
30
|
+
Installs (or removes) the persistent observer that unloads the chart when it
|
|
31
|
+
leaves the viewport and reloads it on return. Idempotent.
|
|
32
|
+
@private
|
|
33
|
+
*/
|
|
34
|
+
export declare function syncUnloadObserver(viz: Viz): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Axis } from "./Axis.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
3
|
+
Axis preset whose ticks are drawn below the horizontal domain path. Accepts everything the base Axis class does.
|
|
4
4
|
*/
|
|
5
5
|
export default class AxisBottom extends Axis {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Axis } from "./Axis.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
3
|
+
Axis preset whose ticks are drawn to the left of the vertical domain path. Accepts everything the base Axis class does.
|
|
4
4
|
*/
|
|
5
5
|
export default class AxisLeft extends Axis {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Axis } from "./Axis.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
3
|
+
Axis preset whose ticks are drawn to the right of the vertical domain path. Accepts everything the base Axis class does.
|
|
4
4
|
*/
|
|
5
5
|
export default class AxisRight extends Axis {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Axis } from "./Axis.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
3
|
+
Axis preset whose ticks are drawn above the horizontal domain path. Accepts everything the base Axis class does.
|
|
4
4
|
*/
|
|
5
5
|
export default class AxisTop extends Axis {
|
|
6
6
|
/**
|
|
@@ -52,7 +52,7 @@ export default class ColorScale extends BaseClass {
|
|
|
52
52
|
*/
|
|
53
53
|
toScene(): GroupNode;
|
|
54
54
|
/**
|
|
55
|
-
The
|
|
55
|
+
The ColorScale is constructed by combining an Axis for the ticks/labels and a Rect for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the Axis class used to display the text (axisConfig) and the Rect class used to draw the color breaks (rectConfig). This method acts as a pass-through to the config method of the Axis.
|
|
56
56
|
*/
|
|
57
57
|
axisConfig(): Record<string, unknown>;
|
|
58
58
|
axisConfig(_: Record<string, unknown>): this;
|
|
@@ -62,7 +62,7 @@ export default class ColorScale extends BaseClass {
|
|
|
62
62
|
data(): DataPoint[];
|
|
63
63
|
data(_: DataPoint[]): this;
|
|
64
64
|
/**
|
|
65
|
-
A pass-through for the
|
|
65
|
+
A pass-through for the TextBox class used to style the labelMin and labelMax text.
|
|
66
66
|
*/
|
|
67
67
|
labelConfig(): Record<string, unknown>;
|
|
68
68
|
labelConfig(_: Record<string, unknown>): this;
|
|
@@ -77,7 +77,7 @@ export default class ColorScale extends BaseClass {
|
|
|
77
77
|
labelMax(): string | undefined;
|
|
78
78
|
labelMax(_: string): this;
|
|
79
79
|
/**
|
|
80
|
-
|
|
80
|
+
Configuration passed to the Legend that draws the scale when its values are rendered as discrete swatches instead of a continuous bar (for example a categorical or buckets scale), acting as a pass-through to that Legend's config method.
|
|
81
81
|
*/
|
|
82
82
|
legendConfig(): Record<string, unknown>;
|
|
83
83
|
legendConfig(_: Record<string, unknown>): this;
|
|
@@ -88,7 +88,7 @@ export default class ColorScale extends BaseClass {
|
|
|
88
88
|
*/
|
|
89
89
|
outerBounds(): Record<string, number>;
|
|
90
90
|
/**
|
|
91
|
-
The
|
|
91
|
+
The ColorScale is constructed by combining an Axis for the ticks/labels and a Rect for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the Axis class used to display the text (axisConfig) and the Rect class used to draw the color breaks (rectConfig). This method acts as a pass-through to the config method of the Rect.
|
|
92
92
|
*/
|
|
93
93
|
rectConfig(): Record<string, unknown>;
|
|
94
94
|
rectConfig(_: Record<string, unknown>): this;
|
|
@@ -5,12 +5,18 @@ export declare function measureLegendTitle(legend: Legend): void;
|
|
|
5
5
|
export declare function computeLegendLineData(legend: Legend, availableHeight: number): Record<string, unknown>[];
|
|
6
6
|
/**
|
|
7
7
|
Runs the row-wrapping pass: builds rows, retries label-free if it overflows,
|
|
8
|
-
then distributes row `y` offsets. Returns the
|
|
8
|
+
then distributes row `y` offsets. Returns the widest row's width, or
|
|
9
|
+
`false` when even label-free swatches overflow the available space.
|
|
9
10
|
*/
|
|
10
|
-
export declare function wrapLegendRows(legend: Legend, availableWidth: number, availableHeight: number
|
|
11
|
+
export declare function wrapLegendRows(legend: Legend, availableWidth: number, availableHeight: number): number | false;
|
|
12
|
+
/**
|
|
13
|
+
Empties a legend whose swatches don't fit: no title, no shapes, and zero
|
|
14
|
+
outer bounds, so a parent chart claims no margin for it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearLegend(legend: Legend): void;
|
|
11
17
|
/** Computes `_outerBounds` (size + aligned x/y offset) from the laid-out rows. */
|
|
12
18
|
export declare function computeLegendBounds(legend: Legend, spaceNeeded: number): void;
|
|
13
19
|
/** Renders the title TextBox into the legend's title group. */
|
|
14
20
|
export declare function renderLegendTitle(legend: Legend): void;
|
|
15
|
-
/** Builds the per-shape data and renders the Circle/Rect swatch groups. */
|
|
21
|
+
/** Builds the per-shape data and renders the Circle/Rect swatch groups (Line entries draw in both). */
|
|
16
22
|
export declare function renderLegendShapes(legend: Legend): void;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { D3Selection } from "@d3plus/dom";
|
|
2
|
+
import type { GroupNode, SvgRenderer } from "@d3plus/render";
|
|
3
|
+
import { BaseClass } from "../../utils/index.js";
|
|
4
|
+
import type { SizeLegendLayout } from "./sizeLegendLayout.js";
|
|
5
|
+
/** Circle paint for the legend's nested circles. */
|
|
6
|
+
export interface SizeLegendShapeConfig {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
fill?: string;
|
|
9
|
+
fillOpacity?: number;
|
|
10
|
+
stroke?: string;
|
|
11
|
+
strokeOpacity?: number;
|
|
12
|
+
strokeWidth?: number;
|
|
13
|
+
}
|
|
14
|
+
/** Paint for the leader lines running from each circle to its label. */
|
|
15
|
+
export interface SizeLegendLineConfig {
|
|
16
|
+
stroke?: string;
|
|
17
|
+
strokeDasharray?: number[];
|
|
18
|
+
strokeOpacity?: number;
|
|
19
|
+
strokeWidth?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Font settings for the value labels and the title. */
|
|
22
|
+
export interface SizeLegendTextConfig {
|
|
23
|
+
fontColor?: string;
|
|
24
|
+
fontFamily?: string | string[];
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
fontWeight?: number | string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
A nested-circle legend for a size scale: concentric circles sharing a
|
|
30
|
+
bottom tangent, each labeled with the value its radius encodes.
|
|
31
|
+
|
|
32
|
+
Charts that size marks by a `size` accessor (bubble plots, Geomap points,
|
|
33
|
+
Network, Rings) draw one automatically in their bottom-right corner (see
|
|
34
|
+
`sizeLegend` and `sizeLegendConfig` on the chart). On its own, give it
|
|
35
|
+
any d3 continuous scale that maps values to pixel radii.
|
|
36
|
+
@example
|
|
37
|
+
new SizeLegend()
|
|
38
|
+
.scale(d3.scaleSqrt().domain([0, 1000]).range([2, 30]))
|
|
39
|
+
.title("Population")
|
|
40
|
+
.select("#container")
|
|
41
|
+
.render();
|
|
42
|
+
*/
|
|
43
|
+
export default class SizeLegend extends BaseClass {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
_layout: SizeLegendLayout;
|
|
46
|
+
/** Drops values whose circles would outgrow this radius; set by a zoomed chart. */
|
|
47
|
+
_maxRadius?: number;
|
|
48
|
+
_select?: D3Selection;
|
|
49
|
+
_sceneRenderer?: SvgRenderer;
|
|
50
|
+
/**
|
|
51
|
+
Invoked when creating a new class instance, and sets any default parameters.
|
|
52
|
+
@private
|
|
53
|
+
*/
|
|
54
|
+
constructor();
|
|
55
|
+
/**
|
|
56
|
+
Font settings for the value labels: `fontColor`, `fontFamily`, `fontSize`. Merged into the current settings.
|
|
57
|
+
*/
|
|
58
|
+
labelConfig(): SizeLegendTextConfig;
|
|
59
|
+
labelConfig(_: SizeLegendTextConfig): this;
|
|
60
|
+
/**
|
|
61
|
+
Paint for the leader lines: `stroke`, `strokeWidth`, `strokeOpacity`, `strokeDasharray`. Merged into the current settings.
|
|
62
|
+
*/
|
|
63
|
+
lineConfig(): SizeLegendLineConfig;
|
|
64
|
+
lineConfig(_: SizeLegendLineConfig): this;
|
|
65
|
+
/**
|
|
66
|
+
Paint for the circles: `fill`, `fillOpacity`, `stroke`, `strokeWidth`, `strokeOpacity`. Merged into the current settings.
|
|
67
|
+
*/
|
|
68
|
+
shapeConfig(): SizeLegendShapeConfig;
|
|
69
|
+
shapeConfig(_: SizeLegendShapeConfig): this;
|
|
70
|
+
/**
|
|
71
|
+
Font settings for the title: `fontColor`, `fontFamily`, `fontSize`, `fontWeight`. Merged into the current settings.
|
|
72
|
+
*/
|
|
73
|
+
titleConfig(): SizeLegendTextConfig;
|
|
74
|
+
titleConfig(_: SizeLegendTextConfig): this;
|
|
75
|
+
/**
|
|
76
|
+
The container element for a standalone render, as a d3 selector or DOM element.
|
|
77
|
+
*/
|
|
78
|
+
select(): D3Selection | undefined;
|
|
79
|
+
select(_: string | HTMLElement | SVGElement): this;
|
|
80
|
+
/**
|
|
81
|
+
Lays the legend out from the current config and returns the result
|
|
82
|
+
(circles, leader lines, labels, overall width/height). Pure: reads no
|
|
83
|
+
DOM, so a chart can measure the legend before it draws.
|
|
84
|
+
*/
|
|
85
|
+
layout(): SizeLegendLayout;
|
|
86
|
+
/**
|
|
87
|
+
The width and height of the last layout, in pixels.
|
|
88
|
+
*/
|
|
89
|
+
outerBounds(): {
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
Produces a backend-agnostic scene graph of the last layout, offset by the
|
|
95
|
+
optional transform.
|
|
96
|
+
@param x Horizontal offset of the legend's top-left corner.
|
|
97
|
+
@param y Vertical offset of the legend's top-left corner.
|
|
98
|
+
*/
|
|
99
|
+
toScene(x?: number, y?: number): GroupNode;
|
|
100
|
+
/**
|
|
101
|
+
Renders the legend. Standalone, it paints into the `select` container
|
|
102
|
+
(sized to the legend); inside a chart (`renderMode("compute")`) it only
|
|
103
|
+
lays out, and the chart composes `toScene()`.
|
|
104
|
+
@param callback Optional callback invoked after rendering completes.
|
|
105
|
+
*/
|
|
106
|
+
render(callback?: () => void): this;
|
|
107
|
+
}
|