@tetrascience-npm/ts-lib-viz 0.0.0-stage → 0.1.4
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 +202 -0
- package/README.md +2171 -2
- package/dist/src/builder/PlotPanel.d.ts +42 -0
- package/dist/src/builder/PlotPanel.js +433 -0
- package/dist/src/builder/Popover.d.ts +37 -0
- package/dist/src/builder/Popover.js +32 -0
- package/dist/src/builder/Stepper.d.ts +21 -0
- package/dist/src/builder/Stepper.js +41 -0
- package/dist/src/builder/index.d.ts +10 -0
- package/dist/src/builder/index.js +10 -0
- package/dist/src/core/adapters.d.ts +86 -0
- package/dist/src/core/adapters.js +219 -0
- package/dist/src/core/aggregate.d.ts +74 -0
- package/dist/src/core/aggregate.js +102 -0
- package/dist/src/core/annotations.d.ts +34 -0
- package/dist/src/core/annotations.js +71 -0
- package/dist/src/core/band-order.d.ts +86 -0
- package/dist/src/core/band-order.js +132 -0
- package/dist/src/core/binning.d.ts +123 -0
- package/dist/src/core/binning.js +193 -0
- package/dist/src/core/bounds.d.ts +40 -0
- package/dist/src/core/bounds.js +107 -0
- package/dist/src/core/brush.d.ts +73 -0
- package/dist/src/core/brush.js +102 -0
- package/dist/src/core/build.d.ts +322 -0
- package/dist/src/core/build.js +496 -0
- package/dist/src/core/camera.d.ts +152 -0
- package/dist/src/core/camera.js +303 -0
- package/dist/src/core/capabilities.d.ts +24 -0
- package/dist/src/core/capabilities.js +307 -0
- package/dist/src/core/chord.d.ts +49 -0
- package/dist/src/core/chord.js +57 -0
- package/dist/src/core/circular.d.ts +83 -0
- package/dist/src/core/circular.js +63 -0
- package/dist/src/core/cluster.d.ts +136 -0
- package/dist/src/core/cluster.js +607 -0
- package/dist/src/core/critique.d.ts +92 -0
- package/dist/src/core/critique.js +905 -0
- package/dist/src/core/density.d.ts +38 -0
- package/dist/src/core/density.js +82 -0
- package/dist/src/core/figure-set.d.ts +34 -0
- package/dist/src/core/figure-set.js +55 -0
- package/dist/src/core/finding-codes.d.ts +10 -0
- package/dist/src/core/finding-codes.js +1 -0
- package/dist/src/core/fit-types.d.ts +46 -0
- package/dist/src/core/fit-types.js +7 -0
- package/dist/src/core/fitter.d.ts +62 -0
- package/dist/src/core/fitter.js +102 -0
- package/dist/src/core/frame-geometry.d.ts +407 -0
- package/dist/src/core/frame-geometry.js +612 -0
- package/dist/src/core/frame.d.ts +329 -0
- package/dist/src/core/frame.js +1432 -0
- package/dist/src/core/geom-table.d.ts +503 -0
- package/dist/src/core/geom-table.js +484 -0
- package/dist/src/core/geom-types.d.ts +182 -0
- package/dist/src/core/geom-types.js +17 -0
- package/dist/src/core/grammar.d.ts +359 -0
- package/dist/src/core/grammar.js +397 -0
- package/dist/src/core/heat-reductions.d.ts +36 -0
- package/dist/src/core/heat-reductions.js +133 -0
- package/dist/src/core/hexbin.d.ts +84 -0
- package/dist/src/core/hexbin.js +168 -0
- package/dist/src/core/hierarchy.d.ts +59 -0
- package/dist/src/core/hierarchy.js +248 -0
- package/dist/src/core/hit.d.ts +75 -0
- package/dist/src/core/hit.js +37 -0
- package/dist/src/core/index.d.ts +33 -0
- package/dist/src/core/index.js +18 -0
- package/dist/src/core/internal.d.ts +58 -0
- package/dist/src/core/internal.js +58 -0
- package/dist/src/core/labels.d.ts +37 -0
- package/dist/src/core/labels.js +54 -0
- package/dist/src/core/layers.d.ts +594 -0
- package/dist/src/core/layers.js +2892 -0
- package/dist/src/core/load.d.ts +17 -0
- package/dist/src/core/load.js +356 -0
- package/dist/src/core/marginal.d.ts +65 -0
- package/dist/src/core/marginal.js +116 -0
- package/dist/src/core/mesh.d.ts +69 -0
- package/dist/src/core/mesh.js +237 -0
- package/dist/src/core/omission.d.ts +41 -0
- package/dist/src/core/omission.js +62 -0
- package/dist/src/core/palette-sets.d.ts +623 -0
- package/dist/src/core/palette-sets.js +1058 -0
- package/dist/src/core/palette.d.ts +871 -0
- package/dist/src/core/palette.js +511 -0
- package/dist/src/core/plot-data.d.ts +71 -0
- package/dist/src/core/plot-data.js +82 -0
- package/dist/src/core/predicate.d.ts +50 -0
- package/dist/src/core/predicate.js +20 -0
- package/dist/src/core/profile.d.ts +111 -0
- package/dist/src/core/profile.js +221 -0
- package/dist/src/core/readout.d.ts +108 -0
- package/dist/src/core/readout.js +215 -0
- package/dist/src/core/region.d.ts +56 -0
- package/dist/src/core/region.js +101 -0
- package/dist/src/core/rings.d.ts +96 -0
- package/dist/src/core/rings.js +171 -0
- package/dist/src/core/rules.d.ts +45 -0
- package/dist/src/core/rules.js +69 -0
- package/dist/src/core/sankey.d.ts +49 -0
- package/dist/src/core/sankey.js +96 -0
- package/dist/src/core/select.d.ts +52 -0
- package/dist/src/core/select.js +216 -0
- package/dist/src/core/side-track.d.ts +98 -0
- package/dist/src/core/side-track.js +197 -0
- package/dist/src/core/sizing.d.ts +54 -0
- package/dist/src/core/sizing.js +37 -0
- package/dist/src/core/spec-edit.d.ts +68 -0
- package/dist/src/core/spec-edit.js +105 -0
- package/dist/src/core/spec.d.ts +1111 -0
- package/dist/src/core/spec.js +39 -0
- package/dist/src/core/stats.d.ts +161 -0
- package/dist/src/core/stats.js +318 -0
- package/dist/src/core/tick-format.d.ts +21 -0
- package/dist/src/core/tick-format.js +87 -0
- package/dist/src/core/tokens.d.ts +47 -0
- package/dist/src/core/tokens.js +138 -0
- package/dist/src/core/transform.d.ts +21 -0
- package/dist/src/core/transform.js +19 -0
- package/dist/src/core/voxels.d.ts +53 -0
- package/dist/src/core/voxels.js +129 -0
- package/dist/src/core/zoom.d.ts +76 -0
- package/dist/src/core/zoom.js +103 -0
- package/dist/src/graph/GraphSurface.d.ts +127 -0
- package/dist/src/graph/GraphSurface.js +423 -0
- package/dist/src/graph/data.d.ts +103 -0
- package/dist/src/graph/data.js +140 -0
- package/dist/src/graph/index.d.ts +7 -0
- package/dist/src/graph/index.js +7 -0
- package/dist/src/mcp/data.d.ts +28 -0
- package/dist/src/mcp/data.js +131 -0
- package/dist/src/mcp/index.d.ts +7 -0
- package/dist/src/mcp/index.js +7 -0
- package/dist/src/mcp/paths.d.ts +12 -0
- package/dist/src/mcp/paths.js +30 -0
- package/dist/src/mcp/render.d.ts +67 -0
- package/dist/src/mcp/render.js +189 -0
- package/dist/src/mcp/server.d.ts +7 -0
- package/dist/src/mcp/server.js +25 -0
- package/dist/src/mcp/tools.d.ts +82 -0
- package/dist/src/mcp/tools.js +412 -0
- package/dist/src/react/BrushLayer.d.ts +20 -0
- package/dist/src/react/BrushLayer.js +98 -0
- package/dist/src/react/ColorLegend.d.ts +45 -0
- package/dist/src/react/ColorLegend.js +64 -0
- package/dist/src/react/Figure.d.ts +19 -0
- package/dist/src/react/Figure.js +6 -0
- package/dist/src/react/Frame.d.ts +87 -0
- package/dist/src/react/Frame.js +192 -0
- package/dist/src/react/MarkLegend.d.ts +32 -0
- package/dist/src/react/MarkLegend.js +24 -0
- package/dist/src/react/SeriesLegend.d.ts +38 -0
- package/dist/src/react/SeriesLegend.js +27 -0
- package/dist/src/react/SizeLegend.d.ts +24 -0
- package/dist/src/react/SizeLegend.js +25 -0
- package/dist/src/react/Toolbar.d.ts +109 -0
- package/dist/src/react/Toolbar.js +483 -0
- package/dist/src/react/Tooltip.d.ts +37 -0
- package/dist/src/react/Tooltip.js +59 -0
- package/dist/src/react/Viz.d.ts +112 -0
- package/dist/src/react/Viz.js +1311 -0
- package/dist/src/react/export.d.ts +32 -0
- package/dist/src/react/export.js +181 -0
- package/dist/src/react/geoms/Area.d.ts +38 -0
- package/dist/src/react/geoms/Area.js +48 -0
- package/dist/src/react/geoms/Bars.d.ts +130 -0
- package/dist/src/react/geoms/Bars.js +164 -0
- package/dist/src/react/geoms/Box.d.ts +50 -0
- package/dist/src/react/geoms/Box.js +32 -0
- package/dist/src/react/geoms/Chord.d.ts +60 -0
- package/dist/src/react/geoms/Chord.js +78 -0
- package/dist/src/react/geoms/Contour.d.ts +44 -0
- package/dist/src/react/geoms/Contour.js +78 -0
- package/dist/src/react/geoms/DensityCurve.d.ts +30 -0
- package/dist/src/react/geoms/DensityCurve.js +38 -0
- package/dist/src/react/geoms/FitCurve.d.ts +26 -0
- package/dist/src/react/geoms/FitCurve.js +52 -0
- package/dist/src/react/geoms/Freqpoly.d.ts +30 -0
- package/dist/src/react/geoms/Freqpoly.js +45 -0
- package/dist/src/react/geoms/Gauge.d.ts +42 -0
- package/dist/src/react/geoms/Gauge.js +90 -0
- package/dist/src/react/geoms/Heatmap.d.ts +79 -0
- package/dist/src/react/geoms/Heatmap.js +51 -0
- package/dist/src/react/geoms/Hexbin.d.ts +74 -0
- package/dist/src/react/geoms/Hexbin.js +89 -0
- package/dist/src/react/geoms/Icicle.d.ts +38 -0
- package/dist/src/react/geoms/Icicle.js +9 -0
- package/dist/src/react/geoms/Ideogram.d.ts +58 -0
- package/dist/src/react/geoms/Ideogram.js +77 -0
- package/dist/src/react/geoms/Interval.d.ts +28 -0
- package/dist/src/react/geoms/Interval.js +39 -0
- package/dist/src/react/geoms/Line.d.ts +39 -0
- package/dist/src/react/geoms/Line.js +52 -0
- package/dist/src/react/geoms/Parallel.d.ts +38 -0
- package/dist/src/react/geoms/Parallel.js +131 -0
- package/dist/src/react/geoms/Pie.d.ts +62 -0
- package/dist/src/react/geoms/Pie.js +59 -0
- package/dist/src/react/geoms/Points.d.ts +84 -0
- package/dist/src/react/geoms/Points.js +207 -0
- package/dist/src/react/geoms/Points3d.d.ts +49 -0
- package/dist/src/react/geoms/Points3d.js +58 -0
- package/dist/src/react/geoms/Radar.d.ts +39 -0
- package/dist/src/react/geoms/Radar.js +59 -0
- package/dist/src/react/geoms/Range.d.ts +31 -0
- package/dist/src/react/geoms/Range.js +20 -0
- package/dist/src/react/geoms/RingStack.d.ts +39 -0
- package/dist/src/react/geoms/RingStack.js +65 -0
- package/dist/src/react/geoms/Rule.d.ts +29 -0
- package/dist/src/react/geoms/Rule.js +51 -0
- package/dist/src/react/geoms/Sankey.d.ts +24 -0
- package/dist/src/react/geoms/Sankey.js +51 -0
- package/dist/src/react/geoms/Segment.d.ts +36 -0
- package/dist/src/react/geoms/Segment.js +39 -0
- package/dist/src/react/geoms/Sunburst.d.ts +46 -0
- package/dist/src/react/geoms/Sunburst.js +64 -0
- package/dist/src/react/geoms/Surface.d.ts +32 -0
- package/dist/src/react/geoms/Surface.js +49 -0
- package/dist/src/react/geoms/Text.d.ts +35 -0
- package/dist/src/react/geoms/Text.js +40 -0
- package/dist/src/react/geoms/Treemap.d.ts +39 -0
- package/dist/src/react/geoms/Treemap.js +16 -0
- package/dist/src/react/geoms/Violin.d.ts +56 -0
- package/dist/src/react/geoms/Violin.js +60 -0
- package/dist/src/react/geoms/Volume.d.ts +37 -0
- package/dist/src/react/geoms/Volume.js +40 -0
- package/dist/src/react/geoms/Waterfall.d.ts +43 -0
- package/dist/src/react/geoms/Waterfall.js +18 -0
- package/dist/src/react/geoms/cube-stage.d.ts +39 -0
- package/dist/src/react/geoms/cube-stage.js +85 -0
- package/dist/src/react/geoms/hierarchy-cells.d.ts +42 -0
- package/dist/src/react/geoms/hierarchy-cells.js +59 -0
- package/dist/src/react/geoms/sector-axis.d.ts +66 -0
- package/dist/src/react/geoms/sector-axis.js +99 -0
- package/dist/src/react/gl/GlMesh.d.ts +22 -0
- package/dist/src/react/gl/GlMesh.js +78 -0
- package/dist/src/react/gl/GlPoints.d.ts +45 -0
- package/dist/src/react/gl/GlPoints.js +117 -0
- package/dist/src/react/gl/GlVolume.d.ts +28 -0
- package/dist/src/react/gl/GlVolume.js +112 -0
- package/dist/src/react/gl/GlWalls.d.ts +24 -0
- package/dist/src/react/gl/GlWalls.js +55 -0
- package/dist/src/react/gl/context.d.ts +71 -0
- package/dist/src/react/gl/context.js +98 -0
- package/dist/src/react/gl/encode.d.ts +120 -0
- package/dist/src/react/gl/encode.js +215 -0
- package/dist/src/react/gl/index.d.ts +10 -0
- package/dist/src/react/gl/index.js +8 -0
- package/dist/src/react/gl/refresh.d.ts +7 -0
- package/dist/src/react/gl/refresh.js +19 -0
- package/dist/src/react/gl/renderer.d.ts +377 -0
- package/dist/src/react/gl/renderer.js +1081 -0
- package/dist/src/react/gl/shaders.d.ts +92 -0
- package/dist/src/react/gl/shaders.js +405 -0
- package/dist/src/react/gl/surface.d.ts +31 -0
- package/dist/src/react/gl/surface.js +73 -0
- package/dist/src/react/index.d.ts +12 -0
- package/dist/src/react/index.js +11 -0
- package/dist/src/react/orbit.d.ts +38 -0
- package/dist/src/react/orbit.js +81 -0
- package/dist/src/react/sides/DendrogramPanel.d.ts +32 -0
- package/dist/src/react/sides/DendrogramPanel.js +39 -0
- package/dist/src/react/sides/DensityPanel.d.ts +31 -0
- package/dist/src/react/sides/DensityPanel.js +37 -0
- package/dist/src/react/sides/HistogramPanel.d.ts +30 -0
- package/dist/src/react/sides/HistogramPanel.js +18 -0
- package/dist/src/react/sides/RugPanel.d.ts +28 -0
- package/dist/src/react/sides/RugPanel.js +21 -0
- package/dist/src/react/sides/TrackPanel.d.ts +37 -0
- package/dist/src/react/sides/TrackPanel.js +27 -0
- package/dist/src/react/theme.d.ts +48 -0
- package/dist/src/react/theme.js +148 -0
- package/dist/src/react/useFits.d.ts +26 -0
- package/dist/src/react/useFits.js +62 -0
- package/dist/src/react/useZoom.d.ts +50 -0
- package/dist/src/react/useZoom.js +141 -0
- package/package.json +164 -5
- package/theme/default.css +62 -0
|
@@ -0,0 +1,1111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plot spec -- what an author states and a renderer reads.
|
|
3
|
+
*
|
|
4
|
+
* The package's public grammar, and its fields are semver surface. A chart is data.
|
|
5
|
+
*/
|
|
6
|
+
import type { Aggregate } from "./aggregate.js";
|
|
7
|
+
import type { BinClosed, BinDrop, PerAxis } from "./binning.js";
|
|
8
|
+
import type { LinkFields } from "./circular.js";
|
|
9
|
+
import type { RingPanel } from "./rings.js";
|
|
10
|
+
import type { ClusterDistance, DepthScale, Linkage } from "./cluster.js";
|
|
11
|
+
import type { WaivableCode } from "./finding-codes.js";
|
|
12
|
+
import type { PointShape } from "./geom-types.js";
|
|
13
|
+
import type { PaletteName } from "./palette.js";
|
|
14
|
+
import type { Aesthetic, Parts } from "./geom-table.js";
|
|
15
|
+
import type { Bandwidth, Kernel, QuantileType } from "./stats.js";
|
|
16
|
+
import type { AxisTransform } from "./transform.js";
|
|
17
|
+
/**
|
|
18
|
+
* Column ids per aesthetic, ggplot's `aes()`. Which aesthetics apply depends on the kind.
|
|
19
|
+
*
|
|
20
|
+
* Keyed by `Aesthetic` alone. An unknown key fails to compile at `plot()` and throws at a layer.
|
|
21
|
+
*/
|
|
22
|
+
export type Aes = Partial<Record<Aesthetic, string | readonly string[]>>;
|
|
23
|
+
/**
|
|
24
|
+
* What happens where two geoms share a band.
|
|
25
|
+
*
|
|
26
|
+
* Each adjustment reads its own arguments. `"dodge"` and `{kind: "dodge"}` are one request.
|
|
27
|
+
*/
|
|
28
|
+
export type Position = PositionKind
|
|
29
|
+
/** ggplot's `position_stack` and `position_fill`. */
|
|
30
|
+
| {
|
|
31
|
+
kind: "stack" | "fill";
|
|
32
|
+
/** Hands the slots out in reverse. The first series lands on top. */
|
|
33
|
+
reverse?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Where a stack's floor runs. Zero unless stated.
|
|
36
|
+
*
|
|
37
|
+
* `silhouette` centers each stack on zero. `wiggle` keeps the layers flat, a streamgraph.
|
|
38
|
+
* `fill` ignores both.
|
|
39
|
+
*/
|
|
40
|
+
offset?: "zero" | "silhouette" | "wiggle";
|
|
41
|
+
/**
|
|
42
|
+
* Where a point or a line falls inside its own segment. Zero at the floor, one at the far end.
|
|
43
|
+
*
|
|
44
|
+
* Defaults to one, ggplot's top on a positive reading. A negative segment's far end is its bottom.
|
|
45
|
+
*/
|
|
46
|
+
vjust?: number;
|
|
47
|
+
}
|
|
48
|
+
/** ggplot's `position_dodge` and `position_dodge2`. */
|
|
49
|
+
| {
|
|
50
|
+
kind: "dodge" | "dodge2";
|
|
51
|
+
/**
|
|
52
|
+
* How much of the band the dodged set takes, as a fraction. One takes it whole.
|
|
53
|
+
*
|
|
54
|
+
* ggplot's `width`. It aligns a narrow geom with a wider one beside it.
|
|
55
|
+
*/
|
|
56
|
+
width?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Whether a slot's width follows its own band's groups.
|
|
59
|
+
*
|
|
60
|
+
* `total` is the default, as in ggplot: each band divides by its own count. `single` keeps one
|
|
61
|
+
* width across the bands.
|
|
62
|
+
*/
|
|
63
|
+
preserve?: "total" | "single";
|
|
64
|
+
reverse?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** ggplot's `position_jitter` and `position_jitterdodge`. */
|
|
67
|
+
| {
|
|
68
|
+
kind: "jitter" | "jitterdodge";
|
|
69
|
+
/**
|
|
70
|
+
* How far a geom may move each way along x, in data units. The offset is uniform in plus or
|
|
71
|
+
* minus this.
|
|
72
|
+
*
|
|
73
|
+
* Absent takes 0.4 times the axis's resolution, its smallest gap. A band axis has resolution 1.
|
|
74
|
+
* A jitterdodge divides the width, stated or not, by its color levels plus two, as ggplot does.
|
|
75
|
+
*/
|
|
76
|
+
width?: number;
|
|
77
|
+
/** The same along y. Absent on a jitterdodge moves nothing, ggplot's `jitter.height`. */
|
|
78
|
+
height?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Which offsets come out.
|
|
81
|
+
*
|
|
82
|
+
* The offsets are hashed off the row and one spec exports twice to one picture. A seed
|
|
83
|
+
* shifts the hash.
|
|
84
|
+
*/
|
|
85
|
+
seed?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Width a jitterdodge's dodged set spans, in data units. A band is one unit wide.
|
|
88
|
+
*
|
|
89
|
+
* Each level of the layer's color takes an equal slot of it. Absent takes 0.75, ggplot's
|
|
90
|
+
* `dodge.width`.
|
|
91
|
+
*/
|
|
92
|
+
dodgeWidth?: number;
|
|
93
|
+
}
|
|
94
|
+
/** ggplot's `position_nudge`: a fixed offset in the axes' own units. */
|
|
95
|
+
| {
|
|
96
|
+
kind: "identity" | "nudge";
|
|
97
|
+
x?: number;
|
|
98
|
+
y?: number;
|
|
99
|
+
};
|
|
100
|
+
/** The adjustments by name. A bare string states one of these. */
|
|
101
|
+
export type PositionKind = "identity" | "stack" | "fill" | "dodge" | "dodge2" | "jitter" | "jitterdodge" | "nudge";
|
|
102
|
+
/** The adjustment a position asks for, whichever of the two shapes it was written in. */
|
|
103
|
+
export declare const positionKind: (position: Position | undefined) => PositionKind;
|
|
104
|
+
/** What a position states beyond its name, as the wide set. A name alone states nothing. */
|
|
105
|
+
export declare const positionArgs: (position: Position | undefined) => {
|
|
106
|
+
reverse?: boolean;
|
|
107
|
+
offset?: "zero" | "silhouette" | "wiggle";
|
|
108
|
+
vjust?: number;
|
|
109
|
+
width?: number;
|
|
110
|
+
height?: number;
|
|
111
|
+
preserve?: "total" | "single";
|
|
112
|
+
seed?: number;
|
|
113
|
+
dodgeWidth?: number;
|
|
114
|
+
x?: number;
|
|
115
|
+
y?: number;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Chart types the plot builder offers.
|
|
119
|
+
*
|
|
120
|
+
* `parcoords` draws one line per record across several measures. `sankey` renders the funnel.
|
|
121
|
+
*/
|
|
122
|
+
export type PlotKind = "point" | "line" | "area" | "ribbon" | "errorbar" | "linerange" | "pointrange" | "crossbar" | "segment" | "smooth" | "bar" | "waterfall" | "histogram" | "freqpoly" | "hex" | "boxplot" | "violin" | "density" | "heatmap" | "contour" | "parcoords" | "sankey" | "chord" | "ideogram" | "treemap" | "icicle" | "sunburst" | "pie" | "gauge" | "radar" | "point3d" | "surface" | "mesh3d" | "isosurface" | "volume" | "hline" | "vline" | "abline" | "text" | "label";
|
|
123
|
+
/**
|
|
124
|
+
* Where a plot's rows come from.
|
|
125
|
+
*
|
|
126
|
+
* Named by the plot. Binding the rows to the host would make one plot mean two things.
|
|
127
|
+
*/
|
|
128
|
+
export type PlotSource = {
|
|
129
|
+
kind: "entity";
|
|
130
|
+
id: string;
|
|
131
|
+
} | {
|
|
132
|
+
kind: "dataset";
|
|
133
|
+
id: string;
|
|
134
|
+
} | {
|
|
135
|
+
kind: "lookup";
|
|
136
|
+
id: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A saved cohort, which is a predicate and no row list.
|
|
140
|
+
*
|
|
141
|
+
* Naming the cohort keeps the narrowing in the plot and re-evaluable as rows arrive.
|
|
142
|
+
*/
|
|
143
|
+
| {
|
|
144
|
+
kind: "cohort";
|
|
145
|
+
id: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A block in the document showing the plot, by that block's name.
|
|
149
|
+
*
|
|
150
|
+
* The document holds the rows. A dashboard tile pointed at one has nothing to draw.
|
|
151
|
+
*/
|
|
152
|
+
| {
|
|
153
|
+
kind: "node";
|
|
154
|
+
id: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Which geoms get their name written beside them.
|
|
158
|
+
*
|
|
159
|
+
* Chart-design rule 2 puts the label on the geom. Selective -- eight notable points named and
|
|
160
|
+
* nine hundred bare.
|
|
161
|
+
*/
|
|
162
|
+
export type LabelWhen = {
|
|
163
|
+
kind: "all";
|
|
164
|
+
} | {
|
|
165
|
+
kind: "top";
|
|
166
|
+
count: number;
|
|
167
|
+
on: "x" | "y";
|
|
168
|
+
end: "high" | "low";
|
|
169
|
+
} | {
|
|
170
|
+
kind: "threshold";
|
|
171
|
+
on: "x" | "y";
|
|
172
|
+
op: "above" | "below";
|
|
173
|
+
value: number;
|
|
174
|
+
};
|
|
175
|
+
export interface LabelRule {
|
|
176
|
+
/** The field a label draws. */
|
|
177
|
+
field: string;
|
|
178
|
+
when: LabelWhen;
|
|
179
|
+
}
|
|
180
|
+
/** How a tick label writes its number. `auto` shortens by magnitude, 1.2k for 1200. */
|
|
181
|
+
export type TickFormat = "auto" | "fixed" | "scientific" | "percent";
|
|
182
|
+
/**
|
|
183
|
+
* Where a band's order comes from, and where its breaks fall.
|
|
184
|
+
*
|
|
185
|
+
* The two sources exclude each other. `cluster` names the computation. `list` takes an order
|
|
186
|
+
* from elsewhere.
|
|
187
|
+
*/
|
|
188
|
+
export type BandOrder = {
|
|
189
|
+
kind: "list";
|
|
190
|
+
/** The categories, in the order they should appear. Anything absent from the data is skipped. */
|
|
191
|
+
values: readonly string[];
|
|
192
|
+
/** Break positions, each the index in `values` the break sits before. */
|
|
193
|
+
gaps?: readonly number[];
|
|
194
|
+
} | {
|
|
195
|
+
kind: "cluster";
|
|
196
|
+
/**
|
|
197
|
+
* How far apart two rows are.
|
|
198
|
+
*
|
|
199
|
+
* Euclidean by default, matching pheatmap. Correlation reads a row's shape and ignores its
|
|
200
|
+
* level.
|
|
201
|
+
*/
|
|
202
|
+
distance?: ClusterDistance;
|
|
203
|
+
/** How two clusters are joined. Complete by default, matching pheatmap. */
|
|
204
|
+
method?: Linkage;
|
|
205
|
+
/** Clusters the tree is cut into, which puts a break at each boundary. pheatmap's `cutree`. */
|
|
206
|
+
cut?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Rows aggregated into this many centroids before the tree is built. pheatmap's `kmeans_k`.
|
|
209
|
+
*
|
|
210
|
+
* The escape past `CLUSTER_CAP`. The band then names the centroids.
|
|
211
|
+
*/
|
|
212
|
+
kmeans?: number;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* A panel beside the plot area, sharing one of its axes.
|
|
216
|
+
*
|
|
217
|
+
* Four wanted things are one primitive. Each shares one axis and takes a fixed extent on the
|
|
218
|
+
* other.
|
|
219
|
+
*/
|
|
220
|
+
export interface SidePanel {
|
|
221
|
+
position: "top" | "right" | "bottom" | "left";
|
|
222
|
+
/**
|
|
223
|
+
* Extent perpendicular to the shared axis, in pixels.
|
|
224
|
+
*
|
|
225
|
+
* pheatmap's `treeheight_row` for a dendrogram, one cell for a track.
|
|
226
|
+
*/
|
|
227
|
+
size: number;
|
|
228
|
+
/**
|
|
229
|
+
* Whether the panel draws inside the axis labels or outside them.
|
|
230
|
+
*
|
|
231
|
+
* A track belongs against the cells and a tree belongs outside. Absent takes the content's
|
|
232
|
+
* answer.
|
|
233
|
+
*/
|
|
234
|
+
inside?: boolean;
|
|
235
|
+
content: SideContent;
|
|
236
|
+
}
|
|
237
|
+
export type SideContent =
|
|
238
|
+
/**
|
|
239
|
+
* The tree behind a cluster order, from the merge order and heights that produced it.
|
|
240
|
+
*
|
|
241
|
+
* `depth` defaults to `height`, which is R's own plot. `sqrt` opens out tight clusters.
|
|
242
|
+
*/
|
|
243
|
+
{
|
|
244
|
+
kind: "dendrogram";
|
|
245
|
+
depth?: DepthScale;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* One value per category off another column, as a strip of cells. pheatmap's annotation.
|
|
249
|
+
*
|
|
250
|
+
* `palette` names the sequential map a numeric track draws on, separate from the cells'.
|
|
251
|
+
*/
|
|
252
|
+
| {
|
|
253
|
+
kind: "track";
|
|
254
|
+
field: string;
|
|
255
|
+
palette?: PaletteName;
|
|
256
|
+
/**
|
|
257
|
+
* Whether the legend names the values this figure drew alone. pheatmap's `drop_levels`.
|
|
258
|
+
*
|
|
259
|
+
* On by default. Off reads the figure set's assignments and names each pinned value.
|
|
260
|
+
*/
|
|
261
|
+
dropLevels?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The shared axis's own distribution, binned the way a histogram layer is.
|
|
265
|
+
*
|
|
266
|
+
* `binwidth` is in the data's units. Absent takes the Freedman-Diaconis width.
|
|
267
|
+
*/
|
|
268
|
+
| {
|
|
269
|
+
kind: "histogram";
|
|
270
|
+
binwidth?: number;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The shared axis's own distribution as a kernel density.
|
|
274
|
+
*
|
|
275
|
+
* `by: "color"` draws one curve per level of the figure's color channel. Absent pools the
|
|
276
|
+
* readings.
|
|
277
|
+
*/
|
|
278
|
+
| {
|
|
279
|
+
kind: "density";
|
|
280
|
+
by?: "color";
|
|
281
|
+
}
|
|
282
|
+
/** One tick per record along the shared axis. */
|
|
283
|
+
| {
|
|
284
|
+
kind: "rug";
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* What an author states on one position scale, `x`, `y` or `y2`. ggplot's `scale_x_continuous` and siblings.
|
|
288
|
+
*
|
|
289
|
+
* Each field is absent by default and the figure falls back to the data. Fixed `limits` are the ones
|
|
290
|
+
* worth stating.
|
|
291
|
+
*/
|
|
292
|
+
export interface PositionScale {
|
|
293
|
+
title?: string;
|
|
294
|
+
/**
|
|
295
|
+
* How positions map along a value axis. ggplot's `transform`, and `log10` is `scale_x_log10`.
|
|
296
|
+
*
|
|
297
|
+
* `log2` spaces powers of two evenly. `sqrt` spaces by the root and drops a reading below zero.
|
|
298
|
+
* `pseudo_log` runs linear inside one unit of zero and logarithmic past it, either sign.
|
|
299
|
+
*/
|
|
300
|
+
transform?: AxisTransform;
|
|
301
|
+
/** Whether a value axis runs high to low. ggplot's `scale_x_reverse`. */
|
|
302
|
+
reverse?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Whether the column holds epoch milliseconds and the axis reads them as dates.
|
|
305
|
+
*
|
|
306
|
+
* Absent takes the field's own `timeScale`. Ticks land on calendar boundaries, read in `timezone`.
|
|
307
|
+
*/
|
|
308
|
+
time?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* The clock a time axis reads in. ggplot's `timezone`.
|
|
311
|
+
*
|
|
312
|
+
* `UTC`, the default, draws the same for a reader in any zone. `local` reads the viewer's own clock.
|
|
313
|
+
*/
|
|
314
|
+
timezone?: "UTC" | "local";
|
|
315
|
+
/** The two ends the axis runs between, in data units. ggplot's `limits`. */
|
|
316
|
+
limits?: readonly [number, number];
|
|
317
|
+
/**
|
|
318
|
+
* What a reading past stated `limits` becomes. ggplot's `oob`.
|
|
319
|
+
*
|
|
320
|
+
* `censor`, the default, drops it and the footer counts it. `squish` holds it at the edge. `keep`
|
|
321
|
+
* draws it, clipped.
|
|
322
|
+
*/
|
|
323
|
+
oob?: "censor" | "squish" | "keep";
|
|
324
|
+
/**
|
|
325
|
+
* Whether the axis positions by category or by value.
|
|
326
|
+
*
|
|
327
|
+
* Defaults to the field's own type. A plate number is a number and belongs in bands.
|
|
328
|
+
*/
|
|
329
|
+
kind?: "band" | "continuous";
|
|
330
|
+
/**
|
|
331
|
+
* Pixels per category, on a band axis.
|
|
332
|
+
*
|
|
333
|
+
* Absent divides the plot area among the categories. Stated, the figure grows to hold them.
|
|
334
|
+
*/
|
|
335
|
+
bandSize?: number;
|
|
336
|
+
/**
|
|
337
|
+
* Where the category order comes from, on a band axis.
|
|
338
|
+
*
|
|
339
|
+
* Absent leaves the build order, which is first-seen on a category axis and ranked by rows on
|
|
340
|
+
* a grid.
|
|
341
|
+
*/
|
|
342
|
+
order?: BandOrder;
|
|
343
|
+
/**
|
|
344
|
+
* What each category or break is written as. pheatmap's `labels_row`, ggplot's `labels`.
|
|
345
|
+
*
|
|
346
|
+
* Drawn text, keyed as `String(value)` writes a break. A missing entry keeps the default.
|
|
347
|
+
*/
|
|
348
|
+
labels?: Record<string, string>;
|
|
349
|
+
/** Labeled tick positions on a value axis, in data units. Over `breakWidth`. ggplot's `breaks`. */
|
|
350
|
+
breaks?: readonly number[];
|
|
351
|
+
/** Unlabeled tick positions on a value axis, in data units. ggplot's `minor_breaks`. */
|
|
352
|
+
minorBreaks?: readonly number[];
|
|
353
|
+
/**
|
|
354
|
+
* Room past the data at each end of a value axis. ggplot's `expand`.
|
|
355
|
+
*
|
|
356
|
+
* `mult` is a share of the span and `add` a fixed amount, both in transformed units. A pair states
|
|
357
|
+
* the low end first. Stated `limits` take none.
|
|
358
|
+
*/
|
|
359
|
+
expand?: {
|
|
360
|
+
mult?: number | readonly [number, number];
|
|
361
|
+
add?: number | readonly [number, number];
|
|
362
|
+
};
|
|
363
|
+
/** Values the domain of a value axis reaches, drawn or not. ggplot's `expand_limits`. */
|
|
364
|
+
include?: readonly number[];
|
|
365
|
+
/**
|
|
366
|
+
* Interval between labeled ticks, in the data's own units. The scales package's `breaks_width`.
|
|
367
|
+
*
|
|
368
|
+
* A count leaves the placement to the scale, which labels 0.37 as readily as 0.2.
|
|
369
|
+
*/
|
|
370
|
+
breakWidth?: number;
|
|
371
|
+
/**
|
|
372
|
+
* Whether the scale draws a line at each labeled tick. Off unless asked for.
|
|
373
|
+
*
|
|
374
|
+
* A grid is ink on a scale. No fill is drawn and chart-design rule 3 holds.
|
|
375
|
+
*/
|
|
376
|
+
grid?: boolean;
|
|
377
|
+
/** Whether the subdivisions between the labeled ticks draw a line too. Off unless asked for. */
|
|
378
|
+
minorGrid?: boolean;
|
|
379
|
+
/** Unlabeled subdivisions between the labeled ones. On unless turned off. */
|
|
380
|
+
minorTicks?: boolean;
|
|
381
|
+
format?: TickFormat;
|
|
382
|
+
/** Decimal places, for all formats but `auto`. */
|
|
383
|
+
decimals?: number;
|
|
384
|
+
/** Width of the rule and its ticks, in pixels. */
|
|
385
|
+
linewidth?: number;
|
|
386
|
+
/** Length of a tick, in pixels. */
|
|
387
|
+
tickLength?: number;
|
|
388
|
+
/**
|
|
389
|
+
* Which side of the rule the ticks fall on.
|
|
390
|
+
*
|
|
391
|
+
* Outward is the default. Inward puts the dashes inside the plot area.
|
|
392
|
+
*/
|
|
393
|
+
tickSide?: "out" | "in";
|
|
394
|
+
/**
|
|
395
|
+
* Rotation of the tick labels, in degrees counterclockwise from horizontal. ggplot's `element_text(angle)`.
|
|
396
|
+
*
|
|
397
|
+
* Category names longer than their band collide at zero. The frame grows the margin to match.
|
|
398
|
+
*/
|
|
399
|
+
tickAngle?: number;
|
|
400
|
+
/**
|
|
401
|
+
* Where the title draws along its own rule.
|
|
402
|
+
*
|
|
403
|
+
* `start` is the low end and `end` the high one. A centered vertical title turns.
|
|
404
|
+
*/
|
|
405
|
+
titleAlign?: "start" | "center" | "end";
|
|
406
|
+
/** Type size of the ticks and the title, in pixels. */
|
|
407
|
+
fontSize?: number;
|
|
408
|
+
/**
|
|
409
|
+
* Weight of the tick and title ink, one of muted or strong. Muted is the default.
|
|
410
|
+
*
|
|
411
|
+
* Strong pulls the labels up to geom ink. A grid of categories is read off its axes, and muted
|
|
412
|
+
* names on one read as chrome.
|
|
413
|
+
*/
|
|
414
|
+
ink?: "muted" | "strong";
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Where a figure's legends draw, and how they read.
|
|
418
|
+
*
|
|
419
|
+
* The names follow `PositionScale` where the concept matches.
|
|
420
|
+
*/
|
|
421
|
+
export interface LegendOptions {
|
|
422
|
+
/** Which edge the legends take. Outside the plot area on all four, per rule 2. */
|
|
423
|
+
position?: "right" | "left" | "top" | "bottom" | "none";
|
|
424
|
+
/** Where they sit along that edge. */
|
|
425
|
+
align?: "start" | "center" | "end";
|
|
426
|
+
/** Defaults from the edge: a side stacks, a top or a bottom runs across. */
|
|
427
|
+
direction?: "horizontal" | "vertical";
|
|
428
|
+
fontSize?: number;
|
|
429
|
+
/**
|
|
430
|
+
* Which order the rows read in. `authoring`, the default, is the order the layers were written.
|
|
431
|
+
*
|
|
432
|
+
* `geoms` puts the lines in the order their last readings stand, top first, as rule 2 asks.
|
|
433
|
+
*/
|
|
434
|
+
order?: "geoms" | "authoring";
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* The color scale, as far as an author states it.
|
|
438
|
+
*
|
|
439
|
+
* Every field is absent by default and the figure falls back to what the data says.
|
|
440
|
+
*/
|
|
441
|
+
export interface ColorScale {
|
|
442
|
+
/** Name written over the color guide, a ramp or a set of swatches. Falls back to the field it reads. */
|
|
443
|
+
title?: string;
|
|
444
|
+
/** The two ends the map runs between, in the measure's own units. */
|
|
445
|
+
limits?: readonly [number, number];
|
|
446
|
+
/**
|
|
447
|
+
* The value the map treats as its middle, in the measure's own units.
|
|
448
|
+
*
|
|
449
|
+
* A z-score centers at zero and a fold-change at one. `PaletteChoice.center` is the host default.
|
|
450
|
+
*/
|
|
451
|
+
center?: number;
|
|
452
|
+
/**
|
|
453
|
+
* How a value maps onto the ramp. ggplot's `transform`, the position scales' own names.
|
|
454
|
+
*
|
|
455
|
+
* `sqrt` spends less of the map on a heavy tail. A transformed map runs low to high and takes no `center`.
|
|
456
|
+
*/
|
|
457
|
+
transform?: AxisTransform;
|
|
458
|
+
format?: TickFormat;
|
|
459
|
+
/** Decimal places, for all formats but `auto`. */
|
|
460
|
+
decimals?: number;
|
|
461
|
+
/**
|
|
462
|
+
* Cuts that bin the ramp into steps, in the measure's own units.
|
|
463
|
+
*
|
|
464
|
+
* Edges. n cuts make n-1 bins, as pheatmap's `breaks` does. Absent runs the map continuously.
|
|
465
|
+
*/
|
|
466
|
+
bins?: readonly number[];
|
|
467
|
+
/**
|
|
468
|
+
* Values the legend names, in the measure's own units. ggplot's `breaks`, pheatmap's `legend_breaks`.
|
|
469
|
+
*
|
|
470
|
+
* Absent, the legend names the two ends and the middle.
|
|
471
|
+
*/
|
|
472
|
+
breaks?: readonly number[];
|
|
473
|
+
/**
|
|
474
|
+
* What each break is written as, keyed as `String(value)` writes it. ggplot's `labels`.
|
|
475
|
+
*
|
|
476
|
+
* A missing entry takes the scale's format.
|
|
477
|
+
*/
|
|
478
|
+
labels?: Record<string, string>;
|
|
479
|
+
/**
|
|
480
|
+
* The direction the cells are z-scored along. pheatmap's `scale`.
|
|
481
|
+
*
|
|
482
|
+
* A color transform. It leaves position alone and changes what the fill means.
|
|
483
|
+
*/
|
|
484
|
+
standardize?: "row" | "column" | "none";
|
|
485
|
+
/**
|
|
486
|
+
* Each category's color, keyed by its name. ggplot's `values` in `scale_fill_manual`.
|
|
487
|
+
*
|
|
488
|
+
* The host's own vocabulary. It stays outside the palette switcher, and a category it misses draws in one ink.
|
|
489
|
+
*/
|
|
490
|
+
values?: Readonly<Record<string, string>>;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* A chart's scales, keyed by the aesthetic each one maps. ggplot's `scale_*` family.
|
|
494
|
+
*
|
|
495
|
+
* Each field is absent by default and the figure falls back to the data.
|
|
496
|
+
*/
|
|
497
|
+
export interface ChartScales {
|
|
498
|
+
x?: PositionScale;
|
|
499
|
+
y?: PositionScale;
|
|
500
|
+
/** The second vertical scale, for layers that declare `axis: "y2"`. */
|
|
501
|
+
y2?: PositionScale;
|
|
502
|
+
/**
|
|
503
|
+
* The color map, for the kinds that carry the palette on a line or an edge.
|
|
504
|
+
*
|
|
505
|
+
* A layer's own `scales.color` wins over it field by field.
|
|
506
|
+
*/
|
|
507
|
+
color?: ColorScale;
|
|
508
|
+
/**
|
|
509
|
+
* The fill map, for the kinds that carry the palette on an interior. ggplot's `scale_fill_*`.
|
|
510
|
+
*
|
|
511
|
+
* A layer's own `scales.fill` wins over it field by field.
|
|
512
|
+
*/
|
|
513
|
+
fill?: ColorScale;
|
|
514
|
+
size?: GuideScale;
|
|
515
|
+
shape?: GuideScale;
|
|
516
|
+
alpha?: GuideScale;
|
|
517
|
+
linetype?: GuideScale;
|
|
518
|
+
}
|
|
519
|
+
/** A scale the author names the guide of and states nothing else on. ggplot's `name` on `scale_size` and its siblings. */
|
|
520
|
+
export interface GuideScale {
|
|
521
|
+
/** Name written over the guide. Falls back to the field it reads. */
|
|
522
|
+
title?: string;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* A curve fitted through a series, and how many curves that means.
|
|
526
|
+
*
|
|
527
|
+
* One curve per value of the layer's `group` or categorical `color`, as in ggplot. Bound to a plate
|
|
528
|
+
* or a lot, that turns a campaign into thousands of fits.
|
|
529
|
+
*/
|
|
530
|
+
export interface FitSpec {
|
|
531
|
+
model: "4pl" | "5pl";
|
|
532
|
+
/** Confidence level for the band, in the open interval (0, 1). */
|
|
533
|
+
level: number;
|
|
534
|
+
band: boolean;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* The conditional mean through a cloud of points, and the method that draws it.
|
|
538
|
+
*
|
|
539
|
+
* A smooth's curve is the deliverable. Draws on a series of kind `smooth`, with no geoms.
|
|
540
|
+
*/
|
|
541
|
+
export type SmoothMethod = {
|
|
542
|
+
/**
|
|
543
|
+
* Local regression. The default on a small cloud.
|
|
544
|
+
*
|
|
545
|
+
* Costs the square of the row count. Past a few thousand points, use `gam`.
|
|
546
|
+
*/
|
|
547
|
+
method: "loess";
|
|
548
|
+
/** How much of the data each local fit reads, in (0, 1]. Wider is smoother. */
|
|
549
|
+
span?: number;
|
|
550
|
+
} | {
|
|
551
|
+
/** Least squares. `degree` above one bends it, which is `poly(x, n)` in R's spelling. */
|
|
552
|
+
method: "lm";
|
|
553
|
+
degree?: number;
|
|
554
|
+
} | {
|
|
555
|
+
/** Generalized linear model, for a binary outcome or a count. */
|
|
556
|
+
method: "glm";
|
|
557
|
+
family: "gaussian" | "binomial" | "poisson" | "gamma";
|
|
558
|
+
} | {
|
|
559
|
+
/** Robust least squares, for a cloud a handful of outliers would otherwise tilt. */
|
|
560
|
+
method: "rlm";
|
|
561
|
+
} | {
|
|
562
|
+
/** Additive model, for a curve through more points than a local regression can afford. */
|
|
563
|
+
method: "gam";
|
|
564
|
+
};
|
|
565
|
+
/** A smooth and its band. One curve per value of the layer's `group` or categorical `color`. */
|
|
566
|
+
export type SmoothSpec = SmoothMethod & {
|
|
567
|
+
/** Confidence level for the band, in the open interval (0, 1). */
|
|
568
|
+
level: number;
|
|
569
|
+
band: boolean;
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* A dash pattern, ggplot's linetype, by the names ggplot gives its integers.
|
|
573
|
+
*
|
|
574
|
+
* The names. `"dashed"` says what will be drawn where `2` says nothing.
|
|
575
|
+
*/
|
|
576
|
+
export type Linetype = "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash";
|
|
577
|
+
/**
|
|
578
|
+
* The patterns in the order a bound linetype aesthetic hands them out.
|
|
579
|
+
*
|
|
580
|
+
* Solid leads and one group draws an unbroken run. The rest run from the most distinct down.
|
|
581
|
+
*/
|
|
582
|
+
export declare const LINETYPES: readonly Linetype[];
|
|
583
|
+
/**
|
|
584
|
+
* One pattern as an SVG dasharray, in CSS pixels.
|
|
585
|
+
*
|
|
586
|
+
* Solid answers undefined and the run draws whole. The numbers are R's own linetype patterns as
|
|
587
|
+
* on and off lengths.
|
|
588
|
+
*/
|
|
589
|
+
export declare function dashArray(dash: Linetype | undefined): string | undefined;
|
|
590
|
+
/**
|
|
591
|
+
* How a geom is drawn, held apart from what it encodes.
|
|
592
|
+
*
|
|
593
|
+
* The type parameter names the kind, which decides `parts`. A plain `LayerStyle` is the wide set.
|
|
594
|
+
*/
|
|
595
|
+
export interface LayerStyle<K extends PlotKind = PlotKind> {
|
|
596
|
+
/** Point radius in pixels. Read where the size channel binds no field. */
|
|
597
|
+
size?: number;
|
|
598
|
+
/**
|
|
599
|
+
* Smallest and largest radius the size channel resolves to, in pixels.
|
|
600
|
+
*
|
|
601
|
+
* Absent derives both ends from the panel's own `pointRadius`.
|
|
602
|
+
*/
|
|
603
|
+
sizeRange?: readonly [number, number];
|
|
604
|
+
alpha?: number;
|
|
605
|
+
/**
|
|
606
|
+
* Space between one cell and the next, in pixels. pheatmap's `cellgap`.
|
|
607
|
+
*
|
|
608
|
+
* A grid drawn with no gap abuts, and a corner radius on an abutting cell cannot be seen. A
|
|
609
|
+
* couple of pixels reads each cell as its own chip.
|
|
610
|
+
*/
|
|
611
|
+
cellGap?: number;
|
|
612
|
+
/**
|
|
613
|
+
* Interior paint, where no column maps it. ggplot's `fill` set as a constant.
|
|
614
|
+
*
|
|
615
|
+
* A bar or a cell paints its inside with this. A line has no interior.
|
|
616
|
+
*/
|
|
617
|
+
fill?: string;
|
|
618
|
+
/**
|
|
619
|
+
* Which half of the band a violin's density occupies.
|
|
620
|
+
*
|
|
621
|
+
* Both is symmetric about the band. One half is the raincloud's, leaving room for a box.
|
|
622
|
+
*/
|
|
623
|
+
half?: "both" | "high" | "low";
|
|
624
|
+
/**
|
|
625
|
+
* Glyph the points draw.
|
|
626
|
+
*
|
|
627
|
+
* The channel that survives print and a color-blind reader. Circles unless asked otherwise.
|
|
628
|
+
*/
|
|
629
|
+
shape?: PointShape;
|
|
630
|
+
/**
|
|
631
|
+
* Where a line changes value between two readings. Absent runs a straight segment.
|
|
632
|
+
*
|
|
633
|
+
* `after` keeps a reading until the next arrives. `before` takes the new value at the step.
|
|
634
|
+
*/
|
|
635
|
+
step?: "after" | "before";
|
|
636
|
+
/**
|
|
637
|
+
* Whether a segment draws a head at the end it finishes on. Drawn unless refused.
|
|
638
|
+
*
|
|
639
|
+
* `arrow: false` is for a range with no start, such as a dumbbell.
|
|
640
|
+
*/
|
|
641
|
+
arrow?: boolean;
|
|
642
|
+
/**
|
|
643
|
+
* How a binned density tiles. Hexagons unless asked.
|
|
644
|
+
*
|
|
645
|
+
* A square cell cross-references against the axes. A hexagon reads better as shape.
|
|
646
|
+
*/
|
|
647
|
+
tiling?: "hex" | "rect";
|
|
648
|
+
/**
|
|
649
|
+
* Width of a bar, a box or a violin, in pixels.
|
|
650
|
+
*
|
|
651
|
+
* A cap. The band still divides between the geoms sharing it.
|
|
652
|
+
*/
|
|
653
|
+
thickness?: number;
|
|
654
|
+
/**
|
|
655
|
+
* Where a ring's slices start, as a fraction of the outer radius.
|
|
656
|
+
*
|
|
657
|
+
* Zero draws a pie. Above zero clears a hole, a donut, and the hole clears the crowded middle.
|
|
658
|
+
*/
|
|
659
|
+
innerRadius?: number;
|
|
660
|
+
/**
|
|
661
|
+
* Gap between one sector of a ring and the next, in degrees.
|
|
662
|
+
*
|
|
663
|
+
* A chord's sectors read as separate names with it. Zero closes them into one band.
|
|
664
|
+
*/
|
|
665
|
+
gap?: number;
|
|
666
|
+
/**
|
|
667
|
+
* Where the first sector starts, in degrees counterclockwise from twelve. Default 0.
|
|
668
|
+
*
|
|
669
|
+
* ggplot's direction for an angle. A figure turns to put one name where a reader looks first.
|
|
670
|
+
*/
|
|
671
|
+
rotate?: number;
|
|
672
|
+
/**
|
|
673
|
+
* Radial gap between a sector band and the ribbons inside it, in pixels.
|
|
674
|
+
*
|
|
675
|
+
* Zero seats the ribbons against the band. Anything over it separates the axis from the flow.
|
|
676
|
+
*/
|
|
677
|
+
inset?: number;
|
|
678
|
+
/**
|
|
679
|
+
* How much of the room a dial takes, as a fraction of the radius its panel allows.
|
|
680
|
+
*
|
|
681
|
+
* Default 1. Anything under it leaves a margin the figure can write a scale ring into.
|
|
682
|
+
*/
|
|
683
|
+
radius?: number;
|
|
684
|
+
/**
|
|
685
|
+
* How far a dial turns, in degrees. Default 180.
|
|
686
|
+
*
|
|
687
|
+
* The arc is centered on twelve o'clock whatever the sweep. 270 opens at the bottom.
|
|
688
|
+
*/
|
|
689
|
+
sweep?: number;
|
|
690
|
+
/**
|
|
691
|
+
* Sections the scale ring outside a dial is cut into. Absent draws no ring.
|
|
692
|
+
*
|
|
693
|
+
* Each section takes its color from the magnitude map at its own midpoint. A reader reads the
|
|
694
|
+
* section under the reading instead of the angle.
|
|
695
|
+
*/
|
|
696
|
+
sections?: number;
|
|
697
|
+
/** Corner radius on a grid's cell, in pixels. Absent tiles them square. */
|
|
698
|
+
cornerRadius?: number;
|
|
699
|
+
/**
|
|
700
|
+
* Fades a grid's cell by how many rows stand behind it.
|
|
701
|
+
*
|
|
702
|
+
* A mean of one reading and a mean of four hundred draw the same color and carry different
|
|
703
|
+
* weight. The fade puts that difference on the cell.
|
|
704
|
+
*/
|
|
705
|
+
fadeBySupport?: boolean;
|
|
706
|
+
/**
|
|
707
|
+
* Fills a pair with no rows at nought, the bottom of the ramp.
|
|
708
|
+
*
|
|
709
|
+
* A count and a sum over no rows are nought, and the critic refuses the rest.
|
|
710
|
+
*/
|
|
711
|
+
emptyAsZero?: boolean;
|
|
712
|
+
/**
|
|
713
|
+
* Edge or line color, where no column maps it. ggplot's `color` set as a constant.
|
|
714
|
+
*
|
|
715
|
+
* A line, a point or a rule draws in it. A bar, a cell or a slice outlines itself in it.
|
|
716
|
+
*/
|
|
717
|
+
color?: string;
|
|
718
|
+
/** Width of the edge or line, in pixels. ggplot's `linewidth`. Zero draws none. */
|
|
719
|
+
linewidth?: number;
|
|
720
|
+
/** Dash pattern of the edge or line, where no column maps it. ggplot's `linetype`. */
|
|
721
|
+
linetype?: Linetype;
|
|
722
|
+
/**
|
|
723
|
+
* Width of the paper-colored halo a point draws around itself, in pixels. Zero draws none.
|
|
724
|
+
*
|
|
725
|
+
* The halo reads as space between overlapping points. Absent draws one pixel on a point above
|
|
726
|
+
* four pixels.
|
|
727
|
+
*/
|
|
728
|
+
halo?: number;
|
|
729
|
+
/**
|
|
730
|
+
* Where an isosurface draws its shell, as a fraction of the field's range. Half unless stated.
|
|
731
|
+
*
|
|
732
|
+
* Half the maximum encloses the core and a lower fraction reaches the shoulders.
|
|
733
|
+
*/
|
|
734
|
+
isoLevel?: number;
|
|
735
|
+
/**
|
|
736
|
+
* Which back faces of a cube's box take a pane. matplotlib's `pane`. Absent draws none.
|
|
737
|
+
*
|
|
738
|
+
* `walls` fills the two upright back walls and `all` the floor as well.
|
|
739
|
+
*/
|
|
740
|
+
panes?: "walls" | "all";
|
|
741
|
+
/**
|
|
742
|
+
* Where text sits across its anchor, ggplot's way. Zero starts at the reading, one ends there.
|
|
743
|
+
*
|
|
744
|
+
* Half centers it, the default.
|
|
745
|
+
*/
|
|
746
|
+
hjust?: number;
|
|
747
|
+
/** Where text sits up its anchor. Zero puts its foot at the reading, one its top. Half centers it. */
|
|
748
|
+
vjust?: number;
|
|
749
|
+
/** Type size of a text geom, in pixels. Absent takes the panel's annotation size. */
|
|
750
|
+
fontSize?: number;
|
|
751
|
+
/**
|
|
752
|
+
* Draws the glyph as an outline with paper showing through it.
|
|
753
|
+
*
|
|
754
|
+
* A hollow geom is countable where a filled one is not. The paper halo goes unread here.
|
|
755
|
+
*/
|
|
756
|
+
hollow?: boolean;
|
|
757
|
+
/**
|
|
758
|
+
* Paint for a named part of a composite geom.
|
|
759
|
+
*
|
|
760
|
+
* Keyed by the parts the geometry has. A part takes the geom's own fields and no parts.
|
|
761
|
+
*/
|
|
762
|
+
parts?: Parts<K>;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* The value written on each geom: a grid's cells, a slice, a sector or a dial. pheatmap's
|
|
766
|
+
* `display_numbers`.
|
|
767
|
+
*
|
|
768
|
+
* A direct label, on top of the geom. `format` and `decimals` are the axis's own fields.
|
|
769
|
+
*/
|
|
770
|
+
export interface CellNumbers {
|
|
771
|
+
/**
|
|
772
|
+
* Which geoms get a number. Absent writes them all, which is `display_numbers = TRUE`.
|
|
773
|
+
*
|
|
774
|
+
* The comparison runs against the value before its format: a cell's in the units the ramp reads,
|
|
775
|
+
* a slice's own value, a reading on a sector's axis, and a dial's reading.
|
|
776
|
+
*/
|
|
777
|
+
when?: {
|
|
778
|
+
op: "above" | "below";
|
|
779
|
+
value: number;
|
|
780
|
+
};
|
|
781
|
+
format?: TickFormat;
|
|
782
|
+
/** Decimal places, for all formats but `auto`. */
|
|
783
|
+
decimals?: number;
|
|
784
|
+
/**
|
|
785
|
+
* Fixed ink for the numbers. pheatmap's `number_color`.
|
|
786
|
+
*
|
|
787
|
+
* Absent picks black or white per cell off the fill's own luminance.
|
|
788
|
+
*/
|
|
789
|
+
color?: string;
|
|
790
|
+
/** Type size, in pixels. Absent takes the panel's own axis size. */
|
|
791
|
+
fontSize?: number;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Parameters of the statistics a series runs, keyed by statistic.
|
|
795
|
+
*
|
|
796
|
+
* `StatOptions` records which names each statistic reads. `stat_bin`'s three-way `drop` is
|
|
797
|
+
* `dropEmpty` here.
|
|
798
|
+
*/
|
|
799
|
+
export interface StatParams {
|
|
800
|
+
/**
|
|
801
|
+
* Width of one interval, in the data's own units.
|
|
802
|
+
*
|
|
803
|
+
* A pair states one per axis, across then down. A one-dimensional bin reads the first entry.
|
|
804
|
+
*/
|
|
805
|
+
binwidth?: PerAxis;
|
|
806
|
+
/**
|
|
807
|
+
* Intervals across the range, or cells across each axis.
|
|
808
|
+
*
|
|
809
|
+
* A one-dimensional bin stating neither this nor `binwidth` takes the Freedman-Diaconis width. A
|
|
810
|
+
* lattice takes 30 per axis.
|
|
811
|
+
*/
|
|
812
|
+
bins?: PerAxis;
|
|
813
|
+
/** Middle of one interval, which fixes where all the edges fall. */
|
|
814
|
+
center?: PerAxis;
|
|
815
|
+
/**
|
|
816
|
+
* An edge of one interval, which fixes where all of them fall.
|
|
817
|
+
*
|
|
818
|
+
* Stating this with `center` draws nothing. Default half a width below the lowest reading.
|
|
819
|
+
*/
|
|
820
|
+
boundary?: PerAxis;
|
|
821
|
+
/** Which end of an interval holds a reading recorded on its edge. Default the right end. */
|
|
822
|
+
closed?: BinClosed;
|
|
823
|
+
/** Adds an empty interval at each end. A filled shape closes on the axis. Default false. */
|
|
824
|
+
pad?: boolean;
|
|
825
|
+
/** The edges themselves, which override the width, the count and the alignment. */
|
|
826
|
+
breaks?: readonly number[];
|
|
827
|
+
/**
|
|
828
|
+
* Which empty intervals a one-dimensional binning keeps. Default `none`, keeping them all.
|
|
829
|
+
*
|
|
830
|
+
* ggplot's `stat_bin` spells this `drop`. The violin's boolean has that name below.
|
|
831
|
+
*/
|
|
832
|
+
dropEmpty?: BinDrop;
|
|
833
|
+
/** Kernel bandwidth, or the rule that reads one off the data. Default Silverman's. */
|
|
834
|
+
bw?: Bandwidth;
|
|
835
|
+
/** Multiplier on whatever the bandwidth resolved to. Default 1. */
|
|
836
|
+
adjust?: number;
|
|
837
|
+
/** Which kernel a density sums. Default gaussian. */
|
|
838
|
+
kernel?: Kernel;
|
|
839
|
+
/** Points a curve is evaluated at. Default 512 for a density, 100 per side for a contour. */
|
|
840
|
+
n?: number;
|
|
841
|
+
/** Stops a density at the smallest and largest reading. Default false, and true on a violin. */
|
|
842
|
+
trim?: boolean;
|
|
843
|
+
/** Range the measure can occupy, which a density folds its tails back inside. Default unbounded. */
|
|
844
|
+
bounds?: readonly [number, number];
|
|
845
|
+
/**
|
|
846
|
+
* What a set of violins holds constant. Default `area`.
|
|
847
|
+
*
|
|
848
|
+
* `count` scales the areas by each group's count. `width` fixes the maximum width.
|
|
849
|
+
*/
|
|
850
|
+
scale?: "area" | "count" | "width";
|
|
851
|
+
/**
|
|
852
|
+
* Drops the unit with too little to draw. Default true.
|
|
853
|
+
*
|
|
854
|
+
* On a violin, a group with too few readings. On a lattice, a cell nothing landed in.
|
|
855
|
+
*/
|
|
856
|
+
drop?: boolean;
|
|
857
|
+
/** Probabilities a violin draws a line at inside its outline. Default the three quartiles. */
|
|
858
|
+
quantiles?: readonly number[];
|
|
859
|
+
/** How far a box's whisker reaches past the quartiles, in interquartile ranges. Default 1.5. */
|
|
860
|
+
coef?: number;
|
|
861
|
+
/** Which of R's nine quantile definitions a summary's quartiles take. Default 7. */
|
|
862
|
+
quantileType?: QuantileType;
|
|
863
|
+
/**
|
|
864
|
+
* What a flow's value is measured against. Default `global`.
|
|
865
|
+
*
|
|
866
|
+
* `column` measures each column against its own population. A long cascade draws its last
|
|
867
|
+
* columns under a pixel on one global scale.
|
|
868
|
+
*/
|
|
869
|
+
normalize?: "global" | "column";
|
|
870
|
+
/**
|
|
871
|
+
* Which column a flow's end node draws in. Default `left`, one right of the node reaching it.
|
|
872
|
+
*
|
|
873
|
+
* `justify` puts each node with no outgoing flow in the last column.
|
|
874
|
+
*/
|
|
875
|
+
align?: "left" | "justify";
|
|
876
|
+
}
|
|
877
|
+
export interface LayerSpec {
|
|
878
|
+
id: string;
|
|
879
|
+
name?: string;
|
|
880
|
+
kind: PlotKind;
|
|
881
|
+
/** Column ids per aesthetic. Which aesthetics apply depends on the kind. */
|
|
882
|
+
aes: Aes;
|
|
883
|
+
/** Aggregate applied when the channel binds a dimension and not a record. */
|
|
884
|
+
aggregate?: Aggregate;
|
|
885
|
+
/**
|
|
886
|
+
* Reads the series as a running total along its axis.
|
|
887
|
+
*
|
|
888
|
+
* With no aggregate the series sums. A bar, a line, an area and a frequency polygon draw one.
|
|
889
|
+
*/
|
|
890
|
+
cumulative?: boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Which vertical scale this layer reads, `scales.y` or `scales.y2`. Absent reads `y`.
|
|
893
|
+
*
|
|
894
|
+
* A titre in mg/mL against a KD in nM on one scale draws one layer as a flat line.
|
|
895
|
+
*/
|
|
896
|
+
axis?: "y" | "y2";
|
|
897
|
+
style?: LayerStyle;
|
|
898
|
+
/**
|
|
899
|
+
* The interval drawn around each reduction. Absent draws none.
|
|
900
|
+
*
|
|
901
|
+
* `sd` is the readings' spread and `sem` pins down their mean. One reading gets no interval.
|
|
902
|
+
*/
|
|
903
|
+
error?: "sd" | "sem";
|
|
904
|
+
/**
|
|
905
|
+
* Draws the readings behind each group over the geom. Absent draws none.
|
|
906
|
+
*
|
|
907
|
+
* Read where the axis holds categories. A count has no readings to show.
|
|
908
|
+
*/
|
|
909
|
+
replicates?: boolean;
|
|
910
|
+
/**
|
|
911
|
+
* What happens where this geom shares a band with another.
|
|
912
|
+
*
|
|
913
|
+
* Absent stacks the groups of a bar, a histogram or an area, as ggplot does, and overlaps the rest.
|
|
914
|
+
* `stack` sets each geom on the running total. `dodge` gives each geom its own slot.
|
|
915
|
+
*/
|
|
916
|
+
position?: Position;
|
|
917
|
+
/** Direct labels on this series' geoms. Absent means none. */
|
|
918
|
+
directLabels?: LabelRule;
|
|
919
|
+
/**
|
|
920
|
+
* The value written on each geom, where the kind writes one: a grid's cells, a slice, a sector or a
|
|
921
|
+
* dial. Absent writes none.
|
|
922
|
+
*
|
|
923
|
+
* Content, beside `directLabels`, which names the geoms.
|
|
924
|
+
*/
|
|
925
|
+
numbers?: CellNumbers;
|
|
926
|
+
/** A curve fitted through this series' geoms. Absent means none. */
|
|
927
|
+
fit?: FitSpec;
|
|
928
|
+
/**
|
|
929
|
+
* The smoother a series of kind `smooth` runs. Ignored by the rest.
|
|
930
|
+
*
|
|
931
|
+
* A fit hangs off the geom it was fitted through. A smooth is the layer.
|
|
932
|
+
*/
|
|
933
|
+
smooth?: SmoothSpec;
|
|
934
|
+
/**
|
|
935
|
+
* Parameters of the statistics this series' kind runs. Absent takes each default.
|
|
936
|
+
*
|
|
937
|
+
* `StatOptions` keyed by the statistics in the kind's `GRAMMAR` row. Other names are dropped.
|
|
938
|
+
*/
|
|
939
|
+
statParams?: StatParams;
|
|
940
|
+
/**
|
|
941
|
+
* Rings stacked outside a circular figure, innermost first.
|
|
942
|
+
*
|
|
943
|
+
* Each one reads a column of the same table against the sectors the figure drew.
|
|
944
|
+
*/
|
|
945
|
+
rings?: readonly RingPanel[];
|
|
946
|
+
/**
|
|
947
|
+
* Columns holding the far end of a link, drawn inside the figure.
|
|
948
|
+
*
|
|
949
|
+
* The near end is the figure's own position channels. A row naming a far end draws no tile.
|
|
950
|
+
*/
|
|
951
|
+
links?: LinkFields;
|
|
952
|
+
/**
|
|
953
|
+
* The magnitude map this series paints from. Absent takes the chart's own.
|
|
954
|
+
*
|
|
955
|
+
* A name out of the palette registry. Two series each binding a measure to color need this.
|
|
956
|
+
*/
|
|
957
|
+
palette?: PaletteName;
|
|
958
|
+
/**
|
|
959
|
+
* What this layer states about its own scales, over the chart's.
|
|
960
|
+
*
|
|
961
|
+
* The chart's scale on the same aesthetic is the default and this wins field by field.
|
|
962
|
+
*/
|
|
963
|
+
scales?: {
|
|
964
|
+
color?: ColorScale;
|
|
965
|
+
fill?: ColorScale;
|
|
966
|
+
};
|
|
967
|
+
visible?: boolean;
|
|
968
|
+
/**
|
|
969
|
+
* Rows this layer reads in place of the chart's table. ggplot's `data`.
|
|
970
|
+
*
|
|
971
|
+
* Saved with the spec. A column the chart's table also has takes its label and unit.
|
|
972
|
+
*/
|
|
973
|
+
data?: readonly Record<string, string | number | boolean | null>[];
|
|
974
|
+
/** Whether this layer reaches the legend. ggplot's `show.legend`. Absent reaches it. */
|
|
975
|
+
showLegend?: boolean;
|
|
976
|
+
}
|
|
977
|
+
/** Data coordinates. An annotation survives a zoom, a rescale or a re-query. */
|
|
978
|
+
export interface Anchor {
|
|
979
|
+
x: number | string;
|
|
980
|
+
y: number | string;
|
|
981
|
+
}
|
|
982
|
+
export interface Leader {
|
|
983
|
+
shape: "straight" | "curved";
|
|
984
|
+
toward: Anchor;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* What a scientist wrote on the chart.
|
|
988
|
+
*
|
|
989
|
+
* Saved with the plot. The builder panel seeds `axis-end` from a measure's direction. A reference
|
|
990
|
+
* line is an `hline` or `vline` layer.
|
|
991
|
+
*/
|
|
992
|
+
export type Annotation = {
|
|
993
|
+
kind: "note";
|
|
994
|
+
text: string;
|
|
995
|
+
at: Anchor;
|
|
996
|
+
leader?: Leader;
|
|
997
|
+
align?: "left" | "center" | "right";
|
|
998
|
+
} | {
|
|
999
|
+
kind: "axis-end";
|
|
1000
|
+
axis: "x" | "y";
|
|
1001
|
+
end: "low" | "high";
|
|
1002
|
+
text: string;
|
|
1003
|
+
};
|
|
1004
|
+
/** The spec format this version of the package writes, stated on `ChartSpec.version`. */
|
|
1005
|
+
export declare const SPEC_VERSION = 1;
|
|
1006
|
+
/**
|
|
1007
|
+
* What the pipeline reads -- the chart itself, apart from where it is kept.
|
|
1008
|
+
*
|
|
1009
|
+
* `buildFrame`, `buildLayers` and `critique` read these fields. `StoredSpec` adds where a host
|
|
1010
|
+
* keeps it.
|
|
1011
|
+
*/
|
|
1012
|
+
export interface ChartSpec {
|
|
1013
|
+
/** The spec format, `SPEC_VERSION`. The builder writes it, and absent reads as this format. */
|
|
1014
|
+
version?: typeof SPEC_VERSION;
|
|
1015
|
+
id: string;
|
|
1016
|
+
/** The claim the chart makes, written as a sentence. Rendered as the headline. */
|
|
1017
|
+
headline?: string;
|
|
1018
|
+
/** What is plotted, with units. Rendered under the headline. */
|
|
1019
|
+
subtitle?: string;
|
|
1020
|
+
/** Provenance, written on the footer line beside what the figure admits. ggplot's `labs(caption =)`. */
|
|
1021
|
+
caption?: string;
|
|
1022
|
+
layers: readonly LayerSpec[];
|
|
1023
|
+
/**
|
|
1024
|
+
* A small-multiple grid, one panel per value of `by`. ggplot's `facet_wrap`.
|
|
1025
|
+
*
|
|
1026
|
+
* `columns` is panels per row, `ncol`. Absent divides the width by the narrowest panel worth a column.
|
|
1027
|
+
*/
|
|
1028
|
+
facet?: {
|
|
1029
|
+
by: string;
|
|
1030
|
+
columns?: number;
|
|
1031
|
+
};
|
|
1032
|
+
/**
|
|
1033
|
+
* Which way round the shared pair of scales draws. Absent draws `cartesian`.
|
|
1034
|
+
*
|
|
1035
|
+
* `flip` swaps the roles, ggplot's `coord_flip`. The names stay with the data and the frame swaps
|
|
1036
|
+
* at the end. Polar is no value here: the circular kinds, such as `pie` and `radar`, carry it.
|
|
1037
|
+
*/
|
|
1038
|
+
coord?: "cartesian" | "flip";
|
|
1039
|
+
/** What an author states on each scale, keyed by the aesthetic it maps. The data answers the rest. */
|
|
1040
|
+
scales?: ChartScales;
|
|
1041
|
+
/**
|
|
1042
|
+
* Fields the tooltip adds, in order.
|
|
1043
|
+
*
|
|
1044
|
+
* The useful line is often one nobody plotted. Empty means the bound channels alone.
|
|
1045
|
+
*/
|
|
1046
|
+
tooltip?: readonly string[];
|
|
1047
|
+
/** What the author wrote on the chart. Absent writes nothing. */
|
|
1048
|
+
annotations?: readonly Annotation[];
|
|
1049
|
+
/**
|
|
1050
|
+
* Findings the author read and disagreed with, by code.
|
|
1051
|
+
*
|
|
1052
|
+
* A `wrong` finding stops a save. Naming its code here lets it through. The footer reports it.
|
|
1053
|
+
* `headline-missing` is no code an override names.
|
|
1054
|
+
*/
|
|
1055
|
+
overrides?: readonly WaivableCode[];
|
|
1056
|
+
/**
|
|
1057
|
+
* Where the legends draw and how they read.
|
|
1058
|
+
*
|
|
1059
|
+
* Chart-design rule 2 asks for a legend outside the plot area. Applies to all three legends.
|
|
1060
|
+
*/
|
|
1061
|
+
legend?: LegendOptions;
|
|
1062
|
+
/**
|
|
1063
|
+
* Panels drawn beside the plot area, each sharing one of its axes.
|
|
1064
|
+
*
|
|
1065
|
+
* A layout field on the spec. The spec travels with the figure.
|
|
1066
|
+
*/
|
|
1067
|
+
sides?: readonly SidePanel[];
|
|
1068
|
+
/**
|
|
1069
|
+
* The figure's drawing height in pixels: the panel, or a facet's whole grid.
|
|
1070
|
+
*
|
|
1071
|
+
* A facet's rows divide it, less their strips and the axis title under them. The headline, the
|
|
1072
|
+
* legend and the caption sit outside it.
|
|
1073
|
+
*/
|
|
1074
|
+
height?: number;
|
|
1075
|
+
/**
|
|
1076
|
+
* Whether the figure fills the room it is given or the room its content asks for.
|
|
1077
|
+
*
|
|
1078
|
+
* `container` is the default. `content` lets a stated `bandSize` decide the plot area.
|
|
1079
|
+
*/
|
|
1080
|
+
sizing?: "container" | "content";
|
|
1081
|
+
/**
|
|
1082
|
+
* The figure's width in pixels, where it states its own. A facet's columns and a side legend divide it.
|
|
1083
|
+
*
|
|
1084
|
+
* Absent, the figure measures the element it draws in. A stated width also sizes that element.
|
|
1085
|
+
*/
|
|
1086
|
+
width?: number;
|
|
1087
|
+
/**
|
|
1088
|
+
* Panel height over panel width, a fraction. ggplot's `aspect.ratio`: 2 draws a panel twice as tall as wide.
|
|
1089
|
+
*
|
|
1090
|
+
* The height follows the width each panel was given. An explicit `height` wins.
|
|
1091
|
+
*/
|
|
1092
|
+
aspect?: number;
|
|
1093
|
+
/**
|
|
1094
|
+
* Units of y per unit of x on screen, in transformed space. ggplot's `coord_fixed(ratio)`.
|
|
1095
|
+
*
|
|
1096
|
+
* The height follows from the width and the two domains, over `height` and `aspect`. One draws
|
|
1097
|
+
* a unit line at 45 degrees on matching axes. `aspect` shapes the panel and this shapes the data.
|
|
1098
|
+
*/
|
|
1099
|
+
ratio?: number;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* A chart as a host keeps it: the spec, the table it reads, and when it last changed.
|
|
1103
|
+
*
|
|
1104
|
+
* A host's own identity fields ride through the generic editors and `PlotPanel` on its own subtype.
|
|
1105
|
+
*/
|
|
1106
|
+
export interface StoredSpec extends ChartSpec {
|
|
1107
|
+
/** The table this plot reads. Named by the plot and the same on each surface. */
|
|
1108
|
+
source?: PlotSource;
|
|
1109
|
+
/** When the host last saved it, in epoch milliseconds. The host stamps it. */
|
|
1110
|
+
updatedAt?: number;
|
|
1111
|
+
}
|