@sophistry/charts 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +32 -2
- package/dist/3d/bar-chart3d.d.ts +55 -0
- package/dist/3d/definitions.d.ts +37 -0
- package/dist/3d/definitions.js +14 -0
- package/dist/3d/forward.d.ts +64 -0
- package/dist/3d/index.d.ts +30 -0
- package/dist/3d/index.js +1 -0
- package/dist/3d/quiver3d.d.ts +52 -0
- package/dist/3d/scatter3d.d.ts +44 -0
- package/dist/3d/stem3d.d.ts +45 -0
- package/dist/3d/surface-grid3d.d.ts +33 -0
- package/dist/3d/tri-surface3d.d.ts +45 -0
- package/dist/3d/voxels3d.d.ts +25 -0
- package/dist/3d/wireframe3d.d.ts +30 -0
- package/dist/band.d.ts +20 -0
- package/dist/bars/bar-chart.d.ts +143 -0
- package/dist/bars/bar-labels.d.ts +116 -0
- package/dist/bars/bars.d.ts +223 -0
- package/dist/bars/bullet.d.ts +157 -0
- package/dist/bars/candlestick.d.ts +97 -0
- package/dist/bars/funnel.d.ts +90 -0
- package/dist/bars/histogram.d.ts +108 -0
- package/dist/bars/index.d.ts +22 -0
- package/dist/bars/race.d.ts +28 -0
- package/dist/bars/rules.d.ts +121 -0
- package/dist/bars/shared.d.ts +41 -0
- package/dist/bars/transforms.d.ts +249 -0
- package/dist/bars/waterfall.d.ts +106 -0
- package/dist/batch.d.ts +142 -0
- package/dist/channels-_Xf-p6Lx.js +56 -0
- package/dist/chart.d.ts +87 -0
- package/dist/color-norm.d.ts +90 -0
- package/dist/context.d.ts +111 -0
- package/dist/curves/density.d.ts +125 -0
- package/dist/curves/ecdf.d.ts +72 -0
- package/dist/curves/fill-between.d.ts +100 -0
- package/dist/curves/index.d.ts +15 -0
- package/dist/curves/line-plot.d.ts +104 -0
- package/dist/curves/regression.d.ts +124 -0
- package/dist/curves/shared.d.ts +52 -0
- package/dist/curves/stack-plot.d.ts +140 -0
- package/dist/curves/stairs.d.ts +170 -0
- package/dist/data/channels.d.ts +170 -0
- package/dist/end-space.d.ts +81 -0
- package/dist/entries/definitions.d.ts +20 -0
- package/dist/entries/definitions.js +6 -0
- package/dist/frame/band-axis.d.ts +42 -0
- package/dist/frame/coords.d.ts +111 -0
- package/dist/frame/fit.d.ts +170 -0
- package/dist/frame/format.d.ts +40 -0
- package/dist/frame/guide-metrics.d.ts +36 -0
- package/dist/frame/guides.d.ts +67 -0
- package/dist/frame/keys.d.ts +96 -0
- package/dist/frame/layout.d.ts +145 -0
- package/dist/frame/registry.d.ts +31 -0
- package/dist/frame/reports.d.ts +53 -0
- package/dist/frame/secondary-axes.d.ts +73 -0
- package/dist/frame/secondary.d.ts +56 -0
- package/dist/frame/tooltip-overlay.d.ts +64 -0
- package/dist/frame/types.d.ts +658 -0
- package/dist/grids/barbs.d.ts +51 -0
- package/dist/grids/cell-rects.d.ts +37 -0
- package/dist/grids/cells.d.ts +130 -0
- package/dist/grids/contour-f.d.ts +80 -0
- package/dist/grids/contour-shared.d.ts +53 -0
- package/dist/grids/contour.d.ts +84 -0
- package/dist/grids/dendrogram.d.ts +104 -0
- package/dist/grids/heatmap.d.ts +163 -0
- package/dist/grids/hex-bin.d.ts +93 -0
- package/dist/grids/hist2d.d.ts +107 -0
- package/dist/grids/imshow.d.ts +84 -0
- package/dist/grids/index.d.ts +26 -0
- package/dist/grids/pcolormesh.d.ts +90 -0
- package/dist/grids/ramp-cells.d.ts +66 -0
- package/dist/grids/tri-contour.d.ts +120 -0
- package/dist/grids/tri-shared.d.ts +61 -0
- package/dist/grids/tripcolor.d.ts +73 -0
- package/dist/guides/colorbar.d.ts +110 -0
- package/dist/guides/index.d.ts +11 -0
- package/dist/guides/legend.d.ts +118 -0
- package/dist/guides/nodes.d.ts +13 -0
- package/dist/guides/size-legend.d.ts +233 -0
- package/dist/hierarchy/breadcrumbs.d.ts +133 -0
- package/dist/hierarchy/circle-pack.d.ts +72 -0
- package/dist/hierarchy/drill.d.ts +245 -0
- package/dist/hierarchy/frame.d.ts +67 -0
- package/dist/hierarchy/icicle.d.ts +76 -0
- package/dist/hierarchy/index.d.ts +20 -0
- package/dist/hierarchy/labels.d.ts +24 -0
- package/dist/hierarchy/mosaic.d.ts +130 -0
- package/dist/hierarchy/own-tooltip.d.ts +12 -0
- package/dist/hierarchy/props.d.ts +13 -0
- package/dist/hierarchy/sankey.d.ts +132 -0
- package/dist/hierarchy/shared.d.ts +247 -0
- package/dist/hierarchy/sunburst.d.ts +74 -0
- package/dist/hierarchy/tree.d.ts +124 -0
- package/dist/hierarchy/treemap.d.ts +76 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +5 -0
- package/dist/item-tooltip.d.ts +33 -0
- package/dist/join.d.ts +223 -0
- package/dist/math/3d/bar3d.d.ts +27 -0
- package/dist/math/3d/quiver3d.d.ts +26 -0
- package/dist/math/3d/scatter3d.d.ts +15 -0
- package/dist/math/3d/stem3d.d.ts +22 -0
- package/dist/math/3d/surfaceGrid3d.d.ts +33 -0
- package/dist/math/3d/trisurface.d.ts +11 -0
- package/dist/math/3d/voxels.d.ts +17 -0
- package/dist/math/aggregate.d.ts +68 -0
- package/dist/math/bar.d.ts +31 -0
- package/dist/math/barLabels.d.ts +83 -0
- package/dist/math/barbs.d.ts +36 -0
- package/dist/math/boxplot.d.ts +36 -0
- package/dist/math/breadcrumbs.d.ts +128 -0
- package/dist/math/bubble.d.ts +38 -0
- package/dist/math/bullet.d.ts +110 -0
- package/dist/math/chord.d.ts +103 -0
- package/dist/math/cluster.d.ts +88 -0
- package/dist/math/contour.d.ts +48 -0
- package/dist/math/contourf.d.ts +50 -0
- package/dist/math/dodge.d.ts +36 -0
- package/dist/math/ecdf.d.ts +41 -0
- package/dist/math/errorbar.d.ts +27 -0
- package/dist/math/eventplot.d.ts +26 -0
- package/dist/math/facet.d.ts +90 -0
- package/dist/math/fillBetween.d.ts +28 -0
- package/dist/math/gauge.d.ts +71 -0
- package/dist/math/hexbin.d.ts +20 -0
- package/dist/math/hierarchy.d.ts +179 -0
- package/dist/math/hierarchyJoin.d.ts +59 -0
- package/dist/math/histogram.d.ts +36 -0
- package/dist/math/histogram2d.d.ts +44 -0
- package/dist/math/imshow.d.ts +26 -0
- package/dist/math/index.d.ts +139 -0
- package/dist/math/index.js +3 -0
- package/dist/math/jitter.d.ts +16 -0
- package/dist/math/join.d.ts +135 -0
- package/dist/math/keyframes.d.ts +127 -0
- package/dist/math/legend.d.ts +120 -0
- package/dist/math/line.d.ts +53 -0
- package/dist/math/morph.d.ts +81 -0
- package/dist/math/mosaic.d.ts +119 -0
- package/dist/math/ordinal.d.ts +79 -0
- package/dist/math/parallel.d.ts +38 -0
- package/dist/math/pcolormesh.d.ts +22 -0
- package/dist/math/pie.d.ts +105 -0
- package/dist/math/polarArea.d.ts +34 -0
- package/dist/math/radar.d.ts +110 -0
- package/dist/math/range.d.ts +98 -0
- package/dist/math/regression.d.ts +109 -0
- package/dist/math/reveal.d.ts +63 -0
- package/dist/math/sankey.d.ts +154 -0
- package/dist/math/scatter.d.ts +14 -0
- package/dist/math/shared/binning.d.ts +23 -0
- package/dist/math/shared/gridCells.d.ts +41 -0
- package/dist/math/shared/gridExtent.d.ts +5 -0
- package/dist/math/shared/pairs.d.ts +2 -0
- package/dist/math/shared/polar.d.ts +23 -0
- package/dist/math/stack.d.ts +69 -0
- package/dist/math/stackplot.d.ts +35 -0
- package/dist/math/stairs.d.ts +17 -0
- package/dist/math/stem.d.ts +21 -0
- package/dist/math/symbol.d.ts +25 -0
- package/dist/math/tree.d.ts +117 -0
- package/dist/math/tricontour.d.ts +76 -0
- package/dist/math/violin.d.ts +99 -0
- package/dist/math/waffle.d.ts +48 -0
- package/dist/math/waterfall.d.ts +28 -0
- package/dist/math-CSHNpGej.js +3648 -0
- package/dist/mix.d.ts +24 -0
- package/dist/multiview/brush.d.ts +165 -0
- package/dist/multiview/chart-group.d.ts +265 -0
- package/dist/multiview/chart-link.d.ts +188 -0
- package/dist/multiview/chart-zoom.d.ts +144 -0
- package/dist/multiview/facet.d.ts +238 -0
- package/dist/multiview/group-guides.d.ts +99 -0
- package/dist/multiview/index.d.ts +17 -0
- package/dist/multiview/joint-plot.d.ts +114 -0
- package/dist/multiview/pair-plot.d.ts +153 -0
- package/dist/multiview/panels.d.ts +22 -0
- package/dist/multiview/parallel-coordinates.d.ts +109 -0
- package/dist/points/event-plot.d.ts +67 -0
- package/dist/points/index.d.ts +19 -0
- package/dist/points/labels.d.ts +70 -0
- package/dist/points/links.d.ts +123 -0
- package/dist/points/rects.d.ts +80 -0
- package/dist/points/rug.d.ts +72 -0
- package/dist/points/scatter.d.ts +169 -0
- package/dist/points/segment-marks.d.ts +39 -0
- package/dist/points/shared.d.ts +34 -0
- package/dist/points/stem.d.ts +75 -0
- package/dist/points/strip.d.ts +145 -0
- package/dist/points/symbol-marker.d.ts +33 -0
- package/dist/points/ticks.d.ts +102 -0
- package/dist/props.d.ts +126 -0
- package/dist/radial/chord.d.ts +148 -0
- package/dist/radial/gauge.d.ts +126 -0
- package/dist/radial/index.d.ts +15 -0
- package/dist/radial/pie-chart.d.ts +143 -0
- package/dist/radial/polar-area-chart.d.ts +135 -0
- package/dist/radial/radar-chart.d.ts +176 -0
- package/dist/radial/radial-bar-chart.d.ts +116 -0
- package/dist/radial/shared.d.ts +78 -0
- package/dist/radial/waffle.d.ts +130 -0
- package/dist/raster.d.ts +43 -0
- package/dist/series.d.ts +71 -0
- package/dist/src-CwGo1bes.js +19221 -0
- package/dist/stagger.d.ts +54 -0
- package/dist/statistics/box-plot.d.ts +151 -0
- package/dist/statistics/error-bar.d.ts +148 -0
- package/dist/statistics/groups.d.ts +140 -0
- package/dist/statistics/index.d.ts +7 -0
- package/dist/statistics/violin-plot.d.ts +143 -0
- package/dist/text-width.d.ts +9 -0
- package/dist/tooltip.d.ts +276 -0
- package/dist/util.d.ts +33 -0
- package/dist/voxels-9lJ2TZS4.js +235 -0
- package/dist/wireframe3d-D157GZAq.js +345 -0
- package/package.json +86 -3
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public types of `chart`: its props, a layer's report, and the frame
|
|
3
|
+
* layers read through `chartContext`.
|
|
4
|
+
*/
|
|
5
|
+
import type { AxisOptions, AxisPosition, CoordinateSystem, SceneNode, XAxisPosition, YAxisPosition } from "@sophistry/core";
|
|
6
|
+
import type { ColorInput } from "@sophistry/core/color";
|
|
7
|
+
import type { BandKey, BandScale, Bounds, Point, RangeTransition, Scale, ScaleSpec } from "@sophistry/core/geometry";
|
|
8
|
+
import type { Colormap } from "@sophistry/core/themes";
|
|
9
|
+
import type { PositionValue } from "../data/channels.js";
|
|
10
|
+
import type { JoinStages, JoinStaging } from "../math/join.js";
|
|
11
|
+
import type { OrdinalColorScale } from "../math/ordinal.js";
|
|
12
|
+
import type { SymbolName } from "../math/symbol.js";
|
|
13
|
+
import type { LayersReveal } from "../props.js";
|
|
14
|
+
import type { TooltipAnchor, TooltipFormat, TooltipState } from "../tooltip.js";
|
|
15
|
+
/**
|
|
16
|
+
* How a series' marks look in a legend entry.
|
|
17
|
+
*
|
|
18
|
+
* @category Charts
|
|
19
|
+
*/
|
|
20
|
+
export interface LegendMark {
|
|
21
|
+
/** A short stroke: the series is drawn as a line. */
|
|
22
|
+
line?: boolean;
|
|
23
|
+
/** A marker of this shape (on the stroke, if there is one). */
|
|
24
|
+
symbol?: SymbolName;
|
|
25
|
+
/** A filled square: the series is drawn as areas or bars. Wins over `line` and `symbol`. */
|
|
26
|
+
fill?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A square-root size scale in scene units: what a size key draws.
|
|
30
|
+
*
|
|
31
|
+
* @category Charts
|
|
32
|
+
*/
|
|
33
|
+
export interface SizeScale {
|
|
34
|
+
/** The value that reaches `range[1]`. */
|
|
35
|
+
maxValue: number;
|
|
36
|
+
/**
|
|
37
|
+
* The radii of a value of 0 and of `maxValue`.
|
|
38
|
+
* @default [0, 0.35]
|
|
39
|
+
*/
|
|
40
|
+
range?: readonly [number, number];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A fixed axis range for `chart`: a {@link Range} whose ends may also
|
|
44
|
+
* be `Date`s or Temporal values, for a time axis. `step` stays a number in
|
|
45
|
+
* the axis's units; a `{ from, to, t }` transition takes numbers only.
|
|
46
|
+
*
|
|
47
|
+
* @see https://sophistry.dev/guides/charts/#dates-and-time-zones
|
|
48
|
+
* @category Charts
|
|
49
|
+
*/
|
|
50
|
+
export type ChartRange = [
|
|
51
|
+
min: PositionValue,
|
|
52
|
+
max: PositionValue,
|
|
53
|
+
step?: number
|
|
54
|
+
];
|
|
55
|
+
/**
|
|
56
|
+
* Per-axis options for `chart`: everything an `axes` axis takes,
|
|
57
|
+
* plus how the frame fits and places it.
|
|
58
|
+
*
|
|
59
|
+
* @see https://sophistry.dev/guides/charts/#scales
|
|
60
|
+
* @category Charts
|
|
61
|
+
*/
|
|
62
|
+
export interface ChartAxisOptions extends Omit<AxisOptions, "scale"> {
|
|
63
|
+
/**
|
|
64
|
+
* How values map along the axis: a continuous scale (`"linear"`, `"log"`,
|
|
65
|
+
* `"sqrt"`, `"symlog"`, `"time"`, `"utc"`, or a custom `Scale`) or `"band"`
|
|
66
|
+
* for categories. Omitted, it is `"band"` when a layer reports categories,
|
|
67
|
+
* `"utc"` when a layer's channel gives dates, else `"linear"`.
|
|
68
|
+
*/
|
|
69
|
+
scale?: ScaleSpec | "band";
|
|
70
|
+
/** Band axes: the categories, in order. Omitted, the layers' categories in first-seen order. */
|
|
71
|
+
categories?: readonly BandKey[];
|
|
72
|
+
/** Band axes: a category's label; `""` draws none. Defaults to `String(key)`. */
|
|
73
|
+
categoryLabel?: (key: BandKey, index: number) => string;
|
|
74
|
+
/** Band axes: fraction of each slot left empty between bands, 0..1. @default 0.4 */
|
|
75
|
+
padding?: number;
|
|
76
|
+
/** Continuous axes: keep zero in range. Omitted, kept when any layer asks (bars, areas and histograms do). */
|
|
77
|
+
zero?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Continuous axes: round a fitted range out to tick values. `false` keeps
|
|
80
|
+
* the data's ends; `"tight"` rounds an end out only when the next tick is
|
|
81
|
+
* within a quarter step of the data.
|
|
82
|
+
* @default true
|
|
83
|
+
*/
|
|
84
|
+
nice?: boolean | "tight";
|
|
85
|
+
/**
|
|
86
|
+
* Continuous axes: pad a fitted range by this fraction of the data's span on
|
|
87
|
+
* each side before rounding. A side held at zero by `zero` stays there.
|
|
88
|
+
* @default 0
|
|
89
|
+
*/
|
|
90
|
+
margin?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Flip the axis: a continuous axis runs from its range's end to its start, a
|
|
93
|
+
* band axis lays its categories out the other way.
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
reverse?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Continuous axes: pin out-of-range values to the range's ends instead of
|
|
99
|
+
* drawing them past the frame.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
clamp?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Band axes: each category's slot index (may be fractional), overriding its
|
|
105
|
+
* place in `categories`; 0 is leftmost, or the top of a y axis. For sort and
|
|
106
|
+
* rank animations, e.g. from a `raceTimeline` entry's `position`.
|
|
107
|
+
* Returning undefined keeps the category's own slot.
|
|
108
|
+
*/
|
|
109
|
+
slot?: (key: BandKey) => number | undefined;
|
|
110
|
+
/** Draw this axis. The scale still applies when false. @default true */
|
|
111
|
+
visible?: boolean;
|
|
112
|
+
/** Band axes: draw the axis line the bands stand on. @default true */
|
|
113
|
+
line?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Where the axis line crosses the other axis: `"zero"` at the data origin
|
|
116
|
+
* (pinned to the nearest edge when out of range), `"edge"` at the plot's low
|
|
117
|
+
* edge, or a value of the other axis. Bars and areas still grow from zero. Defaults to `"zero"`
|
|
118
|
+
* for a continuous axis, `"edge"` for a band axis.
|
|
119
|
+
*/
|
|
120
|
+
position?: AxisPosition;
|
|
121
|
+
/**
|
|
122
|
+
* Continuous axes: a rule across the plot at zero, for when the other axis is
|
|
123
|
+
* drawn elsewhere. Omitted, on when a layer measures from zero along this
|
|
124
|
+
* axis, zero is in range, and the other axis has moved off it.
|
|
125
|
+
*/
|
|
126
|
+
zeroLine?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* {@link ChartAxisOptions} for `<Chart xAxis>`: `position` also takes
|
|
130
|
+
* `"bottom"` and `"top"`.
|
|
131
|
+
*
|
|
132
|
+
* @category Charts
|
|
133
|
+
*/
|
|
134
|
+
export interface ChartXAxisOptions extends Omit<ChartAxisOptions, "position"> {
|
|
135
|
+
/** As {@link ChartAxisOptions.position}; `"bottom"` is `"edge"`, `"top"` puts the numbers above the line. */
|
|
136
|
+
position?: XAxisPosition;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* {@link ChartAxisOptions} for `<Chart yAxis>`: `position` also takes
|
|
140
|
+
* `"left"` and `"right"`.
|
|
141
|
+
*
|
|
142
|
+
* @category Charts
|
|
143
|
+
*/
|
|
144
|
+
export interface ChartYAxisOptions extends Omit<ChartAxisOptions, "position"> {
|
|
145
|
+
/** As {@link ChartAxisOptions.position}; `"left"` is `"edge"`, `"right"` puts the numbers right of the line. */
|
|
146
|
+
position?: YAxisPosition;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Options for a secondary axis (`<Chart y2Axis>`, `x2Axis`): a continuous
|
|
150
|
+
* axis's {@link ChartAxisOptions}, plus tick alignment with the primary axis.
|
|
151
|
+
*
|
|
152
|
+
* @see https://sophistry.dev/guides/charts/#scales
|
|
153
|
+
* @category Charts
|
|
154
|
+
*/
|
|
155
|
+
export interface ChartSecondaryAxisOptions extends Omit<ChartAxisOptions, "position" | "categories" | "slot"> {
|
|
156
|
+
/**
|
|
157
|
+
* Put this axis's ticks where the primary axis's are, so one grid reads for
|
|
158
|
+
* both. The range is widened to a nice step covering the data; linear,
|
|
159
|
+
* fitted axes only (a given range wins).
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
alignTicks?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The categorical colour scale of a `chart`: how the categories layers
|
|
166
|
+
* report through `series` map to colours and legend names.
|
|
167
|
+
*
|
|
168
|
+
* @see https://sophistry.dev/guides/charts/#color
|
|
169
|
+
* @category Charts
|
|
170
|
+
*/
|
|
171
|
+
export interface ChartColorOptions {
|
|
172
|
+
/**
|
|
173
|
+
* The categories, in order; pin it so colours stay put when data is filtered.
|
|
174
|
+
* Unlisted categories follow in first-seen order.
|
|
175
|
+
*/
|
|
176
|
+
domain?: readonly BandKey[];
|
|
177
|
+
/**
|
|
178
|
+
* The colours, cycled over the domain: `okabeIto`, `tableau10`,
|
|
179
|
+
* `observable10`, or your own. Defaults to the theme's series colours.
|
|
180
|
+
*/
|
|
181
|
+
range?: readonly ColorInput[];
|
|
182
|
+
/** A category's name in the legend. Defaults to `String(key)`. */
|
|
183
|
+
label?: (key: BandKey, index: number) => string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Props for `chart`.
|
|
187
|
+
*
|
|
188
|
+
* @see https://sophistry.dev/guides/charts/#the-chart-frame
|
|
189
|
+
* @category Charts
|
|
190
|
+
*/
|
|
191
|
+
export interface ChartProps {
|
|
192
|
+
/** Width of the chart; under `autosize="fit"` guides on the right fit inside it. */
|
|
193
|
+
width: number;
|
|
194
|
+
/** Height of the plotting area (of everything, under `autosize="contain"`). */
|
|
195
|
+
height: number;
|
|
196
|
+
/**
|
|
197
|
+
* Centre of the chart: of the area `width × height` covers (see `autosize`). Defaults to the
|
|
198
|
+
* origin.
|
|
199
|
+
*/
|
|
200
|
+
center?: Point;
|
|
201
|
+
/**
|
|
202
|
+
* Which guides `width` and `height` make room for: `"fit"` fits the guides
|
|
203
|
+
* on the right (legend, colour bar, right-hand axis) inside `width`;
|
|
204
|
+
* `"contain"` fits every guide on every side inside `width × height`;
|
|
205
|
+
* `"pad"` makes the plotting area exactly `width × height` with all guides
|
|
206
|
+
* outside.
|
|
207
|
+
* @default "fit"
|
|
208
|
+
*/
|
|
209
|
+
autosize?: "fit" | "pad" | "contain";
|
|
210
|
+
/**
|
|
211
|
+
* Fixed x range `[min, max, step?]`, or `{ from, to, t }` to animate the
|
|
212
|
+
* domain (ticks and grid cross-fade; pair it with `clip`). Omitted, fitted to
|
|
213
|
+
* the layers' data. Ignored by a band axis.
|
|
214
|
+
*/
|
|
215
|
+
xRange?: ChartRange | RangeTransition;
|
|
216
|
+
/** Fixed y range, or a `{ from, to, t }` transition; see `xRange`. */
|
|
217
|
+
yRange?: ChartRange | RangeTransition;
|
|
218
|
+
/** Options for both axes. */
|
|
219
|
+
axis?: ChartAxisOptions;
|
|
220
|
+
/** Overrides for the x axis, merged over `axis`. */
|
|
221
|
+
xAxis?: ChartXAxisOptions;
|
|
222
|
+
/** Overrides for the y axis, merged over `axis`. */
|
|
223
|
+
yAxis?: ChartYAxisOptions;
|
|
224
|
+
/**
|
|
225
|
+
* Fixed range of the secondary y axis, which layers inside a
|
|
226
|
+
* `secondaryY` map through; or a `{ from, to, t }` transition.
|
|
227
|
+
* Omitted, fitted to those layers.
|
|
228
|
+
*/
|
|
229
|
+
y2Range?: ChartRange | RangeTransition;
|
|
230
|
+
/** Options for the secondary y axis, merged over `axis`. It always stands on the right; continuous scales only. */
|
|
231
|
+
y2Axis?: ChartSecondaryAxisOptions;
|
|
232
|
+
/** Title above the top of the secondary y axis. */
|
|
233
|
+
y2Label?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Fixed range of the secondary x axis, which layers inside a
|
|
236
|
+
* `secondaryX` map through; or a `{ from, to, t }` transition.
|
|
237
|
+
* Omitted, fitted to those layers.
|
|
238
|
+
*/
|
|
239
|
+
x2Range?: ChartRange | RangeTransition;
|
|
240
|
+
/** Options for the secondary x axis, merged over `axis`. It always runs along the top; continuous scales only. */
|
|
241
|
+
x2Axis?: ChartSecondaryAxisOptions;
|
|
242
|
+
/** Title past the right end of the secondary x axis. */
|
|
243
|
+
x2Label?: string;
|
|
244
|
+
/** Draw arrowheads at the far ends of continuous axes. @default false */
|
|
245
|
+
tip?: boolean;
|
|
246
|
+
/** Title past the far end of the x axis. */
|
|
247
|
+
xLabel?: string;
|
|
248
|
+
/** Title past the top of the y axis. */
|
|
249
|
+
yLabel?: string;
|
|
250
|
+
/** Font size of `xLabel` and `yLabel`. @default 0.34 */
|
|
251
|
+
axisLabelFontSize?: number;
|
|
252
|
+
/** Grid lines at the major ticks of both axes, one, or none. Band axes get none. @default false */
|
|
253
|
+
grid?: boolean | "x" | "y";
|
|
254
|
+
/** Grid line colour. Defaults to the theme's grid colour. */
|
|
255
|
+
gridColor?: string;
|
|
256
|
+
/** Title centred above the plotting area. */
|
|
257
|
+
title?: string;
|
|
258
|
+
/** Font size of `title`. @default 0.42 */
|
|
259
|
+
titleFontSize?: number;
|
|
260
|
+
/** A quieter second line under the title. */
|
|
261
|
+
subtitle?: string;
|
|
262
|
+
/** Font size of `subtitle`. @default 0.3 */
|
|
263
|
+
subtitleFontSize?: number;
|
|
264
|
+
/** The categorical colour scale every layer's `series` maps through. */
|
|
265
|
+
color?: ChartColorOptions;
|
|
266
|
+
/**
|
|
267
|
+
* A legend of the layers' series: `"right"` in a column beside the plot,
|
|
268
|
+
* `"top"` in a row above it, `false` never. Omitted, drawn on the right
|
|
269
|
+
* whenever a layer reports a series.
|
|
270
|
+
*/
|
|
271
|
+
legend?: boolean | "right" | "top";
|
|
272
|
+
/** A title above the legend's entries. */
|
|
273
|
+
legendTitle?: string;
|
|
274
|
+
/** Font size of the legend. @default 0.28 */
|
|
275
|
+
legendFontSize?: number;
|
|
276
|
+
/**
|
|
277
|
+
* A size key for layers that size marks by value (`Scatter`'s `size`),
|
|
278
|
+
* drawn with the legend. Omitted, drawn whenever a layer reports a size
|
|
279
|
+
* scale; `false` never. Layers on different size scales get one key each.
|
|
280
|
+
*/
|
|
281
|
+
sizeLegend?: boolean | ChartSizeLegendOptions;
|
|
282
|
+
/** How layers share non-positional scales; by default sized layers share one size scale, so bubbles compare across layers. */
|
|
283
|
+
scales?: ChartScales;
|
|
284
|
+
/**
|
|
285
|
+
* A colour bar for the first layer that colours by value (`Imshow`,
|
|
286
|
+
* `Pcolormesh`, `Cells`, `Hist2D`, `HexBin`, `ContourF`), beside the plot.
|
|
287
|
+
* @default false
|
|
288
|
+
*/
|
|
289
|
+
colorbar?: boolean;
|
|
290
|
+
/** A title above the colour bar. */
|
|
291
|
+
colorbarLabel?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Reveal, 0..1: the frame draws in the first half, the layers in the second,
|
|
294
|
+
* and legend entries fade in over the last tenth.
|
|
295
|
+
* @default 1
|
|
296
|
+
*/
|
|
297
|
+
progress?: number;
|
|
298
|
+
/**
|
|
299
|
+
* How the layers reveal: `"layers"` each in its own way (lines sweep, bars
|
|
300
|
+
* grow); `"x"` one front sweeping left to right with every layer drawn whole
|
|
301
|
+
* behind it.
|
|
302
|
+
* @default "layers"
|
|
303
|
+
*/
|
|
304
|
+
reveal?: LayersReveal;
|
|
305
|
+
/**
|
|
306
|
+
* Paint the layers only inside the plotting area (axes and titles are never
|
|
307
|
+
* clipped). Turn on when a range is fixed short of the data, or animates.
|
|
308
|
+
* @default false
|
|
309
|
+
*/
|
|
310
|
+
clip?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Tooltips for every layer: `true` gives each layer its default tooltip,
|
|
313
|
+
* `false` turns all off, an object sets options. A layer's own `tooltip`
|
|
314
|
+
* wins. Omitted, only layers given a `tooltip` show one.
|
|
315
|
+
*/
|
|
316
|
+
tooltip?: boolean | ChartTooltipOptions;
|
|
317
|
+
/** Paint order of the frame; higher draws later. */
|
|
318
|
+
zIndex?: number;
|
|
319
|
+
/** Set to false to hide the frame; layers keep their own `visible`. */
|
|
320
|
+
visible?: boolean;
|
|
321
|
+
/** The layers, placed in the plot's coordinate context. */
|
|
322
|
+
children?: readonly SceneNode[];
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Options for a `chart`'s tooltips (`tooltip`).
|
|
326
|
+
*
|
|
327
|
+
* @see https://sophistry.dev/guides/charts/#tooltips
|
|
328
|
+
* @category Charts
|
|
329
|
+
*/
|
|
330
|
+
export interface ChartTooltipOptions {
|
|
331
|
+
/**
|
|
332
|
+
* `"item"`: hovering a mark shows its datum. `"x"`: one shared tooltip for
|
|
333
|
+
* every line and point at the x nearest the pointer, with a crosshair.
|
|
334
|
+
* @default "item"
|
|
335
|
+
*/
|
|
336
|
+
mode?: "item" | "x";
|
|
337
|
+
/**
|
|
338
|
+
* Where a hover tooltip stands: `"pointer"` above the pointer, or `"datum"`
|
|
339
|
+
* above the mark. Tap and keyboard tooltips always stand above the mark.
|
|
340
|
+
* @default "pointer"
|
|
341
|
+
*/
|
|
342
|
+
anchor?: TooltipAnchor;
|
|
343
|
+
/** Formatters keyed by channel (`x`, `y`, `series`, `size`, `value`, …), replacing the axis's or legend's format. A layer's own `format` wins. */
|
|
344
|
+
format?: TooltipFormat;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Options for a `chart`'s size key (`sizeLegend`).
|
|
348
|
+
*
|
|
349
|
+
* @category Charts
|
|
350
|
+
*/
|
|
351
|
+
export interface ChartSizeLegendOptions {
|
|
352
|
+
/**
|
|
353
|
+
* A title above the circles; `""` for none. With several keys, titles the first. Defaults to
|
|
354
|
+
* the layer's `size` channel name, when it is a key.
|
|
355
|
+
*/
|
|
356
|
+
title?: string;
|
|
357
|
+
/**
|
|
358
|
+
* The values to draw circles for, in every key. Defaults to up to three round values of each
|
|
359
|
+
* key's scale.
|
|
360
|
+
*/
|
|
361
|
+
values?: readonly number[];
|
|
362
|
+
/** How a value is written. Defaults to the axes' formatting. */
|
|
363
|
+
format?: (value: number) => string;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* How a `chart`'s layers share its non-positional scales (`scales`).
|
|
367
|
+
*
|
|
368
|
+
* @category Charts
|
|
369
|
+
*/
|
|
370
|
+
export interface ChartScales {
|
|
371
|
+
/**
|
|
372
|
+
* Sized layers (`Scatter`'s `size`): one scale for all, or each its own.
|
|
373
|
+
* A layer's own `sizeMaxValue` always wins.
|
|
374
|
+
* @default "shared"
|
|
375
|
+
*/
|
|
376
|
+
size?: "shared" | "independent";
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* What `chartHandle(node)` hands back.
|
|
380
|
+
*
|
|
381
|
+
* @category Charts
|
|
382
|
+
*/
|
|
383
|
+
export interface ChartHandle {
|
|
384
|
+
/** The plot's coordinate system. A band x axis centres category `i` at `i + 0.5`; a band y axis counts from the top. */
|
|
385
|
+
coords: CoordinateSystem;
|
|
386
|
+
/** The x axis's band scale, when x is categorical. */
|
|
387
|
+
xBand: BandScale | undefined;
|
|
388
|
+
/** The y axis's band scale, when y is categorical. */
|
|
389
|
+
yBand: BandScale | undefined;
|
|
390
|
+
/** A category's colour from the chart's colour scale, as a CSS string. */
|
|
391
|
+
color(key: BandKey): string;
|
|
392
|
+
/** The colour scale's categories in order, as the legend lists them. */
|
|
393
|
+
colorDomain(): readonly BandKey[];
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* What one layer contributes to the frame's colour scale and legend.
|
|
397
|
+
*
|
|
398
|
+
* @category Charts
|
|
399
|
+
*/
|
|
400
|
+
export interface ColorExtent {
|
|
401
|
+
/** The categories the layer colours by, in order. */
|
|
402
|
+
categories: readonly BandKey[];
|
|
403
|
+
/** How the layer's marks look in the legend. Defaults to a filled square. */
|
|
404
|
+
mark?: LegendMark;
|
|
405
|
+
/** During a keyed transition: the categories at each end, so the legend can fade entries in and out. Omitted, all at both ends. */
|
|
406
|
+
ends?: {
|
|
407
|
+
from: readonly BandKey[];
|
|
408
|
+
to: readonly BandKey[];
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* The order the legend lists these categories in, where it should differ from `categories`
|
|
412
|
+
* (which also orders the colours): a stack lists its top band first, so the legend reads
|
|
413
|
+
* down as the bands do. Omitted, `categories`' order.
|
|
414
|
+
*/
|
|
415
|
+
legendOrder?: readonly BandKey[];
|
|
416
|
+
/**
|
|
417
|
+
* During a keyed transition: `legendOrder` at each end, so the legend's entries slide from
|
|
418
|
+
* one order to the other. Omitted, `legendOrder` at both.
|
|
419
|
+
*/
|
|
420
|
+
legendOrders?: {
|
|
421
|
+
from: readonly BandKey[];
|
|
422
|
+
to: readonly BandKey[];
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* What a layer that sizes its marks by value contributes to the frame's
|
|
427
|
+
* size key: its square-root size scale, in scene units.
|
|
428
|
+
*
|
|
429
|
+
* @category Charts
|
|
430
|
+
*/
|
|
431
|
+
export interface SizeExtent extends SizeScale {
|
|
432
|
+
/** The radii of a value of 0 and of `maxValue`. */
|
|
433
|
+
range: readonly [number, number];
|
|
434
|
+
/** The channel's name: the key's default title. */
|
|
435
|
+
label?: string;
|
|
436
|
+
/** During a keyed transition: the far end's `maxValue`, when each end is scaled on its own. */
|
|
437
|
+
to?: number;
|
|
438
|
+
/** The layer pins its scale (`sizeMaxValue`), so a shared size scale does not replace it. */
|
|
439
|
+
pinned?: boolean;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* The shared size scale of a chart's sized layers (or a `<Facet>`'s panels):
|
|
443
|
+
* the greatest maximum any of them reports, at each end of a transition.
|
|
444
|
+
*
|
|
445
|
+
* @category Charts
|
|
446
|
+
*/
|
|
447
|
+
export interface SharedSizeDomain {
|
|
448
|
+
/** The shared maximum at `blend` 0 (or always, without a transition). */
|
|
449
|
+
from: number;
|
|
450
|
+
/** The shared maximum at `blend` 1. */
|
|
451
|
+
to: number;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* What a layer that colours by value contributes to the frame's colour bar.
|
|
455
|
+
*
|
|
456
|
+
* @category Charts
|
|
457
|
+
*/
|
|
458
|
+
export interface RampExtent {
|
|
459
|
+
/** The values the colormap spans, `[low, high]`. */
|
|
460
|
+
domain: readonly [number, number];
|
|
461
|
+
/** The colormap: 0..1 (low to high) to a CSS colour. */
|
|
462
|
+
colormap: Colormap;
|
|
463
|
+
/**
|
|
464
|
+
* The layer's colour norm over `domain` (log, diverging), so the bar's ticks
|
|
465
|
+
* match the layer. Defaults to linear.
|
|
466
|
+
*/
|
|
467
|
+
scale?: Scale;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* A layer's keyed data transition in progress, as reported to its
|
|
471
|
+
* `chart`: the far end's extents and whether marks enter or exit.
|
|
472
|
+
*
|
|
473
|
+
* @category Charts
|
|
474
|
+
*/
|
|
475
|
+
export interface LayerTransition {
|
|
476
|
+
/**
|
|
477
|
+
* The layer's blend, 0..1. The frame stages its domains on the first
|
|
478
|
+
* transitioning layer's blend, so drive a chart's layers from one track.
|
|
479
|
+
*/
|
|
480
|
+
t: number;
|
|
481
|
+
/** How the blend is spent. @default "staged" */
|
|
482
|
+
staging?: JoinStaging;
|
|
483
|
+
/** The `to` data's extent on x. Omitted, the layer's `x` extent. */
|
|
484
|
+
x?: AxisExtent;
|
|
485
|
+
/** The `to` data's extent on y. Omitted, the layer's `y` extent. */
|
|
486
|
+
y?: AxisExtent;
|
|
487
|
+
/** The `to` data's extent on the secondary y axis (inside a `secondaryY`). */
|
|
488
|
+
y2?: AxisExtent;
|
|
489
|
+
/** The `to` data's extent on the secondary x axis (inside a `secondaryX`). */
|
|
490
|
+
x2?: AxisExtent;
|
|
491
|
+
/** Some mark enters (its key is only in `to`). */
|
|
492
|
+
enters?: boolean;
|
|
493
|
+
/** Some mark exits (its key is only in `data`). */
|
|
494
|
+
exits?: boolean;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* What one layer contributes to fitting one axis.
|
|
498
|
+
*
|
|
499
|
+
* @category Charts
|
|
500
|
+
*/
|
|
501
|
+
export interface AxisExtent {
|
|
502
|
+
/** Values the axis must show; only the extremes matter and non-finite ones are ignored. */
|
|
503
|
+
values?: readonly number[];
|
|
504
|
+
/** Categories the axis must show, in order. Any makes an unspecified axis a band axis. */
|
|
505
|
+
categories?: readonly BandKey[];
|
|
506
|
+
/** The layer's marks measure from zero (bars, areas), so zero must be in view. */
|
|
507
|
+
zero?: boolean;
|
|
508
|
+
/** Band axes: the gap between bands this layer suits (cells want none). The axis's own `padding` wins, then the first layer's. */
|
|
509
|
+
padding?: number;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* A layer's report to its `chart`: an {@link AxisExtent} per axis.
|
|
513
|
+
*
|
|
514
|
+
* @category Charts
|
|
515
|
+
*/
|
|
516
|
+
export interface ChartLayerExtent {
|
|
517
|
+
x?: AxisExtent;
|
|
518
|
+
y?: AxisExtent;
|
|
519
|
+
/** The secondary y axis's extent; a `secondaryY` moves the layer's `y` here. */
|
|
520
|
+
y2?: AxisExtent;
|
|
521
|
+
/** The secondary x axis's extent; a `secondaryX` moves the layer's `x` here. */
|
|
522
|
+
x2?: AxisExtent;
|
|
523
|
+
/**
|
|
524
|
+
* Room the layer draws in outside the plotting area, per side (e.g. a
|
|
525
|
+
* clustered heatmap's dendrograms). The frame keeps other guides clear of it
|
|
526
|
+
* and gives its position through ``frame.marginBox(side)``.
|
|
527
|
+
*/
|
|
528
|
+
margin?: ChartMargin;
|
|
529
|
+
/** The categories the layer colours through the frame's colour scale (its `series`). */
|
|
530
|
+
color?: ColorExtent;
|
|
531
|
+
/** The colormap and value range the layer colours by, for the colour bar. */
|
|
532
|
+
ramp?: RampExtent;
|
|
533
|
+
/** The layer's size scale, for the size key. */
|
|
534
|
+
size?: SizeExtent;
|
|
535
|
+
/** The layer fills the plotting area under the axes (an image, a mesh), so axis numbers get a halo (`numberHalo`). */
|
|
536
|
+
covers?: boolean;
|
|
537
|
+
/** A keyed data transition: `x`/`y` above are the `blend` 0 end, this carries the far end. Fitted axes blend between the two. */
|
|
538
|
+
transition?: LayerTransition;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* One end of a keyed transition whose fitted axis changes kind (band ↔
|
|
542
|
+
* continuous): the plot with that axis as it is at this end.
|
|
543
|
+
*
|
|
544
|
+
* @category Extending
|
|
545
|
+
*/
|
|
546
|
+
export interface ChartEnd {
|
|
547
|
+
/** The plot's coordinates at this end: what this end's data maps through. */
|
|
548
|
+
coords: CoordinateSystem;
|
|
549
|
+
/** The x axis's band scale at this end, when x is categorical there. */
|
|
550
|
+
xBand: BandScale | undefined;
|
|
551
|
+
/** The y axis's band scale at this end, when y is categorical there. */
|
|
552
|
+
yBand: BandScale | undefined;
|
|
553
|
+
/** Where the axes stand at this end, as {@link ChartFrame.axesAt}. */
|
|
554
|
+
axesAt: {
|
|
555
|
+
x: number;
|
|
556
|
+
y: number;
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* The plot at both ends of a transition whose fitted axis changes kind
|
|
561
|
+
* (band ↔ continuous). A mark draws each end's datum through that end's plot
|
|
562
|
+
* and blends the two in scene units during the update stage.
|
|
563
|
+
*
|
|
564
|
+
* @category Extending
|
|
565
|
+
*/
|
|
566
|
+
export interface ChartEnds {
|
|
567
|
+
/** The x axis changes kind (its ends are `from` and `to`). */
|
|
568
|
+
x: boolean;
|
|
569
|
+
/** The y axis changes kind. */
|
|
570
|
+
y: boolean;
|
|
571
|
+
/** The plot at the `blend` 0 end. */
|
|
572
|
+
from: ChartEnd;
|
|
573
|
+
/** The plot at the `blend` 1 end. */
|
|
574
|
+
to: ChartEnd;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* What a layer reads from its chart: one immutable snapshot of the frame,
|
|
578
|
+
* provided through `chartContext` and replaced (a new object) whenever any
|
|
579
|
+
* field changes, so reading it with `ctx.context(chartContext)` reruns
|
|
580
|
+
* exactly the layers' `update`. Never keep one across updates.
|
|
581
|
+
*
|
|
582
|
+
* @category Extending
|
|
583
|
+
*/
|
|
584
|
+
export interface ChartFrame {
|
|
585
|
+
coords: CoordinateSystem;
|
|
586
|
+
xBand: BandScale | undefined;
|
|
587
|
+
yBand: BandScale | undefined;
|
|
588
|
+
/** The layers' reveal, 0..1: 0 until the frame has drawn (straight to 1 under `reveal="x"`). */
|
|
589
|
+
dataProgress: number;
|
|
590
|
+
/** The frame's own reveal, 0..1, for marks that belong with the axes, like category names. */
|
|
591
|
+
frameProgress: number;
|
|
592
|
+
/**
|
|
593
|
+
* Where the axes are drawn, in data units: `x` is where the y axis stands,
|
|
594
|
+
* `y` where the x axis runs. Differs from `coords.crossing()` (the baseline
|
|
595
|
+
* marks measure from) when an axis's `position` moved it.
|
|
596
|
+
*/
|
|
597
|
+
axesAt: {
|
|
598
|
+
x: number;
|
|
599
|
+
y: number;
|
|
600
|
+
};
|
|
601
|
+
/** The categorical colour scale over every layer's series. */
|
|
602
|
+
colorScale: OrdinalColorScale;
|
|
603
|
+
/**
|
|
604
|
+
* The shared maximum a sized layer scales to unless it pins its own
|
|
605
|
+
* (`sizeMaxValue`). Undefined under `scales={{ size: "independent" }}` or
|
|
606
|
+
* with no sized layer. Read it for drawing, never in the layer's report.
|
|
607
|
+
*/
|
|
608
|
+
sizeDomain: SharedSizeDomain | undefined;
|
|
609
|
+
/** The stages of the running keyed transition (see {@link LayerTransition}), or undefined. */
|
|
610
|
+
join: JoinStages | undefined;
|
|
611
|
+
/** The plot at each end while a transition changes a fitted axis's kind (see {@link ChartEnds}); undefined otherwise. */
|
|
612
|
+
ends: ChartEnds | undefined;
|
|
613
|
+
/** The chart's tooltip state, for marks with a `tooltip` prop (also provided as `tooltipContext`). */
|
|
614
|
+
tooltip: TooltipState;
|
|
615
|
+
/**
|
|
616
|
+
* How the chart writes a channel's value, for tooltips: `"x"`/`"y"` as their
|
|
617
|
+
* axis does, `"series"` as the legend does, `"size"` as the size key does.
|
|
618
|
+
* Inside a `secondaryY` or `secondaryX`, the secondary axis's.
|
|
619
|
+
*/
|
|
620
|
+
format(channel: ChartFormatChannel): (value: number | BandKey) => string;
|
|
621
|
+
/** The scene-unit band a side's reserved margin occupies (see {@link ChartLayerExtent.margin}); empty when none is reserved. */
|
|
622
|
+
marginBox(side: ChartSide): Bounds;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Where a chart's layers send their reports: provided once by the chart
|
|
626
|
+
* through `chartLayersContext` (stable for the chart's life; `secondaryX` /
|
|
627
|
+
* `secondaryY` provide a wrapper that moves reports onto their axes).
|
|
628
|
+
*
|
|
629
|
+
* @category Extending
|
|
630
|
+
*/
|
|
631
|
+
export interface ChartLayers {
|
|
632
|
+
/**
|
|
633
|
+
* Sets `owner`'s report (`null` withdraws it, on dispose). The chart
|
|
634
|
+
* refits only when the report changed by value; only the extremes of
|
|
635
|
+
* each `values` array count. The same report object as last time is
|
|
636
|
+
* skipped without being read, so don't change a report (or its `values`)
|
|
637
|
+
* in place: make a new one.
|
|
638
|
+
*/
|
|
639
|
+
report(owner: object, extent: ChartLayerExtent | null): void;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* The channels {@link ChartFrame.format} writes values of.
|
|
643
|
+
*
|
|
644
|
+
* @category Extending
|
|
645
|
+
*/
|
|
646
|
+
export type ChartFormatChannel = "x" | "y" | "series" | "size";
|
|
647
|
+
/**
|
|
648
|
+
* A side of the plotting area.
|
|
649
|
+
*
|
|
650
|
+
* @category Charts
|
|
651
|
+
*/
|
|
652
|
+
export type ChartSide = "top" | "right" | "bottom" | "left";
|
|
653
|
+
/**
|
|
654
|
+
* Room reserved beside the plotting area, per side, in scene units.
|
|
655
|
+
*
|
|
656
|
+
* @category Charts
|
|
657
|
+
*/
|
|
658
|
+
export type ChartMargin = Partial<Record<ChartSide, number>>;
|