@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,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The line geom: one path through readings ordered along the axis.
|
|
3
|
+
*
|
|
4
|
+
* The last of the drawn geometries to get a component, which is what kept the `line` kind out of
|
|
5
|
+
* the facade: `buildLayers` resolved it, and nothing in `/react` could draw the result. It draws
|
|
6
|
+
* both payloads the layer engine produces for the kind. On a value scale the trace carries records
|
|
7
|
+
* and the path runs through them; on a band scale the trace carries a reduction and the path runs
|
|
8
|
+
* through the group centers, which is what a trend over categories means.
|
|
9
|
+
*
|
|
10
|
+
* No dots on the vertices by default. A line is the geom for a sequence read as a whole; a reader
|
|
11
|
+
* who needs the individual readings wants the scatter, not a beaded string.
|
|
12
|
+
*
|
|
13
|
+
* A step is a style and not a kind, since it runs the same statistic through the same geometry in
|
|
14
|
+
* the same coordinate system and differs in what it claims between two readings. A sloped segment
|
|
15
|
+
* says the value moved gradually, which is a claim nobody measured for a count, a stock level or a
|
|
16
|
+
* setting somebody changed.
|
|
17
|
+
*/
|
|
18
|
+
import { type Linetype, type LinePoint, type Scale } from "../../core/internal.js";
|
|
19
|
+
export type { LinePoint };
|
|
20
|
+
export interface LineProps {
|
|
21
|
+
/** In axis units, already ordered the way the line reads. */
|
|
22
|
+
points: LinePoint[];
|
|
23
|
+
x: Scale;
|
|
24
|
+
y: Scale;
|
|
25
|
+
color: string;
|
|
26
|
+
/**
|
|
27
|
+
* Where the value changes between two readings. Absent runs a straight segment.
|
|
28
|
+
*
|
|
29
|
+
* `after` holds a reading until the next one arrives, which is a run chart, a stock level or a
|
|
30
|
+
* setting left alone. `before` takes the new value at the step, which is a count that had already
|
|
31
|
+
* changed by the time somebody read it.
|
|
32
|
+
*/
|
|
33
|
+
step?: "after" | "before";
|
|
34
|
+
lineWidth?: number;
|
|
35
|
+
opacity?: number;
|
|
36
|
+
/** Pattern the run draws. Absent draws it whole, which is what a solid linetype means. */
|
|
37
|
+
dash?: Linetype;
|
|
38
|
+
}
|
|
39
|
+
export declare function Line({ points, x, y, color, step, lineWidth, opacity, dash }: LineProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The line geom: one path through readings ordered along the axis.
|
|
4
|
+
*
|
|
5
|
+
* The last of the drawn geometries to get a component, which is what kept the `line` kind out of
|
|
6
|
+
* the facade: `buildLayers` resolved it, and nothing in `/react` could draw the result. It draws
|
|
7
|
+
* both payloads the layer engine produces for the kind. On a value scale the trace carries records
|
|
8
|
+
* and the path runs through them; on a band scale the trace carries a reduction and the path runs
|
|
9
|
+
* through the group centers, which is what a trend over categories means.
|
|
10
|
+
*
|
|
11
|
+
* No dots on the vertices by default. A line is the geom for a sequence read as a whole; a reader
|
|
12
|
+
* who needs the individual readings wants the scatter, not a beaded string.
|
|
13
|
+
*
|
|
14
|
+
* A step is a style and not a kind, since it runs the same statistic through the same geometry in
|
|
15
|
+
* the same coordinate system and differs in what it claims between two readings. A sloped segment
|
|
16
|
+
* says the value moved gradually, which is a claim nobody measured for a count, a stock level or a
|
|
17
|
+
* setting somebody changed.
|
|
18
|
+
*/
|
|
19
|
+
import { useMemo } from "react";
|
|
20
|
+
import { dashArray } from "../../core/internal.js";
|
|
21
|
+
export function Line({ points, x, y, color, step, lineWidth = 1.5, opacity = 1, dash }) {
|
|
22
|
+
const d = useMemo(() => {
|
|
23
|
+
const at = (point) => [x(point.x).toFixed(2), y(point.y).toFixed(2)];
|
|
24
|
+
let path = "";
|
|
25
|
+
let last;
|
|
26
|
+
for (const point of points) {
|
|
27
|
+
const [px, py] = at(point);
|
|
28
|
+
if (!last) {
|
|
29
|
+
path = `M${px},${py}`;
|
|
30
|
+
}
|
|
31
|
+
else if (point.gap) {
|
|
32
|
+
/* A missing reading between the two. The path lifts and starts again. */
|
|
33
|
+
path += `M${px},${py}`;
|
|
34
|
+
}
|
|
35
|
+
else if (step === "after") {
|
|
36
|
+
/* Along at the old height, then up at the new reading's own position. */
|
|
37
|
+
path += `L${px},${at(last)[1]}L${px},${py}`;
|
|
38
|
+
}
|
|
39
|
+
else if (step === "before") {
|
|
40
|
+
path += `L${at(last)[0]},${py}L${px},${py}`;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
path += `L${px},${py}`;
|
|
44
|
+
}
|
|
45
|
+
last = point;
|
|
46
|
+
}
|
|
47
|
+
return path;
|
|
48
|
+
}, [points, x, y, step]);
|
|
49
|
+
if (points.length < 2)
|
|
50
|
+
return null;
|
|
51
|
+
return (_jsx("path", { d: d, fill: "none", stroke: color, strokeWidth: lineWidth, strokeOpacity: opacity, strokeDasharray: dashArray(dash), strokeLinejoin: "round", strokeLinecap: "round" }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel coordinates: one line per record, across a rule per measure.
|
|
3
|
+
*
|
|
4
|
+
* The trade-off view. Four measures held at once is the question, and a shared pair of axes cannot
|
|
5
|
+
* express it, so this geom takes the panel whole and draws its own rules in each measure's own units.
|
|
6
|
+
* `GRAMMAR` answers `false` for the kind's axial coordinate, which is what stops the frame drawing a
|
|
7
|
+
* horizontal rule under it.
|
|
8
|
+
*
|
|
9
|
+
* A range dragged on a rule is the tool that turns the picture into an answer, per the ADR "A range
|
|
10
|
+
* on an axis filters the parallel plot". The arithmetic is `/core`'s: `axisLayout` puts the rules
|
|
11
|
+
* down, `valueOn` reads a drag back into the measure's units, and the caller narrows the build with
|
|
12
|
+
* what comes out. The geom holds no ranges of its own, since the figure states what was kept and one
|
|
13
|
+
* of the two would otherwise be reporting a filter the other did not apply.
|
|
14
|
+
*
|
|
15
|
+
* Hover searches the lines and not the pixels. A polyline a pixel wide is not something a hand
|
|
16
|
+
* points at, so `nearestLine` answers with whichever record runs closest.
|
|
17
|
+
*/
|
|
18
|
+
import { type AxisRanges, type GeomHit, type ParallelAxis, type ParallelLine } from "../../core/internal.js";
|
|
19
|
+
import type { ValueRamp } from "../../core/internal.js";
|
|
20
|
+
export interface ParallelProps {
|
|
21
|
+
axes: ParallelAxis[];
|
|
22
|
+
lines: ParallelLine[];
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
/** Maps a line's weight to a color. Lines with no weight take `color`. */
|
|
26
|
+
ramp: ValueRamp;
|
|
27
|
+
color: string;
|
|
28
|
+
/** Opacity of a line at rest. Absent is 0.7. */
|
|
29
|
+
opacity?: number;
|
|
30
|
+
/** The ranges in force. The caller holds them, since the caller is what narrows the build. */
|
|
31
|
+
ranges?: AxisRanges;
|
|
32
|
+
onRanges?: (next: AxisRanges) => void;
|
|
33
|
+
format?: (value: number) => string;
|
|
34
|
+
/** The record whose line runs nearest the pointer, placed where the line passes it. */
|
|
35
|
+
onHover?: (hit: GeomHit<ParallelLine> | null) => void;
|
|
36
|
+
onSelect?: (hit: GeomHit<ParallelLine>) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare function Parallel({ axes, lines, width, height, ramp, color, opacity, ranges, onRanges, format, onHover, onSelect, }: ParallelProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Parallel coordinates: one line per record, across a rule per measure.
|
|
4
|
+
*
|
|
5
|
+
* The trade-off view. Four measures held at once is the question, and a shared pair of axes cannot
|
|
6
|
+
* express it, so this geom takes the panel whole and draws its own rules in each measure's own units.
|
|
7
|
+
* `GRAMMAR` answers `false` for the kind's axial coordinate, which is what stops the frame drawing a
|
|
8
|
+
* horizontal rule under it.
|
|
9
|
+
*
|
|
10
|
+
* A range dragged on a rule is the tool that turns the picture into an answer, per the ADR "A range
|
|
11
|
+
* on an axis filters the parallel plot". The arithmetic is `/core`'s: `axisLayout` puts the rules
|
|
12
|
+
* down, `valueOn` reads a drag back into the measure's units, and the caller narrows the build with
|
|
13
|
+
* what comes out. The geom holds no ranges of its own, since the figure states what was kept and one
|
|
14
|
+
* of the two would otherwise be reporting a filter the other did not apply.
|
|
15
|
+
*
|
|
16
|
+
* Hover searches the lines and not the pixels. A polyline a pixel wide is not something a hand
|
|
17
|
+
* points at, so `nearestLine` answers with whichever record runs closest.
|
|
18
|
+
*/
|
|
19
|
+
import { useMemo, useRef, useState } from "react";
|
|
20
|
+
import { axisLayout, boundsOf, extentOf, nearestLine, placeOn, setRange, valueOn, textRun, } from "../../core/internal.js";
|
|
21
|
+
/** Room for the measure's name above each rule and its low value below. */
|
|
22
|
+
const INSET = { x: 46, top: 26, bottom: 26 };
|
|
23
|
+
/** Type size of a rule's title, and the line pitch a wrapped title takes. */
|
|
24
|
+
const TITLE_SIZE = 11;
|
|
25
|
+
const TITLE_LINE = 13;
|
|
26
|
+
/** Clear space kept between two neighboring titles, and between an end title and the panel edge. */
|
|
27
|
+
const TITLE_GAP = 8;
|
|
28
|
+
/** A rule's title as lines. A title wider than its room puts the unit on a second line. */
|
|
29
|
+
function titleLines(label, room) {
|
|
30
|
+
if (textRun(label.length, TITLE_SIZE) <= room)
|
|
31
|
+
return [label];
|
|
32
|
+
const at = label.lastIndexOf(" (");
|
|
33
|
+
return at > 0 ? [label.slice(0, at), label.slice(at + 1)] : [label];
|
|
34
|
+
}
|
|
35
|
+
/** The widest line of a title, in pixels. */
|
|
36
|
+
const widest = (lines) => Math.max(0, boundsOf(lines.map((line) => textRun(line.length, TITLE_SIZE)))[1]);
|
|
37
|
+
/** The inset once the titles are placed: the end titles fit the panel and a wrapped title gets its line. A quarter of the panel caps each side. */
|
|
38
|
+
function insetFor(titles, width) {
|
|
39
|
+
const ends = [titles[0] ?? [], titles[titles.length - 1] ?? []].map((lines) => widest(lines) / 2 + TITLE_GAP);
|
|
40
|
+
const tall = titles.some((lines) => lines.length > 1);
|
|
41
|
+
const x = Math.min(Math.max(INSET.x, boundsOf(ends)[1]), Math.max(INSET.x, width / 4));
|
|
42
|
+
return { x, top: INSET.top + (tall ? TITLE_LINE : 0), bottom: INSET.bottom };
|
|
43
|
+
}
|
|
44
|
+
/** How wide the grab strip on a rule runs, so a range is draggable without covering the lines. */
|
|
45
|
+
const GRIP = 14;
|
|
46
|
+
/** Pixels a pointer may miss a line by and still be pointing at it. */
|
|
47
|
+
const REACH = 6;
|
|
48
|
+
const asText = (value) => value.toLocaleString(undefined, { maximumSignificantDigits: 3 });
|
|
49
|
+
export function Parallel({ axes, lines, width, height, ramp, color, opacity = 0.7, ranges = {}, onRanges, format = asText, onHover, onSelect, }) {
|
|
50
|
+
/* Wrapped twice. The second pass reads the room between the rules the first pass's inset leaves. */
|
|
51
|
+
const titles = useMemo(() => {
|
|
52
|
+
const wrap = (inset) => {
|
|
53
|
+
const room = axes.length > 1 ? (width - 2 * inset) / (axes.length - 1) - TITLE_GAP : width;
|
|
54
|
+
return axes.map((axis) => titleLines(axis.label, room));
|
|
55
|
+
};
|
|
56
|
+
return wrap(insetFor(wrap(INSET.x), width).x);
|
|
57
|
+
}, [axes, width]);
|
|
58
|
+
const layout = useMemo(() => axisLayout(axes, width, height, insetFor(titles, width)), [axes, width, height, titles]);
|
|
59
|
+
/* The rule under the hand and where the drag began, in that rule's own units. */
|
|
60
|
+
const dragging = useRef(null);
|
|
61
|
+
const [drag, setDrag] = useState(null);
|
|
62
|
+
const [hovered, setHovered] = useState(null);
|
|
63
|
+
const paths = useMemo(() => lines.map((line) => {
|
|
64
|
+
let path = "";
|
|
65
|
+
for (let at = 0; at < layout.at.length; at += 1) {
|
|
66
|
+
const value = line.values[at];
|
|
67
|
+
if (value == null)
|
|
68
|
+
break;
|
|
69
|
+
path += `${path ? "L" : "M"}${layout.at[at].toFixed(2)},${placeOn(value, layout.spans[at]).toFixed(2)}`;
|
|
70
|
+
}
|
|
71
|
+
return { path, color: line.weight == null ? color : ramp(line.weight) };
|
|
72
|
+
}), [lines, layout, ramp, color]);
|
|
73
|
+
const report = (event) => {
|
|
74
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
75
|
+
const found = nearestLine(lines, layout, event.clientX - box.left, event.clientY - box.top, REACH);
|
|
76
|
+
const hit = found && { datum: found.line, index: found.index, at: found.at };
|
|
77
|
+
setHovered(hit);
|
|
78
|
+
onHover?.(hit);
|
|
79
|
+
};
|
|
80
|
+
const clear = () => {
|
|
81
|
+
setHovered(null);
|
|
82
|
+
onHover?.(null);
|
|
83
|
+
};
|
|
84
|
+
/* The whole hit, kept from the hover. A click reports the position the pointer found. */
|
|
85
|
+
const take = () => {
|
|
86
|
+
if (hovered)
|
|
87
|
+
onSelect?.(hovered);
|
|
88
|
+
};
|
|
89
|
+
const startDrag = (axis, index) => (event) => {
|
|
90
|
+
if (!onRanges)
|
|
91
|
+
return;
|
|
92
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
93
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
94
|
+
const value = valueOn(event.clientY - box.top + layout.spans[index].top, layout.spans[index]);
|
|
95
|
+
dragging.current = { axis: axis.id, index, from: value };
|
|
96
|
+
setDrag({ axis: axis.id, extent: [value, value] });
|
|
97
|
+
};
|
|
98
|
+
const moveDrag = (event) => {
|
|
99
|
+
const held = dragging.current;
|
|
100
|
+
if (!held)
|
|
101
|
+
return;
|
|
102
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
103
|
+
const span = layout.spans[held.index];
|
|
104
|
+
setDrag({ axis: held.axis, extent: extentOf(held.from, valueOn(event.clientY - box.top + span.top, span)) });
|
|
105
|
+
};
|
|
106
|
+
/* A press that went nowhere lifts the range, which is how a reader takes a filter back off. */
|
|
107
|
+
const endDrag = () => {
|
|
108
|
+
const held = dragging.current;
|
|
109
|
+
const at = drag;
|
|
110
|
+
dragging.current = null;
|
|
111
|
+
setDrag(null);
|
|
112
|
+
if (!held || !at || !onRanges)
|
|
113
|
+
return;
|
|
114
|
+
const [lo, hi] = at.extent;
|
|
115
|
+
const span = layout.spans[held.index];
|
|
116
|
+
const moved = ((hi - lo) / (span.hi - span.lo || 1)) * (span.bottom - span.top) >= 2;
|
|
117
|
+
onRanges(setRange(ranges, held.axis, moved ? at.extent : null));
|
|
118
|
+
};
|
|
119
|
+
if (axes.length < 2)
|
|
120
|
+
return null;
|
|
121
|
+
return (_jsxs("g", { children: [axes.map((axis, index) => {
|
|
122
|
+
const span = layout.spans[index];
|
|
123
|
+
const at = layout.at[index];
|
|
124
|
+
const shown = drag?.axis === axis.id ? drag.extent : ranges[axis.id];
|
|
125
|
+
return (_jsxs("g", { children: [_jsx("line", { x1: at, x2: at, y1: span.top, y2: span.bottom, stroke: "var(--viz-rule)", strokeWidth: 1 }), _jsx("text", { x: at, y: span.top - 10, fontSize: TITLE_SIZE, textAnchor: "middle", fill: "var(--viz-ink)", children: titles[index].map((line, row, all) => (_jsx("tspan", { x: at, dy: row === 0 ? -(all.length - 1) * TITLE_LINE : TITLE_LINE, children: line }, line))) }), _jsx("text", { x: at, y: span.top - 1, fontSize: 9, textAnchor: "middle", fill: "var(--viz-ink-muted)", children: format(axis.hi) }), _jsx("text", { x: at, y: span.bottom + 12, fontSize: 9, textAnchor: "middle", fill: "var(--viz-ink-muted)", children: format(axis.lo) }), shown && (_jsx("rect", { x: at - GRIP / 2, y: placeOn(shown[1], span), width: GRIP, height: Math.max(1, placeOn(shown[0], span) - placeOn(shown[1], span)), fill: "var(--viz-ink)", fillOpacity: 0.16, stroke: "var(--viz-ink)", strokeOpacity: 0.4 }))] }, axis.id));
|
|
126
|
+
}), paths.map((line, index) => (_jsx("path", { d: line.path, fill: "none", stroke: line.color, strokeWidth: hovered?.index === index ? 2 : 1, strokeOpacity: hovered == null || hovered.index === index ? opacity : 0.25 }, index))), (onHover || onSelect) && (_jsx("rect", { width: width, height: height, fill: "transparent", cursor: onSelect && hovered != null ? "pointer" : undefined, onPointerMove: report, onPointerLeave: clear, onClick: onSelect ? take : undefined })), onRanges &&
|
|
127
|
+
axes.map((axis, index) => {
|
|
128
|
+
const span = layout.spans[index];
|
|
129
|
+
return (_jsx("rect", { x: layout.at[index] - GRIP / 2, y: span.top, width: GRIP, height: Math.max(0, span.bottom - span.top), fill: "transparent", cursor: "ns-resize", onPointerDown: startDrag(axis, index), onPointerMove: moveDrag, onPointerUp: endDrag, onPointerCancel: endDrag }, axis.id));
|
|
130
|
+
})] }));
|
|
131
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shares of one whole, as slices of a ring.
|
|
3
|
+
*
|
|
4
|
+
* The design language ruled the pie out because a reader judges angle and area worse than length.
|
|
5
|
+
* It is permitted on a condition, and the condition is that the figure writes its numbers on the
|
|
6
|
+
* slices: the reader takes the value off text and the arc carries the share. So `numbers` is the
|
|
7
|
+
* payment for the coordinate, and the critic reports a ring drawn without one at `bad`. See the ADR
|
|
8
|
+
* "Polar is permitted where the figure writes its numbers".
|
|
9
|
+
*
|
|
10
|
+
* The geom takes the panel whole. `GRAMMAR` answers false for the kind's axial coordinate, which is
|
|
11
|
+
* what stops the frame drawing a pair of rules around a circle.
|
|
12
|
+
*
|
|
13
|
+
* A slice's color comes off the categorical map by position in the ring. Chart-design rule 8 asks
|
|
14
|
+
* that color encode something or stay neutral, and here it separates neighbors a reader has to tell
|
|
15
|
+
* apart. The identity itself travels on the label, which is why no legend goes with this geom. A
|
|
16
|
+
* series naming a sequential `palette` steps along that map instead, for categories with an order.
|
|
17
|
+
*
|
|
18
|
+
* `hole` above zero makes it a donut. One field, and the layout resolves it against the outer radius,
|
|
19
|
+
* so a ring keeps its proportions across a facet and a hero chart.
|
|
20
|
+
*/
|
|
21
|
+
import { type BarDatum, type GeomHit } from "../../core/internal.js";
|
|
22
|
+
export interface PieProps {
|
|
23
|
+
/** One slice per reduction, in the order the band holds them. */
|
|
24
|
+
data: BarDatum[];
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
/** A color per slice, by position in the ring. */
|
|
28
|
+
identity: (index: number) => string;
|
|
29
|
+
/** One paint for each slice, where the author picked one over the ring's own. */
|
|
30
|
+
fill?: string;
|
|
31
|
+
/** The hole, as a fraction of the outer radius. Zero draws a pie. */
|
|
32
|
+
hole?: number;
|
|
33
|
+
opacity?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Ink between one slice and the next. Page-colored, so it reads as space and the slices stay
|
|
36
|
+
* countable where two neighbors take a similar hue.
|
|
37
|
+
*/
|
|
38
|
+
stroke?: string;
|
|
39
|
+
lineWidth?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The value written on each slice, which is what the coordinate is permitted on.
|
|
42
|
+
*
|
|
43
|
+
* `format` takes the value in the units the slice carries, so the number agrees with the tooltip.
|
|
44
|
+
* `share` writes the slice's fraction of the total instead, which is what a reader of a pie is
|
|
45
|
+
* usually after. `wanted` picks the slices that get one, off the slice's value.
|
|
46
|
+
*/
|
|
47
|
+
numbers?: {
|
|
48
|
+
format: (value: number) => string;
|
|
49
|
+
wanted?: (value: number) => boolean;
|
|
50
|
+
share?: boolean;
|
|
51
|
+
color?: string;
|
|
52
|
+
fontSize: number;
|
|
53
|
+
};
|
|
54
|
+
/** Writes the category name above the number. Chart-design rule 2, applied to a wedge. */
|
|
55
|
+
names?: boolean;
|
|
56
|
+
/** Category drawn at full strength. The rest mute to context. */
|
|
57
|
+
active?: string | null;
|
|
58
|
+
/** The slice under the hand, placed where its label sits, so a readout has somewhere to go. */
|
|
59
|
+
onHover?: (hit: GeomHit<BarDatum> | null) => void;
|
|
60
|
+
onSelect?: (hit: GeomHit<BarDatum>) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare function Pie({ data, width, height, identity, fill, hole, opacity, stroke, lineWidth, numbers, names, active, onHover, onSelect, }: PieProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Shares of one whole, as slices of a ring.
|
|
4
|
+
*
|
|
5
|
+
* The design language ruled the pie out because a reader judges angle and area worse than length.
|
|
6
|
+
* It is permitted on a condition, and the condition is that the figure writes its numbers on the
|
|
7
|
+
* slices: the reader takes the value off text and the arc carries the share. So `numbers` is the
|
|
8
|
+
* payment for the coordinate, and the critic reports a ring drawn without one at `bad`. See the ADR
|
|
9
|
+
* "Polar is permitted where the figure writes its numbers".
|
|
10
|
+
*
|
|
11
|
+
* The geom takes the panel whole. `GRAMMAR` answers false for the kind's axial coordinate, which is
|
|
12
|
+
* what stops the frame drawing a pair of rules around a circle.
|
|
13
|
+
*
|
|
14
|
+
* A slice's color comes off the categorical map by position in the ring. Chart-design rule 8 asks
|
|
15
|
+
* that color encode something or stay neutral, and here it separates neighbors a reader has to tell
|
|
16
|
+
* apart. The identity itself travels on the label, which is why no legend goes with this geom. A
|
|
17
|
+
* series naming a sequential `palette` steps along that map instead, for categories with an order.
|
|
18
|
+
*
|
|
19
|
+
* `hole` above zero makes it a donut. One field, and the layout resolves it against the outer radius,
|
|
20
|
+
* so a ring keeps its proportions across a facet and a hero chart.
|
|
21
|
+
*/
|
|
22
|
+
import { arcPath, inkOn, polarPoint, ringLayout, sliceAngles } from "../../core/internal.js";
|
|
23
|
+
/** A slice too narrow to hold text, in radians. Below this the label would draw over its neighbors. */
|
|
24
|
+
const NARROW = 0.16;
|
|
25
|
+
export function Pie({ data, width, height, identity, fill, hole = 0, opacity, stroke, lineWidth = 1, numbers, names, active, onHover, onSelect, }) {
|
|
26
|
+
const layout = ringLayout(width, height, hole);
|
|
27
|
+
const slices = sliceAngles(data.map((slice) => slice.value));
|
|
28
|
+
if (slices.length === 0 || layout.outer <= 0)
|
|
29
|
+
return null;
|
|
30
|
+
const total = data.reduce((sum, slice) => sum + Math.max(0, slice.value), 0);
|
|
31
|
+
const percent = (value) => `${((Math.max(0, value) / total) * 100).toFixed(1)}%`;
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsx("g", { "data-polar": "slices", children: slices.map((slice, index) => {
|
|
33
|
+
const datum = data[index];
|
|
34
|
+
const at = polarPoint(layout, layout.labelRadius, slice.mid);
|
|
35
|
+
return (_jsx("path", { d: arcPath(layout, slice.from, slice.to), fill: fill ?? datum.color ?? identity(index), fillOpacity: active != null && active !== datum.category ? 0.45 : opacity, stroke: stroke, strokeWidth: stroke ? lineWidth : 0, onMouseEnter: () => onHover?.({ datum, index, at }), onMouseLeave: () => onHover?.(null), onClick: onSelect ? () => onSelect({ datum, index, at }) : undefined, style: onSelect ? { cursor: "pointer" } : undefined }, datum.category));
|
|
36
|
+
}) }), (numbers || names) && (
|
|
37
|
+
/*
|
|
38
|
+
Past the slices, so no later fill covers a number already written.
|
|
39
|
+
|
|
40
|
+
A slice narrower than `NARROW` gets no text. The alternative is a label drawn over its
|
|
41
|
+
neighbors, which is the failure `slices-past-legible` reports on the count. Leaving the
|
|
42
|
+
text off a sliver keeps the figure readable while the finding says why it is short.
|
|
43
|
+
*/
|
|
44
|
+
_jsx("g", { "data-polar": "numbers", fontSize: numbers?.fontSize, pointerEvents: "none", textAnchor: "middle", children: slices.map((slice, index) => {
|
|
45
|
+
const datum = data[index];
|
|
46
|
+
if (slice.to - slice.from < NARROW)
|
|
47
|
+
return null;
|
|
48
|
+
const at = polarPoint(layout, layout.labelRadius, slice.mid);
|
|
49
|
+
const lines = [
|
|
50
|
+
...(names ? [datum.category] : []),
|
|
51
|
+
...(numbers && (numbers.wanted?.(datum.value) ?? true)
|
|
52
|
+
? [numbers.share ? percent(datum.value) : numbers.format(datum.value)]
|
|
53
|
+
: []),
|
|
54
|
+
];
|
|
55
|
+
if (lines.length === 0)
|
|
56
|
+
return null;
|
|
57
|
+
return (_jsx("text", { x: at.x, y: at.y, fill: numbers?.color ?? inkOn(datum.color ?? identity(index)), dominantBaseline: "central", children: lines.map((line, row) => (_jsx("tspan", { x: at.x, dy: row === 0 ? `${-((lines.length - 1) * 0.55)}em` : "1.1em", children: line }, line))) }, datum.category));
|
|
58
|
+
}) }))] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The point geom, and the record behind each geom.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `Hexbin`, which drew circles keyed by array position when the count sat below the
|
|
5
|
+
* density switch. Those circles could not say what they stood for, so a scatter was a picture instead
|
|
6
|
+
* of a way into the data. A point here carries its record key, and hover resolves through one
|
|
7
|
+
* quadtree lookup against a single capture surface instead of a listener per point.
|
|
8
|
+
*
|
|
9
|
+
* Drawing and hit testing read the same projection, so the geom under the readout is the geom the
|
|
10
|
+
* pointer found.
|
|
11
|
+
*
|
|
12
|
+
* Above the fade threshold the points are drawn as a path per color step instead of an element
|
|
13
|
+
* each. A facet of fourteen thousand records is fourteen thousand nodes for the browser to lay out
|
|
14
|
+
* and paint, and six of them on one page is where the specimen section spent half a second. The
|
|
15
|
+
* treatment is the same either way: same radius, same opacity, same color off the ramp. Identity
|
|
16
|
+
* survives because hover resolves through the quadtree and the capture surface, neither of which
|
|
17
|
+
* ever read the drawn elements.
|
|
18
|
+
*/
|
|
19
|
+
import { type PlotPoint } from "../../core/internal.js";
|
|
20
|
+
import type { PointHit, PointShape, Scale, ValueRamp } from "../../core/internal.js";
|
|
21
|
+
/**
|
|
22
|
+
* The faded treatment, per chart-design rule 7.
|
|
23
|
+
*
|
|
24
|
+
* Exported because the GPU renderer only ever draws counts that are already past the fade
|
|
25
|
+
* threshold, and a geom that changed size when the renderer changed would read as the data moving.
|
|
26
|
+
*/
|
|
27
|
+
export declare const FADED_R: number;
|
|
28
|
+
export declare const FADED_OPACITY = 0.16;
|
|
29
|
+
export type { PointShape };
|
|
30
|
+
/**
|
|
31
|
+
* Any glyph as a path, so one merged element can hold thousands of them.
|
|
32
|
+
*
|
|
33
|
+
* Exported so a guide draws its sample through the same arithmetic the chart drew the marks
|
|
34
|
+
* with. A legend that redrew the four shapes by hand is a second writer of one glyph set.
|
|
35
|
+
*/
|
|
36
|
+
export declare function glyph(shape: PointShape, x: number, y: number, r: number): string;
|
|
37
|
+
export type { PlotPoint } from "../../core/internal.js";
|
|
38
|
+
export type { PointHit };
|
|
39
|
+
export interface PointsProps {
|
|
40
|
+
/** Whether the pair of scales is drawn the other way round, as the band geoms take it. */
|
|
41
|
+
transposed?: boolean;
|
|
42
|
+
/** Distance between two neighboring band centers on the category axis, in pixels. A jitter's offset there reads in it. */
|
|
43
|
+
step?: number;
|
|
44
|
+
points: PlotPoint[];
|
|
45
|
+
x: Scale;
|
|
46
|
+
y: Scale;
|
|
47
|
+
/** The 1,500 to 15,000 treatment: smaller and translucent, per chart-design rule 7. */
|
|
48
|
+
faded?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Maps a point's weight to a color.
|
|
51
|
+
*
|
|
52
|
+
* The weight keeps its own units, so scaling belongs to whoever knows what they are: the caller
|
|
53
|
+
* closes over the range it read the field across, and the geom asks for colors without knowing
|
|
54
|
+
* whether it is holding degrees or a proportion.
|
|
55
|
+
*/
|
|
56
|
+
ramp: ValueRamp;
|
|
57
|
+
/** Point radius, where the size channel resolved none. Overrides the density treatment's pick. */
|
|
58
|
+
radius?: number;
|
|
59
|
+
/** Geom opacity. Overrides the density treatment. */
|
|
60
|
+
opacity?: number;
|
|
61
|
+
/** Glyph each geom draws, so two groups over one frame are told apart without relying on hue. */
|
|
62
|
+
shape?: PointShape;
|
|
63
|
+
/**
|
|
64
|
+
* Draws the glyph as an outline with paper showing through it.
|
|
65
|
+
*
|
|
66
|
+
* The hollow center is what a reader counts through, so the halo goes unread here: it would take
|
|
67
|
+
* the stroke the outline needs, and there is nothing left for it to separate.
|
|
68
|
+
*/
|
|
69
|
+
hollow?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Width of the paper-colored halo around each geom, in pixels. Zero draws none.
|
|
72
|
+
*
|
|
73
|
+
* The halo is space and not a border: it lets a reader count geoms that overlap. On a sparse
|
|
74
|
+
* panel there is nothing to separate and it costs the geom some of its own area.
|
|
75
|
+
*/
|
|
76
|
+
halo?: number;
|
|
77
|
+
/** Plot area. Supply with `onHover` so the pointer is caught across the whole frame. */
|
|
78
|
+
width?: number;
|
|
79
|
+
height?: number;
|
|
80
|
+
onHover?: (hit: PointHit | null) => void;
|
|
81
|
+
/** A geom taken instead of read. The caller decides what opening a record means. */
|
|
82
|
+
onSelect?: (hit: PointHit) => void;
|
|
83
|
+
}
|
|
84
|
+
export declare function Points({ points, x, y, faded, ramp, radius, opacity, shape, hollow, halo, width, height, onHover, onSelect, transposed, step, }: PointsProps): import("react").JSX.Element;
|