@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,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns built layers into the axes, scales and footer.
|
|
3
|
+
*
|
|
4
|
+
* Faceting partitions one plot into panels and each panel derives its own axes. The fit footer
|
|
5
|
+
* stays apart from the build.
|
|
6
|
+
*/
|
|
7
|
+
import { type AxisKind, type BuildOptions, type LayerPoint, type Palettes, type Trace } from "./layers.js";
|
|
8
|
+
import { type Omission } from "./omission.js";
|
|
9
|
+
import { type ClusterTree } from "./band-order.js";
|
|
10
|
+
import { type SideTrack } from "./side-track.js";
|
|
11
|
+
import { type Marginal } from "./marginal.js";
|
|
12
|
+
import { type Metrics } from "./sizing.js";
|
|
13
|
+
import type { FitState } from "./fit-types.js";
|
|
14
|
+
import type { Fit } from "./fit-types.js";
|
|
15
|
+
import { type AxisRanges } from "./brush.js";
|
|
16
|
+
import { type PlotData, type PlotField } from "./plot-data.js";
|
|
17
|
+
import { type Annotation, type ChartScales, type ChartSpec, type LegendOptions, type PlotKind, type LayerSpec } from "./spec.js";
|
|
18
|
+
import { type AxisEnd, type AxisSpec, type FrameNote, type LinearAxisSpec, type Scale } from "./frame-geometry.js";
|
|
19
|
+
/** Series counts above this draw translucent, per chart-design rule 7. */
|
|
20
|
+
export declare const FADE_ABOVE = 1500;
|
|
21
|
+
/**
|
|
22
|
+
* Where a scatter moves from SVG to the GPU.
|
|
23
|
+
*
|
|
24
|
+
* The path strings break first. A quarter of a million geoms is megabytes of string per recolor.
|
|
25
|
+
*/
|
|
26
|
+
export declare const GL_ABOVE = 15000;
|
|
27
|
+
/** What rule 7's third row draws in place of one geom per record. */
|
|
28
|
+
export type PointTreatment = "points" | "faded" | "binned";
|
|
29
|
+
/**
|
|
30
|
+
* Which of the three treatments a count asks for.
|
|
31
|
+
*
|
|
32
|
+
* One function. The renderer picking a treatment and the footer stating it read one threshold.
|
|
33
|
+
*/
|
|
34
|
+
export declare const treatmentOf: (count: number) => PointTreatment;
|
|
35
|
+
/**
|
|
36
|
+
* Records the frame is holding as individual geoms.
|
|
37
|
+
*
|
|
38
|
+
* Counted over point traces alone. A trace drawing a hexbin came from a density kind.
|
|
39
|
+
*/
|
|
40
|
+
export declare const pointCount: (frame: ReadyFrame) => number;
|
|
41
|
+
/**
|
|
42
|
+
* What drew, where a count forced something other than one geom per record.
|
|
43
|
+
*
|
|
44
|
+
* The renderer decides this and the frame cannot see it. It reaches the footer as an argument.
|
|
45
|
+
*/
|
|
46
|
+
export interface Substitution {
|
|
47
|
+
/** The geom that stood in. */
|
|
48
|
+
drew: "hexbin" | "contour" | "density grid";
|
|
49
|
+
cells: number;
|
|
50
|
+
rows: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether two reports say the same thing.
|
|
54
|
+
*
|
|
55
|
+
* A geom reports from an effect and the answer is a fresh object each firing. The comparison
|
|
56
|
+
* reads what was said.
|
|
57
|
+
*/
|
|
58
|
+
export declare const sameSubstitution: (a: Substitution | null, b: Substitution | null) => boolean;
|
|
59
|
+
/** Categories drawn before the labels stop fitting under the axis. */
|
|
60
|
+
export declare const CATEGORY_CAP = 60;
|
|
61
|
+
/**
|
|
62
|
+
* Categories a content-sized figure draws.
|
|
63
|
+
*
|
|
64
|
+
* A stated band size decides the plot area and the figure grows to hold it. What runs out is the
|
|
65
|
+
* document.
|
|
66
|
+
*/
|
|
67
|
+
export declare const GROWN_CAP = 1000;
|
|
68
|
+
/**
|
|
69
|
+
* Confidence bands drawn before they stop being readable.
|
|
70
|
+
*
|
|
71
|
+
* Translucent areas compound. Forty of them stack into a solid wash. Past this the curves draw
|
|
72
|
+
* alone and the footer reports it.
|
|
73
|
+
*/
|
|
74
|
+
export declare const BAND_LIMIT = 12;
|
|
75
|
+
export declare const axisLabel: (field: PlotField | undefined) => string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Points a trace holds, for records on the frame's own pair of scales.
|
|
78
|
+
*
|
|
79
|
+
* A reduction holds groups. A parallel trace draws across its own rules. A band has two bounds.
|
|
80
|
+
*/
|
|
81
|
+
export declare const pointsOf: (trace: Trace) => LayerPoint[];
|
|
82
|
+
/**
|
|
83
|
+
* The plot's annotations, in the shapes `Frame` draws.
|
|
84
|
+
*
|
|
85
|
+
* An author names the data and a transpose swaps here.
|
|
86
|
+
*/
|
|
87
|
+
declare function annotationLayers(annotations: readonly Annotation[], swapped?: boolean): {
|
|
88
|
+
axisEnds: AxisEnd[];
|
|
89
|
+
notes: FrameNote[];
|
|
90
|
+
};
|
|
91
|
+
/** Geoms a label rule chose on one trace, and how many more qualified. */
|
|
92
|
+
export interface LabeledTrace {
|
|
93
|
+
trace: Trace;
|
|
94
|
+
indices: number[];
|
|
95
|
+
dropped: number;
|
|
96
|
+
}
|
|
97
|
+
export interface LegendRow {
|
|
98
|
+
key: string;
|
|
99
|
+
label: string;
|
|
100
|
+
color: string;
|
|
101
|
+
/** Set where the row's geoms read the right-hand scale. */
|
|
102
|
+
right?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* What the legend names -- a split value, or a series.
|
|
106
|
+
*
|
|
107
|
+
* Two series over one split field draw the same color for one value. They share a row. `geoms`
|
|
108
|
+
* order reads the lines the way they end.
|
|
109
|
+
*/
|
|
110
|
+
export declare function legendRows(traces: Trace[], order?: LegendOptions["order"]): LegendRow[];
|
|
111
|
+
/**
|
|
112
|
+
* Curves belonging to one trace.
|
|
113
|
+
*
|
|
114
|
+
* A split fits per value and `curvesByGroup` names each curve after its value. An unsplit series
|
|
115
|
+
* takes them all.
|
|
116
|
+
*/
|
|
117
|
+
export declare function fitsFor(trace: Trace, fitted: FitState, panel?: string): Fit[];
|
|
118
|
+
/**
|
|
119
|
+
* Curves the frame will draw.
|
|
120
|
+
*
|
|
121
|
+
* The service fits per split value and the trace cap keeps two dozen. A count off the response
|
|
122
|
+
* says 41 where the reader sees 24.
|
|
123
|
+
*/
|
|
124
|
+
export declare const drawnFits: (traces: Trace[], fitted: FitState) => Fit[];
|
|
125
|
+
/** Everything derived from a spec and its rows, before a pixel is known. */
|
|
126
|
+
export interface ReadyFrame {
|
|
127
|
+
status: "ready";
|
|
128
|
+
traces: Trace[];
|
|
129
|
+
axisKind: AxisKind;
|
|
130
|
+
/** Absent where nothing reads a horizontal axis. */
|
|
131
|
+
xField?: PlotField;
|
|
132
|
+
unbuilt: PlotKind[];
|
|
133
|
+
/**
|
|
134
|
+
* Set where no trace draws against an axis. The panel hands the geoms its whole area.
|
|
135
|
+
*
|
|
136
|
+
* A treemap positions by nesting.
|
|
137
|
+
*/
|
|
138
|
+
axisFree: boolean;
|
|
139
|
+
/** Traces that occupy a slot in the band, in the order they divide it. */
|
|
140
|
+
slotted: Trace[];
|
|
141
|
+
x: AxisSpec;
|
|
142
|
+
/**
|
|
143
|
+
* A value scale, or a band where the geoms name categories on both axes.
|
|
144
|
+
*
|
|
145
|
+
* A heatmap is the one geom that does. The rest read a measure vertically.
|
|
146
|
+
*/
|
|
147
|
+
y: AxisSpec;
|
|
148
|
+
margin: {
|
|
149
|
+
top: number;
|
|
150
|
+
right: number;
|
|
151
|
+
bottom: number;
|
|
152
|
+
left: number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Domain of the right-hand axis, or null where no series reads it.
|
|
156
|
+
*
|
|
157
|
+
* A domain, and faceting shares it. Two panels agreeing about a measure is a fact about
|
|
158
|
+
* numbers.
|
|
159
|
+
*/
|
|
160
|
+
rightDomain: [number, number] | null;
|
|
161
|
+
/** The right-hand scale past its domain: transform, breaks and clamp. Null where no series reads it. */
|
|
162
|
+
rightAxis: Omit<LinearAxisSpec, "domain"> | null;
|
|
163
|
+
annotations: ReturnType<typeof annotationLayers>;
|
|
164
|
+
labeled: LabeledTrace[];
|
|
165
|
+
/** The label rule in words. A reader learns which points were eligible for a name. */
|
|
166
|
+
labelRule: string | null;
|
|
167
|
+
/**
|
|
168
|
+
* Bands where a cluster order was asked for and the cap refused.
|
|
169
|
+
*
|
|
170
|
+
* A refused grid draws in the build order. The critic turns this into a finding.
|
|
171
|
+
*/
|
|
172
|
+
clusterRefused: {
|
|
173
|
+
axis: "x" | "y";
|
|
174
|
+
rows: number;
|
|
175
|
+
cap: number;
|
|
176
|
+
}[];
|
|
177
|
+
/**
|
|
178
|
+
* The trees the bands' cluster orders came out of, per axis.
|
|
179
|
+
*
|
|
180
|
+
* A dendrogram side panel draws this. Null on a stated list and on a refused cap.
|
|
181
|
+
*/
|
|
182
|
+
clusterTrees: {
|
|
183
|
+
x: ClusterTree | null;
|
|
184
|
+
y: ClusterTree | null;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* The spec's annotation tracks, resolved onto the categories the bands drew.
|
|
188
|
+
*
|
|
189
|
+
* The reduction reads the table and the band. A track resolving to nothing is absent.
|
|
190
|
+
*/
|
|
191
|
+
tracks: SideTrack[];
|
|
192
|
+
/**
|
|
193
|
+
* What the marginal panels read off the geoms, per side that asked.
|
|
194
|
+
*
|
|
195
|
+
* The answer is a walk of the cloud. Two panels on one axis share the readings by reference.
|
|
196
|
+
*/
|
|
197
|
+
marginals: Marginal[];
|
|
198
|
+
/**
|
|
199
|
+
* One ledger of what the figure left out. The footer states it.
|
|
200
|
+
*
|
|
201
|
+
* The build's caps arrive on it and the frame's push here. A facet's dropped panels join at
|
|
202
|
+
* `footerOf`.
|
|
203
|
+
*/
|
|
204
|
+
omitted: Omission[];
|
|
205
|
+
/** Whether the plot area clips its geoms, which a stated range asks for. Absent leaves it open. */
|
|
206
|
+
clip?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Whether the shared pair drew with its roles swapped.
|
|
209
|
+
*
|
|
210
|
+
* Read off here. The frame refuses a transpose where the geoms read no shared pair.
|
|
211
|
+
*/
|
|
212
|
+
transposed: boolean;
|
|
213
|
+
/** One row per split value, or per series where nothing splits. */
|
|
214
|
+
legend: LegendRow[];
|
|
215
|
+
fieldAt: Map<string, PlotField>;
|
|
216
|
+
/**
|
|
217
|
+
* The sizing this frame was built at.
|
|
218
|
+
*
|
|
219
|
+
* The axis type size and tick length are already in `x` and `y`. This is for the annotation
|
|
220
|
+
* type and the geom radii.
|
|
221
|
+
*/
|
|
222
|
+
metrics: Metrics;
|
|
223
|
+
}
|
|
224
|
+
export type PlotFrame = ReadyFrame | {
|
|
225
|
+
status: "empty";
|
|
226
|
+
title: string;
|
|
227
|
+
reason: string;
|
|
228
|
+
};
|
|
229
|
+
export declare function buildFrame(plot: ChartSpec, data: PlotData, { palettes: palette, metrics, pinned, facet }: BuildOptions): PlotFrame;
|
|
230
|
+
/**
|
|
231
|
+
* Panels a facet draws.
|
|
232
|
+
*
|
|
233
|
+
* Twelve is where a small multiple stops reading at a tile's width. Chart-design rule 6 names it.
|
|
234
|
+
*/
|
|
235
|
+
export declare const FACET_CAP = 12;
|
|
236
|
+
/** The right-hand scale, built per render. It reads the plot area's height and the frame's `rightAxis`. */
|
|
237
|
+
export declare const rightScaleFor: (domain: [number, number] | null, innerHeight: number, axis?: Omit<LinearAxisSpec, "domain"> | null) => Scale | null;
|
|
238
|
+
export interface FacetPanel {
|
|
239
|
+
/** Value of the facet field, or the empty string where the plot draws one panel. */
|
|
240
|
+
value: string;
|
|
241
|
+
/** Rows behind the panel, which chart-design rule 6 asks be written under its title. */
|
|
242
|
+
count: number;
|
|
243
|
+
frame: ReadyFrame;
|
|
244
|
+
}
|
|
245
|
+
export type PlotPanels = {
|
|
246
|
+
status: "ready";
|
|
247
|
+
panels: FacetPanel[];
|
|
248
|
+
facetField?: PlotField;
|
|
249
|
+
/** Panels the cap refused. */
|
|
250
|
+
facetDropped: number;
|
|
251
|
+
} | {
|
|
252
|
+
status: "empty";
|
|
253
|
+
title: string;
|
|
254
|
+
reason: string;
|
|
255
|
+
};
|
|
256
|
+
/** Rows under each value of the facet field, ranked by size. Empty where the plot draws one panel. */
|
|
257
|
+
export interface Partition {
|
|
258
|
+
field?: PlotField;
|
|
259
|
+
groups: [string, number[]][];
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Which rows belong to which panel.
|
|
263
|
+
*
|
|
264
|
+
* The expensive half, apart from the build. Re-cutting the rows into panels needs the facet
|
|
265
|
+
* field or the table to change.
|
|
266
|
+
*/
|
|
267
|
+
export declare function partitionOf(plot: ChartSpec, data: PlotData): Partition;
|
|
268
|
+
/**
|
|
269
|
+
* The spec as far as the build reads it.
|
|
270
|
+
*
|
|
271
|
+
* Written as everything-but. `style.fill`, `style.color`, `updatedAt` and most of `scales.color`
|
|
272
|
+
* come out. `scale` stays.
|
|
273
|
+
*/
|
|
274
|
+
export declare const shapeOf: (plot: ChartSpec) => string;
|
|
275
|
+
/**
|
|
276
|
+
* What `paint` reads -- the colors the author picked and the ramp settings they dragged.
|
|
277
|
+
*
|
|
278
|
+
* The ramp goes in whole. A setting added to `ColorScale` reaches `paint` through the spread.
|
|
279
|
+
*/
|
|
280
|
+
export declare const colorsOf: (plot: ChartSpec) => string;
|
|
281
|
+
/**
|
|
282
|
+
* The author's colors laid over the palette's.
|
|
283
|
+
*
|
|
284
|
+
* This walks the traces. A series' own color reaches four places, and a scaled channel repaints
|
|
285
|
+
* over `Trace.colorExtent`.
|
|
286
|
+
*/
|
|
287
|
+
export declare function paint(built: PlotPanels, series: readonly LayerSpec[], palettes: Palettes, scales?: ChartScales): PlotPanels;
|
|
288
|
+
/** Lines a set of ranges kept, against the lines the build drew. */
|
|
289
|
+
export interface Kept {
|
|
290
|
+
within: number;
|
|
291
|
+
of: number;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The build with the reader's ranges laid over it.
|
|
295
|
+
*
|
|
296
|
+
* A third pass beside `paint`. A dragged range changes which records draw.
|
|
297
|
+
*/
|
|
298
|
+
export declare function narrow(built: PlotPanels, ranges: AxisRanges): {
|
|
299
|
+
panels: PlotPanels;
|
|
300
|
+
kept: Kept | null;
|
|
301
|
+
};
|
|
302
|
+
export declare function buildPanels(plot: ChartSpec, data: PlotData, { palettes: palette, partition, metrics, pinned }: BuildOptions & {
|
|
303
|
+
partition: Partition;
|
|
304
|
+
}): PlotPanels;
|
|
305
|
+
/**
|
|
306
|
+
* Counts of the curves a fit drew and the ones it failed on.
|
|
307
|
+
*
|
|
308
|
+
* A failed curve leaves no geom on the chart. Both counts are stated.
|
|
309
|
+
*/
|
|
310
|
+
export declare function fitNote(fitted: FitState, all: Fit[]): string[];
|
|
311
|
+
/**
|
|
312
|
+
* The footer's one sentence.
|
|
313
|
+
*
|
|
314
|
+
* Only what a reader would otherwise get wrong. `held` is what the reader took out and leads the
|
|
315
|
+
* list.
|
|
316
|
+
*/
|
|
317
|
+
/** What the footer reads beside the frame. */
|
|
318
|
+
export interface FooterOptions {
|
|
319
|
+
/** The fits the fitter answered, and whether any are pending. */
|
|
320
|
+
fitted: FitState;
|
|
321
|
+
/** Facet levels past the cap, which the sentence counts. */
|
|
322
|
+
facetDropped?: number;
|
|
323
|
+
/** What the reader took out, which leads the sentence. */
|
|
324
|
+
held?: string[];
|
|
325
|
+
/** What a geom drew in place of the one the spec asked for. */
|
|
326
|
+
substituted?: Substitution;
|
|
327
|
+
}
|
|
328
|
+
export declare function footerOf(frame: ReadyFrame, { fitted, facetDropped, held, substituted }: FooterOptions): string | undefined;
|
|
329
|
+
export {};
|