@d3plus/core 4.9.0 → 4.10.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 +3 -1
- package/es/src/charts/BoxWhisker/index.js +73 -4
- package/es/src/charts/BoxWhisker/outliers.js +68 -0
- package/es/src/charts/BoxWhisker/summary.js +83 -0
- package/es/src/charts/BoxWhisker/tooltip.js +122 -0
- package/es/src/charts/Bullet/index.js +2 -1
- package/es/src/charts/BumpChart/index.js +5 -0
- package/es/src/charts/Calendar/index.js +2 -1
- package/es/src/charts/Candlestick/aggregate.js +11 -1
- package/es/src/charts/Candlestick/index.js +5 -5
- package/es/src/charts/Chord/index.js +3 -2
- package/es/src/charts/Funnel/index.js +2 -1
- package/es/src/charts/Gauge/index.js +2 -1
- package/es/src/charts/Geomap/index.js +9 -3
- package/es/src/charts/Histogram/index.js +5 -1
- package/es/src/charts/Matrix/index.js +3 -2
- package/es/src/charts/Network/index.js +9 -4
- package/es/src/charts/Pack/index.js +2 -1
- package/es/src/charts/Pie/index.js +2 -1
- package/es/src/charts/Plot/axisHover.js +180 -0
- package/es/src/charts/Plot/axisHoverAnchors.js +174 -0
- package/es/src/charts/Plot/axisHoverScene.js +202 -0
- package/es/src/charts/Plot/barHitArea.js +81 -0
- package/es/src/charts/Plot/barLabelFit.js +123 -0
- package/es/src/charts/Plot/barWidth.js +2 -2
- package/es/src/charts/Plot/confidenceConfig.js +2 -2
- package/es/src/charts/Plot/draw.js +6 -2
- package/es/src/charts/Plot/index.js +25 -6
- package/es/src/charts/Plot/labelPlacement.js +9 -1
- package/es/src/charts/Plot/openDomainEnds.js +2 -5
- package/es/src/charts/Plot/pipeline.js +5 -3
- package/es/src/charts/Plot/pipelineAxisLayout.js +38 -8
- package/es/src/charts/Plot/pipelineDomains.js +7 -3
- package/es/src/charts/Plot/pipelineLineLabels.js +1 -1
- package/es/src/charts/Plot/plotInit.js +15 -0
- package/es/src/charts/Plot/plotZoom.js +15 -6
- package/es/src/charts/Plot/shapeDefaults.js +4 -4
- package/es/src/charts/Plot/sharedHoverScene.js +50 -31
- package/es/src/charts/Plot/sharedTooltip.js +19 -7
- package/es/src/charts/Plot/stackHelpers.js +13 -1
- package/es/src/charts/Plot/stackShareTooltip.js +9 -4
- package/es/src/charts/Plot/stackThreshold.js +154 -0
- package/es/src/charts/PolarArea/index.js +3 -2
- package/es/src/charts/Priestley/index.js +3 -2
- package/es/src/charts/Pyramid/index.js +4 -2
- package/es/src/charts/Radar/index.js +3 -2
- package/es/src/charts/RadialBar/index.js +2 -1
- package/es/src/charts/RadialMatrix/index.js +3 -2
- package/es/src/charts/Rings/index.js +5 -3
- package/es/src/charts/Sankey/index.js +3 -2
- package/es/src/charts/Treemap/applyLayout.js +14 -1
- package/es/src/charts/Treemap/emit.js +8 -2
- package/es/src/charts/Treemap/emitGroupHeaders.js +104 -0
- package/es/src/charts/Treemap/groupHeaders.js +95 -0
- package/es/src/charts/Treemap/index.js +15 -2
- package/es/src/charts/Treemap/thresholdFunction.js +11 -9
- package/es/src/charts/Waffle/index.js +4 -2
- package/es/src/charts/Waffle/tooltip.js +6 -2
- package/es/src/charts/Waterfall/index.js +4 -2
- package/es/src/charts/definition/makeChart.js +12 -5
- package/es/src/charts/drawSteps/saveChart.js +176 -0
- package/es/src/charts/drawSteps/saveControl.js +148 -0
- package/es/src/charts/drawSteps/saveControlMarkup.js +104 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js +1 -1
- package/es/src/charts/drawSteps/topLeftControls.js +3 -1
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js +1 -1
- package/es/src/charts/events/click.shape.js +30 -1
- package/es/src/charts/events/mouseenter.js +9 -0
- package/es/src/charts/events/mousemove.legend.js +3 -0
- package/es/src/charts/events/mousemove.shape.js +7 -2
- package/es/src/charts/facet/facetConfig.js +2 -2
- package/es/src/charts/facet/facetData.js +2 -2
- package/es/src/charts/features/axes.js +7 -6
- package/es/src/charts/features/axesFinal.js +23 -3
- package/es/src/charts/features/axesMeasure.js +54 -2
- package/es/src/charts/features/colorScaleBucket.js +17 -0
- package/es/src/charts/features/colorScaleHover.js +69 -0
- package/es/src/charts/features/features.js +13 -1
- package/es/src/charts/features/featuresColorScale.js +44 -4
- package/es/src/charts/features/featuresLegend.js +6 -8
- package/es/src/charts/features/plotPaint.js +4 -4
- package/es/src/charts/features/shapeEmit.js +23 -2
- package/es/src/charts/features/shareKey.js +15 -0
- package/es/src/charts/features/thresholdMembers.js +71 -0
- package/es/src/charts/helpers/densityChart.js +3 -1
- package/es/src/charts/helpers/valueTitle.js +6 -3
- package/es/src/charts/partition/chartFields.js +4 -3
- package/es/src/charts/partition/hierarchy.js +2 -0
- package/es/src/charts/pipeline/preDrawData.js +31 -10
- package/es/src/charts/pipeline/vizDraw.js +40 -29
- package/es/src/charts/pipeline/vizPreDraw.js +24 -15
- package/es/src/charts/viz/Viz.js +43 -8
- package/es/src/charts/viz/VizBase.js +32 -12
- package/es/src/charts/viz/dataPoller.js +52 -0
- package/es/src/charts/viz/groupRow.js +35 -0
- package/es/src/charts/viz/interactionOpacity.js +19 -5
- package/es/src/charts/viz/missingFields.js +122 -0
- package/es/src/charts/viz/reportHandlerError.js +10 -0
- package/es/src/charts/viz/shapeClassTargets.js +18 -2
- package/es/src/charts/viz/simpleHover.js +2 -0
- package/es/src/charts/viz/vizClassName.js +31 -0
- package/es/src/charts/viz/vizDataPolling.js +167 -0
- package/es/src/charts/viz/vizDefaults.js +66 -0
- package/es/src/charts/viz/vizFields.js +18 -2
- package/es/src/charts/viz/vizRender.js +8 -2
- package/es/src/components/Axis/Axis.js +28 -0
- package/es/src/components/Axis/axisDefaults.js +3 -1
- package/es/src/components/Axis/axisLabelAngle.js +175 -0
- package/es/src/components/Axis/axisLabelThinning.js +13 -4
- package/es/src/components/Axis/axisLayout.js +86 -19
- package/es/src/components/Axis/axisLayoutLabels.js +66 -13
- package/es/src/components/Axis/axisLayoutScale.js +3 -0
- package/es/src/components/Axis/axisRender.js +38 -9
- package/es/src/components/Axis/axisRounding.js +15 -4
- package/es/src/components/Axis/axisSlantWrap.js +39 -0
- package/es/src/components/Axis/powTicks.js +73 -0
- package/es/src/components/ColorScale/ColorScale.js +28 -28
- package/es/src/components/ColorScale/bucketBounds.js +35 -0
- package/es/src/components/ColorScale/colorScaleHoverMark.js +327 -0
- package/es/src/components/ColorScale/colorScaleRender.js +25 -1
- package/es/src/components/ColorScale/colorScaleScale.js +15 -9
- package/es/src/components/ColorScale/colorScaleType.js +26 -0
- package/es/src/components/TextBox.js +2 -0
- package/es/src/components/Timeline/Timeline.js +43 -52
- package/es/src/components/Timeline/brushSpan.js +78 -0
- package/es/src/components/Timeline/timelineConfig.js +7 -0
- package/es/src/components/Timeline/timelineRender.js +44 -6
- package/es/src/components/Tooltip.js +13 -8
- package/es/src/shapes/Box.js +66 -79
- package/es/src/shapes/boxOutlierShape.js +19 -0
- package/es/src/shapes/boxStats.js +35 -0
- package/es/src/shapes/boxStyle.js +78 -0
- package/es/src/shapes/boxSummary.js +174 -0
- package/es/src/shapes/shapeStandalone.js +2 -0
- package/es/src/utils/BaseClass.js +19 -0
- package/es/src/utils/className.js +78 -0
- package/es/src/utils/configWarnings.js +25 -0
- package/es/src/utils/fieldAccessor.js +31 -0
- package/es/src/utils/paintComponentScene.js +2 -0
- package/package.json +10 -9
- package/types/index.d.ts +3 -1
- package/types/internal.d.ts +3 -1
- package/types/src/charts/BoxWhisker/index.d.ts +3 -1
- package/types/src/charts/BoxWhisker/outliers.d.ts +25 -0
- package/types/src/charts/BoxWhisker/summary.d.ts +39 -0
- package/types/src/charts/BoxWhisker/tooltip.d.ts +36 -0
- package/types/src/charts/Candlestick/aggregate.d.ts +6 -0
- package/types/src/charts/Plot/axisHover.d.ts +68 -0
- package/types/src/charts/Plot/axisHoverAnchors.d.ts +88 -0
- package/types/src/charts/Plot/axisHoverScene.d.ts +88 -0
- package/types/src/charts/Plot/barHitArea.d.ts +59 -0
- package/types/src/charts/Plot/barLabelFit.d.ts +81 -0
- package/types/src/charts/Plot/index.d.ts +13 -0
- package/types/src/charts/Plot/labelPlacement.d.ts +5 -0
- package/types/src/charts/Plot/plotInit.d.ts +9 -2
- package/types/src/charts/Plot/plotZoom.d.ts +2 -0
- package/types/src/charts/Plot/sharedHoverScene.d.ts +3 -3
- package/types/src/charts/Plot/sharedTooltip.d.ts +11 -4
- package/types/src/charts/Plot/stackHelpers.d.ts +5 -0
- package/types/src/charts/Plot/stackThreshold.d.ts +75 -0
- package/types/src/charts/Treemap/emit.d.ts +2 -1
- package/types/src/charts/Treemap/emitGroupHeaders.d.ts +16 -0
- package/types/src/charts/Treemap/groupHeaders.d.ts +91 -0
- package/types/src/charts/Treemap/index.d.ts +2 -0
- package/types/src/charts/Treemap/thresholdFunction.d.ts +5 -2
- package/types/src/charts/definition/ChartDefinition.d.ts +14 -2
- package/types/src/charts/definition/makeChart.d.ts +4 -3
- package/types/src/charts/drawSteps/saveChart.d.ts +47 -0
- package/types/src/charts/drawSteps/saveControl.d.ts +9 -0
- package/types/src/charts/drawSteps/saveControlMarkup.d.ts +44 -0
- package/types/src/charts/drawSteps/tableViewMarkup.d.ts +1 -0
- package/types/src/charts/drawSteps/topLeftControls.d.ts +1 -1
- package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +1 -1
- package/types/src/charts/facet/facetData.d.ts +1 -1
- package/types/src/charts/features/axesMeasure.d.ts +9 -1
- package/types/src/charts/features/colorScaleBucket.d.ts +9 -0
- package/types/src/charts/features/colorScaleHover.d.ts +32 -0
- package/types/src/charts/features/features.d.ts +8 -0
- package/types/src/charts/features/plotPaint.d.ts +2 -0
- package/types/src/charts/features/shapeEmit.d.ts +2 -0
- package/types/src/charts/features/shareKey.d.ts +9 -0
- package/types/src/charts/features/thresholdMembers.d.ts +38 -0
- package/types/src/charts/helpers/valueTitle.d.ts +4 -2
- package/types/src/charts/pipeline/stages.d.ts +2 -0
- package/types/src/charts/pipeline/vizDraw.d.ts +8 -3
- package/types/src/charts/pipeline/vizPreDraw.d.ts +3 -2
- package/types/src/charts/viz/Viz.d.ts +28 -4
- package/types/src/charts/viz/VizBase.d.ts +12 -3
- package/types/src/charts/viz/dataPoller.d.ts +28 -0
- package/types/src/charts/viz/groupRow.d.ts +24 -0
- package/types/src/charts/viz/interactionOpacity.d.ts +3 -1
- package/types/src/charts/viz/missingFields.d.ts +57 -0
- package/types/src/charts/viz/reportHandlerError.d.ts +7 -0
- package/types/src/charts/viz/shapeClassTargets.d.ts +6 -0
- package/types/src/charts/viz/simpleHover.d.ts +2 -1
- package/types/src/charts/viz/vizClassName.d.ts +23 -0
- package/types/src/charts/viz/vizDataPolling.d.ts +48 -0
- package/types/src/charts/viz/vizDefaults.d.ts +49 -0
- package/types/src/charts/viz/vizFields.d.ts +15 -0
- package/types/src/charts/viz/vizTypes.d.ts +33 -1
- package/types/src/components/Axis/Axis.d.ts +36 -8
- package/types/src/components/Axis/axisLabelAngle.d.ts +110 -0
- package/types/src/components/Axis/axisLabelThinning.d.ts +3 -7
- package/types/src/components/Axis/axisLayout.d.ts +5 -0
- package/types/src/components/Axis/axisLayoutLabels.d.ts +13 -0
- package/types/src/components/Axis/axisRounding.d.ts +6 -3
- package/types/src/components/Axis/axisSlantWrap.d.ts +22 -0
- package/types/src/components/Axis/powTicks.d.ts +29 -0
- package/types/src/components/ColorScale/ColorScale.d.ts +13 -0
- package/types/src/components/ColorScale/bucketBounds.d.ts +14 -0
- package/types/src/components/ColorScale/colorScaleHoverMark.d.ts +86 -0
- package/types/src/components/ColorScale/colorScaleScale.d.ts +3 -0
- package/types/src/components/ColorScale/colorScaleType.d.ts +17 -0
- package/types/src/components/Timeline/brushSpan.d.ts +41 -0
- package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
- package/types/src/components/Timeline/timelineRender.d.ts +8 -0
- package/types/src/components/Tooltip.d.ts +8 -0
- package/types/src/shapes/Box.d.ts +1 -8
- package/types/src/shapes/boxOutlierShape.d.ts +9 -0
- package/types/src/shapes/boxStats.d.ts +19 -0
- package/types/src/shapes/boxStyle.d.ts +25 -0
- package/types/src/shapes/boxSummary.d.ts +66 -0
- package/types/src/shapes/emitLabels.d.ts +1 -1
- package/types/src/shapes/shapeConfig.d.ts +42 -4
- package/types/src/utils/BaseClass.d.ts +23 -0
- package/types/src/utils/D3Scale.d.ts +3 -0
- package/types/src/utils/D3plusConfig.d.ts +261 -5
- package/types/src/utils/className.d.ts +64 -0
- package/types/src/utils/configWarnings.d.ts +21 -2
- package/types/src/utils/fieldAccessor.d.ts +24 -0
- package/types/src/utils/index.d.ts +1 -1
- package/types/src/utils/paintComponentScene.d.ts +3 -1
- package/umd/d3plus-core.full.js +6405 -1068
- package/umd/d3plus-core.full.min.js +2 -2
- package/umd/d3plus-core.js +5328 -1002
- package/umd/d3plus-core.min.js +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Warns when a config key names a data field that no row of the chart's data
|
|
3
|
+
has (a typo like `y: "vlaue"` otherwise draws an empty chart in silence).
|
|
4
|
+
Only field names the user gave are checked: string config values become
|
|
5
|
+
accessors remembered by `fieldAccessor`, while function accessors,
|
|
6
|
+
constants, and defaults are never checked.
|
|
7
|
+
*/
|
|
8
|
+
import type { DataPoint } from "@d3plus/data";
|
|
9
|
+
import type { VizInstance } from "./vizTypes.js";
|
|
10
|
+
/** A config key and the data field it names. */
|
|
11
|
+
export interface FieldUse {
|
|
12
|
+
key: string;
|
|
13
|
+
field: string;
|
|
14
|
+
}
|
|
15
|
+
/** The most field names a warning lists. */
|
|
16
|
+
export declare const MAX_LISTED_FIELDS = 10;
|
|
17
|
+
/**
|
|
18
|
+
The data fields a chart's config names, each under the first key that
|
|
19
|
+
holds its accessor (so `thresholdKey`, which some charts point at `sum` or
|
|
20
|
+
`y`, only names a field the user gave it alone).
|
|
21
|
+
@param viz The chart.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fieldUses(viz: VizInstance): FieldUse[];
|
|
24
|
+
/**
|
|
25
|
+
The rows a chart's field names are read from: its data (the user's rows,
|
|
26
|
+
when the chart derives `_data` from them), plus the `nodes` and `links`
|
|
27
|
+
arrays of a network chart.
|
|
28
|
+
@param viz The chart.
|
|
29
|
+
*/
|
|
30
|
+
export declare function fieldRows(viz: VizInstance): DataPoint[][];
|
|
31
|
+
/**
|
|
32
|
+
Whether any row in `rowSets` has `field`.
|
|
33
|
+
@param rowSets Arrays of data rows.
|
|
34
|
+
@param field The field name.
|
|
35
|
+
*/
|
|
36
|
+
export declare function rowsHaveField(rowSets: DataPoint[][], field: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
Every field name in `rowSets`, in the order first seen.
|
|
39
|
+
@param rowSets Arrays of data rows.
|
|
40
|
+
*/
|
|
41
|
+
export declare function rowFields(rowSets: DataPoint[][]): string[];
|
|
42
|
+
/**
|
|
43
|
+
The warning for a config key whose field no row has, listing the first
|
|
44
|
+
`MAX_LISTED_FIELDS` fields the rows do have.
|
|
45
|
+
@param chart The chart's name.
|
|
46
|
+
@param use The config key and the field it names.
|
|
47
|
+
@param fields The fields the rows have.
|
|
48
|
+
*/
|
|
49
|
+
export declare function missingFieldMessage(chart: string, { key, field }: FieldUse, fields: string[]): string;
|
|
50
|
+
/**
|
|
51
|
+
Warns, once per key and field for each chart, about every config key that
|
|
52
|
+
names a field none of the chart's rows have. Rows missing some fields are
|
|
53
|
+
normal (sparse data), so a field any row has never warns, and a chart with
|
|
54
|
+
no rows warns about nothing.
|
|
55
|
+
@param viz The chart.
|
|
56
|
+
*/
|
|
57
|
+
export declare function warnMissingFields(viz: VizInstance): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Reports an error an event handler threw without interrupting the event:
|
|
3
|
+
`reportError` logs it as an uncaught error (with its stack) and fires the
|
|
4
|
+
window's `error` event, so the remaining handlers still run. Falls back to
|
|
5
|
+
`console.error` where `reportError` doesn't exist.
|
|
6
|
+
*/
|
|
7
|
+
export declare function reportHandlerError(error: unknown): void;
|
|
@@ -15,6 +15,12 @@ export interface ShapeClassTarget extends HandlerDatum {
|
|
|
15
15
|
`index`; `x` is always the datum as given.
|
|
16
16
|
*/
|
|
17
17
|
export declare function handlerDatum(raw: unknown, index: number): HandlerDatum;
|
|
18
|
+
/**
|
|
19
|
+
A picked node's shape class: its stamped `shapeType`, else the shape its
|
|
20
|
+
node type draws (a Treemap tile is a `"Rect"`, a Geomap region a
|
|
21
|
+
`"Path"`). Text, images, and groups have none.
|
|
22
|
+
*/
|
|
23
|
+
export declare function nodeShapeType(node: SceneNode): string | undefined;
|
|
18
24
|
/**
|
|
19
25
|
The shape classes a picked chart node fires `"<event>.<shapeType>"`
|
|
20
26
|
handlers for: the shape that drew it, with the pick's own `(d, i, x)`, then
|
|
@@ -4,6 +4,7 @@ import type { VizInstance } from "./vizTypes.js";
|
|
|
4
4
|
(Chord, Network, Rings, Sankey): stores the predicate, hands it to the
|
|
5
5
|
legend, schedules a repaint so the scene's interaction-opacity pass
|
|
6
6
|
re-reads it, and broadcasts it to linked charts.
|
|
7
|
+
With no argument, returns the current predicate.
|
|
7
8
|
@param _ The hover predicate, or `false` to clear it.
|
|
8
9
|
*/
|
|
9
|
-
export declare function simpleHover(this: VizInstance, _
|
|
10
|
+
export declare function simpleHover(this: VizInstance, _?: unknown): unknown;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Where a chart's `className` goes: the element its pixels are drawn on, the
|
|
3
|
+
root `<svg class="d3plus-viz">` or, with the Canvas renderer, its
|
|
4
|
+
`<canvas>`. (With Canvas the root svg stays in place above the canvas for
|
|
5
|
+
the zoom brush, so it takes no classes: a background on it would hide the
|
|
6
|
+
chart.)
|
|
7
|
+
*/
|
|
8
|
+
import { type ElementsSource } from "../../utils/className.js";
|
|
9
|
+
/** A chart's fixed root class. */
|
|
10
|
+
export declare const ROOT_CLASS = "d3plus-viz";
|
|
11
|
+
/**
|
|
12
|
+
The elements a chart's `className` applies to, each with the fixed
|
|
13
|
+
classes it keeps. Before the first render the chart's `select` is still the
|
|
14
|
+
page's own container, which never takes the classes.
|
|
15
|
+
@param root The chart's `select` node.
|
|
16
|
+
@param renderer The chart's scene renderer, once it has rendered.
|
|
17
|
+
@param kind The chart's renderer setting.
|
|
18
|
+
@private
|
|
19
|
+
*/
|
|
20
|
+
export declare function vizClassNameTargets(root: unknown, renderer: ElementsSource | undefined, kind: "svg" | "canvas"): {
|
|
21
|
+
el: Element;
|
|
22
|
+
keep?: string[];
|
|
23
|
+
}[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type Viz from "./Viz.js";
|
|
3
|
+
type PollPath = string | Record<string, unknown> | DataPoint[];
|
|
4
|
+
/**
|
|
5
|
+
Whether a `data` value is fetched: a URL, a request object, or an Array
|
|
6
|
+
holding at least one of them.
|
|
7
|
+
@private
|
|
8
|
+
*/
|
|
9
|
+
export declare function isPollable(source: unknown): boolean;
|
|
10
|
+
/**
|
|
11
|
+
The paths a poll fetches: `source` as an Array, with each URL and request
|
|
12
|
+
object revalidated with the server (`cache: "no-cache"`) unless the request
|
|
13
|
+
sets its own `cache`.
|
|
14
|
+
@private
|
|
15
|
+
*/
|
|
16
|
+
export declare function pollPaths(source: unknown): PollPath[];
|
|
17
|
+
/**
|
|
18
|
+
A short fingerprint of a JSON-serializable value (its JSON length plus a
|
|
19
|
+
32-bit FNV-1a hash), used to skip redrawing when a poll returns the same
|
|
20
|
+
data.
|
|
21
|
+
@private
|
|
22
|
+
*/
|
|
23
|
+
export declare function dataSignature(value: unknown): string;
|
|
24
|
+
/**
|
|
25
|
+
Records the fingerprint of freshly loaded data, so a poll returning the
|
|
26
|
+
same data skips its redraw.
|
|
27
|
+
@private
|
|
28
|
+
*/
|
|
29
|
+
export declare function recordDataSignature(viz: Viz, data: unknown): void;
|
|
30
|
+
/**
|
|
31
|
+
Stops a chart's data polling and its visibility listeners.
|
|
32
|
+
@private
|
|
33
|
+
*/
|
|
34
|
+
export declare function stopDataPolling(viz: Viz): void;
|
|
35
|
+
/**
|
|
36
|
+
Starts, restarts or stops a drawn chart's data polling to match its
|
|
37
|
+
`dataPollingInterval` and `data`. A no-op while the poll it would start is
|
|
38
|
+
already running, and never polls during server-side rendering.
|
|
39
|
+
@private
|
|
40
|
+
*/
|
|
41
|
+
export declare function syncDataPolling(viz: Viz): void;
|
|
42
|
+
/**
|
|
43
|
+
Applies a `dataPollingInterval` change to a chart that has finished its
|
|
44
|
+
data load; a chart still loading starts polling once it draws.
|
|
45
|
+
@private
|
|
46
|
+
*/
|
|
47
|
+
export declare function onDataPollingIntervalSet(viz: Viz): void;
|
|
48
|
+
export {};
|
|
@@ -164,6 +164,55 @@ export declare const searchControlStyleActiveDefault: {
|
|
|
164
164
|
color: string;
|
|
165
165
|
};
|
|
166
166
|
export declare const searchControlStyleHoverDefault: false;
|
|
167
|
+
/**
|
|
168
|
+
Default inline styles for the download button, the same structural values
|
|
169
|
+
as the other top-left controls, as their own objects so setting
|
|
170
|
+
`saveControlClassName` can detect an untouched default by reference.
|
|
171
|
+
@private
|
|
172
|
+
*/
|
|
173
|
+
export declare const saveControlStyleDefault: {
|
|
174
|
+
"align-items": string;
|
|
175
|
+
"box-sizing": string;
|
|
176
|
+
display: string;
|
|
177
|
+
font: string;
|
|
178
|
+
height: string;
|
|
179
|
+
"justify-content": string;
|
|
180
|
+
margin: number;
|
|
181
|
+
padding: number;
|
|
182
|
+
width: string;
|
|
183
|
+
};
|
|
184
|
+
export declare const saveControlStyleActiveDefault: {
|
|
185
|
+
"background-color": string;
|
|
186
|
+
"border-color": string;
|
|
187
|
+
color: string;
|
|
188
|
+
};
|
|
189
|
+
export declare const saveControlStyleHoverDefault: false;
|
|
190
|
+
/**
|
|
191
|
+
Default inline styles for the download menu and its items: the theme
|
|
192
|
+
(colors, border, spacing, font) on top of the fixed layout in
|
|
193
|
+
`saveControlMarkup.ts`. Setting `saveControlMenuClassName` drops them.
|
|
194
|
+
@private
|
|
195
|
+
*/
|
|
196
|
+
export declare const saveControlMenuStyleDefault: {
|
|
197
|
+
background: string;
|
|
198
|
+
border: string;
|
|
199
|
+
"border-radius": string;
|
|
200
|
+
"box-shadow": string;
|
|
201
|
+
color: string;
|
|
202
|
+
"margin-top": string;
|
|
203
|
+
padding: string;
|
|
204
|
+
};
|
|
205
|
+
export declare const saveControlMenuItemStyleDefault: {
|
|
206
|
+
background: string;
|
|
207
|
+
border: string;
|
|
208
|
+
color: string;
|
|
209
|
+
font: string;
|
|
210
|
+
margin: number;
|
|
211
|
+
padding: string;
|
|
212
|
+
};
|
|
213
|
+
export declare const saveControlMenuItemStyleHoverDefault: {
|
|
214
|
+
background: string;
|
|
215
|
+
};
|
|
167
216
|
/**
|
|
168
217
|
Seeds a fresh Viz instance's schema defaults and installs the identity-coerce
|
|
169
218
|
fluent accessors. Extracted from the constructor so the seeding logic stays
|
|
@@ -44,6 +44,9 @@ declare const fields: {
|
|
|
44
44
|
coerce: "const";
|
|
45
45
|
};
|
|
46
46
|
dataCutoff: {};
|
|
47
|
+
dataPollingInterval: {
|
|
48
|
+
onSet: (viz: VizInstance) => void;
|
|
49
|
+
};
|
|
47
50
|
depth: {};
|
|
48
51
|
detectResize: {};
|
|
49
52
|
detectResizeDelay: {};
|
|
@@ -107,6 +110,18 @@ declare const fields: {
|
|
|
107
110
|
coerce: "const";
|
|
108
111
|
};
|
|
109
112
|
noDataMessage: {};
|
|
113
|
+
saveControl: {};
|
|
114
|
+
saveControlClassName: {};
|
|
115
|
+
saveControlConfig: {
|
|
116
|
+
merge: true;
|
|
117
|
+
};
|
|
118
|
+
saveControlMenuClassName: {};
|
|
119
|
+
saveControlMenuItemStyle: {};
|
|
120
|
+
saveControlMenuItemStyleHover: {};
|
|
121
|
+
saveControlMenuStyle: {};
|
|
122
|
+
saveControlStyle: {};
|
|
123
|
+
saveControlStyleActive: {};
|
|
124
|
+
saveControlStyleHover: {};
|
|
110
125
|
scrollContainer: {};
|
|
111
126
|
search: {};
|
|
112
127
|
searchAccessor: {};
|
|
@@ -27,6 +27,7 @@ import type { ShapeEmitter } from "../features/shapeEmit.js";
|
|
|
27
27
|
import type { BarSpanLayout } from "../Plot/barWidth.js";
|
|
28
28
|
import type { ConfidenceBand } from "../Plot/confidenceBands.js";
|
|
29
29
|
import type { PlotFacetScales } from "../Plot/facetScales.js";
|
|
30
|
+
import type { AxisHoverState } from "../Plot/axisHover.js";
|
|
30
31
|
import type { ZoomControlIconKey } from "../drawSteps/zoomControlsMarkup.js";
|
|
31
32
|
import type { BottomRightBox } from "../drawSteps/bottomRightControlsMarkup.js";
|
|
32
33
|
import type { ZoomTransform } from "d3-zoom";
|
|
@@ -115,9 +116,21 @@ export interface VizInstance {
|
|
|
115
116
|
_margin: Margin;
|
|
116
117
|
_padding: Padding;
|
|
117
118
|
_data: DataPoint[];
|
|
119
|
+
/**
|
|
120
|
+
The user's rows, when the chart replaces `_data` with rows it derives
|
|
121
|
+
from them (Histogram's bins) before pre-draw.
|
|
122
|
+
*/
|
|
123
|
+
_sourceData?: DataPoint[];
|
|
118
124
|
_filteredData: DataPoint[];
|
|
119
125
|
_formattedData?: DataPoint[];
|
|
120
126
|
_legendData: DataPoint[];
|
|
127
|
+
/**
|
|
128
|
+
The rows a chart's threshold weighs: every row of the whole chart (all
|
|
129
|
+
small-multiple panels), legend-hidden ones included.
|
|
130
|
+
*/
|
|
131
|
+
_thresholdRows?: DataPoint[];
|
|
132
|
+
/** Formats a threshold bucket member's value in tooltips (default: abbreviated). */
|
|
133
|
+
_thresholdMemberFormat?: (value: number) => string;
|
|
121
134
|
_hidden: (string | number)[];
|
|
122
135
|
_solo: (string | number)[];
|
|
123
136
|
/**
|
|
@@ -370,6 +383,8 @@ export interface VizInstance {
|
|
|
370
383
|
/** The small-multiples panel the hover is in, by key. */
|
|
371
384
|
panel?: string;
|
|
372
385
|
} | null;
|
|
386
|
+
/** The hovered point's axis guides and badges (`axisHover`), if any. */
|
|
387
|
+
_axisHoverState?: AxisHoverState | null;
|
|
373
388
|
/** True while the shared multi-series tooltip owns the tooltip. */
|
|
374
389
|
_sharedHoverActive?: boolean;
|
|
375
390
|
/** The tooltip's own `arrow`/`thead`/`tbody`, held while the shared tooltip replaces them. */
|
|
@@ -447,6 +462,20 @@ export interface VizInstance {
|
|
|
447
462
|
x?: Record<string, unknown>;
|
|
448
463
|
y?: Record<string, unknown>;
|
|
449
464
|
};
|
|
465
|
+
/**
|
|
466
|
+
Values a chart adds to an axis's values, given the plotted rows and the
|
|
467
|
+
axis (`"x"`, `"x2"`, `"y"`, or `"y2"`), so its domain covers marks that
|
|
468
|
+
reach past each row's own value (e.g. BoxWhisker's precomputed whiskers
|
|
469
|
+
and outliers).
|
|
470
|
+
*/
|
|
471
|
+
_plotAxisValues?: (rows: Record<string, unknown>[], axis: string) => unknown[];
|
|
472
|
+
/**
|
|
473
|
+
The rows that place an axis's values, given the plotted rows and the
|
|
474
|
+
axis (`"x"`, `"x2"`, `"y"`, or `"y2"`): a chart can leave out rows its
|
|
475
|
+
marks don't draw, or add rows at values they reach (e.g. BoxWhisker's
|
|
476
|
+
hidden outliers and the whisker ends past what remains).
|
|
477
|
+
*/
|
|
478
|
+
_plotAxisRows?: (rows: Record<string, unknown>[], axis: string) => Record<string, unknown>[];
|
|
450
479
|
/** Per-chart overrides of Plot's shape emitters, by shape key (see `emitShape`). */
|
|
451
480
|
_plotShapeEmitters?: Record<string, ShapeEmitter>;
|
|
452
481
|
/**
|
|
@@ -533,7 +562,8 @@ export interface VizInstance {
|
|
|
533
562
|
_drawSceneToTarget(durationOverride?: number): void;
|
|
534
563
|
_scheduleSceneRepaint(): void;
|
|
535
564
|
_sceneRepaintRAF?: number;
|
|
536
|
-
|
|
565
|
+
_thresholdLegend?(legendData: DataPoint[]): DataPoint[];
|
|
566
|
+
_thresholdFunction?(data: DataPoint[], tree?: unknown, all?: DataPoint[]): DataPoint[];
|
|
537
567
|
/** The chart's size-legend radius scale, estimated before layout for the given chart area (see `ChartDefinition.sizeLegendScale`). */
|
|
538
568
|
_sizeLegendScale?(available: {
|
|
539
569
|
width: number;
|
|
@@ -541,6 +571,8 @@ export interface VizInstance {
|
|
|
541
571
|
}): SizeLegendScale | null;
|
|
542
572
|
/** The region chart chrome may be drawn inside, with the chart's marks as obstacles (see `ChartDefinition.insetRegion`). */
|
|
543
573
|
_insetRegion?(): InsetRegion | null;
|
|
574
|
+
/** The shape a colorScale row draws as (see `ChartDefinition.colorScaleShape`). */
|
|
575
|
+
_colorScaleShape?(d: DataPoint, i: number): string;
|
|
544
576
|
/** The chart's small-multiple hooks (see `ChartDefinition.facet`). */
|
|
545
577
|
_facetHooks?(): FacetHooks;
|
|
546
578
|
toScene?(): SceneNode;
|
|
@@ -18,12 +18,22 @@ export default class Axis extends BaseClass {
|
|
|
18
18
|
_scaleData: unknown[];
|
|
19
19
|
/** Whether the last layout pass rotated the labels (see `labelRotation`). */
|
|
20
20
|
_labelRotation: boolean | undefined;
|
|
21
|
+
/** The angle the last layout pass rotated the labels by (0 when flat). */
|
|
22
|
+
_labelAngle: number;
|
|
23
|
+
/** Whether the last layout pass slanted the labels (see `settingTurn`). */
|
|
24
|
+
_labelSlant: boolean;
|
|
21
25
|
/** The configured `labelRotation`: `undefined` lets the layout decide. */
|
|
22
|
-
_labelRotationSetting: boolean | undefined;
|
|
26
|
+
_labelRotationSetting: boolean | number | undefined;
|
|
23
27
|
_margin: Record<string, number>;
|
|
24
28
|
_outerBounds: Record<string, number>;
|
|
25
29
|
/** The measured size of the tick-label/title space, before margins (see `fixedSize`). */
|
|
26
30
|
_labelSpace?: number;
|
|
31
|
+
/**
|
|
32
|
+
How far slanted labels reach past the start and end of the range, set
|
|
33
|
+
by the layout pass (see `labelRotation`). A Plot makes room for them
|
|
34
|
+
when its range is fixed.
|
|
35
|
+
*/
|
|
36
|
+
_labelOverflow: [number, number];
|
|
27
37
|
_position: {
|
|
28
38
|
horizontal: boolean;
|
|
29
39
|
width: string;
|
|
@@ -75,6 +85,12 @@ export default class Axis extends BaseClass {
|
|
|
75
85
|
@private
|
|
76
86
|
*/
|
|
77
87
|
_getDomain(): unknown[];
|
|
88
|
+
/**
|
|
89
|
+
The scale's domain (or its negative log half's, with `negative`) in the
|
|
90
|
+
order it was given, undoing `reverse`.
|
|
91
|
+
@private
|
|
92
|
+
*/
|
|
93
|
+
_givenDomain(negative?: boolean): unknown[];
|
|
78
94
|
/**
|
|
79
95
|
Returns a value's scale position, taking into account negative and positive log scales.
|
|
80
96
|
@param d @private
|
|
@@ -150,14 +166,26 @@ export default class Axis extends BaseClass {
|
|
|
150
166
|
gridConfig(): Record<string, unknown>;
|
|
151
167
|
gridConfig(_: Record<string, unknown>): this;
|
|
152
168
|
/**
|
|
153
|
-
Whether to rotate
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
Whether to rotate the axis labels, and by how much. `true` rotates
|
|
170
|
+
them -90 degrees and `false` keeps them flat. Left `undefined` (the
|
|
171
|
+
default), a horizontal axis of categories rotates its labels when any
|
|
172
|
+
label would not fit its share of the axis whole (a word dropped, cut
|
|
173
|
+
off, or broken across lines) or would overlap its neighbor: they
|
|
174
|
+
slant 30 degrees (-30 on a bottom axis, 30 on a top one), or stand at
|
|
175
|
+
-90 when even slanted they would leave more labels cut short or
|
|
176
|
+
hidden. A vertical axis never rotates its labels on its own. A number
|
|
177
|
+
rotates them by that many degrees (clockwise, so `-45` rises to the
|
|
178
|
+
right): each label hangs off the axis from the end of its text
|
|
179
|
+
nearest the axis, which sits across from its tick, so on a bottom
|
|
180
|
+
axis a negative angle ends each label at its tick and a positive one
|
|
181
|
+
starts it there. Angles outside -90 to 90 turn a half turn to read
|
|
182
|
+
left to right (`135` draws as `-45`), and `0` keeps the labels flat.
|
|
183
|
+
Slanted labels wrap between words onto up to three lines, as many as
|
|
184
|
+
fit between neighboring labels, so they reach less far from the
|
|
185
|
+
axis. Labels that still overlap once rotated are thinned evenly.
|
|
158
186
|
*/
|
|
159
|
-
labelRotation(): boolean | undefined;
|
|
160
|
-
labelRotation(_: boolean | undefined): this;
|
|
187
|
+
labelRotation(): boolean | number | undefined;
|
|
188
|
+
labelRotation(_: boolean | number | undefined): this;
|
|
161
189
|
/**
|
|
162
190
|
The orientation of the shape.
|
|
163
191
|
*/
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Label angles for `labelRotation`. `true` rotates labels -90 degrees; a
|
|
3
|
+
number rotates them by that many degrees; left to the layout, crowded
|
|
4
|
+
labels slant 30 degrees (see `autoAngle`). Labels at an angle between the
|
|
5
|
+
two axis directions ("slanted", e.g. -45) hang off the axis from the end
|
|
6
|
+
of their text nearest it, so each one ends (or starts) at its tick.
|
|
7
|
+
*/
|
|
8
|
+
/** The axis sides, as `Axis.orient` names them. */
|
|
9
|
+
export type AxisOrient = "top" | "right" | "bottom" | "left";
|
|
10
|
+
/** A point relative to a label's tick, on the axis line. */
|
|
11
|
+
export interface Point {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
`degrees` brought into [-90, 90], turning upside-down text a half turn
|
|
17
|
+
so it reads left to right: 135 becomes -45, 180 becomes 0.
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeAngle(degrees: number): number;
|
|
20
|
+
/**
|
|
21
|
+
The angle a `labelRotation` setting rotates labels by when they rotate:
|
|
22
|
+
a number (normalized, see `normalizeAngle`), else -90.
|
|
23
|
+
*/
|
|
24
|
+
export declare function settingAngle(setting: unknown): number;
|
|
25
|
+
/** How an axis draws its labels: whether they rotate, by what angle, and whether they slant. */
|
|
26
|
+
export interface LabelTurn {
|
|
27
|
+
rotate: boolean;
|
|
28
|
+
/** Degrees, 0 when flat. */
|
|
29
|
+
angle: number;
|
|
30
|
+
/** Laid out at the angle (see `slantedLabelBox`), rather than upright as `true` stands them. */
|
|
31
|
+
slant: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** No rotation. */
|
|
34
|
+
export declare const FLAT: LabelTurn;
|
|
35
|
+
/**
|
|
36
|
+
How a `labelRotation` setting draws an axis's labels before the layout
|
|
37
|
+
has its say: `true` upright (-90), a number at its angle, anything else
|
|
38
|
+
flat.
|
|
39
|
+
*/
|
|
40
|
+
export declare function settingTurn(setting: unknown, horizontal: boolean): LabelTurn;
|
|
41
|
+
/**
|
|
42
|
+
The angle crowded labels slant at when the layout rotates them: -30 on
|
|
43
|
+
a bottom axis (rising to the right, ending at their ticks), 30 on a top
|
|
44
|
+
axis (the mirror image).
|
|
45
|
+
*/
|
|
46
|
+
export declare const autoAngle: (orient: string) => number;
|
|
47
|
+
/**
|
|
48
|
+
Whether a `labelRotation` setting rotates the labels: `true`, or a
|
|
49
|
+
number that isn't a multiple of 180. `undefined` leaves it to the
|
|
50
|
+
layout, which this doesn't decide.
|
|
51
|
+
*/
|
|
52
|
+
export declare function settingRotates(setting: unknown): boolean;
|
|
53
|
+
/**
|
|
54
|
+
Whether a `labelRotation` setting lays its labels out at their angle
|
|
55
|
+
(see `slantedLabelBox`): a number that rotates them, except ±90 on a
|
|
56
|
+
horizontal axis, which stands them upright as `true` does.
|
|
57
|
+
*/
|
|
58
|
+
export declare function slantsLabels(setting: unknown, horizontal: boolean): boolean;
|
|
59
|
+
/**
|
|
60
|
+
The angle (in radians, 0 to π/2) between a label's text at `angle` and
|
|
61
|
+
the axis it labels: 0 when the text runs along the axis, π/2 when it
|
|
62
|
+
stands straight out from it.
|
|
63
|
+
*/
|
|
64
|
+
export declare function axisCrossing(angle: number, horizontal: boolean): number;
|
|
65
|
+
/**
|
|
66
|
+
Which end of a rotated label's text sits at its tick: the end nearer the
|
|
67
|
+
axis. On a bottom axis, text rising to the right (a negative angle) ends
|
|
68
|
+
at its tick and text falling to the right starts at it; a top axis is
|
|
69
|
+
the reverse; a left axis's labels end at their ticks, a right axis's start
|
|
70
|
+
at them.
|
|
71
|
+
*/
|
|
72
|
+
export declare function rotatedTextAnchor(orient: AxisOrient, angle: number): "start" | "middle" | "end";
|
|
73
|
+
/** A slanted label's box before rotation, and its corners once rotated. */
|
|
74
|
+
export interface SlantedLabelBox {
|
|
75
|
+
/** The unrotated box, relative to the tick; it rotates about its center. */
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
/** The rotated text's four corners, relative to the tick. */
|
|
81
|
+
corners: Point[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
Where a slanted label goes: its text (`width` long, `textHeight` thick,
|
|
85
|
+
in a box `height` tall) rotated by `angle` about the box's center, with
|
|
86
|
+
the text's end nearest the axis (see `rotatedTextAnchor`) across from its
|
|
87
|
+
tick and every corner at least `gap` from the axis line.
|
|
88
|
+
*/
|
|
89
|
+
export declare function slantedLabelBox(orient: AxisOrient, angle: number, width: number, textHeight: number, height: number, gap: number): SlantedLabelBox;
|
|
90
|
+
/**
|
|
91
|
+
How far a slanted label reaches from its tick along the axis, before and
|
|
92
|
+
after it (toward lower and higher positions).
|
|
93
|
+
*/
|
|
94
|
+
export declare function slantedReach(orient: AxisOrient, angle: number, width: number, textHeight: number): [number, number];
|
|
95
|
+
/**
|
|
96
|
+
How far a slanted label reaches out from the axis line: its text's
|
|
97
|
+
length and thickness projected across the axis.
|
|
98
|
+
*/
|
|
99
|
+
export declare function slantedDepth(angle: number, horizontal: boolean, width: number, textHeight: number): number;
|
|
100
|
+
/**
|
|
101
|
+
The longest and thickest a slanted label's text may be: as long as
|
|
102
|
+
reaches `depth` out from the axis (with one line of `lineHeight`), and
|
|
103
|
+
as thick as fits between labels `space` apart along the axis (at least
|
|
104
|
+
one line). Text running along the axis is `space` long and `depth`
|
|
105
|
+
thick.
|
|
106
|
+
*/
|
|
107
|
+
export declare function slantedWrapSize(angle: number, horizontal: boolean, depth: number, space: number, lineHeight: number): {
|
|
108
|
+
width: number;
|
|
109
|
+
height: number;
|
|
110
|
+
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Label thinning for `createTextData` (see `axisLayoutLabels.ts`): the
|
|
3
|
-
passes that hide labels crowding their neighbors, and the widening of
|
|
4
|
-
labels that each wrap within their own share of the axis.
|
|
5
|
-
*/
|
|
6
1
|
import type { AxisTextDatum } from "./axisLayoutLabels.js";
|
|
7
2
|
/**
|
|
8
3
|
A measured label's text extent along its axis, which the overlap pass
|
|
@@ -12,9 +7,10 @@ import type { AxisTextDatum } from "./axisLayoutLabels.js";
|
|
|
12
7
|
The measured `height` also holds the label's padding (see
|
|
13
8
|
`calculateLabelSize`) and the leading above and below the text, which this
|
|
14
9
|
leaves out, so neighbors are spaced by their padding alone, as they are
|
|
15
|
-
along a horizontal axis.
|
|
10
|
+
along a horizontal axis. Slanted labels span their glyphs' thickness where
|
|
11
|
+
it crosses the axis.
|
|
16
12
|
*/
|
|
17
|
-
export declare function labelExtent(datum: Pick<AxisTextDatum, "fP" | "fS" | "height" | "lineHeight" | "lines" | "rotate" | "width">, horizontal: boolean): number;
|
|
13
|
+
export declare function labelExtent(datum: Pick<AxisTextDatum, "angle" | "slant" | "fP" | "fS" | "height" | "lineHeight" | "lines" | "rotate" | "width">, horizontal: boolean): number;
|
|
18
14
|
/**
|
|
19
15
|
Fits flat labels that each wrap within their own share of the axis (see
|
|
20
16
|
`ownLabelSpaces`, which gives `spaces`). A label too long for its share,
|
|
@@ -27,6 +27,11 @@ export interface AxisLayoutResult {
|
|
|
27
27
|
the instance afterward.
|
|
28
28
|
*/
|
|
29
29
|
export declare function measureAxis(axis: Axis): AxisLayoutResult;
|
|
30
|
+
/**
|
|
31
|
+
How far the first and last slanted labels shown reach past the start and
|
|
32
|
+
end of `range`, along the axis (0 when they don't, or aren't slanted).
|
|
33
|
+
*/
|
|
34
|
+
export declare function slantedOverflow(axis: Axis, textData: AxisTextDatum[], range: number[]): [number, number];
|
|
30
35
|
/**
|
|
31
36
|
Whether the axis may rotate its labels on its own: one label per category
|
|
32
37
|
naming things rather than numbers or dates, which read in sequence even
|
|
@@ -18,6 +18,10 @@ export interface AxisTextDatum {
|
|
|
18
18
|
lineHeight: number;
|
|
19
19
|
position: number;
|
|
20
20
|
rotate?: boolean;
|
|
21
|
+
/** The degrees a rotated label turns (see `labelRotation`), 0 when flat. */
|
|
22
|
+
angle?: number;
|
|
23
|
+
/** Whether the label is laid out at its angle (see `settingTurn`). */
|
|
24
|
+
slant?: boolean;
|
|
21
25
|
space: number;
|
|
22
26
|
lines: string[];
|
|
23
27
|
widths: number[];
|
|
@@ -44,6 +48,8 @@ interface LabelLayoutCtx {
|
|
|
44
48
|
`ownLabelSpaces`) rather than the widest share any label has.
|
|
45
49
|
*/
|
|
46
50
|
ownSpace?: boolean;
|
|
51
|
+
/** The width slanted labels wrap at (see `slantedLineWidth`). */
|
|
52
|
+
slantWidth?: number;
|
|
47
53
|
}
|
|
48
54
|
/** Applies the axis title's wrapped height to the orient-side margin. */
|
|
49
55
|
export declare function applyTitleMargin(axis: Axis, ctx: {
|
|
@@ -83,6 +89,13 @@ export declare function ownLabelSpaces(positions: number[], rangeOuter: number[]
|
|
|
83
89
|
export declare function wholeLineLabels(axis: Axis, labels: unknown[]): boolean;
|
|
84
90
|
/** Whether a scale places one tick per category (every value labeled in turn). */
|
|
85
91
|
export declare function isDiscreteScale(scale: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
How far a measured label reaches out from the axis: its height when it
|
|
94
|
+
lies flat along a horizontal axis, its width when it stands out from the
|
|
95
|
+
axis, and for a slanted label, both projected across the axis (with its
|
|
96
|
+
padding on a horizontal axis, as its height holds).
|
|
97
|
+
*/
|
|
98
|
+
export declare function labelDepth(t: AxisTextDatum, horizontal: boolean): number;
|
|
86
99
|
/** Derives `_outerBounds` + axis margins from the measured text data. */
|
|
87
100
|
export declare function computeAxisBounds(axis: Axis, ctx: {
|
|
88
101
|
textData: AxisTextDatum[];
|
|
@@ -6,9 +6,12 @@ export declare const floorPow: (d: number) => number;
|
|
|
6
6
|
export declare const ceilPow: (d: number) => number;
|
|
7
7
|
/** `d` with floating-point noise (runs of 0s or 9s) trimmed; tiny values become 0. */
|
|
8
8
|
export declare const fixFloat: (d: number) => number;
|
|
9
|
+
/** The axis scales whose domains round to nice values (see `roundedDomain`). */
|
|
10
|
+
export declare const roundingScales: string[];
|
|
9
11
|
/**
|
|
10
|
-
A linear or
|
|
11
|
-
("outside" or "inside") rounds it, or undefined when the axis
|
|
12
|
-
domain as given (another scale, or nothing to round).
|
|
12
|
+
A linear, log or power axis domain rounded the way an Axis with this
|
|
13
|
+
`rounding` ("outside" or "inside") rounds it, or undefined when the axis
|
|
14
|
+
leaves the domain as given (another scale, or nothing to round). A power
|
|
15
|
+
scale's domain rounds as a linear one does.
|
|
13
16
|
*/
|
|
14
17
|
export declare function roundedDomain(initialDomain: number[], rounding: string, scale: string): number[] | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The most lines a slanted label wraps onto. */
|
|
2
|
+
export declare const SLANTED_MAX_LINES = 3;
|
|
3
|
+
/** How many lines of `lineHeight` fit in a slanted label `thickness` thick: 1 to 3. */
|
|
4
|
+
export declare const slantedLines: (thickness: number, lineHeight: number) => number;
|
|
5
|
+
/**
|
|
6
|
+
The narrowest width, from `min` up to `max` in steps of `step` times the
|
|
7
|
+
last, at which text wraps onto at most `lines` lines, as `lineCount`
|
|
8
|
+
counts them at a width; `max` when none does.
|
|
9
|
+
*/
|
|
10
|
+
export declare function narrowestWidth(lineCount: (width: number) => number, lines: number, min: number, max: number, step?: number): number;
|
|
11
|
+
/** A label to wrap: its text and font. */
|
|
12
|
+
export interface SlantedText {
|
|
13
|
+
text: string;
|
|
14
|
+
fontFamily: string;
|
|
15
|
+
fontSize: number;
|
|
16
|
+
lineHeight: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
The width slanted labels wrap at to fit on `lines` lines, at most `max`:
|
|
20
|
+
the widest any one of them needs, and never narrower than a word.
|
|
21
|
+
*/
|
|
22
|
+
export declare function slantedLineWidth(labels: SlantedText[], lines: number, max: number): number;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Tick values for a power scale whose exponent isn't 1. Value-spaced ticks
|
|
3
|
+
bunch up where the exponent compresses the axis and leave long gaps
|
|
4
|
+
where it stretches it, so these are spaced evenly along the axis instead,
|
|
5
|
+
each rounded to a round number at the precision its neighbors allow.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
The exponent a `"pow"` axis uses: `exponent` when it is a positive
|
|
9
|
+
number, else 1.
|
|
10
|
+
*/
|
|
11
|
+
export declare const powExponent: (exponent: unknown) => number;
|
|
12
|
+
/**
|
|
13
|
+
`value` rounded to the roundest number within `tolerance` of it: the
|
|
14
|
+
nearest multiple of the largest step (1, 2 or 5 times a power of ten)
|
|
15
|
+
that lands that close.
|
|
16
|
+
*/
|
|
17
|
+
export declare function roundWithin(value: number, tolerance: number): number;
|
|
18
|
+
/**
|
|
19
|
+
Tick values for a power scale: `count` equal steps along the axis (in the
|
|
20
|
+
scale's transformed space), each rounded to a round number. With
|
|
21
|
+
`minor`, the midpoints between those steps are added, so the major
|
|
22
|
+
ticks are always a subset of the minor ones. Returns ascending values
|
|
23
|
+
inside the domain, or the domain's own order when it runs high to low.
|
|
24
|
+
@param domain The scale's domain.
|
|
25
|
+
@param exponent The scale's exponent.
|
|
26
|
+
@param count How many steps to divide the axis into.
|
|
27
|
+
@param minor Whether to add a tick between each pair of steps.
|
|
28
|
+
*/
|
|
29
|
+
export declare function powTicks(domain: number[], exponent: number, count: number, minor?: boolean): number[];
|