@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,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A scatter-plot matrix: every pair of variables against each other, with
|
|
3
|
+
* each variable's distribution on the diagonal. One `chart` per panel in
|
|
4
|
+
* one group: columns share x, rows share y.
|
|
5
|
+
*/
|
|
6
|
+
import type { SceneNode } from "@sophistry/core";
|
|
7
|
+
import type { BandKey, Point } from "@sophistry/core/geometry";
|
|
8
|
+
import type { Channel } from "../data/channels.js";
|
|
9
|
+
import type { ChartAxisOptions, ChartColorOptions } from "../frame/types.js";
|
|
10
|
+
import type { FacetSpace } from "./facet.js";
|
|
11
|
+
/**
|
|
12
|
+
* An off-diagonal panel of a {@link pairPlot}, as `offDiagonal` receives it.
|
|
13
|
+
*
|
|
14
|
+
* @category Charts
|
|
15
|
+
*/
|
|
16
|
+
export interface PairPanel<T> {
|
|
17
|
+
/** Every row. */
|
|
18
|
+
data: readonly T[];
|
|
19
|
+
/** The variable on this panel's x axis (its column's). */
|
|
20
|
+
x: string;
|
|
21
|
+
/** The variable on its y axis (its row's). */
|
|
22
|
+
y: string;
|
|
23
|
+
/** Grid row, from the top. */
|
|
24
|
+
row: number;
|
|
25
|
+
/** Grid column, from the left. */
|
|
26
|
+
column: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Props for {@link pairPlot}.
|
|
30
|
+
*
|
|
31
|
+
* @category Charts
|
|
32
|
+
*/
|
|
33
|
+
export interface PairPlotProps<T> {
|
|
34
|
+
/** The rows. */
|
|
35
|
+
data: readonly T[];
|
|
36
|
+
/** The numeric fields to pair, in order: the matrix's rows (top to bottom) and columns (left to right). */
|
|
37
|
+
variables: readonly string[];
|
|
38
|
+
/** A variable's title under its column and beside its row. Defaults to its name. */
|
|
39
|
+
variableLabels?: Partial<Record<string, string>>;
|
|
40
|
+
/** Splits the points and the diagonal's densities by category, one colour each, keyed by one legend. */
|
|
41
|
+
series?: Channel<T, BandKey>;
|
|
42
|
+
/** The points' identity channel, as `scatter`'s `key`. */
|
|
43
|
+
key?: Channel<T, BandKey>;
|
|
44
|
+
/** Width of the matrix of plots (a legend fits inside; see `autosize`). */
|
|
45
|
+
width: number;
|
|
46
|
+
/** Height of the matrix of plots. */
|
|
47
|
+
height: number;
|
|
48
|
+
/** Centre of the matrix. Defaults to the origin. */
|
|
49
|
+
center?: Point;
|
|
50
|
+
/**
|
|
51
|
+
* Space between neighbouring panels.
|
|
52
|
+
* @default 0.35
|
|
53
|
+
*/
|
|
54
|
+
gap?: number;
|
|
55
|
+
/** Relative column widths, left to right (one per variable), as `facet`'s `widths`. */
|
|
56
|
+
widths?: readonly number[];
|
|
57
|
+
/** Relative row heights, top to bottom, as `facet`'s `heights`. */
|
|
58
|
+
heights?: readonly number[];
|
|
59
|
+
/**
|
|
60
|
+
* `"free"` sizes each column and row by its variable's range (or per axis), so one unit is one
|
|
61
|
+
* length across the matrix. As `facet`'s `space`; `widths`/`heights` win.
|
|
62
|
+
* @default "fixed"
|
|
63
|
+
*/
|
|
64
|
+
space?: FacetSpace;
|
|
65
|
+
/**
|
|
66
|
+
* What the diagonal draws: `"density"` (one curve per series), `"histogram"` (bins of the whole
|
|
67
|
+
* sample), or `false` for nothing.
|
|
68
|
+
* @default "density"
|
|
69
|
+
*/
|
|
70
|
+
diag?: "density" | "histogram" | false;
|
|
71
|
+
/** Histogram diagonal: how many bins. */
|
|
72
|
+
binCount?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Draw only the lower triangle and the diagonal. Read once, at creation.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
corner?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Marker radius.
|
|
80
|
+
* @default 0.05
|
|
81
|
+
*/
|
|
82
|
+
radius?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Draws an off-diagonal panel's layers instead of the default scatter: a function returning
|
|
85
|
+
* layer nodes, called when the panel is made and when `data` changes. A plain value prop; the
|
|
86
|
+
* bindings pass it through untouched.
|
|
87
|
+
*/
|
|
88
|
+
offDiagonal?: (panel: PairPanel<T>) => readonly SceneNode[];
|
|
89
|
+
/** Every panel's axes (tick options, `nice`, `zero`, ...). */
|
|
90
|
+
axis?: ChartAxisOptions;
|
|
91
|
+
grid?: boolean | "x" | "y";
|
|
92
|
+
/**
|
|
93
|
+
* As `chart`'s `autosize`, over the whole matrix.
|
|
94
|
+
* @default "fit"
|
|
95
|
+
*/
|
|
96
|
+
autosize?: "fit" | "pad" | "contain";
|
|
97
|
+
color?: ChartColorOptions;
|
|
98
|
+
/**
|
|
99
|
+
* One legend: on the right (`true`, `"right"`) or in a row over the matrix (`"top"`).
|
|
100
|
+
* On the right by default when `series` is given.
|
|
101
|
+
*/
|
|
102
|
+
legend?: boolean | "right" | "top";
|
|
103
|
+
legendTitle?: string;
|
|
104
|
+
legendFontSize?: number;
|
|
105
|
+
title?: string;
|
|
106
|
+
titleFontSize?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Font size of the variables' titles.
|
|
109
|
+
* @default 0.3
|
|
110
|
+
*/
|
|
111
|
+
labelFontSize?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Reveal, 0..1: every panel's frame, then the data (see `stagger`), then the legend.
|
|
114
|
+
* @see https://sophistry.dev/guides/chart-animation/#reveals
|
|
115
|
+
*/
|
|
116
|
+
progress?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Fraction of the data reveal spent staggering panels in reading order, 0..0.95.
|
|
119
|
+
* @default 0
|
|
120
|
+
*/
|
|
121
|
+
stagger?: number;
|
|
122
|
+
zIndex?: number;
|
|
123
|
+
visible?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A pair plot (scatter-plot matrix): panel (row `i`, column `j`) plots `variables[j]` against
|
|
127
|
+
* `variables[i]`, and the diagonal shows each variable's distribution. Columns share x scales
|
|
128
|
+
* and rows share y scales, so a point lines up across the matrix; a `series` is one colour
|
|
129
|
+
* everywhere with one legend.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* import { pairPlot } from "@sophistry/charts";
|
|
134
|
+
*
|
|
135
|
+
* const flowers = [
|
|
136
|
+
* { kind: "iris", petal: 1.4, sepal: 5.1, width: 3.5 },
|
|
137
|
+
* { kind: "iris", petal: 1.3, sepal: 4.9, width: 3 },
|
|
138
|
+
* { kind: "lily", petal: 4.7, sepal: 7, width: 3.2 },
|
|
139
|
+
* { kind: "lily", petal: 4.5, sepal: 6.4, width: 3.2 },
|
|
140
|
+
* ];
|
|
141
|
+
* pairPlot.create({
|
|
142
|
+
* data: flowers,
|
|
143
|
+
* variables: ["petal", "sepal", "width"],
|
|
144
|
+
* series: "kind",
|
|
145
|
+
* width: 6,
|
|
146
|
+
* height: 6,
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @see https://sophistry.dev/guides/charts/#multiple-views
|
|
151
|
+
* @category Charts
|
|
152
|
+
*/
|
|
153
|
+
export declare const pairPlot: import("@sophistry/core").Definition<PairPlotProps<any>, import("@sophistry/core/internal").CompositeNode<PairPlotProps<any>>, keyof PairPlotProps<any>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the grid presets (`pairPlot`, `jointPlot`) share: a panel is a
|
|
3
|
+
* `chart` inside a plain `group` that provides its group scope. Internal.
|
|
4
|
+
*/
|
|
5
|
+
import type { CompositeContext, ContainerNode, SceneNode } from "@sophistry/core";
|
|
6
|
+
import type { SideRoom } from "../math/facet.js";
|
|
7
|
+
import type { ChartGroup, ChartGroupScope } from "./chart-group.js";
|
|
8
|
+
/** A panel's nodes: the wrapper providing its scope, and its chart. */
|
|
9
|
+
export interface PanelNodes {
|
|
10
|
+
wrapper: ContainerNode;
|
|
11
|
+
plot: SceneNode;
|
|
12
|
+
}
|
|
13
|
+
/** Makes a panel: a chart with `children`, inside a group providing `scope`. */
|
|
14
|
+
export declare function makePanel(scope: ChartGroupScope, children: readonly SceneNode[]): PanelNodes;
|
|
15
|
+
/**
|
|
16
|
+
* The room kept free around a preset's grid of plots, inside its
|
|
17
|
+
* footprint, by `autosize`: none (`"pad"`), the right-hand guides
|
|
18
|
+
* (`"fit"`), or every side (`"contain"`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function outerRoom(autosize: "fit" | "pad" | "contain" | undefined, panels: SideRoom, own: SideRoom, contained?: SideRoom): SideRoom;
|
|
21
|
+
/** Watches a preset's group: reruns its update when a panel published something new. */
|
|
22
|
+
export declare function watchGroup<P>(ctx: CompositeContext<P>, group: ChartGroup, reason: Parameters<CompositeContext<P>["invalidate"]>[0]): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel coordinates: numeric variables side by side as vertical axes,
|
|
3
|
+
* each datum a polyline through its value on every axis.
|
|
4
|
+
*
|
|
5
|
+
* The lines are one path batch (one item per drawn datum, its own stroke;
|
|
6
|
+
* hover and taps resolve per item). A line's partial reveal is its item's
|
|
7
|
+
* `progress`, traced by arc length. The axes are
|
|
8
|
+
* core `numberLine`s and labels.
|
|
9
|
+
*/
|
|
10
|
+
import type { ColorInput } from "@sophistry/core/color";
|
|
11
|
+
import type { Point, Range } from "@sophistry/core/geometry";
|
|
12
|
+
import type { Channel, ColorChannel } from "../data/channels.js";
|
|
13
|
+
import type { TooltipSpec } from "../tooltip.js";
|
|
14
|
+
/**
|
|
15
|
+
* One axis of a {@link parallelCoordinates} chart.
|
|
16
|
+
*
|
|
17
|
+
* @category Charts
|
|
18
|
+
*/
|
|
19
|
+
export interface ParallelAxis<T> {
|
|
20
|
+
/** The value each datum takes on this axis; non-finite values break the datum's line. */
|
|
21
|
+
value: Channel<T, number>;
|
|
22
|
+
/** Written above the axis. */
|
|
23
|
+
label?: string;
|
|
24
|
+
/** `[min, max, step?]` in data units. Omitted, fitted to the data. */
|
|
25
|
+
range?: Range;
|
|
26
|
+
}
|
|
27
|
+
/** @category Charts */
|
|
28
|
+
export interface ParallelCoordinatesProps<T> {
|
|
29
|
+
/** One polyline per datum. */
|
|
30
|
+
data: readonly T[];
|
|
31
|
+
/** One vertical axis per entry, evenly spaced left to right. */
|
|
32
|
+
axes: readonly ParallelAxis<T>[];
|
|
33
|
+
/** Distance from the first axis to the last. */
|
|
34
|
+
width: number;
|
|
35
|
+
/** Height of each axis. */
|
|
36
|
+
height: number;
|
|
37
|
+
/** Centre of the chart. Defaults to the origin. */
|
|
38
|
+
center?: Point;
|
|
39
|
+
/** One colour for every line, or `(d, i) => colour`. Wins over `colors`. */
|
|
40
|
+
color?: ColorChannel<T>;
|
|
41
|
+
/** Colours cycled across the lines by index. Defaults to the theme's categorical colours. */
|
|
42
|
+
colors?: readonly ColorInput[];
|
|
43
|
+
/**
|
|
44
|
+
* Line width.
|
|
45
|
+
* @default 0.025
|
|
46
|
+
*/
|
|
47
|
+
strokeWidth?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Line opacity, 0..1, so dense bundles read darker.
|
|
50
|
+
* @default 0.6
|
|
51
|
+
*/
|
|
52
|
+
opacity?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Font size of the axis labels.
|
|
55
|
+
* @default 0.24
|
|
56
|
+
*/
|
|
57
|
+
axisLabelFontSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Font size of the tick numbers.
|
|
60
|
+
* @default 0.18
|
|
61
|
+
*/
|
|
62
|
+
tickFontSize?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Reveal, 0..1: the axes draw first, then every line draws left to right across them.
|
|
65
|
+
* @default 1
|
|
66
|
+
* @see https://sophistry.dev/guides/chart-animation/#reveals
|
|
67
|
+
*/
|
|
68
|
+
progress?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Fraction of the line reveal spent staggering one datum after the next, 0..0.95.
|
|
71
|
+
* @default 0
|
|
72
|
+
*/
|
|
73
|
+
stagger?: number;
|
|
74
|
+
/** Hover tooltip: `true` lists the datum's value on each axis, or `(d, i) => string`. */
|
|
75
|
+
tooltip?: TooltipSpec<T>;
|
|
76
|
+
zIndex?: number;
|
|
77
|
+
visible?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Parallel coordinates: numeric variables side by side as vertical axes, each datum a
|
|
81
|
+
* polyline through its value on every axis, for spotting clusters and trade-offs across many
|
|
82
|
+
* dimensions. Sized by `width` and `height`; needs no `chart`. See {@link parallelLines}
|
|
83
|
+
* for the geometry alone. The lines are one path batch.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { parallelCoordinates } from "@sophistry/charts";
|
|
88
|
+
*
|
|
89
|
+
* const cars = [
|
|
90
|
+
* { mpg: 30, hp: 95, weight: 1100 },
|
|
91
|
+
* { mpg: 22, hp: 150, weight: 1500 },
|
|
92
|
+
* { mpg: 15, hp: 240, weight: 1900 },
|
|
93
|
+
* ];
|
|
94
|
+
* parallelCoordinates.create({
|
|
95
|
+
* data: cars,
|
|
96
|
+
* axes: [
|
|
97
|
+
* { value: "mpg", label: "mpg" },
|
|
98
|
+
* { value: "hp", label: "hp" },
|
|
99
|
+
* { value: "weight", label: "weight" },
|
|
100
|
+
* ],
|
|
101
|
+
* width: 8,
|
|
102
|
+
* height: 4,
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see https://sophistry.dev/reference/chart-catalogue/#lines-scatter-and-error-bars
|
|
107
|
+
* @category Charts
|
|
108
|
+
*/
|
|
109
|
+
export declare const parallelCoordinates: import("@sophistry/core").Definition<ParallelCoordinatesProps<any>, import("@sophistry/core/internal").CompositeNode<ParallelCoordinatesProps<any>>, keyof ParallelCoordinatesProps<any>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `eventPlot`: an event raster, one row of vertical ticks per sequence. One
|
|
3
|
+
* `line` instances node for every tick of every row (see
|
|
4
|
+
* `segment-marks.ts`), keyed `"row:tick"`.
|
|
5
|
+
*/
|
|
6
|
+
import type { ColorInput } from "@sophistry/core/color";
|
|
7
|
+
import type { Channel, ColorChannel } from "../data/channels.js";
|
|
8
|
+
/**
|
|
9
|
+
* Props of {@link eventPlot}.
|
|
10
|
+
*
|
|
11
|
+
* @category Charts
|
|
12
|
+
*/
|
|
13
|
+
export interface EventPlotProps<T = unknown> {
|
|
14
|
+
/** One row per datum (a spike train, a subject, ...). */
|
|
15
|
+
data: readonly T[];
|
|
16
|
+
/**
|
|
17
|
+
* The row's event positions along x, in data units. Defaults to the datum when `data` is
|
|
18
|
+
* `number[][]`. Empty rows are fine; non-finite entries are skipped.
|
|
19
|
+
*/
|
|
20
|
+
events?: Channel<T, readonly number[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Vertical spacing between rows, in data units: row `i` is centred on `y = i * lineOffset`.
|
|
23
|
+
* @default 1
|
|
24
|
+
*/
|
|
25
|
+
lineOffset?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Length of each tick in data units, centred on its row.
|
|
28
|
+
* @default 0.8
|
|
29
|
+
*/
|
|
30
|
+
lineLength?: number;
|
|
31
|
+
/** One colour for every row, or `(d, i) => colour`. Wins over `colors`. */
|
|
32
|
+
color?: ColorChannel<T>;
|
|
33
|
+
/** Colours cycled across rows by index. Defaults to the theme's categorical colours. */
|
|
34
|
+
colors?: readonly ColorInput[];
|
|
35
|
+
/** Line width. */
|
|
36
|
+
strokeWidth?: number;
|
|
37
|
+
opacity?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Reveal, 0..1: each tick draws from its low end.
|
|
40
|
+
* @default 1
|
|
41
|
+
*/
|
|
42
|
+
progress?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Fraction of the reveal spent staggering the ticks left to right across every row, 0..0.95, so
|
|
45
|
+
* the raster fills in as the events happened.
|
|
46
|
+
* @default 0
|
|
47
|
+
*/
|
|
48
|
+
stagger?: number;
|
|
49
|
+
zIndex?: number;
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* An event raster: one row of vertical ticks per sequence (spike trains, say), each tick at an
|
|
54
|
+
* event's x. Row 0 is at `y = 0`, so give the axes a y range like `[-1, data.length]`. One
|
|
55
|
+
* instances node.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { chart, eventPlot } from "@sophistry/charts";
|
|
60
|
+
*
|
|
61
|
+
* chart.create({ width: 8, height: 4, yRange: [-1, 3], children: [eventPlot.create({ data: [[1, 2.5], [0.5, 3], [2]] })] });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @see https://sophistry.dev/reference/chart-catalogue/#distributions
|
|
65
|
+
* @category Charts
|
|
66
|
+
*/
|
|
67
|
+
export declare const eventPlot: import("@sophistry/core").Definition<EventPlotProps<any>, import("@sophistry/core/internal").CompositeNode<EventPlotProps<any>>, keyof EventPlotProps<any>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Family barrel: per-datum point marks. Re-exported from the package entry. */
|
|
2
|
+
export type { EventPlotProps } from "./event-plot.js";
|
|
3
|
+
export { eventPlot } from "./event-plot.js";
|
|
4
|
+
export type { LabelsProps } from "./labels.js";
|
|
5
|
+
export { labels } from "./labels.js";
|
|
6
|
+
export type { LinksProps, SegmentStyleProps, VectorsProps } from "./links.js";
|
|
7
|
+
export { links, vectors } from "./links.js";
|
|
8
|
+
export type { RectsProps } from "./rects.js";
|
|
9
|
+
export { rects } from "./rects.js";
|
|
10
|
+
export type { RugProps } from "./rug.js";
|
|
11
|
+
export { rug } from "./rug.js";
|
|
12
|
+
export type { ScatterProps, ScatterTrailOptions } from "./scatter.js";
|
|
13
|
+
export { scatter } from "./scatter.js";
|
|
14
|
+
export type { StemProps } from "./stem.js";
|
|
15
|
+
export { stem } from "./stem.js";
|
|
16
|
+
export type { BeeswarmProps, DotDistributionProps, StripProps, } from "./strip.js";
|
|
17
|
+
export { beeswarm, strip } from "./strip.js";
|
|
18
|
+
export type { TickBaseProps, TickXProps, TickYProps } from "./ticks.js";
|
|
19
|
+
export { tickX, tickY } from "./ticks.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `labels`: text at data positions.
|
|
3
|
+
*
|
|
4
|
+
* One `label` node per datum, kept by key: the core has no batched text
|
|
5
|
+
* (a text spec is one string with its own measured box), and a label beside
|
|
6
|
+
* its point (`direction`) is placed by that box. Labels annotate a few
|
|
7
|
+
* points, not thousands, so this is the one point mark that stays per datum.
|
|
8
|
+
*/
|
|
9
|
+
import type { Vec2 } from "@sophistry/core";
|
|
10
|
+
import type { BandKey } from "@sophistry/core/geometry";
|
|
11
|
+
import type { Channel, ColorChannel, PositionValue } from "../data/channels.js";
|
|
12
|
+
import type { KeyedTransitionProps, RevealProps } from "../props.js";
|
|
13
|
+
/**
|
|
14
|
+
* Props of {@link labels}.
|
|
15
|
+
*
|
|
16
|
+
* @category Charts
|
|
17
|
+
*/
|
|
18
|
+
export interface LabelsProps<T = unknown> extends KeyedTransitionProps<T>, RevealProps {
|
|
19
|
+
/** One label per datum. */
|
|
20
|
+
data: readonly T[];
|
|
21
|
+
/** X position: a number in data units (a `Date` reads as epoch ms) or a category on a band axis. Defaults to the index when `data` is `number[]`. */
|
|
22
|
+
x?: Channel<T, BandKey | PositionValue>;
|
|
23
|
+
/** Y position: a number in data units or a category on a band axis. Defaults to the datum when `data` is `number[]`. */
|
|
24
|
+
y?: Channel<T, BandKey | PositionValue>;
|
|
25
|
+
/** The text. Defaults to the datum, as a number, when `data` is `number[]`. */
|
|
26
|
+
text?: Channel<T, string>;
|
|
27
|
+
/** Which side of the point the text sits on (`UP`, `RIGHT`, `UR`, ...), `gap` away. Omitted, the text is centred on the point. */
|
|
28
|
+
direction?: Vec2;
|
|
29
|
+
/**
|
|
30
|
+
* Gap between the point and the text when `direction` is set.
|
|
31
|
+
* @default 0.18
|
|
32
|
+
*/
|
|
33
|
+
gap?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Font size.
|
|
36
|
+
* @default 0.26
|
|
37
|
+
*/
|
|
38
|
+
fontSize?: number;
|
|
39
|
+
/** Text colour, constant or `(d, i) => colour`. Defaults to the theme foreground. */
|
|
40
|
+
color?: ColorChannel<T>;
|
|
41
|
+
opacity?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Reveal, 0..1: each label fades in, over the end of the data phase.
|
|
44
|
+
* @default 1
|
|
45
|
+
*/
|
|
46
|
+
progress?: number;
|
|
47
|
+
zIndex?: number;
|
|
48
|
+
visible?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Text at data positions: names on a scatter, values over a line, annotations at a peak. Each
|
|
52
|
+
* label is placed by its measured box, so `direction: UP` clears the point by the same gap
|
|
53
|
+
* for any text. One `label` node per datum (see the file header).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { UP } from "@sophistry/core";
|
|
58
|
+
* import { chart, labels } from "@sophistry/charts";
|
|
59
|
+
*
|
|
60
|
+
* const cities = [
|
|
61
|
+
* { name: "Lima", gdp: 15, life: 76 },
|
|
62
|
+
* { name: "Oslo", gdp: 80, life: 83 },
|
|
63
|
+
* ];
|
|
64
|
+
* chart.create({ width: 8, height: 4, children: [labels.create({ data: cities, x: "gdp", y: "life", text: "name", direction: UP })] });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @see https://sophistry.dev/guides/charts/#marks
|
|
68
|
+
* @category Charts
|
|
69
|
+
*/
|
|
70
|
+
export declare const labels: import("@sophistry/core").Definition<LabelsProps<any>, import("@sophistry/core/internal").CompositeNode<LabelsProps<any>>, keyof LabelsProps<any>>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `links` and `vectors`: straight segments between data points, optionally
|
|
3
|
+
* arrowed. One instances node per layer: `line` items, or `arrow` items
|
|
4
|
+
* (with a tip) for `arrow: true` and for every vector. Items are keyed by
|
|
5
|
+
* datum index. The reveal is each item's
|
|
6
|
+
* `progress` channel, tracing its outline.
|
|
7
|
+
*/
|
|
8
|
+
import type { BandKey } from "@sophistry/core/geometry";
|
|
9
|
+
import type { Channel, ColorChannel, PositionValue } from "../data/channels.js";
|
|
10
|
+
import type { TooltipSpec } from "../tooltip.js";
|
|
11
|
+
/**
|
|
12
|
+
* Everything {@link links} and {@link vectors} share.
|
|
13
|
+
*
|
|
14
|
+
* @category Charts
|
|
15
|
+
*/
|
|
16
|
+
export interface SegmentStyleProps<T> {
|
|
17
|
+
/** Line colour, constant or `(d, i) => colour`. Defaults to the theme's first series colour. */
|
|
18
|
+
color?: ColorChannel<T>;
|
|
19
|
+
/** Line width. */
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
opacity?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Arrow-tip length, when there is a tip.
|
|
24
|
+
* @default 0.18
|
|
25
|
+
*/
|
|
26
|
+
tipLength?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Reveal, 0..1: each segment draws from its start to its end.
|
|
29
|
+
* @default 1
|
|
30
|
+
*/
|
|
31
|
+
progress?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Fraction of the reveal spent staggering one segment after the next, 0..0.95.
|
|
34
|
+
* @default 0
|
|
35
|
+
*/
|
|
36
|
+
stagger?: number;
|
|
37
|
+
/** Hover tooltip: `true` for the segment's coordinates, or `(d, i) => string`. */
|
|
38
|
+
tooltip?: TooltipSpec<T>;
|
|
39
|
+
zIndex?: number;
|
|
40
|
+
visible?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props of {@link links}.
|
|
44
|
+
*
|
|
45
|
+
* @category Charts
|
|
46
|
+
*/
|
|
47
|
+
export interface LinksProps<T = unknown> extends SegmentStyleProps<T> {
|
|
48
|
+
/** One segment per datum. */
|
|
49
|
+
data: readonly T[];
|
|
50
|
+
/** Start x: a number in data units (a `Date` reads as epoch ms) or a category on a band axis. */
|
|
51
|
+
x1: Channel<T, BandKey | PositionValue>;
|
|
52
|
+
/** Start y: a number in data units or a category on a band axis. */
|
|
53
|
+
y1: Channel<T, BandKey | PositionValue>;
|
|
54
|
+
/** End x, as `x1`. */
|
|
55
|
+
x2: Channel<T, BandKey | PositionValue>;
|
|
56
|
+
/** End y, as `y1`. */
|
|
57
|
+
y2: Channel<T, BandKey | PositionValue>;
|
|
58
|
+
/**
|
|
59
|
+
* Draw an arrow tip at the end.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
arrow?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Props of {@link vectors}.
|
|
66
|
+
*
|
|
67
|
+
* @category Charts
|
|
68
|
+
*/
|
|
69
|
+
export interface VectorsProps<T = unknown> extends SegmentStyleProps<T> {
|
|
70
|
+
/** One arrow per datum. */
|
|
71
|
+
data: readonly T[];
|
|
72
|
+
/** Tail x, in data units (a `Date` reads as epoch ms). */
|
|
73
|
+
x: Channel<T, PositionValue>;
|
|
74
|
+
/** Tail y, in data units. */
|
|
75
|
+
y: Channel<T, PositionValue>;
|
|
76
|
+
/** X component, in data units (scaled by `scale`). */
|
|
77
|
+
u: Channel<T, number>;
|
|
78
|
+
/** Y component, in data units (scaled by `scale`). */
|
|
79
|
+
v: Channel<T, number>;
|
|
80
|
+
/**
|
|
81
|
+
* Multiplies every vector before drawing, to fit long ones in.
|
|
82
|
+
* @default 1
|
|
83
|
+
*/
|
|
84
|
+
scale?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Straight segments from `(x1, y1)` to `(x2, y2)`, optionally arrowed: before/after pairs,
|
|
88
|
+
* dumbbells, migrations. Each draws in the direction of change. One instances node.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* import { chart, links } from "@sophistry/charts";
|
|
93
|
+
*
|
|
94
|
+
* const moves = [
|
|
95
|
+
* { from: 0, a: 1, to: 2, b: 3 },
|
|
96
|
+
* { from: 1, a: 3, to: 3, b: 0 },
|
|
97
|
+
* ];
|
|
98
|
+
* chart.create({ width: 8, height: 4, children: [links.create({ data: moves, x1: "from", y1: "a", x2: "to", y2: "b", arrow: true })] });
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @see https://sophistry.dev/guides/charts/#marks
|
|
102
|
+
* @category Charts
|
|
103
|
+
*/
|
|
104
|
+
export declare const links: import("@sophistry/core").Definition<LinksProps<any>, import("@sophistry/core/internal").CompositeNode<LinksProps<any>>, keyof LinksProps<any>>;
|
|
105
|
+
/**
|
|
106
|
+
* Arrows from `(x, y)` along `(u, v)`, a quiver plot for data you already have (for a sampled
|
|
107
|
+
* function, use `vectorField`). Each grows from its tail. One instances node.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* import { chart, vectors } from "@sophistry/charts";
|
|
112
|
+
*
|
|
113
|
+
* const wind = [
|
|
114
|
+
* { x: 0, y: 0, u: 1, v: 0.5 },
|
|
115
|
+
* { x: 1, y: 0, u: 0.8, v: 1 },
|
|
116
|
+
* ];
|
|
117
|
+
* chart.create({ width: 8, height: 4, children: [vectors.create({ data: wind, x: "x", y: "y", u: "u", v: "v", scale: 0.5 })] });
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @see https://sophistry.dev/guides/charts/#marks
|
|
121
|
+
* @category Charts
|
|
122
|
+
*/
|
|
123
|
+
export declare const vectors: import("@sophistry/core").Definition<VectorsProps<any>, import("@sophistry/core/internal").CompositeNode<VectorsProps<any>>, keyof VectorsProps<any>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rects`: rectangles in data space from `x1`/`x2`/`y1`/`y2`; a pair left
|
|
3
|
+
* out spans the plot that way. One `rect` instances node per layer.
|
|
4
|
+
*
|
|
5
|
+
* Each rectangle reveals by tracing its outline while its
|
|
6
|
+
* fill comes up (the item's `progress` channel: its reveal and presence).
|
|
7
|
+
*/
|
|
8
|
+
import type { ColorInput } from "@sophistry/core/color";
|
|
9
|
+
import type { MarkTransition } from "../batch.js";
|
|
10
|
+
import type { Channel, ColorChannel, PositionValue } from "../data/channels.js";
|
|
11
|
+
import type { KeyedTransitionProps, RevealProps } from "../props.js";
|
|
12
|
+
import type { TooltipSpec } from "../tooltip.js";
|
|
13
|
+
/**
|
|
14
|
+
* Props of {@link rects}.
|
|
15
|
+
*
|
|
16
|
+
* @category Charts
|
|
17
|
+
*/
|
|
18
|
+
export interface RectsProps<T = unknown> extends KeyedTransitionProps<T>, RevealProps {
|
|
19
|
+
/** One rectangle per datum. */
|
|
20
|
+
data: readonly T[];
|
|
21
|
+
/** Left edge, in data units (a `Date` reads as epoch ms). With `x2` also omitted, the rectangle spans the plot's full width. */
|
|
22
|
+
x1?: Channel<T, PositionValue>;
|
|
23
|
+
/** Right edge, in data units. */
|
|
24
|
+
x2?: Channel<T, PositionValue>;
|
|
25
|
+
/** Bottom edge, in data units. With `y2` also omitted, the rectangle spans the plot's full height. */
|
|
26
|
+
y1?: Channel<T, PositionValue>;
|
|
27
|
+
/** Top edge, in data units. */
|
|
28
|
+
y2?: Channel<T, PositionValue>;
|
|
29
|
+
/** Fill, constant or `(d, i) => colour`. Wins over `colors`. */
|
|
30
|
+
color?: ColorChannel<T>;
|
|
31
|
+
/** Colours cycled across the rectangles by index. Defaults to the theme's categorical colours. */
|
|
32
|
+
colors?: readonly ColorInput[];
|
|
33
|
+
/**
|
|
34
|
+
* Fill opacity, 0..1.
|
|
35
|
+
* @default 0.35
|
|
36
|
+
*/
|
|
37
|
+
fillOpacity?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Outline colour.
|
|
40
|
+
* @default "none"
|
|
41
|
+
*/
|
|
42
|
+
stroke?: ColorInput;
|
|
43
|
+
strokeWidth?: number;
|
|
44
|
+
opacity?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Reveal, 0..1: each rectangle traces its outline as its fill comes up.
|
|
47
|
+
* @default 1
|
|
48
|
+
*/
|
|
49
|
+
progress?: number;
|
|
50
|
+
/** Hover tooltip: `(d, i) => string`. */
|
|
51
|
+
tooltip?: TooltipSpec<T>;
|
|
52
|
+
/** How rectangles move when `data` changes outside a `to` blend; see {@link MarkTransition}. */
|
|
53
|
+
transition?: MarkTransition;
|
|
54
|
+
/**
|
|
55
|
+
* Paint order; higher draws later. Behind the data by default.
|
|
56
|
+
* @default -1
|
|
57
|
+
*/
|
|
58
|
+
zIndex?: number;
|
|
59
|
+
visible?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Rectangles in data space from `x1`/`x2`/`y1`/`y2`. Leave out a pair and the rectangle spans
|
|
63
|
+
* the plot that way: a vertical or horizontal span (shaded recessions, a target band); with all
|
|
64
|
+
* four, a floating box. Drawn behind the data by default. One instances node.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { chart, rects } from "@sophistry/charts";
|
|
69
|
+
*
|
|
70
|
+
* const recessions = [
|
|
71
|
+
* { start: 2001.2, end: 2001.9 },
|
|
72
|
+
* { start: 2008, end: 2009.5 },
|
|
73
|
+
* ];
|
|
74
|
+
* chart.create({ width: 8, height: 4, children: [rects.create({ data: recessions, x1: "start", x2: "end" })] });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @see https://sophistry.dev/guides/charts/#marks
|
|
78
|
+
* @category Charts
|
|
79
|
+
*/
|
|
80
|
+
export declare const rects: import("@sophistry/core").Definition<RectsProps<any>, import("@sophistry/core/internal").CompositeNode<RectsProps<any>>, keyof RectsProps<any>>;
|