@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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The pointer gestures a chart zooms by beyond d3-zoom's own pan and wheel:
|
|
3
|
+
a mouse drag that draws a box to zoom into (`zoomDrag: "brush"`), and
|
|
4
|
+
what a double-click does (`zoomDoubleClick`).
|
|
5
|
+
|
|
6
|
+
The drawn box needs no brush overlay over the chart: the press listens on
|
|
7
|
+
the zoom surface beside the chart's own pointer listeners, so a click
|
|
8
|
+
that doesn't drag still reaches the shape under it, and hover still
|
|
9
|
+
works until a drag begins. Once one does, it reuses the brush mode's
|
|
10
|
+
pieces: the zoom brush shows the box (with its styles), and releasing
|
|
11
|
+
zooms to it through `viz._zoomToBounds`.
|
|
12
|
+
|
|
13
|
+
@module
|
|
14
|
+
*/
|
|
15
|
+
import type Viz from "../viz/Viz.js";
|
|
16
|
+
/** A point in the zoom surface's coordinates. */
|
|
17
|
+
export type Point = [number, number];
|
|
18
|
+
/** A box's top-left and bottom-right corners. */
|
|
19
|
+
export type Box = [Point, Point];
|
|
20
|
+
/** How far (px) a press moves before it draws a box instead of clicking. */
|
|
21
|
+
export declare const BOX_DRAG_DISTANCE = 3;
|
|
22
|
+
/**
|
|
23
|
+
Clamps a point into a box.
|
|
24
|
+
@param point The point.
|
|
25
|
+
@param box The box.
|
|
26
|
+
*/
|
|
27
|
+
export declare function clampPoint([x, y]: Point, [[x0, y0], [x1, y1]]: Box): Point;
|
|
28
|
+
/**
|
|
29
|
+
The box two corners span, whichever way the drag went.
|
|
30
|
+
@param a One corner.
|
|
31
|
+
@param b The opposite corner.
|
|
32
|
+
*/
|
|
33
|
+
export declare function spanBox(a: Point, b: Point): Box;
|
|
34
|
+
/**
|
|
35
|
+
Whether a point lies in a box, edges included.
|
|
36
|
+
@param point The point.
|
|
37
|
+
@param box The box.
|
|
38
|
+
*/
|
|
39
|
+
export declare function inBox([x, y]: Point, [[x0, y0], [x1, y1]]: Box): boolean;
|
|
40
|
+
/**
|
|
41
|
+
Whether a press at `at` may draw a zoom box: the primary button with no
|
|
42
|
+
modifier key (Shift + drag pans), the first press of a click (not the
|
|
43
|
+
second of a double-click), inside the chart area, and not on a brush
|
|
44
|
+
(the timeline's).
|
|
45
|
+
@param event The mousedown.
|
|
46
|
+
@param at The press, in the zoom surface's coordinates.
|
|
47
|
+
@param area The chart area, in the same coordinates.
|
|
48
|
+
*/
|
|
49
|
+
export declare function startsBoxDrag(event: MouseEvent, at: Point, area: Box): boolean;
|
|
50
|
+
/**
|
|
51
|
+
Whether a move from `from` to `to` (client pixels) has gone far enough
|
|
52
|
+
to be a drag rather than a click.
|
|
53
|
+
@param from Where the press began.
|
|
54
|
+
@param to Where the pointer is now.
|
|
55
|
+
*/
|
|
56
|
+
export declare function dragsFar(from: Point, to: Point): boolean;
|
|
57
|
+
/**
|
|
58
|
+
Binds the gestures this module adds to the zoom surface, after d3-zoom's
|
|
59
|
+
own: the drawn zoom box for `zoomDrag: "brush"`, and the double-click
|
|
60
|
+
for `zoomDoubleClick`.
|
|
61
|
+
@param viz The chart.
|
|
62
|
+
@param tgt The element d3-zoom is bound to.
|
|
63
|
+
@param reset Returns the chart to its initial view.
|
|
64
|
+
*/
|
|
65
|
+
export declare function bindZoomGestures(viz: Viz, tgt: NonNullable<Viz["_zoomEventTarget"]>, reset: () => void): void;
|
|
66
|
+
/**
|
|
67
|
+
Removes the gestures `bindZoomGestures` added (d3-zoom's own listeners,
|
|
68
|
+
the double-click included, go with `.on(".zoom", null)`).
|
|
69
|
+
@param tgt The element they were bound to.
|
|
70
|
+
*/
|
|
71
|
+
export declare function unbindZoomGestures(tgt: NonNullable<Viz["_zoomEventTarget"]>): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type Viz from "../viz/Viz.js";
|
|
2
|
+
/** Bounds in the zoom surface's unzoomed coordinates: top-left, bottom-right. */
|
|
3
|
+
export type Bounds = [[number, number], [number, number]];
|
|
4
|
+
/** A zoom transform: scale `k`, then translate by `x`, `y`. */
|
|
5
|
+
export interface FitTransform {
|
|
6
|
+
k: number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
Which screen dimensions the zoom actually scales. Every chart zooms its
|
|
12
|
+
picture uniformly, except a Plot, which rescales only its linear and time
|
|
13
|
+
axes: a LinePlot or a bar chart with a discrete x axis zooms vertically
|
|
14
|
+
alone.
|
|
15
|
+
@param viz The chart.
|
|
16
|
+
*/
|
|
17
|
+
export declare function zoomedDims(viz: Viz): {
|
|
18
|
+
x: boolean;
|
|
19
|
+
y: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
The zoom transform that fits `bounds` (unzoomed surface coordinates) to
|
|
23
|
+
the chart's zoom area along each dimension the zoom scales (see
|
|
24
|
+
`zoomedDims`): the dimension with less room fills the area, and the other
|
|
25
|
+
is centered in it. A dimension the zoom doesn't scale (a Plot's discrete
|
|
26
|
+
axis) has no say in the scale.
|
|
27
|
+
@param viz The chart.
|
|
28
|
+
@param bounds The bounds to show.
|
|
29
|
+
*/
|
|
30
|
+
export declare function fitBounds(viz: Viz, bounds: Bounds): FitTransform;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SceneEvent } from "@d3plus/render";
|
|
2
|
+
import type { AxisTooltipTarget } from "../../components/Axis/axisTooltipTargets.js";
|
|
3
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
4
|
+
/** What an axis tooltip shows. */
|
|
5
|
+
export interface AxisTooltipContent {
|
|
6
|
+
/** The label's whole text when it is drawn cut short, else `false`. */
|
|
7
|
+
title: string | false;
|
|
8
|
+
/** The text the axis option gives, else `false`. */
|
|
9
|
+
body: string | false;
|
|
10
|
+
/** The tooltip config the axis option gives, its accessors bound to the label. */
|
|
11
|
+
config?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
A copy of a config value whose functions, at any depth, are called with
|
|
15
|
+
`args` whatever they are passed.
|
|
16
|
+
@param value A config object, or any value in one.
|
|
17
|
+
@param args What every function in it receives.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bindAccessors(value: unknown, args: unknown[]): unknown;
|
|
20
|
+
/**
|
|
21
|
+
What hovering an axis label shows, from the axis's `titleTooltip` or
|
|
22
|
+
`tickTooltip`: a string is the body, a function returns it (given the
|
|
23
|
+
title, or the tick's value and index), and an object is a tooltip config
|
|
24
|
+
whose accessors receive the same. A label drawn cut short adds its whole
|
|
25
|
+
text as the title. Null when there is nothing to show: the option is
|
|
26
|
+
`false`, its function returns `false`, or the label is drawn whole and
|
|
27
|
+
the option is unset or its function returns nothing.
|
|
28
|
+
@param target The hovered label.
|
|
29
|
+
@param fullText Whether a cut label shows its whole text.
|
|
30
|
+
@param self The `this` the option's function is called with.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveAxisTooltip(target: AxisTooltipTarget, fullText?: boolean, self?: unknown): AxisTooltipContent | null;
|
|
33
|
+
/**
|
|
34
|
+
Whether a tooltip datum is an axis tooltip's.
|
|
35
|
+
@param d The first of a tooltip's data.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isAxisTooltipDatum(d: unknown): boolean;
|
|
38
|
+
/**
|
|
39
|
+
Shows, moves, or hides the axis tooltip for a pointer event. Moving onto
|
|
40
|
+
a label with something to show (see `resolveAxisTooltip`) shows it at the
|
|
41
|
+
pointer; moving anywhere else, or leaving the chart, hides it when it is
|
|
42
|
+
still the tooltip showing. Charts with `tooltip: false` skip the whole
|
|
43
|
+
text of cut labels, and show only what an axis option gives. Labels show
|
|
44
|
+
nothing while a transition is in flight.
|
|
45
|
+
@param viz The chart.
|
|
46
|
+
@param event The pointer event.
|
|
47
|
+
@returns Whether an axis tooltip is showing for the event.
|
|
48
|
+
*/
|
|
49
|
+
export declare function handleAxisTooltip(viz: VizInstance, event: SceneEvent): boolean;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The text a ring chart (Pie with a hole, Donut, Sunburst, RadialBar) draws
|
|
3
|
+
in its empty middle when `centerLabel` is set: the chart's total, a
|
|
4
|
+
string, or what a function returns, wrapped and shrunk to fit the largest
|
|
5
|
+
box in the hole (see `centerLabelBoxes`). It is chrome: it carries no
|
|
6
|
+
datum, takes no pointer events, and draws nothing when it can't fit whole.
|
|
7
|
+
*/
|
|
8
|
+
import type { DataPoint } from "@d3plus/data";
|
|
9
|
+
import type { SceneNode } from "@d3plus/render";
|
|
10
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
11
|
+
/** The `centerLabel` setting: the total (`true`), a string, or a function of the drawn data and their total. */
|
|
12
|
+
export type CenterLabelSetting = boolean | string | ((data: DataPoint[], total: number) => unknown) | null | undefined;
|
|
13
|
+
/** A chart's empty middle: a circle of `radius` around the origin, or the slice of it a partial sweep spans (radians, 0 at 12 o'clock, clockwise). */
|
|
14
|
+
export interface CenterHole {
|
|
15
|
+
radius: number;
|
|
16
|
+
startAngle?: number;
|
|
17
|
+
endAngle?: number;
|
|
18
|
+
}
|
|
19
|
+
/** A box the text may fill, around the origin. */
|
|
20
|
+
export interface CenterLabelBox {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
/** The outline the text wraps within. */
|
|
26
|
+
shape: "circle" | "square";
|
|
27
|
+
}
|
|
28
|
+
/** The scene key of the center label's group. */
|
|
29
|
+
export declare const CENTER_LABEL_KEY = "center-label";
|
|
30
|
+
/**
|
|
31
|
+
The `centerLabelConfig` defaults: the chart's text color, sized between
|
|
32
|
+
10 and 40 pixels, 5 pixels clear of the ring.
|
|
33
|
+
@param viz The chart.
|
|
34
|
+
*/
|
|
35
|
+
export declare function centerLabelDefaults(viz: VizInstance): Record<string, unknown>;
|
|
36
|
+
/**
|
|
37
|
+
The sum of `value` over `data`, leaving out values that aren't numbers.
|
|
38
|
+
@param data The drawn rows.
|
|
39
|
+
@param value The chart's value accessor.
|
|
40
|
+
*/
|
|
41
|
+
export declare function centerLabelTotal(data: DataPoint[], value: (d: DataPoint, i: number) => unknown): number;
|
|
42
|
+
/**
|
|
43
|
+
The text a `centerLabel` setting draws: the total, formatted the way the
|
|
44
|
+
chart's tooltips format values, for `true`; the string itself; or a
|
|
45
|
+
function's return value. Empty for a falsy setting or return value.
|
|
46
|
+
@param setting The `centerLabel` setting.
|
|
47
|
+
@param data The drawn rows.
|
|
48
|
+
@param total Their total.
|
|
49
|
+
@param locale The chart's locale.
|
|
50
|
+
*/
|
|
51
|
+
export declare function centerLabelText(setting: CenterLabelSetting, data: DataPoint[], total: number, locale?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
The boxes the text may fill in a hole: the whole circle (its text wrapped
|
|
54
|
+
to the circle) for a full turn, or, for a partial sweep, the largest box
|
|
55
|
+
of each of a few shapes that fits in the slice of the circle it spans.
|
|
56
|
+
Empty when the hole has no room.
|
|
57
|
+
@param hole The hole.
|
|
58
|
+
*/
|
|
59
|
+
export declare function centerLabelBoxes(hole: CenterHole): CenterLabelBox[];
|
|
60
|
+
/**
|
|
61
|
+
The TextBox config the label is drawn with: the user's `centerLabelConfig`
|
|
62
|
+
over the centered defaults. A `fontSize` without `fontResize` fixes the
|
|
63
|
+
size; otherwise the text shrinks from `fontMax` to fit.
|
|
64
|
+
@param config The `centerLabelConfig`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function centerLabelStyle(config: Record<string, unknown>): Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
The center label's scene nodes: one inert group holding the text, at the
|
|
69
|
+
largest size that fits the hole whole, centered in it. Empty when
|
|
70
|
+
`centerLabel` is unset or the text fits nowhere.
|
|
71
|
+
@param viz The chart.
|
|
72
|
+
@param hole The chart's empty middle, around its origin.
|
|
73
|
+
@param value The chart's value accessor, summed for the total.
|
|
74
|
+
*/
|
|
75
|
+
export declare function centerLabelNodes(viz: VizInstance, hole: CenterHole, value: (d: DataPoint, i: number) => unknown): SceneNode[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
A bivariate `colorScale`: two fields (`colorScale: ["a", "b"]`) read as
|
|
3
|
+
one accessor that returns each row's pair of values, which the chart's
|
|
4
|
+
ColorScale bins and colors from a grid (see
|
|
5
|
+
`components/ColorScale/bivariateScale.ts`). Rows missing either value
|
|
6
|
+
have no colorScale value, like a row missing the one field of a
|
|
7
|
+
single-variable colorScale.
|
|
8
|
+
*/
|
|
9
|
+
import type { DataPoint } from "@d3plus/data";
|
|
10
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
11
|
+
type Accessor = (d: DataPoint, i: number) => unknown;
|
|
12
|
+
/** What a bivariate accessor reads: its two accessors and the field names behind them. */
|
|
13
|
+
export interface BivariateSpec {
|
|
14
|
+
accessors: [Accessor, Accessor];
|
|
15
|
+
fields: [string | undefined, string | undefined];
|
|
16
|
+
}
|
|
17
|
+
/** `value` as a finite number, or null (null, undefined, "", and non-numbers have none). */
|
|
18
|
+
export declare function toNumber(value: unknown): number | null;
|
|
19
|
+
/** Whether `value` names a bivariate `colorScale`: two keys or accessors. */
|
|
20
|
+
export declare function isBivariateSetting(value: unknown): value is unknown[];
|
|
21
|
+
/**
|
|
22
|
+
The accessor a bivariate `colorScale` stores: each row's two values as a
|
|
23
|
+
`[first, second]` pair of numbers, or undefined when either is missing.
|
|
24
|
+
@param fields The two data keys or accessors.
|
|
25
|
+
*/
|
|
26
|
+
export declare function bivariateAccessor(fields: unknown[]): (d: DataPoint, i: number) => [number, number] | undefined;
|
|
27
|
+
/** The bivariate setting behind a stored `colorScale`, or null for any other. */
|
|
28
|
+
export declare function bivariateOf(fn: unknown): BivariateSpec | null;
|
|
29
|
+
/** The chart's bivariate `colorScale` setting, or null when it has none. */
|
|
30
|
+
export declare function bivariateSpec(viz: VizInstance): BivariateSpec | null;
|
|
31
|
+
/**
|
|
32
|
+
The names a chart gives its bivariate scale's variables when
|
|
33
|
+
`bivariateLabels` doesn't: each field's name, or "Value 1" / "Value 2"
|
|
34
|
+
for an accessor.
|
|
35
|
+
@param viz The chart.
|
|
36
|
+
@param spec Its bivariate setting.
|
|
37
|
+
*/
|
|
38
|
+
export declare function bivariateFieldNames(viz: VizInstance, spec: BivariateSpec): [string, string];
|
|
39
|
+
/**
|
|
40
|
+
The tooltip rows a chart's bivariate `colorScale` adds for a row: each
|
|
41
|
+
variable's name (as the key labels it) and the row's value, formatted
|
|
42
|
+
as the key formats its ranges. A variable the row has no value for gets
|
|
43
|
+
no row; a colorScale cell, or a chart without a bivariate scale, gets
|
|
44
|
+
none at all.
|
|
45
|
+
@param viz The chart.
|
|
46
|
+
@param d The hovered row.
|
|
47
|
+
@param i Its index.
|
|
48
|
+
*/
|
|
49
|
+
export declare function bivariateTooltipRows(viz: VizInstance, d: DataPoint, i: number): [string, string][];
|
|
50
|
+
export {};
|
|
@@ -32,6 +32,16 @@ export declare function colorScaleBucketOf(d: unknown): (DataPoint & {
|
|
|
32
32
|
legend). Returns null when there's no colorScale to read.
|
|
33
33
|
*/
|
|
34
34
|
export declare function colorScaleBucketPredicate(viz: VizInstance, bucketColor: unknown): ((d: DataPoint, i: number) => boolean) | null;
|
|
35
|
+
/**
|
|
36
|
+
Highlights a colorScale bucket's data shapes, as hovering its swatch does:
|
|
37
|
+
every datum whose colorScale value falls in the bucket's color range stays
|
|
38
|
+
bright while the rest dim, and `_hoverBucket` marks the hover as a
|
|
39
|
+
bucket's.
|
|
40
|
+
@param viz The chart.
|
|
41
|
+
@param d A swatch's datum, or its label's, at any depth of wrapping.
|
|
42
|
+
@returns Whether `d` is a bucket's, highlighted or not.
|
|
43
|
+
*/
|
|
44
|
+
export declare function hoverColorScaleBucket(viz: VizInstance, d: unknown): boolean;
|
|
35
45
|
/**
|
|
36
46
|
The set of bucket colors that contain at least one datum satisfying
|
|
37
47
|
`predicate` — i.e. the swatches that should stay bright while the rest dim.
|
|
@@ -3,12 +3,13 @@ import type { VizInstance } from "../viz/vizTypes.js";
|
|
|
3
3
|
/**
|
|
4
4
|
The colorScale value of a hovered scene node: its datum unwrapped to the
|
|
5
5
|
source row (as the shapes' fill unwraps it), read through the chart's
|
|
6
|
-
`colorScale
|
|
7
|
-
|
|
6
|
+
`colorScale`: a pair of values on a bivariate colorScale. Null for
|
|
7
|
+
chrome (legend, axes, the colorScale itself), a node without a row, or a
|
|
8
|
+
row without a finite value.
|
|
8
9
|
@param viz The chart.
|
|
9
10
|
@param node The hovered scene node.
|
|
10
11
|
*/
|
|
11
|
-
export declare function colorScaleHoverValue(viz: VizInstance, node: SceneNode | undefined): number | null;
|
|
12
|
+
export declare function colorScaleHoverValue(viz: VizInstance, node: SceneNode | undefined): number | [number, number] | null;
|
|
12
13
|
/**
|
|
13
14
|
Updates the colorScale's hover mark for a pointer event, repainting only
|
|
14
15
|
when the marked value changes. Moves are ignored while a transition is
|
|
@@ -30,3 +31,12 @@ export declare function hoveredSwatch(viz: VizInstance): {
|
|
|
30
31
|
color: unknown;
|
|
31
32
|
dimOpacity: number;
|
|
32
33
|
} | null;
|
|
34
|
+
/**
|
|
35
|
+
A swatch label showing its axis tooltip lights its bucket, as hovering its
|
|
36
|
+
swatch does (see `hoverColorScaleBucket`); moving off it, or onto a label
|
|
37
|
+
with nothing to show, clears that highlight.
|
|
38
|
+
@param viz The chart.
|
|
39
|
+
@param event The pointer event.
|
|
40
|
+
@param shown Whether an axis tooltip shows for the event (see `handleAxisTooltip`).
|
|
41
|
+
*/
|
|
42
|
+
export declare function handleSwatchLabelHover(viz: VizInstance, event: SceneEvent, shown: boolean): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The share of a chart a colorScale along one of its sides takes at most:
|
|
3
|
+
a third of the chart across the scale, its bar, padding, ticks, labels
|
|
4
|
+
and title together.
|
|
5
|
+
*/
|
|
6
|
+
import type ColorScale from "../../components/ColorScale/ColorScale.js";
|
|
7
|
+
/** The most of a chart, across the scale, that a colorScale along one of its sides takes. */
|
|
8
|
+
export declare const MAX_SHARE: number;
|
|
9
|
+
/** The part of a colorScale's frame that `limitFrame` reads. */
|
|
10
|
+
interface LimitedFrame {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
/** The side of the chart the scale sits on. */
|
|
16
|
+
orient: string | false;
|
|
17
|
+
/** `"end"` for a scale that sits against the far edge of its frame. */
|
|
18
|
+
align: string;
|
|
19
|
+
}
|
|
20
|
+
/** Whether a colorScale on the `orient` side of a chart runs along its width. */
|
|
21
|
+
export declare function isWide(orient: string | false): boolean;
|
|
22
|
+
/**
|
|
23
|
+
The room left for a scale's axis (its ticks, labels and title) when the
|
|
24
|
+
whole scale takes at most `limit`: what its bar, `size` thick, and the
|
|
25
|
+
`padding` on either side of the scale leave, in whole pixels.
|
|
26
|
+
*/
|
|
27
|
+
export declare function axisRoom(limit: number, size: number, padding: number): number;
|
|
28
|
+
/**
|
|
29
|
+
Whether the ColorScale last drew a swatch per bucket, the form a Legend
|
|
30
|
+
lays out, rather than a bar along an axis or a bivariate key.
|
|
31
|
+
*/
|
|
32
|
+
export declare function drawsSwatches(cs: ColorScale): boolean;
|
|
33
|
+
/**
|
|
34
|
+
`frame` cut down to `limit` across the scale, still against the edge of
|
|
35
|
+
the chart its scale is aligned to.
|
|
36
|
+
*/
|
|
37
|
+
export declare function limitFrame<T extends LimitedFrame>(frame: T, limit: number): T;
|
|
38
|
+
/**
|
|
39
|
+
`frame` with the `limit` a colorScale along a side of the chart keeps to:
|
|
40
|
+
`set`, the size across the scale its `colorScaleConfig` gives it (its
|
|
41
|
+
`width` at the left or right, its `height` at the top or bottom), up to
|
|
42
|
+
the frame's own, with the frame cut down to it against its edge; else a
|
|
43
|
+
third of the frame across the scale.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sideFrame<T extends LimitedFrame>(frame: T, set: number | undefined): T & {
|
|
46
|
+
limit: number;
|
|
47
|
+
};
|
|
48
|
+
/** The number `config` sets for `key`, or undefined when it sets none. */
|
|
49
|
+
export declare function configSize(config: Record<string, unknown>, key: "width" | "height"): number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
The frame a scale drawn as swatches is laid out in again, or undefined
|
|
52
|
+
when it keeps `frame`: one as far across the scale as its Legend may
|
|
53
|
+
reach, the size the scale's `legendConfig` gives it there or else the
|
|
54
|
+
frame's `limit`, once its swatches claim more than that limit (a frame
|
|
55
|
+
already cut down to the limit keeps it).
|
|
56
|
+
*/
|
|
57
|
+
export declare function swatchFrame<T extends LimitedFrame & {
|
|
58
|
+
limit?: number;
|
|
59
|
+
}>(cs: ColorScale, frame: T): T | undefined;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The rows a chart's `colorScale` adds to its shape tooltips: the row's
|
|
3
|
+
colorScale value, named and formatted as the colorScale shows it (two
|
|
4
|
+
rows for a bivariate colorScale, one per variable).
|
|
5
|
+
*/
|
|
6
|
+
import type { DataPoint } from "@d3plus/data";
|
|
7
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
8
|
+
/**
|
|
9
|
+
The name a tooltip gives a single-variable colorScale's value: the
|
|
10
|
+
colorScale's `axisConfig.title`, else the field it reads, else the
|
|
11
|
+
translated "Value".
|
|
12
|
+
@param viz The chart.
|
|
13
|
+
*/
|
|
14
|
+
export declare function colorScaleValueLabel(viz: VizInstance): string;
|
|
15
|
+
/**
|
|
16
|
+
The tooltip rows a chart's `colorScale` adds for a row: its value, named
|
|
17
|
+
(see `colorScaleValueLabel`) and formatted (see `colorScaleValueFormat`)
|
|
18
|
+
as the colorScale shows it, or, for a bivariate colorScale, each
|
|
19
|
+
variable's (see `bivariateTooltipRows`). None for a row without a value,
|
|
20
|
+
a colorScale bucket or key cell, a chart without a colorScale, one
|
|
21
|
+
whose tooltip already shows the value (`ChartDefinition.colorScaleTooltip`),
|
|
22
|
+
or one whose `tooltipConfig.tbody` the user has set.
|
|
23
|
+
@param viz The chart.
|
|
24
|
+
@param d The hovered row.
|
|
25
|
+
@param i Its index.
|
|
26
|
+
*/
|
|
27
|
+
export declare function colorScaleTooltipRows(viz: VizInstance, d: DataPoint, i: number): [string, string][];
|
|
28
|
+
/** A tooltip whose `tbody` can be read and replaced. */
|
|
29
|
+
interface TbodyHost {
|
|
30
|
+
tbody(): unknown;
|
|
31
|
+
tbody(_: unknown): unknown;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
Leads `tooltip`'s `tbody` with the row's colorScale value rows (see
|
|
35
|
+
`colorScaleTooltipRows`), ahead of the chart's own rows. A `tbody` led on an earlier
|
|
36
|
+
hover is unwrapped first, so the rows never stack.
|
|
37
|
+
@param tooltip The chart's tooltip.
|
|
38
|
+
@param viz The chart.
|
|
39
|
+
@param d The hovered row.
|
|
40
|
+
@param i Its index.
|
|
41
|
+
*/
|
|
42
|
+
export declare function leadWithColorScaleRows<T extends TbodyHost>(tooltip: T, viz: VizInstance, d: DataPoint, i: number): T;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { VizInstance } from "../viz/vizTypes.js";
|
|
2
|
+
/** The part of a colorScale's frame a top placement moves. */
|
|
3
|
+
interface TopFrame {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/** What a laid-out colorScale shows: the room it claims across it and its text. */
|
|
10
|
+
interface ScaleShown {
|
|
11
|
+
claim: number;
|
|
12
|
+
labels: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
Whether a colorScale laid out beside the corner panels draws as well as
|
|
16
|
+
it does across the whole width (`whole`): no taller, its swatches with
|
|
17
|
+
every label they had, or its bar, shorter, with at least half as many
|
|
18
|
+
labels and no more of them cut short.
|
|
19
|
+
*/
|
|
20
|
+
export declare function drawsAsWell(swatches: boolean, beside: ScaleShown, whole: ScaleShown): boolean;
|
|
21
|
+
/**
|
|
22
|
+
Paints a colorScale at the top of the chart with `paint`, into the first
|
|
23
|
+
of `cornerPlacements` it draws as well in as across all of `frame` (see
|
|
24
|
+
`drawsAsWell`): between the corner panels, then inset from each by its
|
|
25
|
+
own amount, and last across the whole width below them. `room` is the
|
|
26
|
+
height the chart has below `frame.y`. Returns how far the scale dropped
|
|
27
|
+
below `frame.y`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function paintTopColorScale<T extends TopFrame>(viz: VizInstance, frame: T, room: number, paint: (frame: T) => void): number;
|
|
30
|
+
export {};
|
|
@@ -58,6 +58,20 @@ export declare function cubicArrowEdge(curve: Cubic, trims: EdgeArrowTrims, tipB
|
|
|
58
58
|
source?: ArrowedEnd;
|
|
59
59
|
target?: ArrowedEnd;
|
|
60
60
|
};
|
|
61
|
+
/** Joined cubic Bézier curves as one path's `d`. */
|
|
62
|
+
export declare function cubicsPathD(curves: readonly Cubic[]): string;
|
|
63
|
+
/**
|
|
64
|
+
`cubicArrowEdge` for a path of joined cubics, from the first's start to
|
|
65
|
+
the last's end: each arrowed end is taken on its end's cubic.
|
|
66
|
+
*/
|
|
67
|
+
export declare function cubicsArrowEdge(curves: readonly Cubic[], trims: EdgeArrowTrims, tipBack?: {
|
|
68
|
+
source: number;
|
|
69
|
+
target: number;
|
|
70
|
+
}): {
|
|
71
|
+
d: string;
|
|
72
|
+
source?: ArrowedEnd;
|
|
73
|
+
target?: ArrowedEnd;
|
|
74
|
+
};
|
|
61
75
|
/**
|
|
62
76
|
A polyline edge's visible stroke and its arrowed ends: each head's tip
|
|
63
77
|
sits `tipBack` pixels back along the polyline from its end, its base
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The hierarchy depth Tree records on a node's row (1 for a top-level
|
|
3
|
+
node), so code handed the row alone, like a tooltip's title, knows the
|
|
4
|
+
node's level. It lives under its own key so a data field named `depth` is
|
|
5
|
+
never overwritten; the plain `depth` key mirrors it only on rows without
|
|
6
|
+
their own `depth` field.
|
|
7
|
+
*/
|
|
8
|
+
/** The row key d3plus writes a node's hierarchy depth under. */
|
|
9
|
+
export declare const DEPTH_KEY = "__d3plusDepth";
|
|
10
|
+
/**
|
|
11
|
+
Writes `depth` onto `row` under `DEPTH_KEY`, and as `depth` too unless the
|
|
12
|
+
row already has a `depth` of its own.
|
|
13
|
+
*/
|
|
14
|
+
export declare function stampDepth(row: Record<string, unknown>, depth: number): void;
|
|
15
|
+
/**
|
|
16
|
+
The hierarchy depth d3plus wrote on a row, or on the row under a shape or
|
|
17
|
+
legend wrapper. Undefined when it carries none.
|
|
18
|
+
*/
|
|
19
|
+
export declare function depthOf(d: Record<string, unknown> | undefined | null): number | undefined;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
@module
|
|
16
16
|
*/
|
|
17
17
|
import type { DataPoint } from "@d3plus/data";
|
|
18
|
-
import type { SceneNode } from "@d3plus/render";
|
|
18
|
+
import type { PathNode, SceneNode } from "@d3plus/render";
|
|
19
19
|
/** Which end(s) of an edge carry an arrowhead. `true` is equivalent to `"target"`. */
|
|
20
20
|
export type ArrowEndValue = boolean | "target" | "source" | "both";
|
|
21
21
|
/** The `arrows` config: a fixed value or a per-edge accessor. */
|
|
@@ -62,6 +62,32 @@ export declare function arrowSizeFor(arrowSize: unknown, d: DataPoint, i: number
|
|
|
62
62
|
stroke, at least halfway along the head and at most its base.
|
|
63
63
|
*/
|
|
64
64
|
export declare function arrowTrim(size: number, strokeWidth: number): number;
|
|
65
|
+
/**
|
|
66
|
+
An `arrowSize` config for an edge drawn `scale` times wider, as hover
|
|
67
|
+
and active emphasis draw it: a size you set grows with the stroke, and
|
|
68
|
+
the default follows the wider stroke on its own (see `defaultArrowSize`).
|
|
69
|
+
*/
|
|
70
|
+
export declare function scaledArrowSize(arrowSize: unknown, scale: number): unknown;
|
|
71
|
+
/**
|
|
72
|
+
An edge's stroke width `scale` times wider, as hover and active emphasis
|
|
73
|
+
draw it (a 0 or unset width counting as 1, the way they do).
|
|
74
|
+
*/
|
|
75
|
+
export declare function scaledStrokeWidth(strokeWidth: number | undefined, scale: number): number | undefined;
|
|
76
|
+
/** An edge's visible stroke, its arrowheads, and what emphasis changes on the stroke. */
|
|
77
|
+
export interface ArrowEdge {
|
|
78
|
+
d: string;
|
|
79
|
+
arrows: SceneNode[];
|
|
80
|
+
emphasis?: PathNode["emphasis"];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
An edge's visible stroke and arrowheads as `draw` draws them at their
|
|
84
|
+
own stroke width, carrying the geometry hover and active emphasis widen
|
|
85
|
+
them to: each arrowhead grows with the wider stroke and darkens with it,
|
|
86
|
+
and the stroke ends back inside it, so neither pokes past the other.
|
|
87
|
+
@param draw Draws the edge at `scale` times its stroke width (see
|
|
88
|
+
`scaledStrokeWidth` and `scaledArrowSize`).
|
|
89
|
+
*/
|
|
90
|
+
export declare function emphasizedArrowEdge(draw: (scale: number) => ArrowEdge): ArrowEdge;
|
|
65
91
|
/** An edge's arrowheads: which ends carry one, their size, and the stroke trim at each. */
|
|
66
92
|
export interface EdgeArrowTrims {
|
|
67
93
|
ends: ArrowEnds;
|
|
@@ -158,7 +184,8 @@ export interface ArrowNodeOpts {
|
|
|
158
184
|
/**
|
|
159
185
|
Build one arrowhead scene node. `interactive: false` so the edge path owns
|
|
160
186
|
hit-testing, and the same `datum` as its edge so the hover-dim pass keeps the
|
|
161
|
-
arrow paired with its edge.
|
|
187
|
+
arrow paired with its edge. Emphasis darkens its fill with its edge's
|
|
188
|
+
stroke rather than outlining it.
|
|
162
189
|
*/
|
|
163
190
|
export declare function arrowNode(opts: ArrowNodeOpts): SceneNode;
|
|
164
191
|
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Discrete axis ticks that follow the hover: each tick label is stamped
|
|
3
|
+
with the value it stands for (see `hoverMatch`), so while marks are
|
|
4
|
+
hovered the labels of their buckets stay at full opacity and the rest dim
|
|
5
|
+
with the other marks. Continuous axes show a hover badge instead (see
|
|
6
|
+
`Plot/axisHover.ts`).
|
|
7
|
+
*/
|
|
8
|
+
import type { DataPoint } from "@d3plus/data";
|
|
9
|
+
import type { SceneNode } from "@d3plus/render";
|
|
10
|
+
/** An axis's scale setting, the way the Axis component stores it. */
|
|
11
|
+
interface AxisLike {
|
|
12
|
+
schema?: {
|
|
13
|
+
scale?: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** Whether an Axis draws discrete buckets (a band, ordinal, or point scale). */
|
|
17
|
+
export declare const discreteAxis: (axis: AxisLike | undefined) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
Stamps every tick label in an axis scene with `hoverMatch`: the tick's
|
|
20
|
+
value, matched against `field` on the hovered marks' data.
|
|
21
|
+
@param node The axis scene (or any subtree of it).
|
|
22
|
+
@param field The datum key a mark keeps the axis value under.
|
|
23
|
+
*/
|
|
24
|
+
export declare function tagHoverTicks(node: SceneNode, field: string): void;
|
|
25
|
+
/**
|
|
26
|
+
The values under `field` in a datum or any datum it wraps (the first one
|
|
27
|
+
that has it), as strings; an array value gives each of its items.
|
|
28
|
+
*/
|
|
29
|
+
export declare function datumValues(datum: DataPoint | undefined, field: string): string[];
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Work spread over the browser's idle time: jobs run in short turns from
|
|
3
|
+
`requestIdleCallback` (or `setTimeout` where it is missing), so no turn
|
|
4
|
+
keeps the main thread busy for long.
|
|
5
|
+
*/
|
|
6
|
+
/** What `requestIdleCallback` hands its callback. */
|
|
7
|
+
interface IdleDeadline {
|
|
8
|
+
timeRemaining(): number;
|
|
9
|
+
}
|
|
10
|
+
/** The longest a turn runs, in milliseconds, however long the browser stays idle. */
|
|
11
|
+
export declare const IDLE_BUDGET = 12;
|
|
12
|
+
/** Calls `fn` at the next idle moment, or soon after when the browser has no idle callbacks. */
|
|
13
|
+
export declare function requestIdle(fn: (deadline?: IdleDeadline) => void): void;
|
|
14
|
+
/** A job: each `step` works for about `budget` milliseconds (at least one unit), and returns whether it is done. */
|
|
15
|
+
export interface IdleJob {
|
|
16
|
+
step(budget: number): boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
Jobs keyed by name, run one after another in idle turns. Callbacks
|
|
20
|
+
passed to `beforeNext` run at the start of the next turn, before any job.
|
|
21
|
+
*/
|
|
22
|
+
export declare class IdleQueue {
|
|
23
|
+
private jobs;
|
|
24
|
+
private before;
|
|
25
|
+
private waiting;
|
|
26
|
+
/** How many jobs are waiting or running. */
|
|
27
|
+
get size(): number;
|
|
28
|
+
/** Whether a job named `key` is waiting or running. */
|
|
29
|
+
has(key: string): boolean;
|
|
30
|
+
/** Queues `job` under `key`, unless a job of that name is already queued. */
|
|
31
|
+
add(key: string, job: IdleJob): void;
|
|
32
|
+
/** Cancels every job whose name isn't in `keys`. */
|
|
33
|
+
keep(keys: Set<string>): void;
|
|
34
|
+
/** Cancels every job and every `beforeNext` callback. */
|
|
35
|
+
clear(): void;
|
|
36
|
+
/** Runs `fn` at the start of the next idle turn. */
|
|
37
|
+
beforeNext(fn: () => void): void;
|
|
38
|
+
private wake;
|
|
39
|
+
/** One idle turn: the `beforeNext` callbacks, then jobs until the turn's time is up. */
|
|
40
|
+
private turn;
|
|
41
|
+
}
|
|
42
|
+
/** The idle queue of `owner` (a chart), made on first use. */
|
|
43
|
+
export declare function idleQueue(owner: object): IdleQueue;
|
|
44
|
+
/** Cancels the idle work of `owner` (a chart), if it has any. */
|
|
45
|
+
export declare function cancelIdleWork(owner: object): void;
|
|
46
|
+
export {};
|