@d3plus/core 4.11.0 → 4.12.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/es/internal.js +15 -5
- package/es/src/charts/Alluvial/emit.js +2 -2
- package/es/src/charts/Alluvial/index.js +7 -1
- package/es/src/charts/Alluvial/titles.js +24 -4
- package/es/src/charts/ArcDiagram/emit.js +27 -13
- package/es/src/charts/ArcDiagram/events.js +6 -2
- package/es/src/charts/ArcDiagram/index.js +2 -0
- package/es/src/charts/BarChart/index.js +3 -10
- package/es/src/charts/Calendar/index.js +2 -0
- package/es/src/charts/Candlestick/index.js +4 -10
- package/es/src/charts/Gantt/applyLayout.js +2 -4
- package/es/src/charts/Geomap/flowEmit.js +11 -6
- package/es/src/charts/Hexbin/index.js +2 -0
- package/es/src/charts/Icicle/index.js +3 -1
- package/es/src/charts/Matrix/applyLayout.js +20 -9
- package/es/src/charts/Matrix/index.js +19 -1
- package/es/src/charts/Network/applyLayout.js +36 -5
- package/es/src/charts/Network/bundle.js +5 -4
- package/es/src/charts/Network/emit.js +39 -40
- package/es/src/charts/Network/graph.js +34 -5
- package/es/src/charts/Network/graphFluent.js +5 -3
- package/es/src/charts/Network/index.js +6 -1
- package/es/src/charts/Pack/applyLayout.js +16 -5
- package/es/src/charts/Pack/emit.js +15 -8
- package/es/src/charts/Pack/groupRows.js +61 -0
- package/es/src/charts/Pack/index.js +3 -0
- package/es/src/charts/Pack/neutralPaint.js +20 -0
- package/es/src/charts/Pack/nodeNames.js +35 -0
- package/es/src/charts/ParallelCoordinates/axes.js +22 -22
- package/es/src/charts/ParallelCoordinates/chrome.js +18 -0
- package/es/src/charts/ParallelCoordinates/index.js +3 -1
- package/es/src/charts/ParallelCoordinates/titles.js +17 -9
- package/es/src/charts/Pie/emit.js +9 -1
- package/es/src/charts/Pie/index.js +10 -0
- package/es/src/charts/Plot/areaEnter.js +68 -0
- package/es/src/charts/Plot/draw.js +26 -12
- package/es/src/charts/Plot/index.js +4 -10
- package/es/src/charts/Plot/lineMarkerKeys.js +19 -0
- package/es/src/charts/Plot/plotInit.js +6 -0
- package/es/src/charts/Plot/shapeLabelLegend.js +67 -0
- package/es/src/charts/Plot/sharedHover.js +2 -1
- package/es/src/charts/Plot/sharedTooltip.js +13 -3
- package/es/src/charts/PolarArea/index.js +2 -1
- package/es/src/charts/Priestley/applyLayout.js +11 -7
- package/es/src/charts/Priestley/index.js +0 -2
- package/es/src/charts/Priestley/timeAxis.js +11 -8
- package/es/src/charts/Pyramid/gutter.js +52 -16
- package/es/src/charts/Pyramid/index.js +55 -7
- package/es/src/charts/Pyramid/scene.js +4 -4
- package/es/src/charts/Radar/applyLayout.js +31 -33
- package/es/src/charts/Radar/axisDecorations.js +29 -17
- package/es/src/charts/Radar/curvedLabels.js +43 -2
- package/es/src/charts/Radar/emit.js +30 -15
- package/es/src/charts/Radar/index.js +41 -2
- package/es/src/charts/Radar/points.js +85 -0
- package/es/src/charts/RadialBar/emit.js +6 -1
- package/es/src/charts/RadialBar/index.js +10 -0
- package/es/src/charts/RadialMatrix/applyLayout.js +115 -31
- package/es/src/charts/RadialMatrix/index.js +15 -2
- package/es/src/charts/Rings/applyLayout.js +11 -150
- package/es/src/charts/Rings/emit.js +80 -40
- package/es/src/charts/Rings/index.js +27 -4
- package/es/src/charts/Rings/ringsCurves.js +156 -0
- package/es/src/charts/Rings/ringsParallel.js +20 -3
- package/es/src/charts/Rings/ringsPlacement.js +152 -0
- package/es/src/charts/Rings/ringsSizing.js +61 -38
- package/es/src/charts/Sankey/applyLayout.js +18 -4
- package/es/src/charts/Sankey/index.js +7 -1
- package/es/src/charts/Sunburst/emit.js +9 -1
- package/es/src/charts/Sunburst/index.js +13 -1
- package/es/src/charts/Tree/applyLayout.js +44 -14
- package/es/src/charts/Tree/emit.js +5 -5
- package/es/src/charts/Tree/index.js +10 -12
- package/es/src/charts/Tree/keys.js +33 -0
- package/es/src/charts/Tree/nodeLabel.js +15 -0
- package/es/src/charts/Treemap/emitGroupHeaders.js +3 -5
- package/es/src/charts/definition/makeChart.js +6 -2
- package/es/src/charts/drawSteps/minimap.js +4 -20
- package/es/src/charts/drawSteps/zoomActions.js +36 -0
- package/es/src/charts/drawSteps/zoomControls.js +31 -18
- package/es/src/charts/drawSteps/zoomControlsMarkup.js +23 -4
- package/es/src/charts/drawSteps/zoomDrag.js +188 -0
- package/es/src/charts/drawSteps/zoomFit.js +69 -0
- package/es/src/charts/events/click.legend.js +4 -2
- package/es/src/charts/events/click.shape.js +5 -3
- package/es/src/charts/events/mouseenter.js +6 -16
- package/es/src/charts/events/mouseleave.js +9 -2
- package/es/src/charts/events/mousemove.legend.js +28 -32
- package/es/src/charts/events/mousemove.shape.js +44 -44
- package/es/src/charts/features/axes.js +15 -4
- package/es/src/charts/features/axesFinal.js +7 -2
- package/es/src/charts/features/axesMeasure.js +26 -8
- package/es/src/charts/features/axisTooltip.js +138 -0
- package/es/src/charts/features/centerLabel.js +177 -0
- package/es/src/charts/features/colorScaleBivariate.js +83 -0
- package/es/src/charts/features/colorScaleBucket.js +18 -0
- package/es/src/charts/features/colorScaleHover.js +30 -5
- package/es/src/charts/features/colorScaleLimit.js +73 -0
- package/es/src/charts/features/colorScaleTooltip.js +77 -0
- package/es/src/charts/features/colorScaleTop.js +61 -0
- package/es/src/charts/features/curvedArrows.js +33 -0
- package/es/src/charts/features/depthKey.js +26 -0
- package/es/src/charts/features/edgeArrows.js +61 -2
- package/es/src/charts/features/featuresColorScale.js +57 -16
- package/es/src/charts/features/hoverTicks.js +41 -0
- package/es/src/charts/features/idleQueue.js +72 -0
- package/es/src/charts/features/linkInteraction.js +59 -7
- package/es/src/charts/features/networkMeasures.js +241 -0
- package/es/src/charts/features/nodeStats.js +309 -0
- package/es/src/charts/features/plotEndLabels.js +28 -7
- package/es/src/charts/features/plotPaint.js +9 -2
- package/es/src/charts/features/shapeEmit.js +7 -1
- package/es/src/charts/features/textHalo.js +3 -2
- package/es/src/charts/partition/chartFields.js +12 -3
- package/es/src/charts/partition/interaction.js +10 -5
- package/es/src/charts/pipeline/insetPlacement.js +8 -3
- package/es/src/charts/polar/chrome.js +81 -9
- package/es/src/charts/polar/config.js +4 -0
- package/es/src/charts/polar/wedgeLayout.js +2 -1
- package/es/src/charts/viz/Viz.js +24 -15
- package/es/src/charts/viz/VizBase.js +39 -4
- package/es/src/charts/viz/backgroundInk.js +10 -0
- package/es/src/charts/viz/emphasis.js +14 -0
- package/es/src/charts/viz/fillStroke.js +10 -0
- package/es/src/charts/viz/interactionOpacity.js +115 -32
- package/es/src/charts/viz/reportDrawError.js +15 -0
- package/es/src/charts/viz/setCursor.js +29 -0
- package/es/src/charts/viz/tooltipEnabled.js +38 -0
- package/es/src/charts/viz/userClick.js +34 -0
- package/es/src/charts/viz/vizDataPolling.js +0 -1
- package/es/src/charts/viz/vizDefaults.js +13 -34
- package/es/src/charts/viz/vizFields.js +6 -1
- package/es/src/charts/viz/vizRender.js +35 -5
- package/es/src/charts/viz/vizVisibility.js +12 -2
- package/es/src/components/Axis/Axis.js +29 -2
- package/es/src/components/Axis/axisBreak.js +29 -7
- package/es/src/components/Axis/axisDefaults.js +11 -0
- package/es/src/components/Axis/axisLabelKinds.js +36 -0
- package/es/src/components/Axis/axisLabelLineHeight.js +19 -0
- package/es/src/components/Axis/axisLabelRoom.js +37 -0
- package/es/src/components/Axis/axisLabelSize.js +171 -0
- package/es/src/components/Axis/axisLabelThinning.js +98 -4
- package/es/src/components/Axis/axisLayout.js +71 -46
- package/es/src/components/Axis/axisLayoutLabels.js +82 -140
- package/es/src/components/Axis/axisLayoutScale.js +9 -10
- package/es/src/components/Axis/axisLimit.js +27 -0
- package/es/src/components/Axis/axisMaxSize.js +39 -0
- package/es/src/components/Axis/axisRender.js +20 -8
- package/es/src/components/Axis/axisRounding.js +16 -1
- package/es/src/components/Axis/axisScene.js +11 -2
- package/es/src/components/Axis/axisTitle.js +53 -0
- package/es/src/components/Axis/axisTooltipTargets.js +128 -0
- package/es/src/components/ColorScale/ColorScale.js +62 -18
- package/es/src/components/ColorScale/bivariateRender.js +353 -0
- package/es/src/components/ColorScale/bivariateScale.js +150 -0
- package/es/src/components/ColorScale/colorScaleRender.js +32 -2
- package/es/src/components/ColorScale/colorScaleSwatchTooltips.js +77 -0
- package/es/src/components/Legend/Legend.js +10 -2
- package/es/src/components/Legend/legendCut.js +108 -0
- package/es/src/components/Legend/legendRender.js +38 -13
- package/es/src/components/TextBox.js +5 -2
- package/es/src/components/Timeline/timelineRender.js +2 -1
- package/es/src/components/textBoxScene.js +3 -0
- package/es/src/components/textEllipsis.js +7 -0
- package/es/src/components/tooltipDom.js +8 -5
- package/es/src/fluent.js +48 -0
- package/es/src/utils/BaseClass.js +7 -2
- package/es/src/utils/configValue.js +9 -0
- package/package.json +10 -10
- package/types/index.d.ts +1 -1
- package/types/internal.d.ts +22 -5
- package/types/src/charts/Alluvial/titles.d.ts +16 -3
- package/types/src/charts/ArcDiagram/emit.d.ts +3 -2
- package/types/src/charts/ArcDiagram/events.d.ts +2 -1
- package/types/src/charts/Geomap/flowEmit.d.ts +3 -2
- package/types/src/charts/Matrix/applyLayout.d.ts +4 -2
- package/types/src/charts/Network/applyLayout.d.ts +11 -0
- package/types/src/charts/Network/bundle.d.ts +3 -1
- package/types/src/charts/Network/graph.d.ts +12 -4
- package/types/src/charts/Pack/applyLayout.d.ts +2 -0
- package/types/src/charts/Pack/groupRows.d.ts +46 -0
- package/types/src/charts/Pack/index.d.ts +3 -0
- package/types/src/charts/Pack/neutralPaint.d.ts +14 -0
- package/types/src/charts/Pack/nodeNames.d.ts +23 -0
- package/types/src/charts/ParallelCoordinates/chrome.d.ts +12 -0
- package/types/src/charts/ParallelCoordinates/index.d.ts +1 -0
- package/types/src/charts/ParallelCoordinates/titles.d.ts +7 -2
- package/types/src/charts/Plot/areaEnter.d.ts +34 -0
- package/types/src/charts/Plot/index.d.ts +4 -10
- package/types/src/charts/Plot/lineMarkerKeys.d.ts +11 -0
- package/types/src/charts/Plot/shapeLabelLegend.d.ts +19 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +7 -1
- package/types/src/charts/Priestley/timeAxis.d.ts +7 -4
- package/types/src/charts/Pyramid/gutter.d.ts +28 -6
- package/types/src/charts/Pyramid/scene.d.ts +1 -1
- package/types/src/charts/Radar/applyLayout.d.ts +2 -3
- package/types/src/charts/Radar/axisDecorations.d.ts +5 -2
- package/types/src/charts/Radar/curvedLabels.d.ts +35 -0
- package/types/src/charts/Radar/emit.d.ts +5 -2
- package/types/src/charts/Radar/index.d.ts +7 -2
- package/types/src/charts/Radar/points.d.ts +50 -0
- package/types/src/charts/RadialMatrix/applyLayout.d.ts +6 -4
- package/types/src/charts/Rings/emit.d.ts +24 -2
- package/types/src/charts/Rings/index.d.ts +4 -2
- package/types/src/charts/Rings/ringsCurves.d.ts +50 -0
- package/types/src/charts/Rings/ringsGraph.d.ts +29 -5
- package/types/src/charts/Rings/ringsParallel.d.ts +4 -2
- package/types/src/charts/Rings/ringsPlacement.d.ts +47 -0
- package/types/src/charts/Rings/ringsSizing.d.ts +36 -9
- package/types/src/charts/Tree/applyLayout.d.ts +20 -0
- package/types/src/charts/Tree/keys.d.ts +25 -0
- package/types/src/charts/Tree/nodeLabel.d.ts +11 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +13 -0
- package/types/src/charts/definition/makeChart.d.ts +2 -2
- package/types/src/charts/drawSteps/zoomActions.d.ts +30 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +15 -0
- package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +16 -1
- package/types/src/charts/drawSteps/zoomDrag.d.ts +71 -0
- package/types/src/charts/drawSteps/zoomFit.d.ts +30 -0
- package/types/src/charts/features/axisTooltip.d.ts +49 -0
- package/types/src/charts/features/centerLabel.d.ts +75 -0
- package/types/src/charts/features/colorScaleBivariate.d.ts +50 -0
- package/types/src/charts/features/colorScaleBucket.d.ts +10 -0
- package/types/src/charts/features/colorScaleHover.d.ts +13 -3
- package/types/src/charts/features/colorScaleLimit.d.ts +60 -0
- package/types/src/charts/features/colorScaleTooltip.d.ts +43 -0
- package/types/src/charts/features/colorScaleTop.d.ts +30 -0
- package/types/src/charts/features/curvedArrows.d.ts +14 -0
- package/types/src/charts/features/depthKey.d.ts +19 -0
- package/types/src/charts/features/edgeArrows.d.ts +29 -2
- package/types/src/charts/features/hoverTicks.d.ts +30 -0
- package/types/src/charts/features/idleQueue.d.ts +46 -0
- package/types/src/charts/features/linkInteraction.d.ts +13 -4
- package/types/src/charts/features/networkMeasures.d.ts +53 -0
- package/types/src/charts/features/nodeStats.d.ts +93 -0
- package/types/src/charts/features/plotEndLabels.d.ts +14 -1
- package/types/src/charts/features/textHalo.d.ts +4 -3
- package/types/src/charts/partition/chartFields.d.ts +6 -1
- package/types/src/charts/pipeline/insetPlacement.d.ts +6 -0
- package/types/src/charts/polar/chrome.d.ts +19 -6
- package/types/src/charts/viz/Viz.d.ts +10 -3
- package/types/src/charts/viz/VizBase.d.ts +31 -2
- package/types/src/charts/viz/backgroundInk.d.ts +8 -0
- package/types/src/charts/viz/emphasis.d.ts +17 -0
- package/types/src/charts/viz/fillStroke.d.ts +7 -0
- package/types/src/charts/viz/reportDrawError.d.ts +12 -0
- package/types/src/charts/viz/setCursor.d.ts +26 -0
- package/types/src/charts/viz/tooltipEnabled.d.ts +31 -0
- package/types/src/charts/viz/userClick.d.ts +35 -0
- package/types/src/charts/viz/vizFields.d.ts +5 -0
- package/types/src/charts/viz/vizTypes.d.ts +16 -0
- package/types/src/charts/viz/vizVisibility.d.ts +7 -0
- package/types/src/components/Axis/Axis.d.ts +33 -3
- package/types/src/components/Axis/axisBreak.d.ts +19 -3
- package/types/src/components/Axis/axisDefaults.d.ts +12 -0
- package/types/src/components/Axis/axisLabelKinds.d.ts +22 -0
- package/types/src/components/Axis/axisLabelLineHeight.d.ts +27 -0
- package/types/src/components/Axis/axisLabelRoom.d.ts +17 -0
- package/types/src/components/Axis/axisLabelSize.d.ts +82 -0
- package/types/src/components/Axis/axisLabelThinning.d.ts +38 -2
- package/types/src/components/Axis/axisLayout.d.ts +9 -2
- package/types/src/components/Axis/axisLayoutLabels.d.ts +28 -33
- package/types/src/components/Axis/axisLayoutScale.d.ts +3 -1
- package/types/src/components/Axis/axisLimit.d.ts +18 -0
- package/types/src/components/Axis/axisMaxSize.d.ts +48 -0
- package/types/src/components/Axis/axisRounding.d.ts +8 -0
- package/types/src/components/Axis/axisTitle.d.ts +30 -0
- package/types/src/components/Axis/axisTooltipTargets.d.ts +82 -0
- package/types/src/components/ColorScale/ColorScale.d.ts +21 -11
- package/types/src/components/ColorScale/bivariateRender.d.ts +53 -0
- package/types/src/components/ColorScale/bivariateScale.d.ts +92 -0
- package/types/src/components/ColorScale/colorScaleSwatchTooltips.d.ts +48 -0
- package/types/src/components/Legend/Legend.d.ts +5 -0
- package/types/src/components/Legend/legendCut.d.ts +31 -0
- package/types/src/components/Legend/legendRender.d.ts +6 -1
- package/types/src/components/TextBox.d.ts +4 -0
- package/types/src/components/textEllipsis.d.ts +6 -0
- package/types/src/fluent.d.ts +18 -0
- package/types/src/shapes/emitLabels.d.ts +1 -1
- package/types/src/utils/D3plusConfig.d.ts +485 -609
- package/types/src/utils/configValue.d.ts +8 -0
- package/types/src/utils/index.d.ts +1 -1
- package/types/umd-entry.d.ts +4 -0
- package/umd/d3plus-core.full.js +22930 -17936
- package/umd/d3plus-core.full.min.js +2 -2
- package/umd/d3plus-core.js +21240 -16404
- package/umd/d3plus-core.min.js +2 -2
|
@@ -7,12 +7,17 @@
|
|
|
7
7
|
- `axisLabels.ts` — sizes the web to its metric labels.
|
|
8
8
|
- `levels.ts` — nice ring values + level value labels.
|
|
9
9
|
- `rings.ts` — ring styles + ring scene nodes.
|
|
10
|
-
- `
|
|
10
|
+
- `points.ts` — a dot on each vertex, its tooltip row, and its hover.
|
|
11
|
+
- `emit.ts` — Path scene nodes per polygon, then the dots.
|
|
11
12
|
*/
|
|
12
13
|
import type { ChartDefinition } from "../definition/ChartDefinition.js";
|
|
13
14
|
export declare const radarDef: ChartDefinition;
|
|
14
15
|
/**
|
|
15
|
-
Creates a radar visualization based on an array of data.
|
|
16
|
+
Creates a radar visualization based on an array of data. Each polygon is
|
|
17
|
+
a see-through fill outlined in its color (`shapeConfig.Path`), with a dot
|
|
18
|
+
on every vertex, styled by `shapeConfig.Circle`. The dots, not the
|
|
19
|
+
polygons, answer the pointer: hovering one shows that group's value for
|
|
20
|
+
its metric. `r: 0` hides them, and the polygons answer instead.
|
|
16
21
|
*/
|
|
17
22
|
declare const _default: new () => any;
|
|
18
23
|
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Radar vertex dots: one Circle per polygon vertex, painted from
|
|
3
|
+
`shapeConfig.Circle` (a `r` of 0 or less draws none). Hovering a dot
|
|
4
|
+
shows that group's value for its metric and keeps only that metric's
|
|
5
|
+
label bright.
|
|
6
|
+
*/
|
|
7
|
+
import type { DataPoint } from "@d3plus/data";
|
|
8
|
+
import type { SceneNode } from "@d3plus/render";
|
|
9
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
10
|
+
/** The metric and value a dot's datum stands for. */
|
|
11
|
+
export interface RadarPoint {
|
|
12
|
+
metric: unknown;
|
|
13
|
+
value: number;
|
|
14
|
+
}
|
|
15
|
+
/** A polygon's vertices, as `applyRadarLayout` lays them out. */
|
|
16
|
+
export interface RadarPointGroup {
|
|
17
|
+
id: string | number;
|
|
18
|
+
/** Each vertex's merged row. */
|
|
19
|
+
arr: DataPoint[];
|
|
20
|
+
/** Each vertex's metric. */
|
|
21
|
+
metrics: unknown[];
|
|
22
|
+
/** Each vertex's value. */
|
|
23
|
+
values: number[];
|
|
24
|
+
/** Each vertex's position, relative to the web's center. */
|
|
25
|
+
points: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/** Marks `row` as the dot for `point`, so its tooltip and hover read it. */
|
|
31
|
+
export declare function registerRadarPoint(row: DataPoint, point: RadarPoint): void;
|
|
32
|
+
/** The metric and value `d` stands for when it is a dot's row, else undefined. */
|
|
33
|
+
export declare function radarPointOf(d: unknown): RadarPoint | undefined;
|
|
34
|
+
/**
|
|
35
|
+
The tooltip rows for a hovered datum: a dot's metric and value, nothing
|
|
36
|
+
for a polygon.
|
|
37
|
+
*/
|
|
38
|
+
export declare function radarPointTooltipRows(viz: VizInstance, d: DataPoint): [string, string][];
|
|
39
|
+
/**
|
|
40
|
+
One Circle node per vertex of group `g` (the `gi`th), painted from
|
|
41
|
+
`circleConfig`. None when the radius resolves to 0 or less.
|
|
42
|
+
*/
|
|
43
|
+
export declare function radarGroupPointNodes(viz: VizInstance, g: RadarPointGroup, gi: number, circleConfig: Record<string, unknown>): SceneNode[];
|
|
44
|
+
/** The vertex dots of every group, in group order (see `radarGroupPointNodes`). */
|
|
45
|
+
export declare const radarPointNodes: (viz: VizInstance, groups: RadarPointGroup[], circleConfig: Record<string, unknown>) => SceneNode[];
|
|
46
|
+
/**
|
|
47
|
+
Wraps the chart's `mouseenter` handler so hovering a dot lights its
|
|
48
|
+
whole polygon but only its own metric's label (see `_hoverFocus`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function radarPointHover(viz: VizInstance): void;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
`applyRadialMatrixLayout` — RadialMatrix's chart-specific layout stage.
|
|
3
3
|
|
|
4
4
|
Runs `matrixData.prepData`, computes polar geometry (label positions,
|
|
5
|
-
arc generator),
|
|
6
|
-
|
|
7
|
-
`viz.ctx
|
|
8
|
-
|
|
5
|
+
arc generator), and lays the column labels into `_chartScene`: curved
|
|
6
|
+
just outside the circle when they all fit (see `labelPosition`), which
|
|
7
|
+
leaves the circle the most room, else straight in `viz.ctx.columnLabels`
|
|
8
|
+
(a TextBox, in compute mode) wherever they don't curve. Stashes
|
|
9
|
+
`arcData` on `viz.ctx`, plus `radialMatrixWidth`/`radialMatrixHeight`
|
|
10
|
+
so the chart transform can center the layout.
|
|
9
11
|
*/
|
|
10
12
|
import type { TransformStage } from "../pipeline/stages.js";
|
|
11
13
|
export declare const applyRadialMatrixLayout: TransformStage;
|
|
@@ -34,14 +34,35 @@ export interface RingsEdge {
|
|
|
34
34
|
targetBisectX?: number;
|
|
35
35
|
targetBisectY?: number;
|
|
36
36
|
loop?: SelfLoopGeometry;
|
|
37
|
+
/** A link along one ring: the cubics it draws as (see `ringArcCubics`). */
|
|
38
|
+
segments?: Cubic[];
|
|
37
39
|
}
|
|
40
|
+
type Cubic = [
|
|
41
|
+
[
|
|
42
|
+
number,
|
|
43
|
+
number
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
number,
|
|
47
|
+
number
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
number,
|
|
51
|
+
number
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
number,
|
|
55
|
+
number
|
|
56
|
+
]
|
|
57
|
+
];
|
|
38
58
|
/**
|
|
39
59
|
An edge's visible stroke: `d`, cut short inside its arrowheads (see
|
|
40
60
|
`edgeArrowTrims`). A spline edge or a loop follows its curve up to each
|
|
41
|
-
head's base, then runs along the head's axis (see `
|
|
61
|
+
head's base, then runs along the head's axis (see `cubicsArrowEdge`); a
|
|
42
62
|
spline's arrow tips sit on the node's edge, where the curve ends.
|
|
63
|
+
`scale` widens the stroke (see `emphasizedArrowEdge`).
|
|
43
64
|
*/
|
|
44
|
-
export declare function ringsVisibleD(viz: VizInstance, edge: RingsEdge, i: number, strokeWidth: unknown, d: string): string;
|
|
65
|
+
export declare function ringsVisibleD(viz: VizInstance, edge: RingsEdge, i: number, strokeWidth: unknown, d: string, scale?: number): string;
|
|
45
66
|
/** Each edge's scene key, unique across `edges`: parallel edges after the first add their order among them (see `uniqueLinkKeys`). */
|
|
46
67
|
export declare const ringsLinkKeys: (edges: readonly RingsEdge[]) => string[];
|
|
47
68
|
/**
|
|
@@ -55,3 +76,4 @@ export declare function ringsEdgeAnchor(edge: RingsEdge): LinkAnchor;
|
|
|
55
76
|
*/
|
|
56
77
|
export declare function ringsEdgePath(edge: RingsEdge): [number, number][] | null;
|
|
57
78
|
export declare const ringsEmit: ChartEmit;
|
|
79
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
Rings — node-link diagram laid out around a central focal node in
|
|
3
|
-
|
|
3
|
+
concentric rings (`hops` of them).
|
|
4
4
|
|
|
5
5
|
Implementation files in this folder:
|
|
6
|
-
- `applyLayout.ts` —
|
|
6
|
+
- `applyLayout.ts` — the layout stage: labels, link strokes, ctx.
|
|
7
7
|
- `emit.ts` — link Paths + per-shape-type node groups.
|
|
8
8
|
- `ringsGraph.ts` — node set + link resolution.
|
|
9
|
+
- `ringsPlacement.ts` — ring claiming, node angles, drawn links.
|
|
10
|
+
- `ringsCurves.ts` — the curves of links between ring nodes.
|
|
9
11
|
- `ringsSizing.ts` — ring geometry + node sizing.
|
|
10
12
|
*/
|
|
11
13
|
import type { ChartDefinition } from "../definition/ChartDefinition.js";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Rings' curved links between ring nodes: a link across rings bends
|
|
3
|
+
through the gap between them, and a link along one ring runs a little
|
|
4
|
+
over a quarter of the way into the gap outside it, around that circle,
|
|
5
|
+
and back in.
|
|
6
|
+
|
|
7
|
+
@module
|
|
8
|
+
*/
|
|
9
|
+
import type { RingsEdge, RingsNode } from "./ringsGraph.js";
|
|
10
|
+
import type { RingGeometry } from "./ringsSizing.js";
|
|
11
|
+
type Point = [number, number];
|
|
12
|
+
/** A cubic Bézier curve: its start, two control points, and end. */
|
|
13
|
+
export type Cubic = [Point, Point, Point, Point];
|
|
14
|
+
/** The radius of ring `k` (1 innermost) in `geom`, also past the last ring. */
|
|
15
|
+
export declare const ringRadius: (geom: RingGeometry, k: number) => number;
|
|
16
|
+
/** The radius halfway between ring `k` and the ring (or spacing) outside it. */
|
|
17
|
+
export declare const gapMiddle: (geom: RingGeometry, k: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
The circle a link along ring `k` runs around: `RING_ARC_SHARE` of the
|
|
20
|
+
way into the gap outside the ring, and clear of both nodes.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ringArcRadius: (geom: RingGeometry, k: number, nodes: Pick<RingsNode, "r">[]) => number;
|
|
23
|
+
/**
|
|
24
|
+
The cubics of a circular arc around `c` of `radius`, from angle `from`
|
|
25
|
+
turning `sweep` radians (negative turns the other way), a quarter turn
|
|
26
|
+
or less each.
|
|
27
|
+
*/
|
|
28
|
+
export declare function arcCubics(c: Point, radius: number, from: number, sweep: number): Cubic[];
|
|
29
|
+
/**
|
|
30
|
+
The curves of a link between two nodes on one ring, around the circle
|
|
31
|
+
of `radius` about `c`: out from the source's outer side, turning onto
|
|
32
|
+
the circle, along it the shorter way around, and back in to the
|
|
33
|
+
target's outer side. Each turn takes as much of the circle as it rises
|
|
34
|
+
to it (less when the nodes sit closer than that, where the two turns
|
|
35
|
+
meet at the circle in a single arch).
|
|
36
|
+
*/
|
|
37
|
+
export declare function ringArcCubics(source: Pick<RingsNode, "x" | "y" | "r" | "radians">, target: Pick<RingsNode, "x" | "y" | "r" | "radians">, c: Point, radius: number): Cubic[];
|
|
38
|
+
/** Joined cubics as one path's `d`, unrounded like the other Rings links'. */
|
|
39
|
+
export declare const ringsSegmentsD: (curves: readonly Cubic[]) => string;
|
|
40
|
+
/** Lays out a link along one ring around its `arc`: its `segments`, ends, and bisect points. */
|
|
41
|
+
export declare function applyRingArc(edge: RingsEdge): void;
|
|
42
|
+
/**
|
|
43
|
+
Sets a link's curve between two ring nodes. Across rings, it leaves each
|
|
44
|
+
node on the side facing the other's ring and bends through the middle of
|
|
45
|
+
the gap between them. Along one ring, it runs a little over a quarter
|
|
46
|
+
of the way into the gap outside that ring (or past the last ring),
|
|
47
|
+
around it, and back in (see `ringArcCubics`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function curveRingsEdge(edge: RingsEdge, geom: RingGeometry): void;
|
|
50
|
+
export {};
|
|
@@ -23,12 +23,9 @@ export interface RingsNode {
|
|
|
23
23
|
x?: number;
|
|
24
24
|
y?: number;
|
|
25
25
|
r?: number;
|
|
26
|
-
ring
|
|
26
|
+
/** The ring the node sits on, 1 innermost (unset on the center). */
|
|
27
|
+
ring?: number;
|
|
27
28
|
radians?: number;
|
|
28
|
-
edges?: RingsEdge[] | Record<string, {
|
|
29
|
-
angle: number;
|
|
30
|
-
radius: number;
|
|
31
|
-
}>;
|
|
32
29
|
size?: number;
|
|
33
30
|
labelBounds?: {
|
|
34
31
|
x: number;
|
|
@@ -63,6 +60,33 @@ export interface RingsEdge {
|
|
|
63
60
|
targetBisectY?: number;
|
|
64
61
|
/** The loop a link from a node to itself draws as, once laid out. */
|
|
65
62
|
loop?: SelfLoopGeometry;
|
|
63
|
+
/**
|
|
64
|
+
A link along one ring: the circle its middle runs along (centered on
|
|
65
|
+
the chart's center), and the curves it draws as, from source to target.
|
|
66
|
+
*/
|
|
67
|
+
arc?: {
|
|
68
|
+
cx: number;
|
|
69
|
+
cy: number;
|
|
70
|
+
radius: number;
|
|
71
|
+
};
|
|
72
|
+
segments?: [
|
|
73
|
+
[
|
|
74
|
+
number,
|
|
75
|
+
number
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
number,
|
|
79
|
+
number
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
number,
|
|
83
|
+
number
|
|
84
|
+
],
|
|
85
|
+
[
|
|
86
|
+
number,
|
|
87
|
+
number
|
|
88
|
+
]
|
|
89
|
+
][];
|
|
66
90
|
}
|
|
67
91
|
/** A node record as a link end. */
|
|
68
92
|
export declare const ringsLinkEnd: (n: RingsNode) => LinkEnd;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Rings' parallel links: several links between the same two nodes, in
|
|
3
3
|
either direction. Each node takes one place on its ring however many
|
|
4
4
|
links reach it, and the links fan out as curves bowed either side of
|
|
5
|
-
the line between their nodes,
|
|
5
|
+
the line between their nodes (or, along one ring, circle around at
|
|
6
|
+
different distances), so each stays its own mark.
|
|
6
7
|
*/
|
|
7
8
|
import type { RingsEdge } from "./ringsGraph.js";
|
|
8
9
|
type Point = {
|
|
@@ -36,7 +37,8 @@ export declare function bowedEdge(s: Point, t: Point, normal: [number, number],
|
|
|
36
37
|
leaving a link with no parallel alone. Their middles sit a hit path's
|
|
37
38
|
width (and a gap) apart, so each can be pointed at. A straight link
|
|
38
39
|
becomes a bowed curve (see `bowedEdge`); a curved one moves to the side
|
|
39
|
-
(see `shiftSpline`)
|
|
40
|
+
(see `shiftSpline`); one along a ring circles nearer or farther out (see
|
|
41
|
+
`shiftRingArc`). The side follows the two nodes, not the link's
|
|
40
42
|
direction, so links both ways between them fan apart too.
|
|
41
43
|
*/
|
|
42
44
|
export declare function fanParallelEdges(edges: readonly RingsEdge[]): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
2
|
+
import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
|
|
3
|
+
import type { RingsEdge, RingsNode } from "./ringsGraph.js";
|
|
4
|
+
import type { RingGeometry } from "./ringsSizing.js";
|
|
5
|
+
/** The center's rings, innermost first, and each ring node's children on the ring outside it. */
|
|
6
|
+
export interface RingsTree {
|
|
7
|
+
rings: RingsNode[][];
|
|
8
|
+
children: Map<RingsNode, RingsNode[]>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
Claims the nodes on each of `hops` rings around `center`, breadth-first,
|
|
12
|
+
so a node reachable by several paths sits once, on its shallowest ring.
|
|
13
|
+
The first ring is the center's neighbors, fewest links first; each later
|
|
14
|
+
ring is, in order, the unclaimed neighbors of each node on the ring
|
|
15
|
+
inside it, which become that node's children.
|
|
16
|
+
*/
|
|
17
|
+
export declare function claimRings(linkMap: Record<string, RingsEdge[]>, center: RingsNode, hops: number): RingsTree;
|
|
18
|
+
/**
|
|
19
|
+
How many outer-ring slots each node spans: one on the outermost ring (or
|
|
20
|
+
with no children), else the sum of its children's.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ringWeights(tree: RingsTree): Map<RingsNode, number>;
|
|
23
|
+
/**
|
|
24
|
+
Sets each ring node's angle (`radians`) and position on its ring. The
|
|
25
|
+
circle splits into one slot per outer-ring position (`ringWeights`): the
|
|
26
|
+
first ring's nodes take arcs as wide as their slots, the first centered
|
|
27
|
+
at the top, and each node's children split its arc the same way. Returns
|
|
28
|
+
the number of slots.
|
|
29
|
+
*/
|
|
30
|
+
export declare function placeRings(tree: RingsTree, geom: RingGeometry): number;
|
|
31
|
+
/**
|
|
32
|
+
Places the center node and `geom.rings.length` rings around it, and sizes
|
|
33
|
+
every node. Returns the placed `nodes` (center first, then ring by ring),
|
|
34
|
+
the `rings`, and the size scale (null when unsized).
|
|
35
|
+
*/
|
|
36
|
+
export declare function placeRingsNodes(v: VizInstance, linkMap: Record<string, RingsEdge[]>, center: RingsNode, geom: RingGeometry): {
|
|
37
|
+
nodes: RingsNode[];
|
|
38
|
+
rings: RingsNode[][];
|
|
39
|
+
radius: SizeLegendScale | null;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
The links drawn between placed nodes, each once: every link from the
|
|
43
|
+
center to the first ring, and every link from a node on a ring inside the
|
|
44
|
+
outermost to another ring node (curved, see `curveRingsEdge`). With
|
|
45
|
+
`ringLinks`, links between two nodes on the outermost ring draw too.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildRingsEdges(rings: RingsNode[][], linkMap: Record<string, RingsEdge[]>, center: RingsNode, geom: RingGeometry, ringLinks?: boolean): RingsEdge[];
|
|
@@ -6,7 +6,7 @@ interface SizedNode {
|
|
|
6
6
|
data: DataPoint;
|
|
7
7
|
i: number;
|
|
8
8
|
r?: number;
|
|
9
|
-
ring?:
|
|
9
|
+
ring?: number;
|
|
10
10
|
size?: number;
|
|
11
11
|
}
|
|
12
12
|
type RadiusScale = SizeLegendScale & ((n: number) => number);
|
|
@@ -14,19 +14,46 @@ type RadiusScale = SizeLegendScale & ((n: number) => number);
|
|
|
14
14
|
export interface RingGeometry {
|
|
15
15
|
width: number;
|
|
16
16
|
height: number;
|
|
17
|
+
/** The distance between neighboring rings, and the room outside the last for its labels. */
|
|
17
18
|
ringWidth: number;
|
|
19
|
+
/** The first ring's radius. */
|
|
18
20
|
primaryRing: number;
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
The ring spacing nodes are sized by: the center, its label, and the
|
|
23
|
+
first ring's nodes. With one ring, the two-ring chart's, so they keep
|
|
24
|
+
that size.
|
|
25
|
+
*/
|
|
26
|
+
baseRing: number;
|
|
27
|
+
/** Each ring's radius, innermost first. */
|
|
28
|
+
rings: number[];
|
|
20
29
|
}
|
|
21
|
-
/**
|
|
22
|
-
export declare function
|
|
30
|
+
/** The number of rings a `hops` value asks for: a whole number, at least 1 (2 when unset or not a number). */
|
|
31
|
+
export declare function ringsHops(hops: unknown): number;
|
|
23
32
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`ringsSizeScale`, and return it; unsized charts use the fixed ring radii
|
|
27
|
-
and return null.
|
|
33
|
+
Ring geometry for a chart area: the center plus `hops` rings, evenly
|
|
34
|
+
spaced so the last leaves one more spacing of room for its labels.
|
|
28
35
|
*/
|
|
29
|
-
export declare function
|
|
36
|
+
export declare function ringsGeometry(width: number, height: number, hops?: number): RingGeometry;
|
|
37
|
+
/**
|
|
38
|
+
The largest radius an unsized node may take on each of `count` rings
|
|
39
|
+
`ringWidth` apart, innermost first. Each ring's room halves the one
|
|
40
|
+
inside it, so outer nodes are smaller, and an inner ring's nodes stay
|
|
41
|
+
within half again the size of the ring outside it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ringNodeRadii(ringWidth: number, count: number): number[];
|
|
44
|
+
/**
|
|
45
|
+
Each ring's unsized node radius, innermost first: the first ring's
|
|
46
|
+
nodes take the two-ring chart's first-ring size for the `baseRing`
|
|
47
|
+
spacing, and every ring past it the second ring's.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ringsNodeRadii(geom: RingGeometry): number[];
|
|
50
|
+
/**
|
|
51
|
+
Assigns each ring node its `ring` (1 innermost) + `r`, and `center.r`.
|
|
52
|
+
Sized charts (`size` set) run every node, center included, through one
|
|
53
|
+
`ringsSizeScale`, and return it; unsized charts give each ring its
|
|
54
|
+
`ringsNodeRadii` radius and return null.
|
|
55
|
+
*/
|
|
56
|
+
export declare function sizeRingsNodes(v: VizInstance, center: SizedNode, geom: RingGeometry, slots: number, rings: SizedNode[][]): RadiusScale | null;
|
|
30
57
|
/**
|
|
31
58
|
Where the center node's label goes. Unsized, the center circle is always
|
|
32
59
|
large, so the label fills the inner ring's square as before. Sized, the
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
1
2
|
import type { TransformStage } from "../pipeline/stages.js";
|
|
3
|
+
type Branch = {
|
|
4
|
+
key?: string | number | boolean | null;
|
|
5
|
+
values?: Branch[] | DataPoint[];
|
|
6
|
+
} & Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
Whether a nest entry is a group rather than a data row: it has a key, `0`
|
|
9
|
+
or `false` included, and a list of values. `undefined`, `null` and `""`
|
|
10
|
+
are no key.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isBranch(d: Branch): boolean;
|
|
13
|
+
/**
|
|
14
|
+
The first level of a Tree's nest, with each entry that has no key (one
|
|
15
|
+
`nest` groups the rows without a first-level key under) replaced by the
|
|
16
|
+
rows under it, so each of those rows is a leaf under the root.
|
|
17
|
+
@param entries The first level of the nest.
|
|
18
|
+
@param levels The number of key levels the nest has.
|
|
19
|
+
*/
|
|
20
|
+
export declare function rootEntries(entries: Branch[], levels: number): Branch[];
|
|
2
21
|
export declare const applyTreeLayout: TransformStage;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
How a Tree reads a node's `groupBy` keys. A row that has no key at some
|
|
3
|
+
level (`undefined`, `null` or `""`) is drawn as a leaf of the group above
|
|
4
|
+
it, so it is named and keyed by the keys it does have.
|
|
5
|
+
*/
|
|
6
|
+
import type { DataPoint } from "@d3plus/data";
|
|
7
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
8
|
+
/** Whether a `groupBy` value is no key: `undefined`, `null` or `""`. */
|
|
9
|
+
export declare function noKey(value: unknown): boolean;
|
|
10
|
+
/**
|
|
11
|
+
The `groupBy` level a Tree node is named at: its own `level` when its row
|
|
12
|
+
has a key there, or else the deepest drawn level it has one at. Undefined
|
|
13
|
+
when the row has no key at any drawn level.
|
|
14
|
+
*/
|
|
15
|
+
export declare function nameLevel(viz: VizInstance, d: DataPoint, i: number, level: number): number | undefined;
|
|
16
|
+
/**
|
|
17
|
+
The id a Tree node's scene keys are built from: its `groupBy` value at its
|
|
18
|
+
own level, or, for a row without a key there, every drawn key it has,
|
|
19
|
+
missing ones included, joined with `/`, so it never matches the group it
|
|
20
|
+
is drawn under.
|
|
21
|
+
*/
|
|
22
|
+
export declare function nodeId(viz: VizInstance, d: {
|
|
23
|
+
data?: DataPoint;
|
|
24
|
+
depth?: number;
|
|
25
|
+
}, i: number): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
A Tree node's label at its own `groupBy` level, from the hierarchy depth
|
|
5
|
+
the layout stamps on the node's row: a branch node is named after its
|
|
6
|
+
group, not after the leaves under it. A row without a key at its own
|
|
7
|
+
level is a leaf there, named by the `label` accessor when there is one,
|
|
8
|
+
or else at the deepest level it has a key. The tooltip's title and the
|
|
9
|
+
node's accessible name both read it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function nodeLabel(viz: VizInstance, d: DataPoint, i: number): string;
|
|
@@ -72,6 +72,13 @@ interface ChartDefinitionBase {
|
|
|
72
72
|
data-driven chart; Circle and Rect shapes for the Plot family).
|
|
73
73
|
*/
|
|
74
74
|
pointMark?: (viz: VizInstance, node: SceneNode) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
Optional `groupBy` level a shape's row stands for, for a chart that
|
|
77
|
+
draws several levels at once (a Sunburst's rings). The `tooltip`
|
|
78
|
+
accessor receives it as `depth` (see `tooltipLevels`). Return undefined
|
|
79
|
+
for a row at the level the chart draws.
|
|
80
|
+
*/
|
|
81
|
+
shapeDepth?: (viz: VizInstance, d: DataPoint) => number | undefined;
|
|
75
82
|
/**
|
|
76
83
|
Optional small-multiples hooks (see `facet/facetConfig.ts`): the panel
|
|
77
84
|
aspect the chart reads best at, and for charts with scales, how panels
|
|
@@ -135,6 +142,12 @@ interface ChartDefinitionBase {
|
|
|
135
142
|
work, and return the same `scene` object when it changes nothing.
|
|
136
143
|
*/
|
|
137
144
|
decorateScene?: (viz: VizInstance, scene: Scene) => Scene;
|
|
145
|
+
/**
|
|
146
|
+
`false` when the chart's tooltip already shows its colorScale value
|
|
147
|
+
(Calendar's "Value" row, Hexbin's measure), so shape tooltips don't
|
|
148
|
+
add the colorScale's value rows (see `colorScaleTooltipRows`).
|
|
149
|
+
*/
|
|
150
|
+
colorScaleTooltip?: false;
|
|
138
151
|
/**
|
|
139
152
|
Imperative per-instance setup hook — runs once after `applyDefinition`
|
|
140
153
|
seeds the chart. Use for event handler overrides and shadowed methods
|
|
@@ -6,9 +6,9 @@
|
|
|
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
8
|
`_thresholdFunction` / `_thresholdLegend` / `_sizeLegendScale` / `_insetRegion` /
|
|
9
|
-
`_tableData` / `_colorScaleShape` / `_pointMark` delegate to `def.thresholdFunction` /
|
|
9
|
+
`_tableData` / `_colorScaleShape` / `_pointMark` / `_shapeDepth` delegate to `def.thresholdFunction` /
|
|
10
10
|
`def.sizeLegendScale` / `def.insetRegion` / `def.tableData` / `def.colorScaleShape` /
|
|
11
|
-
`def.pointMark` if
|
|
11
|
+
`def.pointMark` / `def.shapeDepth` if
|
|
12
12
|
present (else to the base chart's), `_facetHooks` layers `def.facet` over the base chart's, and
|
|
13
13
|
`toScene` passes the base chart's scene through `def.decorateScene`.
|
|
14
14
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The zoom-control buttons' actions, for a chart's `zoomIn`, `zoomOut`,
|
|
3
|
+
`zoomReset`, and `zoomBrush` methods: buttons of a page's own can zoom a
|
|
4
|
+
chart exactly as the built-in ones do, shown or not.
|
|
5
|
+
|
|
6
|
+
@module
|
|
7
|
+
*/
|
|
8
|
+
import type Viz from "../viz/Viz.js";
|
|
9
|
+
/**
|
|
10
|
+
Whether a chart can zoom right now: `zoom` is on and it has rendered, so
|
|
11
|
+
its zoom surface and brush are in place.
|
|
12
|
+
@param viz The chart.
|
|
13
|
+
*/
|
|
14
|
+
export declare function canZoom(viz: Viz): boolean;
|
|
15
|
+
/**
|
|
16
|
+
Zooms by `factor` about the chart area's center, as the zoom-in (`factor`
|
|
17
|
+
is `zoomFactor`) and zoom-out (`1 / zoomFactor`) buttons do, or resets to
|
|
18
|
+
the initial view for `0`, as the reset button does. Does nothing while
|
|
19
|
+
the chart can't zoom (see `canZoom`).
|
|
20
|
+
@param viz The chart.
|
|
21
|
+
@param factor The zoom multiplier, or 0 to reset.
|
|
22
|
+
*/
|
|
23
|
+
export declare function zoomBy(viz: Viz, factor: number): void;
|
|
24
|
+
/**
|
|
25
|
+
Turns brush mode on or off, as the brush button does, and has the button
|
|
26
|
+
(when it shows) report it. Does nothing while the chart can't zoom.
|
|
27
|
+
@param viz The chart.
|
|
28
|
+
@param on Whether brush mode is on.
|
|
29
|
+
*/
|
|
30
|
+
export declare function setZoomBrush(viz: Viz, on: boolean): void;
|
|
@@ -55,6 +55,21 @@ export declare function applyZoomPointerEvents(viz: Viz): void;
|
|
|
55
55
|
the zoom behavior measures from (Geomap's imperative tile layer).
|
|
56
56
|
*/
|
|
57
57
|
export declare function tileZoomTransform(viz: Viz): ZoomTransform;
|
|
58
|
+
/**
|
|
59
|
+
@name zoomEvents
|
|
60
|
+
Turns brush mode on or off, binding the zoom gestures to match: brush
|
|
61
|
+
mode hands every press to the zoom brush, and otherwise d3-zoom takes the
|
|
62
|
+
wheel, pinch, and pan (as `zoomScroll` and `zoomPan` allow) and the
|
|
63
|
+
`zoomDrag`/`zoomDoubleClick` gestures are bound beside it.
|
|
64
|
+
*/
|
|
65
|
+
export declare function zoomEvents(this: Viz, brush?: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
@name zoomMath
|
|
68
|
+
Zooms in or out by a multiplier about the chart area's center, as the
|
|
69
|
+
zoom-in and zoom-out buttons do; `0` resets to the initial view.
|
|
70
|
+
@param factor
|
|
71
|
+
*/
|
|
72
|
+
export declare function zoomMath(this: Viz, factor?: number): void;
|
|
58
73
|
/**
|
|
59
74
|
Applies a programmatic zoom: clamps the scale to `scaleExtent` and the
|
|
60
75
|
translate to `translateExtent` (the constraint d3-zoom enforces for
|
|
@@ -93,6 +93,9 @@ export declare const ZOOM_PANEL_PADDING = 4;
|
|
|
93
93
|
`padding` (with `box-sizing: border-box`) one 4px inset from the chart's
|
|
94
94
|
top/right edge. This isn't part of the auto-disable `zoomControlClassName`
|
|
95
95
|
triggers, so a host page never has to re-add its own spacing utility.
|
|
96
|
+
The panel spans the chart's width, so it lets the pointer through to
|
|
97
|
+
whatever it covers (a color scale's axis, a title) and only its buttons
|
|
98
|
+
(see `zoomControlsHtml`) take it.
|
|
96
99
|
*/
|
|
97
100
|
export declare const ZOOM_PANEL_STYLE: Record<string, string>;
|
|
98
101
|
/**
|
|
@@ -103,6 +106,7 @@ export declare const ZOOM_PANEL_STYLE: Record<string, string>;
|
|
|
103
106
|
consumer's own class onto each button without losing the fixed classes
|
|
104
107
|
event delegation depends on. The brush toggle carries `aria-pressed` (and
|
|
105
108
|
the `.active` class frameworks like Bootstrap style) while brush mode is on.
|
|
109
|
+
Each button takes the pointer back from the panel (`ZOOM_PANEL_STYLE`).
|
|
106
110
|
*/
|
|
107
111
|
export declare function zoomControlsHtml(viz: Viz): string;
|
|
108
112
|
/**
|
|
@@ -124,7 +128,7 @@ export declare function overlayHost(viz: Viz): HTMLElement | null;
|
|
|
124
128
|
a click on the button itself — e.g. leaving brush mode after a selection.
|
|
125
129
|
*/
|
|
126
130
|
export declare function syncBrushButton(viz: Viz): void;
|
|
127
|
-
/** Whether a chart shows the zoom-control panel. */
|
|
131
|
+
/** Whether a chart shows the zoom-control panel: it zooms, and `zoomControls` isn't false. */
|
|
128
132
|
export declare function showsZoomControls(viz: Viz): boolean;
|
|
129
133
|
/**
|
|
130
134
|
The zoom-control panel's size (padding included) as it will render in the
|
|
@@ -138,6 +142,17 @@ export declare function zoomControlsBox(viz: Viz): {
|
|
|
138
142
|
width: number;
|
|
139
143
|
height: number;
|
|
140
144
|
} | null;
|
|
145
|
+
/**
|
|
146
|
+
The box the minimap hangs beneath: the zoom-control panel, or, with the
|
|
147
|
+
buttons hidden (`zoomControls: false`), a strip as wide as the default
|
|
148
|
+
panel down to the chart area's top, so the minimap overlays the chart
|
|
149
|
+
area rather than the title and other top content that take the
|
|
150
|
+
buttons' room. Null when the chart doesn't zoom.
|
|
151
|
+
*/
|
|
152
|
+
export declare function minimapAnchor(viz: Viz): {
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
} | null;
|
|
141
156
|
/**
|
|
142
157
|
How far down the chart content must start to clear the zoom buttons
|
|
143
158
|
with the same gap below them as above: the panel's height (its top
|