@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
Link interaction shared by the node-link charts (Network, Rings, Sankey,
|
|
3
3
|
ArcDiagram): the datum each link is drawn with, its tooltip and spoken
|
|
4
|
-
label, what hovering a link or a
|
|
4
|
+
label, what hovering a link, a node, or a legend entry highlights, and
|
|
5
|
+
the connections a
|
|
5
6
|
node's tooltip lists.
|
|
6
7
|
|
|
7
8
|
A link's datum is its row from `links`, with `source` and `target`
|
|
@@ -119,6 +120,13 @@ export declare function linkAriaLabel(viz: VizInstance, d: LinkDatum): string;
|
|
|
119
120
|
Rows that aren't recorded nodes (legend entries) match by `nodeKey`.
|
|
120
121
|
*/
|
|
121
122
|
export declare function linkHighlight(viz: VizInstance, d: LinkDatum, nodeKey?: NodeKey): Predicate;
|
|
123
|
+
/**
|
|
124
|
+
What hovering a legend entry highlights: the nodes it stands for (one, or
|
|
125
|
+
every member of a merged entry, such as a cluster) and the links between
|
|
126
|
+
them. A row matches when every id it holds is one of the entry's, so the
|
|
127
|
+
entry matches itself.
|
|
128
|
+
*/
|
|
129
|
+
export declare function legendHighlight(viz: VizInstance, d: DataPoint, i: number): Predicate;
|
|
122
130
|
/**
|
|
123
131
|
A node's links in `graph`, the other end of each, and its direction,
|
|
124
132
|
strongest first. A link from the node to itself is `loop`, with the node
|
|
@@ -146,9 +154,10 @@ export declare function nodeTooltipLinkLimit(viz: VizInstance, graph: LinkGraph)
|
|
|
146
154
|
/** The arrow a node's tooltip marks a link from the node to itself with. */
|
|
147
155
|
export declare const LOOP_ARROW = "\u21BB";
|
|
148
156
|
/**
|
|
149
|
-
A node's tooltip rows: its number of connections
|
|
150
|
-
|
|
151
|
-
|
|
157
|
+
A node's tooltip rows: its number of connections (left out when its
|
|
158
|
+
degree takes its place) and the network measures `nodeTooltipStats`
|
|
159
|
+
lists (see `nodeStatRows`), then its strongest links ("→ Target" or "← Source", or "↻ Node" for a link to
|
|
160
|
+
itself, with the link's value when the links differ in value), up to
|
|
152
161
|
`nodeTooltipLinkLimit`. The arrows mirror right to left (see
|
|
153
162
|
`linkArrows`).
|
|
154
163
|
*/
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Shortest-path measures of a network's nodes: betweenness (Brandes'
|
|
3
|
+
algorithm) and closeness, from one search per node. The graph is a list
|
|
4
|
+
of directed arcs; an undirected link is two arcs, one each way.
|
|
5
|
+
*/
|
|
6
|
+
/** One way along a link: from `source` to `target`, `length` steps long (default 1). */
|
|
7
|
+
export interface MeasureArc {
|
|
8
|
+
source: string;
|
|
9
|
+
target: string;
|
|
10
|
+
length?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Each node's betweenness and closeness, both from 0 to 1. */
|
|
13
|
+
export interface NetworkMeasures {
|
|
14
|
+
betweenness: Map<string, number>;
|
|
15
|
+
closeness: Map<string, number>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
Works out the measures one node's search at a time (see
|
|
19
|
+
`networkMeasures`), so the work can be spread over several turns.
|
|
20
|
+
*/
|
|
21
|
+
export interface MeasuresTask {
|
|
22
|
+
/**
|
|
23
|
+
Runs searches until `budget` milliseconds have passed (at least one),
|
|
24
|
+
and returns whether every node has been searched.
|
|
25
|
+
*/
|
|
26
|
+
step(budget?: number): boolean;
|
|
27
|
+
/** The measures, once `step` has returned `true`. */
|
|
28
|
+
result(): NetworkMeasures;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
A task working out each node's betweenness and closeness (see
|
|
32
|
+
`networkMeasures`), one node's search per unit of work.
|
|
33
|
+
@param nodes The node ids; arcs naming other ids are ignored.
|
|
34
|
+
@param arcs The directed arcs between them.
|
|
35
|
+
*/
|
|
36
|
+
export declare function measuresTask(nodes: string[], arcs: MeasureArc[]): MeasuresTask;
|
|
37
|
+
/**
|
|
38
|
+
Each node's betweenness and closeness.
|
|
39
|
+
|
|
40
|
+
Betweenness is the share of shortest paths between other pairs of nodes
|
|
41
|
+
that pass through the node, normalized by `(n - 1)(n - 2)` (the most a
|
|
42
|
+
node can have, as the center of a star), so it runs from 0 to 1.
|
|
43
|
+
|
|
44
|
+
Closeness is the inverse of the node's average distance to the nodes it
|
|
45
|
+
can reach, scaled by the share of the other nodes it can reach (Wasserman
|
|
46
|
+
and Faust's form, so a node in a small component isn't as close as one
|
|
47
|
+
linked to everything). It is 1 for a node one step from every other, and
|
|
48
|
+
0 for a node that reaches none. In a directed graph it reads distances
|
|
49
|
+
from the node along its arcs.
|
|
50
|
+
@param nodes The node ids; arcs naming other ids are ignored.
|
|
51
|
+
@param arcs The directed arcs between them.
|
|
52
|
+
*/
|
|
53
|
+
export declare function networkMeasures(nodes: string[], arcs: MeasureArc[]): NetworkMeasures;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Network measures in a node's tooltip (Network, Rings, ArcDiagram, and
|
|
3
|
+
Sankey): its degree (in and out when the chart draws arrows, and in
|
|
4
|
+
Sankey), its betweenness and closeness, and its cluster. In a browser,
|
|
5
|
+
betweenness and closeness are worked out in idle time after the chart
|
|
6
|
+
draws (see `scheduleNodeStats`); a tooltip shown before they are ready
|
|
7
|
+
reads "…" for them, and fills them in when they are. They are kept until the chart's nodes or
|
|
8
|
+
links change.
|
|
9
|
+
*/
|
|
10
|
+
import type { DataPoint } from "@d3plus/data";
|
|
11
|
+
import type { ConfigField } from "../../fluent.js";
|
|
12
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
13
|
+
import type { ArrowValue } from "./edgeArrows.js";
|
|
14
|
+
import type { LinkGraph } from "./linkInteraction.js";
|
|
15
|
+
import type { MeasureArc } from "./networkMeasures.js";
|
|
16
|
+
/** A measure a node's tooltip can list. */
|
|
17
|
+
export type NodeStat = "degree" | "betweenness" | "closeness" | "cluster";
|
|
18
|
+
/** Every measure, in the order a node's tooltip lists them. */
|
|
19
|
+
export declare const NODE_STATS: readonly NodeStat[];
|
|
20
|
+
/** One link, as the measures read it. */
|
|
21
|
+
export interface StatLink {
|
|
22
|
+
source: string;
|
|
23
|
+
target: string;
|
|
24
|
+
/** Its index in `links`, for the `arrows` accessor. */
|
|
25
|
+
index: number;
|
|
26
|
+
/** Its value (`linkSize` or `value`), when it is a number. */
|
|
27
|
+
value?: number;
|
|
28
|
+
datum: DataPoint;
|
|
29
|
+
}
|
|
30
|
+
/** What a chart's links say about each node, for one `arrows` and weighting. */
|
|
31
|
+
export interface NodeStatsGraph {
|
|
32
|
+
/** Whether a link carries an arrowhead at one end only, so in and out differ. */
|
|
33
|
+
directed: boolean;
|
|
34
|
+
/** Each node's links (a link to itself counts once). */
|
|
35
|
+
degree: Map<string, number>;
|
|
36
|
+
/** Each node's links arriving at it (directed charts). */
|
|
37
|
+
inDegree: Map<string, number>;
|
|
38
|
+
/** Each node's links leaving it (directed charts). */
|
|
39
|
+
outDegree: Map<string, number>;
|
|
40
|
+
nodes: string[];
|
|
41
|
+
arcs: MeasureArc[];
|
|
42
|
+
}
|
|
43
|
+
type Row = [string, string];
|
|
44
|
+
/** The `nodeTooltipStats` and `nodeTooltipStatsConfig` fields. */
|
|
45
|
+
export declare function nodeStatsFields(): ConfigField[];
|
|
46
|
+
/**
|
|
47
|
+
The measures `nodeTooltipStats` asks for, in its order: every measure
|
|
48
|
+
for `true`, the known names of an Array (once each), and none otherwise.
|
|
49
|
+
*/
|
|
50
|
+
export declare function nodeTooltipStatList(value: unknown): NodeStat[];
|
|
51
|
+
/**
|
|
52
|
+
The degrees and the arcs the measures walk. A link is one-way when
|
|
53
|
+
`arrows` puts a head on one end only (from source to target for
|
|
54
|
+
`"target"`, back for `"source"`), and two-way otherwise. When `weighted`,
|
|
55
|
+
a link's length is the strongest link's weight over its own, so the
|
|
56
|
+
strongest link is one step and a link half as strong is two.
|
|
57
|
+
*/
|
|
58
|
+
export declare function nodeStatsGraph(nodes: string[], links: StatLink[], arrows: ArrowValue | undefined, weighted: boolean): NodeStatsGraph;
|
|
59
|
+
/**
|
|
60
|
+
Whether the measures are worked out in idle time: in a browser, but not
|
|
61
|
+
while `@d3plus/ssr` renders the chart (or anywhere without a window),
|
|
62
|
+
where they are worked out when first asked for.
|
|
63
|
+
*/
|
|
64
|
+
export declare function nodeStatsInIdle(viz: VizInstance): boolean;
|
|
65
|
+
/**
|
|
66
|
+
Works out a published graph's betweenness and closeness in the browser's
|
|
67
|
+
idle time after the chart draws (see `IdleQueue`), so a node's tooltip
|
|
68
|
+
rarely waits for them. The graphs one draw publishes (one per small
|
|
69
|
+
multiple) are settled together in the first idle turn after it: their
|
|
70
|
+
measures are queued, and a run for nodes and links the chart no longer
|
|
71
|
+
draws is cancelled. Nothing is queued while `@d3plus/ssr` renders.
|
|
72
|
+
@param refresh Runs when a graph's measures are ready, to update an open tooltip.
|
|
73
|
+
*/
|
|
74
|
+
export declare function scheduleNodeStats(viz: VizInstance, graph: LinkGraph, links: () => StatLink[], refresh: () => void): void;
|
|
75
|
+
/** What a node's tooltip shows for a measure still being worked out: an ellipsis. */
|
|
76
|
+
export declare const STAT_PENDING = "\u2026";
|
|
77
|
+
/**
|
|
78
|
+
A node's measure rows, in `nodeTooltipStats` order: "Degree" (or
|
|
79
|
+
"In-degree" and "Out-degree" when the chart draws arrows, and in
|
|
80
|
+
Sankey), "Betweenness", "Closeness", and "Cluster" (when clusters color
|
|
81
|
+
the chart and the node is in one). Betweenness and closeness read
|
|
82
|
+
`STAT_PENDING` until they are ready (see `measuresFor`), so the tooltip
|
|
83
|
+
keeps its size when they fill in. `degree` says whether its
|
|
84
|
+
degree is listed, so the tooltip leaves out its count of connections.
|
|
85
|
+
@param links The graph's links, read once per graph, `arrows`, and
|
|
86
|
+
weighting when a measure other than the cluster needs them.
|
|
87
|
+
@param refresh Runs when measures this asked for become ready.
|
|
88
|
+
*/
|
|
89
|
+
export declare function nodeStatRows(viz: VizInstance, graph: LinkGraph, id: string, links: () => StatLink[], refresh?: () => void): {
|
|
90
|
+
rows: Row[];
|
|
91
|
+
degree: boolean;
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
@@ -64,7 +64,7 @@ export declare function labelsXEnds(viz: Viz, showX: boolean, showY: boolean): b
|
|
|
64
64
|
export declare function domainEnds(axis: Axis): unknown[];
|
|
65
65
|
/**
|
|
66
66
|
Formats an axis's domain ends with its tick format and measures them with
|
|
67
|
-
its label font (
|
|
67
|
+
its label font and line height (see `labelLineHeight`).
|
|
68
68
|
Read after the axis has been measured or rendered.
|
|
69
69
|
*/
|
|
70
70
|
export declare function measureEndLabels(axis: Axis): EndLabelMeasure;
|
|
@@ -74,6 +74,19 @@ export declare function measureEndLabels(axis: Axis): EndLabelMeasure;
|
|
|
74
74
|
claim) shorter than the labels.
|
|
75
75
|
*/
|
|
76
76
|
export declare function endLabelSpace(measure: EndLabelMeasure, available: number): number;
|
|
77
|
+
/** How a Plot labels its x axis, and the height those labels claim below the plot. */
|
|
78
|
+
export interface XLabelClaim {
|
|
79
|
+
xLabelMode: XLabelMode;
|
|
80
|
+
xHeight: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
The x labels a Plot keeps once its chrome (title, legend, the corner
|
|
84
|
+
controls' reach, …) has claimed its margins. End labels claim their room
|
|
85
|
+
against the chart area as it stood before; when `room`, the height left
|
|
86
|
+
for the plot and its x labels, no longer holds both (see
|
|
87
|
+
`endLabelSpace`), they are dropped and the plot takes their height.
|
|
88
|
+
*/
|
|
89
|
+
export declare function endLabelsInRoom(claim: XLabelClaim, measure: () => EndLabelMeasure, room: number): XLabelClaim;
|
|
77
90
|
/**
|
|
78
91
|
Splits `span` between a start and an end label of natural widths `start`
|
|
79
92
|
and `end`, at least `gap` apart. Labels that fit keep room to their
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
color, painted under the text's fill, that clears the marks just around
|
|
4
4
|
each glyph.
|
|
5
5
|
*/
|
|
6
|
-
import type { SceneNode } from "@d3plus/render";
|
|
6
|
+
import type { SceneNode, TextNode } from "@d3plus/render";
|
|
7
7
|
/**
|
|
8
8
|
Copies of `nodes` with every text node (at any depth) haloed in `color`,
|
|
9
9
|
`width` pixels wide (half of it past each glyph's edge).
|
|
10
10
|
@param nodes The scene nodes.
|
|
11
11
|
@param color The halo color, usually the chart's background.
|
|
12
|
-
@param width The halo's stroke width
|
|
12
|
+
@param width The halo's stroke width, or a function of each text node
|
|
13
|
+
that gives it (to scale it with the text's size).
|
|
13
14
|
*/
|
|
14
|
-
export declare function textHalo(nodes: SceneNode[], color: string, width: number): SceneNode[];
|
|
15
|
+
export declare function textHalo(nodes: SceneNode[], color: string, width: number | ((node: TextNode) => number)): SceneNode[];
|
|
@@ -20,10 +20,15 @@ export declare function partitionSumCoerce(v: unknown): unknown;
|
|
|
20
20
|
export declare function partitionSumOnSet(viz: VizInstance, v: unknown): void;
|
|
21
21
|
/** Legend entries ordered by value, largest first. */
|
|
22
22
|
export declare function partitionLegendSort(viz: VizInstance): (a: DataPoint, b: DataPoint) => number;
|
|
23
|
+
/**
|
|
24
|
+
A def's `shapeDepth`: the `groupBy` level of the node a row is laid out
|
|
25
|
+
as, so a `tooltip` accessor can tell a parent node from the deepest ones.
|
|
26
|
+
*/
|
|
27
|
+
export declare function partitionShapeDepth<N extends PartitionNode>(interaction: PartitionInteraction<N>): (viz: VizInstance, d: DataPoint) => number | undefined;
|
|
23
28
|
/**
|
|
24
29
|
Records the chart's own default `color` and `shapeConfig.fill` (shading
|
|
25
30
|
applies only while they stay in place) as `<prefix>DefaultColor` and
|
|
26
31
|
`<prefix>DefaultFill`, and installs the shared hover, tooltip, and
|
|
27
|
-
click-to-zoom handlers.
|
|
32
|
+
click-to-zoom handlers, the last as the chart's own click.
|
|
28
33
|
*/
|
|
29
34
|
export declare function partitionSetup<N extends PartitionNode>(viz: VizInstance, interaction: PartitionInteraction<N>): void;
|
|
@@ -28,6 +28,12 @@ import type { VizInstance } from "../viz/vizTypes.js";
|
|
|
28
28
|
this from their `insetRegion`.
|
|
29
29
|
*/
|
|
30
30
|
export declare function sceneInsetRegion(viz: VizInstance, bounds?: Bounds, skip?: (node: SceneNode) => boolean): InsetRegion;
|
|
31
|
+
/**
|
|
32
|
+
The smallest a legend entry can be: the row a 12px label line takes, as
|
|
33
|
+
the Legend measures it (the line at the height it paints, see
|
|
34
|
+
`labelLineHeight`, and the pixel above it), plus the Legend's padding.
|
|
35
|
+
*/
|
|
36
|
+
export declare const MIN_LEGEND_ENTRY: number;
|
|
31
37
|
/**
|
|
32
38
|
Where a box of `width` × `height` sits in the open rects (sorted largest
|
|
33
39
|
first): in the first chart corner, in `CORNERS` order, that some rect
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import type { DataPoint } from "@d3plus/data";
|
|
9
9
|
import type { SceneNode } from "@d3plus/render";
|
|
10
10
|
import type { TransformStage } from "../pipeline/stages.js";
|
|
11
|
+
import type { RadarCurveLabel } from "../Radar/curvedLabels.js";
|
|
11
12
|
import type { RadarLevels } from "../Radar/levels.js";
|
|
12
13
|
type Viz = Parameters<TransformStage>[0]["viz"];
|
|
13
14
|
/** One category label to place around the circle. */
|
|
@@ -16,6 +17,8 @@ export interface PolarCategory {
|
|
|
16
17
|
text: string;
|
|
17
18
|
/** The slot's center angle (radians, 0 at 12 o'clock, clockwise). */
|
|
18
19
|
angle: number;
|
|
20
|
+
/** The slot's angle (radians); defaults to an even share of the circle. */
|
|
21
|
+
span?: number;
|
|
19
22
|
data: DataPoint;
|
|
20
23
|
}
|
|
21
24
|
/** A category label laid out for `emitLabels`. */
|
|
@@ -37,20 +40,30 @@ interface PolarLabelDatum {
|
|
|
37
40
|
};
|
|
38
41
|
rotateAnchor?: [number, number];
|
|
39
42
|
}
|
|
40
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
Where the category labels go, and the radius they leave for the circle:
|
|
45
|
+
the straight labels, and the ones that curve along it.
|
|
46
|
+
*/
|
|
41
47
|
export interface PolarCategoryLayout {
|
|
42
48
|
radius: number;
|
|
43
49
|
labels: PolarLabelDatum[];
|
|
50
|
+
curves: RadarCurveLabel[];
|
|
44
51
|
}
|
|
45
52
|
/**
|
|
46
53
|
Lays out the category labels around a circle centered in `width` ×
|
|
47
|
-
`height`, and the circle's radius. `outerPadding` "auto"
|
|
48
|
-
|
|
49
|
-
circle
|
|
54
|
+
`height`, and the circle's radius. `outerPadding` "auto" curves every
|
|
55
|
+
label just outside the circle when they all fit (see `labelPosition`),
|
|
56
|
+
which leaves the circle the most room, and otherwise sizes both from the
|
|
57
|
+
measured straight labels; a number reserves that many pixels around the
|
|
58
|
+
circle. Either way, a label that fits along the circle curves. With
|
|
59
|
+
`show` false, the circle fills the area.
|
|
50
60
|
*/
|
|
51
61
|
export declare function polarCategoryLayout(viz: Viz, categories: PolarCategory[], width: number, height: number, show?: boolean): PolarCategoryLayout;
|
|
52
|
-
/**
|
|
53
|
-
|
|
62
|
+
/**
|
|
63
|
+
Builds the category label nodes laid out by `polarCategoryLayout`: the
|
|
64
|
+
curved ones, and the straight ones that stay clear of them.
|
|
65
|
+
*/
|
|
66
|
+
export declare function polarCategoryNodes(viz: Viz, { labels, curves }: Pick<PolarCategoryLayout, "labels" | "curves">, key: string): SceneNode[];
|
|
54
67
|
/**
|
|
55
68
|
The value rings and their value labels (Radar's, the innermost included),
|
|
56
69
|
at the radii `toRadius` gives, keyed with `key`.
|
|
@@ -82,8 +82,8 @@ export default class Viz extends VizBase {
|
|
|
82
82
|
*/
|
|
83
83
|
_setSVGSize(width?: number, height?: number): void;
|
|
84
84
|
/**
|
|
85
|
-
Draws the visualization given the specified configuration.
|
|
86
|
-
@param callback Optional callback invoked after rendering completes. It also runs after every later redraw that doesn't pass a callback of its own, including the ones the chart starts itself (legend clicks, resizes, reloading after scrolling back into view), so it can redraw anything it adds to the chart.
|
|
85
|
+
Draws the visualization given the specified configuration. An error thrown while the chart draws (by an accessor in its config, say) is logged with `console.error`, and the chart keeps what it last painted.
|
|
86
|
+
@param callback Optional callback invoked after rendering completes. It also runs after every later redraw that doesn't pass a callback of its own, including the ones the chart starts itself (legend clicks, resizes, reloading after scrolling back into view), so it can redraw anything it adds to the chart. It still runs when the draw throws.
|
|
87
87
|
*/
|
|
88
88
|
render(callback?: () => void): this;
|
|
89
89
|
/**
|
|
@@ -133,6 +133,13 @@ export default class Viz extends VizBase {
|
|
|
133
133
|
i: number;
|
|
134
134
|
x: unknown;
|
|
135
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
The `groupBy` level a shape's row stands for (see
|
|
138
|
+
`ChartDefinition.shapeDepth`): undefined in the base chart, where every
|
|
139
|
+
shape sits at the level the chart draws.
|
|
140
|
+
@private
|
|
141
|
+
*/
|
|
142
|
+
_shapeDepth(_d: DataPoint): number | undefined;
|
|
136
143
|
/**
|
|
137
144
|
Whether a painted scene node is a point mark that nearest-point hover
|
|
138
145
|
(`hoverDistance`) resolves the pointer to. None in the base chart;
|
|
@@ -198,7 +205,7 @@ export default class Viz extends VizBase {
|
|
|
198
205
|
*/
|
|
199
206
|
_scheduleSceneRepaint(): void;
|
|
200
207
|
/**
|
|
201
|
-
Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads and polling for data, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
|
|
208
|
+
Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads and polling for data, cancels work waiting for idle time, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
|
|
202
209
|
*/
|
|
203
210
|
destroy(): this;
|
|
204
211
|
}
|
|
@@ -15,8 +15,8 @@ interface VizBase extends VizFieldAccessors {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
The fluent config accessors shared by every Viz chart that need more than
|
|
18
|
-
storing their value (most are generated from `vizFields.ts`)
|
|
19
|
-
the render lifecycle.
|
|
18
|
+
storing their value (most are generated from `vizFields.ts`), and the
|
|
19
|
+
zoom actions; `Viz` adds the render lifecycle.
|
|
20
20
|
*/
|
|
21
21
|
declare class VizBase extends BaseClass {
|
|
22
22
|
static readonly _displayName: string;
|
|
@@ -115,5 +115,34 @@ declare class VizBase extends BaseClass {
|
|
|
115
115
|
Accessor function or string key for the total value displayed in the visualization.
|
|
116
116
|
*/
|
|
117
117
|
total(_?: boolean | string | ((d: DataPoint, i: number) => number)): this | boolean | string | ((d: DataPoint, i: number) => number);
|
|
118
|
+
/**
|
|
119
|
+
Zooms the chart in by `zoomFactor` about the center of the chart area,
|
|
120
|
+
as the zoom-in button does. Works whether or not the zoom-control
|
|
121
|
+
buttons show (see `zoomControls`), so a page's own button can call it;
|
|
122
|
+
does nothing while `zoom` is off or before the chart first renders.
|
|
123
|
+
*/
|
|
124
|
+
zoomIn(): this;
|
|
125
|
+
/**
|
|
126
|
+
Zooms the chart out by `zoomFactor` about the center of the chart
|
|
127
|
+
area, as the zoom-out button does. Does nothing while `zoom` is off or
|
|
128
|
+
before the chart first renders.
|
|
129
|
+
*/
|
|
130
|
+
zoomOut(): this;
|
|
131
|
+
/**
|
|
132
|
+
Returns the chart to its initial, unzoomed view, as the reset button
|
|
133
|
+
does. Does nothing while `zoom` is off or before the chart first
|
|
134
|
+
renders.
|
|
135
|
+
*/
|
|
136
|
+
zoomReset(): this;
|
|
137
|
+
/**
|
|
138
|
+
Turns brush mode on or off, as the brush button does: while it is on,
|
|
139
|
+
a drag anywhere on the chart draws a box, and releasing zooms into
|
|
140
|
+
the box and turns brush mode off again. With no argument, returns
|
|
141
|
+
whether brush mode is on. Does nothing while `zoom` is off or before
|
|
142
|
+
the chart first renders.
|
|
143
|
+
@param _ Whether brush mode is on.
|
|
144
|
+
*/
|
|
145
|
+
zoomBrush(): boolean;
|
|
146
|
+
zoomBrush(_: boolean): this;
|
|
118
147
|
}
|
|
119
148
|
export default VizBase;
|
|
@@ -19,4 +19,12 @@ export declare function backgroundInk(viz: InkTarget): string;
|
|
|
19
19
|
@private
|
|
20
20
|
*/
|
|
21
21
|
export declare function chartGridline(viz: InkTarget): string;
|
|
22
|
+
/**
|
|
23
|
+
A neutral fill between the chart's background and its ink, for a mark
|
|
24
|
+
that stands for a group rather than one value: Treemap's group headers
|
|
25
|
+
and Pack's group circles while a colorScale colors the rest, and Pack's
|
|
26
|
+
outermost circle.
|
|
27
|
+
@private
|
|
28
|
+
*/
|
|
29
|
+
export declare function neutralFill(viz: InkTarget): string;
|
|
22
30
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
How hover and active emphasize a matched mark (see
|
|
3
|
+
`applyInteractionOpacity`): its stroke darkened by `darken` and drawn
|
|
4
|
+
`width` times as wide.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STROKE_EMPHASIS: {
|
|
7
|
+
readonly hover: {
|
|
8
|
+
readonly darken: 0.5;
|
|
9
|
+
readonly width: 2;
|
|
10
|
+
};
|
|
11
|
+
readonly active: {
|
|
12
|
+
readonly darken: 1;
|
|
13
|
+
readonly width: 3;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/** The two emphasized states. */
|
|
17
|
+
export type EmphasisKind = keyof typeof STROKE_EMPHASIS;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The stroke the chart's default `shapeConfig.stroke` draws around `fill`:
|
|
3
|
+
a shade darker, or the fill itself when it doesn't parse as a color (e.g.
|
|
4
|
+
"none"/"transparent" on a confidence band), which has no darker shade.
|
|
5
|
+
@private
|
|
6
|
+
*/
|
|
7
|
+
export declare function fillStroke(fill: unknown): unknown;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The name a chart reports itself by: its class's `_displayName` (kept
|
|
3
|
+
through minification), else the constructor's name.
|
|
4
|
+
@private
|
|
5
|
+
*/
|
|
6
|
+
export declare function chartName(viz: object): string;
|
|
7
|
+
/**
|
|
8
|
+
Logs an error a chart threw while drawing, naming the chart. The error
|
|
9
|
+
object is passed through, so the console shows its stack.
|
|
10
|
+
@private
|
|
11
|
+
*/
|
|
12
|
+
export declare function reportDrawError(viz: object, error: unknown): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The cursor a chart shows over its shapes and legend entries (the hand
|
|
3
|
+
over one a click acts on). It is set on the element under the pointer:
|
|
4
|
+
the chart's root `<svg>` or, with the Canvas renderer, its `<canvas>`
|
|
5
|
+
(the root svg sits above the canvas and passes pointer events through,
|
|
6
|
+
so its own cursor never shows).
|
|
7
|
+
*/
|
|
8
|
+
import type { VizInstance } from "./vizTypes.js";
|
|
9
|
+
/**
|
|
10
|
+
The parts of a chart `setCursor` reads. (`schema` is not read: it ties
|
|
11
|
+
the type to a chart, every other part being optional.)
|
|
12
|
+
*/
|
|
13
|
+
export type CursorHost = Pick<VizInstance, "schema"> & Partial<Pick<VizInstance, "_renderer" | "_sceneRenderer" | "_select">>;
|
|
14
|
+
/**
|
|
15
|
+
Sets the cursor shown over the chart's drawing surface.
|
|
16
|
+
@param viz The chart.
|
|
17
|
+
@param cursor A CSS cursor.
|
|
18
|
+
*/
|
|
19
|
+
export declare function setCursor(viz: CursorHost, cursor: string): void;
|
|
20
|
+
/**
|
|
21
|
+
Returns both of the chart's drawing surfaces to the default cursor. Run
|
|
22
|
+
before the renderer is swapped for another: the pointer may rest on a
|
|
23
|
+
clickable shape, and the outgoing surface would keep its hand cursor.
|
|
24
|
+
@param viz The chart, still holding the outgoing renderer.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resetCursor(viz: CursorHost): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Whether a hovered shape or legend entry shows a tooltip. Every caller asks
|
|
3
|
+
through `tooltipEnabled`, so the chart's `tooltip` accessor receives the
|
|
4
|
+
same arguments wherever it is consulted.
|
|
5
|
+
*/
|
|
6
|
+
import type { DataPoint } from "@d3plus/data";
|
|
7
|
+
import type { TooltipLevels } from "../../utils/D3plusConfig.js";
|
|
8
|
+
import type { VizInstance } from "./vizTypes.js";
|
|
9
|
+
/** The parts of a chart `tooltipLevels` reads. */
|
|
10
|
+
export type TooltipHost = Pick<VizInstance, "schema"> & Partial<Pick<VizInstance, "_drawDepth" | "_legendDepth" | "_shapeDepth">>;
|
|
11
|
+
/**
|
|
12
|
+
The `groupBy` levels a `tooltip` accessor receives for `d`. `depth` is the
|
|
13
|
+
level `d` stands for: a group row's own level (see `groupRow.ts`), else
|
|
14
|
+
the level its chart reports for the shape (`ChartDefinition.shapeDepth`),
|
|
15
|
+
else the level the chart draws. A legend entry stands for the level its
|
|
16
|
+
label is read at. `maxDepth` is the deepest `groupBy` level, and `legend`
|
|
17
|
+
says which of the two `d` is.
|
|
18
|
+
@param viz The chart.
|
|
19
|
+
@param d The hovered shape's row, or the legend entry's.
|
|
20
|
+
@param legend Whether `d` is a legend entry.
|
|
21
|
+
*/
|
|
22
|
+
export declare function tooltipLevels(viz: TooltipHost, d: DataPoint | undefined | null, legend?: boolean): TooltipLevels;
|
|
23
|
+
/**
|
|
24
|
+
Whether `d` shows a tooltip: the chart's `tooltip` setting, called with
|
|
25
|
+
the datum, its index, and its `groupBy` levels (see `tooltipLevels`).
|
|
26
|
+
@param viz The chart.
|
|
27
|
+
@param d The hovered shape's row, or the legend entry's.
|
|
28
|
+
@param i The row's index.
|
|
29
|
+
@param legend Whether `d` is a legend entry.
|
|
30
|
+
*/
|
|
31
|
+
export declare function tooltipEnabled(viz: TooltipHost, d: DataPoint | undefined | null, i: number, legend?: boolean): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Which click handlers a chart's `on` holds for a shape or a legend entry:
|
|
3
|
+
one of the user's, or the chart's own. The hand cursor shows where a
|
|
4
|
+
click runs either. A chart registers each handler it installs as its own
|
|
5
|
+
(`setOwnClick`); any other handler is the user's, compared by identity.
|
|
6
|
+
*/
|
|
7
|
+
type ClickHandler = (...args: never[]) => unknown;
|
|
8
|
+
/** The parts of a chart these read: its `on` handlers. */
|
|
9
|
+
export interface ClickHost {
|
|
10
|
+
schema: {
|
|
11
|
+
on?: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
Records `handler` as the chart's own handler for `key`, in place of any
|
|
16
|
+
recorded before.
|
|
17
|
+
@param viz The chart.
|
|
18
|
+
@param key The event the chart handles itself: `"click.shape"` or `"click.legend"`.
|
|
19
|
+
@param handler The handler the chart installs under `key`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setOwnClick(viz: object, key: string, handler: ClickHandler): void;
|
|
22
|
+
/**
|
|
23
|
+
Whether the chart's own handler is still the one under `key`.
|
|
24
|
+
@param viz The chart.
|
|
25
|
+
@param key The event the chart handles itself: `"click.shape"` or `"click.legend"`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasOwnClick(viz: ClickHost, key: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
Whether a click runs a handler of the user's: any `click` handler, or one
|
|
30
|
+
under `key` that is not the chart's own.
|
|
31
|
+
@param viz The chart.
|
|
32
|
+
@param key The event the chart handles itself: `"click.shape"` or `"click.legend"`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function hasUserClick(viz: ClickHost, key: string): boolean;
|
|
35
|
+
export {};
|
|
@@ -2,6 +2,8 @@ import type { ConfigField } from "../../fluent.js";
|
|
|
2
2
|
import type { VizInstance } from "./vizTypes.js";
|
|
3
3
|
/** A falsy value (no color) is stored as given, a key string read from each datum. */
|
|
4
4
|
export declare const optionalAccessor: (value: unknown) => unknown;
|
|
5
|
+
/** `optionalAccessor`, except that two keys or accessors make a bivariate accessor (see `colorScaleBivariate.ts`). */
|
|
6
|
+
export declare const colorScaleAccessor: (value: unknown) => unknown;
|
|
5
7
|
/**
|
|
6
8
|
The config keys every chart has, as generated accessors (`viz.<key>(value)`
|
|
7
9
|
sets, `viz.<key>()` gets): stored as given, wrapped as a constant
|
|
@@ -231,9 +233,12 @@ declare const fields: {
|
|
|
231
233
|
zoomBrushSelectionStyle: {};
|
|
232
234
|
zoomControlClassName: {};
|
|
233
235
|
zoomControlIcons: {};
|
|
236
|
+
zoomControls: {};
|
|
234
237
|
zoomControlStyle: {};
|
|
235
238
|
zoomControlStyleActive: {};
|
|
236
239
|
zoomControlStyleHover: {};
|
|
240
|
+
zoomDoubleClick: {};
|
|
241
|
+
zoomDrag: {};
|
|
237
242
|
zoomFactor: {};
|
|
238
243
|
zoomMax: {};
|
|
239
244
|
zoomPadding: {};
|
|
@@ -259,8 +259,20 @@ export interface VizInstance {
|
|
|
259
259
|
_backgroundClick?: (point: [number, number]) => void;
|
|
260
260
|
_active?: ((d: DataPoint, i?: number) => boolean) | false;
|
|
261
261
|
_hover?: ((d: DataPoint, i?: number) => boolean) | false;
|
|
262
|
+
/**
|
|
263
|
+
The marks a hover stands for when its predicate lights more of them
|
|
264
|
+
(a Matrix cell lights its whole row and column): while `hover` is the
|
|
265
|
+
current hover, `hoverMatch` labels follow `rows` instead of every
|
|
266
|
+
matched mark.
|
|
267
|
+
*/
|
|
268
|
+
_hoverFocus?: {
|
|
269
|
+
hover: (d: DataPoint, i: number) => boolean;
|
|
270
|
+
rows: DataPoint[];
|
|
271
|
+
};
|
|
262
272
|
/** True while the current hover came from a colorScale bucket swatch. */
|
|
263
273
|
_hoverBucket?: boolean;
|
|
274
|
+
/** The colorScale bucket a hovered swatch label lights (see `handleSwatchLabelHover`). */
|
|
275
|
+
_swatchLabelBucket?: DataPoint;
|
|
264
276
|
/**
|
|
265
277
|
Hovering a shape outlines it even when nothing else dims
|
|
266
278
|
(`hoverOpacity` 1), as Calendar's days do (see `shapeHoverEnabled`).
|
|
@@ -580,6 +592,8 @@ export interface VizInstance {
|
|
|
580
592
|
};
|
|
581
593
|
_colorScalePosition?: (config: VizInstance) => string | false;
|
|
582
594
|
_colorScale?: false | string | ((d: DataPoint, i: number) => string);
|
|
595
|
+
/** False when the chart's tooltip already shows its colorScale value (see `ChartDefinition.colorScaleTooltip`). */
|
|
596
|
+
_colorScaleTooltip?: boolean;
|
|
583
597
|
_timeline?: boolean;
|
|
584
598
|
_total?: boolean | ((d: DataPoint[], i: number) => number);
|
|
585
599
|
_container?: D3Selection;
|
|
@@ -650,6 +664,8 @@ export interface VizInstance {
|
|
|
650
664
|
_tableData?(): DataPoint[] | null;
|
|
651
665
|
/** The shape a colorScale row draws as (see `ChartDefinition.colorScaleShape`). */
|
|
652
666
|
_colorScaleShape?(d: DataPoint, i: number): string;
|
|
667
|
+
/** The `groupBy` level a shape's row stands for (see `ChartDefinition.shapeDepth`). */
|
|
668
|
+
_shapeDepth?(d: DataPoint): number | undefined;
|
|
653
669
|
/** The chart's small-multiple hooks (see `ChartDefinition.facet`). */
|
|
654
670
|
_facetHooks?(): FacetHooks;
|
|
655
671
|
toScene?(): SceneNode;
|
|
@@ -21,6 +21,13 @@ export declare function observeVisibility(el: Element, scrollContainer: unknown,
|
|
|
21
21
|
@private
|
|
22
22
|
*/
|
|
23
23
|
export declare function vizUnload(viz: Viz): void;
|
|
24
|
+
/**
|
|
25
|
+
Stops what a chart's drawn scene keeps running: its idle work (network
|
|
26
|
+
measures, queued again when it redraws), a pending repaint, and the
|
|
27
|
+
scene renderer with its DOM, listeners, and timers.
|
|
28
|
+
@private
|
|
29
|
+
*/
|
|
30
|
+
export declare function releaseScene(viz: Viz): void;
|
|
24
31
|
/**
|
|
25
32
|
Redraws an unloaded chart without an entrance animation.
|
|
26
33
|
@private
|