@mechane-ai/elements 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +306 -33
- package/dist/ai.js +4 -4
- package/dist/catalog.json +2382 -33
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2958
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -781
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -655
- package/dist/charts/hierarchy.js +1 -121
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -644
- package/dist/charts/plot.js +15 -0
- package/dist/charts/relationship.js +1 -0
- package/dist/charts/text.js +1 -0
- package/dist/charts/timeline.js +1 -266
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/collections.js +1 -2195
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -810
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
- package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
- package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
- package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +1 -1
- package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
- package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
- package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
- package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
- package/dist/packages/charts/src/cells/index.d.ts +11 -0
- package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
- package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
- package/dist/packages/charts/src/chart-frame.d.ts +14 -7
- package/dist/packages/charts/src/chart-grid.d.ts +19 -0
- package/dist/packages/charts/src/chart-input.d.ts +1 -9
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart.d.ts +0 -8
- package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
- package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
- package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
- package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
- package/dist/packages/charts/src/comparison/index.d.ts +6 -0
- package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
- package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
- package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
- package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
- package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
- package/dist/packages/charts/src/distribution/index.d.ts +11 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
- package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
- package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
- package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
- package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
- package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
- package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
- package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
- package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
- package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
- package/dist/packages/charts/src/graph/index.d.ts +6 -2
- package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
- package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
- package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
- package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
- package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
- package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
- package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
- package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
- package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
- package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
- package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
- package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
- package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
- package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
- package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
- package/dist/packages/charts/src/image/image-input.d.ts +27 -0
- package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
- package/dist/packages/charts/src/image/index.d.ts +7 -0
- package/dist/packages/charts/src/index.d.ts +15 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -2
- package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
- package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
- package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
- package/dist/packages/charts/src/relationship/index.d.ts +11 -0
- package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
- package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
- package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
- package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
- package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
- package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
- package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
- package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
- package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
- package/dist/packages/charts/src/spec/figure.d.ts +12 -0
- package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
- package/dist/packages/charts/src/spec/index.d.ts +10 -0
- package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
- package/dist/packages/charts/src/text/index.d.ts +11 -0
- package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
- package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
- package/dist/packages/charts/src/text/token-links.d.ts +49 -0
- package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
- package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
- package/dist/packages/charts/src/text/token-text.d.ts +39 -0
- package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
- package/dist/packages/charts/src/timeline/index.d.ts +3 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
- package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
- package/dist/packages/charts/src/transforms/density.d.ts +53 -0
- package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
- package/dist/packages/charts/src/transforms/index.d.ts +19 -0
- package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
- package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
- package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
- package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
- package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
- package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
- package/dist/packages/charts/src/transforms/values.d.ts +70 -0
- package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
- package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
- package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
- package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
- package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
- package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
- package/dist/packages/charts/src/trend/index.d.ts +10 -0
- package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
- package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
- package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/plot-width-DcqtSgzb.js +124 -0
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +453 -62
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -4
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +60 -0
- package/skills/review-elements/SKILL.md +43 -1
- package/skills/upgrade-elements/SKILL.md +3 -1
- package/skills/upgrade-elements/references/releases.md +184 -0
- package/skills/use-elements/SKILL.md +19 -13
- package/skills/use-elements/references/charts.md +362 -41
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/dist/categorical-values-BXi-rJuv.js +0 -74
- package/dist/chart-data-CIJVWCYt.js +0 -21
- package/dist/chart-frame-BaxKn_MB.js +0 -236
- package/dist/chart-input-Bm82_9Rd.js +0 -22
- package/dist/chart-theme-4zprJ3rW.js +0 -404
- package/dist/plot-width-v2c_rA20.js +0 -63
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type NumericDomain = readonly [minimum: number, maximum: number];
|
|
2
|
+
/**
|
|
3
|
+
* How values spread along an axis: evenly, by ratio, or by ratio on both sides of zero. A log axis needs a positive
|
|
4
|
+
* domain. A symlog axis is linear within one unit of zero, so it can hold zero and signed values.
|
|
5
|
+
*/
|
|
6
|
+
export type ScaleType = 'linear' | 'log' | 'symlog';
|
|
7
|
+
export type ContinuousScale = {
|
|
8
|
+
readonly type: ScaleType;
|
|
9
|
+
readonly domain: NumericDomain;
|
|
10
|
+
readonly range: readonly [number, number];
|
|
11
|
+
/** Where a value sits. One outside the domain sits at the nearest end. Charts reject such input before drawing. */
|
|
12
|
+
readonly position: (value: number) => number;
|
|
13
|
+
/** The value at a position, such as the one under a pointer. */
|
|
14
|
+
readonly valueAt: (position: number) => number;
|
|
15
|
+
};
|
|
16
|
+
export type BandScale = {
|
|
17
|
+
readonly ids: ReadonlyArray<string>;
|
|
18
|
+
/** The distance from one band's start to the next. */
|
|
19
|
+
readonly step: number;
|
|
20
|
+
readonly bandwidth: number;
|
|
21
|
+
/** Where an id's band starts, or undefined for an id the scale does not hold. */
|
|
22
|
+
readonly start: (id: string) => number | undefined;
|
|
23
|
+
readonly center: (id: string) => number | undefined;
|
|
24
|
+
/** The id whose step holds a position, such as the one under a pointer. Positions outside the range take an end. */
|
|
25
|
+
readonly idAt: (position: number) => string | undefined;
|
|
26
|
+
};
|
|
27
|
+
export declare function isFiniteDomain(domain: NumericDomain): boolean;
|
|
28
|
+
/** Why a domain cannot carry a scale type, or undefined when it can. */
|
|
29
|
+
export declare function scaleDomainError(domain: NumericDomain, type?: ScaleType): string | undefined;
|
|
30
|
+
export declare function outsideDomain(value: number, domain: NumericDomain): boolean;
|
|
31
|
+
export type ContinuousScaleInput = {
|
|
32
|
+
readonly type?: ScaleType | undefined;
|
|
33
|
+
readonly domain: NumericDomain;
|
|
34
|
+
/** The positions of the domain's two ends. Pass them reversed for an axis that grows upward on screen. */
|
|
35
|
+
readonly range: readonly [number, number];
|
|
36
|
+
};
|
|
37
|
+
/** A scale for measured values, on the UI SDK number helpers that sliders and meters place their values with. */
|
|
38
|
+
export declare function continuousScale({ type, domain, range }: ContinuousScaleInput): ContinuousScale;
|
|
39
|
+
export type BandScaleInput = {
|
|
40
|
+
readonly ids: ReadonlyArray<string>;
|
|
41
|
+
readonly range: readonly [number, number];
|
|
42
|
+
/** The share of each step left empty between bands and at both ends, from 0 to 1. */
|
|
43
|
+
readonly padding?: number | undefined;
|
|
44
|
+
};
|
|
45
|
+
/** A scale for named categories in supplied order: each takes an equal band, with the same gap at both ends. */
|
|
46
|
+
export declare function bandScale({ ids, range, padding }: BandScaleInput): BandScale;
|
|
47
|
+
/** The smallest and largest value of a column, or undefined for an empty column. It reads a million values safely. */
|
|
48
|
+
export declare function columnExtent(values: ReadonlyArray<number>): NumericDomain | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NumericDomain, ScaleType } from './scale.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Round values between two bounds, about `count` of them, on steps of 1, 2 or 5 times a power of ten. The bounds
|
|
4
|
+
* themselves appear only when they are round.
|
|
5
|
+
*/
|
|
6
|
+
export declare function linearTicks(domain: NumericDomain, count: number): ReadonlyArray<number>;
|
|
7
|
+
/**
|
|
8
|
+
* The powers of ten inside a positive domain, about `count` of them. A domain that holds fewer than three powers also
|
|
9
|
+
* gets their 2 and 5 multiples, so a short log axis still shows enough ticks to read.
|
|
10
|
+
*/
|
|
11
|
+
export declare function logTicks(domain: NumericDomain, count: number): ReadonlyArray<number>;
|
|
12
|
+
/** Zero and the powers of ten on each side of it that a signed domain holds. */
|
|
13
|
+
export declare function symlogTicks(domain: NumericDomain, count: number): ReadonlyArray<number>;
|
|
14
|
+
export type TickInput = {
|
|
15
|
+
readonly domain: NumericDomain;
|
|
16
|
+
readonly type?: ScaleType | undefined;
|
|
17
|
+
/** About how many ticks to return. The round steps decide the exact number. */
|
|
18
|
+
readonly count: number;
|
|
19
|
+
};
|
|
20
|
+
/** Tick values for a measured axis of any scale type. */
|
|
21
|
+
export declare function scaleTicks({ domain, type, count }: TickInput): ReadonlyArray<number>;
|
|
22
|
+
export type TimeTickInput = {
|
|
23
|
+
/** The first and last instant, in milliseconds since the epoch. */
|
|
24
|
+
readonly domain: NumericDomain;
|
|
25
|
+
readonly count: number;
|
|
26
|
+
/** How far the reader's time zone is ahead of UTC at the domain's start, in milliseconds. */
|
|
27
|
+
readonly zoneOffset: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Instants on round clock steps in the reader's zone: seconds, minutes, hours or days. Spans of months and years fall
|
|
31
|
+
* on multiples of 30, 90 or 365 days from the first local midnight, which a date format labels by its day. Spans of
|
|
32
|
+
* decades step by two, five or ten such years.
|
|
33
|
+
*/
|
|
34
|
+
export declare function timeTicks({ domain, count, zoneOffset }: TimeTickInput): ReadonlyArray<number>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
/** The width a plot's container gives it, measured as it resizes. Attach `ref` to the element that sets the width. */
|
|
1
2
|
export declare function usePlotWidth(): {
|
|
2
|
-
ref:
|
|
3
|
-
width: number;
|
|
3
|
+
readonly ref: (element: HTMLDivElement | null) => void;
|
|
4
|
+
readonly width: number;
|
|
4
5
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
6
|
+
/** A surface the application sampled on a regular grid. Row 0 is at the start of `yDomain`, the bottom of the plot. */
|
|
7
|
+
export type ContourGridInput = {
|
|
8
|
+
readonly columns: number;
|
|
9
|
+
readonly rows: number;
|
|
10
|
+
/** `columns * rows` finite samples, row by row, each row from the start of `xDomain` to its end. */
|
|
11
|
+
readonly values: ReadonlyArray<number>;
|
|
12
|
+
/** The x values of the first and last column. */
|
|
13
|
+
readonly xDomain: NumericDomain;
|
|
14
|
+
/** The y values of the first and last row. */
|
|
15
|
+
readonly yDomain: NumericDomain;
|
|
16
|
+
};
|
|
17
|
+
/** A route drawn over the surface, such as the steps an optimizer took. */
|
|
18
|
+
export type ContourPath = {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly label: string;
|
|
21
|
+
readonly points: ReadonlyArray<{
|
|
22
|
+
readonly x: number;
|
|
23
|
+
readonly y: number;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
/** A place the reader should find, such as a minimum or a starting point. */
|
|
27
|
+
export type ContourMarker = {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly label: string;
|
|
30
|
+
readonly x: number;
|
|
31
|
+
readonly y: number;
|
|
32
|
+
};
|
|
33
|
+
export type ContourPlotProps = FigureProps & FigureSelectionProps & {
|
|
34
|
+
readonly grid: ContourGridInput;
|
|
35
|
+
/** The values to draw a line at, in increasing order. The application chooses them. */
|
|
36
|
+
readonly levels: ReadonlyArray<number>;
|
|
37
|
+
readonly x: PlotAxis;
|
|
38
|
+
readonly y: PlotAxis;
|
|
39
|
+
/** What the surface measures, such as a loss, and how its levels are written. */
|
|
40
|
+
readonly value: {
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly format: ValueFormat;
|
|
43
|
+
};
|
|
44
|
+
readonly path?: ReadonlyArray<ContourPath> | undefined;
|
|
45
|
+
readonly markers?: ReadonlyArray<ContourMarker> | undefined;
|
|
46
|
+
readonly height?: PlotHeight | undefined;
|
|
47
|
+
};
|
|
48
|
+
export declare const contourLimits: {
|
|
49
|
+
readonly columns: 128;
|
|
50
|
+
readonly rows: 128;
|
|
51
|
+
readonly levels: 16;
|
|
52
|
+
readonly paths: 6;
|
|
53
|
+
readonly pointsPerPath: 2000;
|
|
54
|
+
readonly markers: 12;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Level lines of a surface the application sampled on a grid, such as a loss landscape. Each level is one line whose
|
|
58
|
+
* shade steps with its value, and a path or markers can be drawn over it. Use it to show where a measure is high or low
|
|
59
|
+
* across two inputs, with the grid, the levels and any path supplied by the application.
|
|
60
|
+
*/
|
|
61
|
+
export declare function ContourPlot(props: ContourPlotProps): ReactNode;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
6
|
+
/**
|
|
7
|
+
* A 2D histogram the application has binned: `columns` by `rows` cells over two domains, with one count per cell, row
|
|
8
|
+
* by row. Row 0 holds the lowest `y` values and column 0 the lowest `x` values. Cells divide each axis evenly in the
|
|
9
|
+
* axis's scale, and the `bin2d` transform returns this shape.
|
|
10
|
+
*/
|
|
11
|
+
export type DensityHistogram = {
|
|
12
|
+
readonly columns: number;
|
|
13
|
+
readonly rows: number;
|
|
14
|
+
readonly counts: ReadonlyArray<number>;
|
|
15
|
+
readonly xDomain: NumericDomain;
|
|
16
|
+
readonly yDomain: NumericDomain;
|
|
17
|
+
};
|
|
18
|
+
export type DensityMapProps = FigureProps & {
|
|
19
|
+
readonly histogram: DensityHistogram;
|
|
20
|
+
/** The axes the histogram was binned on. Leave their domains out: the histogram's own domains are the axes. */
|
|
21
|
+
readonly x: PlotAxis;
|
|
22
|
+
readonly y: PlotAxis;
|
|
23
|
+
/** What each cell counts, with its unit, and how to write it: "Tokens". */
|
|
24
|
+
readonly count: {
|
|
25
|
+
readonly label: string;
|
|
26
|
+
readonly format: ValueFormat;
|
|
27
|
+
};
|
|
28
|
+
readonly height?: PlotHeight | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The largest histogram the map draws, and how many non-empty cells a reader steps through one by one. Beyond that
|
|
32
|
+
* many, the arrow keys step through rows instead.
|
|
33
|
+
*/
|
|
34
|
+
export declare const densityLimits: {
|
|
35
|
+
readonly columns: 512;
|
|
36
|
+
readonly rows: 512;
|
|
37
|
+
readonly cellItems: 1024;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A 2D histogram as a grid of cells, darker where more items fall: where activations cluster across two features, how
|
|
41
|
+
* latency spreads against payload size. The application bins the data, and the map draws up to 512 by 512 cells on
|
|
42
|
+
* canvas. It names the exact count of the cell under the pointer or the keyboard cursor and keys its shades in a
|
|
43
|
+
* legend.
|
|
44
|
+
*/
|
|
45
|
+
export declare function DensityMap(props: DensityMapProps): ReactNode;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ChangeDetails } from '@ui-sdk/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
4
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
5
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
6
|
+
import type { DataRect } from '../plot/render/hit-index.ts';
|
|
7
|
+
import type { PointRenderer } from '../plot/render/point-layer.tsx';
|
|
8
|
+
/**
|
|
9
|
+
* The items of a map as plain columns, already projected by the application. The nth item sits at `x[n]`, `y[n]` and
|
|
10
|
+
* belongs to the group at index `group[n]`. The `ids` column names each item for the readout, or leave it out to number
|
|
11
|
+
* them.
|
|
12
|
+
*/
|
|
13
|
+
export type EmbeddingPoints = {
|
|
14
|
+
readonly ids?: ReadonlyArray<string> | undefined;
|
|
15
|
+
readonly x: ReadonlyArray<number>;
|
|
16
|
+
readonly y: ReadonlyArray<number>;
|
|
17
|
+
readonly group: ReadonlyArray<number>;
|
|
18
|
+
};
|
|
19
|
+
/** A group of items, such as a cluster, a class or a source. Its hue marks its items and its legend entry. */
|
|
20
|
+
export type EmbeddingGroup = {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly tone?: ChartTone | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** A named place on the map, drawn as a label: a cluster name, a probe or the item a reader is studying. */
|
|
26
|
+
export type EmbeddingLandmark = {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly label: string;
|
|
29
|
+
readonly x: number;
|
|
30
|
+
readonly y: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* How the map draws its items. `auto` uses canvas 2D up to `embeddingLimits.canvasPoints` and WebGL beyond. Without
|
|
34
|
+
* WebGL the map draws with canvas 2D, a frame at a time, and says so.
|
|
35
|
+
*/
|
|
36
|
+
export type EmbeddingRenderer = 'auto' | PointRenderer;
|
|
37
|
+
/** A rectangle on the map in data units, such as the area a reader drew. */
|
|
38
|
+
export type EmbeddingRange = DataRect;
|
|
39
|
+
/** Why the range changed, and how many items lie inside the requested range. */
|
|
40
|
+
export type EmbeddingRangeDetails = ChangeDetails<'drag' | 'clear-press' | 'trigger-press'> & {
|
|
41
|
+
readonly count: number;
|
|
42
|
+
};
|
|
43
|
+
export type EmbeddingMapProps = FigureProps & FigureSelectionProps & {
|
|
44
|
+
readonly points: EmbeddingPoints;
|
|
45
|
+
readonly groups: ReadonlyArray<EmbeddingGroup>;
|
|
46
|
+
/** The projection's axes. Both are linear; leave the domains out to fit the items. */
|
|
47
|
+
readonly x: PlotAxis;
|
|
48
|
+
readonly y: PlotAxis;
|
|
49
|
+
readonly landmarks?: ReadonlyArray<EmbeddingLandmark> | undefined;
|
|
50
|
+
readonly renderer?: EmbeddingRenderer | undefined;
|
|
51
|
+
/** The rectangle the reader drew, or null. Supply `onRangeChange` to let a drag draw one. */
|
|
52
|
+
readonly range?: EmbeddingRange | null | undefined;
|
|
53
|
+
readonly onRangeChange?: ((range: EmbeddingRange | null, details: EmbeddingRangeDetails) => void) | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Lets the reader pan and zoom: a drag pans, and a pinch or Control or Command with a scroll zooms. The keys `+`,
|
|
56
|
+
* `−` and `0` zoom from the keyboard, and Shift with a drag draws the range. A plain scroll always scrolls the
|
|
57
|
+
* page.
|
|
58
|
+
*/
|
|
59
|
+
readonly isExplorable?: boolean | undefined;
|
|
60
|
+
readonly height?: PlotHeight | undefined;
|
|
61
|
+
};
|
|
62
|
+
/** The largest map each renderer draws, from draw times measured in headless Chromium. */
|
|
63
|
+
export declare const embeddingLimits: {
|
|
64
|
+
readonly canvasPoints: 100000;
|
|
65
|
+
readonly webglPoints: 1000000;
|
|
66
|
+
readonly groups: 12;
|
|
67
|
+
readonly landmarks: 200;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A map of up to a million points colored by group, already placed in two dimensions by the application, such as a UMAP
|
|
71
|
+
* of activations or embeddings. Readers step through the groups and named landmarks with the arrow keys, point at any
|
|
72
|
+
* item to read it, and draw a rectangle to count the items inside. Pass `coverage` when the points are a sample, and
|
|
73
|
+
* set `isExplorable` to let readers pan and zoom.
|
|
74
|
+
*/
|
|
75
|
+
export declare function EmbeddingMap(props: EmbeddingMapProps): ReactNode;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { ContourGridInput, ContourMarker, ContourPath, ContourPlotProps } from './contour-plot.tsx';
|
|
2
|
+
export { ContourPlot, contourLimits } from './contour-plot.tsx';
|
|
3
|
+
export type { MeasureDimension, MeasureGroup, MeasureRow } from './measures.ts';
|
|
4
|
+
export type { AxisRangeReason, AxisRanges, ParallelCoordinatesProps } from './parallel-coordinates.tsx';
|
|
5
|
+
export { ParallelCoordinates, parallelLimits } from './parallel-coordinates.tsx';
|
|
6
|
+
export type { ScatterMatrixProps } from './scatter-matrix.tsx';
|
|
7
|
+
export { ScatterMatrix, scatterMatrixLimits } from './scatter-matrix.tsx';
|
|
8
|
+
export type { DensityHistogram, DensityMapProps } from './density-map.tsx';
|
|
9
|
+
export { DensityMap, densityLimits } from './density-map.tsx';
|
|
10
|
+
export type { EmbeddingGroup, EmbeddingLandmark, EmbeddingMapProps, EmbeddingPoints, EmbeddingRange, EmbeddingRangeDetails, EmbeddingRenderer, } from './embedding-map.tsx';
|
|
11
|
+
export { EmbeddingMap, embeddingLimits } from './embedding-map.tsx';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type LevelLegendEntry = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly color: string;
|
|
6
|
+
};
|
|
7
|
+
/** The values of the level lines, each beside a sample of its line, from the lowest level to the highest. */
|
|
8
|
+
export declare function LevelLegend({ label, entries, }: {
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly entries: ReadonlyArray<LevelLegendEntry>;
|
|
11
|
+
}): ReactNode;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
2
|
+
import type { ChartLegendItem } from '../chart-frame.tsx';
|
|
3
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
4
|
+
import type { NumericDomain, ScaleType } from '../plot/scale.ts';
|
|
5
|
+
/** One measure the rows of a multi-measure chart are compared on. */
|
|
6
|
+
export type MeasureDimension = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** The measure's name with its unit: "Latency (ms)". */
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly format: ValueFormat;
|
|
11
|
+
/** The values the measure spans. Leave it out to fit the supplied values on round bounds. */
|
|
12
|
+
readonly domain?: NumericDomain | undefined;
|
|
13
|
+
readonly scale?: ScaleType | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** One thing measured, such as a model or a run, with a value for each measure. A null value was not recorded. */
|
|
16
|
+
export type MeasureRow = {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
/** The id of the group the row belongs to. Groups give rows their hue. */
|
|
20
|
+
readonly group?: string | undefined;
|
|
21
|
+
readonly values: Readonly<Record<string, number | null>>;
|
|
22
|
+
};
|
|
23
|
+
/** A named set of rows. Its hue names the set in every mark and in the legend. */
|
|
24
|
+
export type MeasureGroup = {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly label: string;
|
|
27
|
+
readonly tone?: ChartTone | undefined;
|
|
28
|
+
};
|
|
29
|
+
/** A measure with the domain the chart resolved for it. */
|
|
30
|
+
export type MeasureAxis = MeasureDimension & {
|
|
31
|
+
readonly domain: NumericDomain;
|
|
32
|
+
};
|
|
33
|
+
export type MeasureLimits = {
|
|
34
|
+
readonly dimensions: number;
|
|
35
|
+
readonly rows: number;
|
|
36
|
+
};
|
|
37
|
+
/** The value a row holds for a measure, or null where none was recorded. */
|
|
38
|
+
export declare function measureValue(row: MeasureRow, dimension: Pick<MeasureDimension, 'id'>): number | null;
|
|
39
|
+
/** Gives every measure its domain: the declared one, or one fitted to the rows' values. */
|
|
40
|
+
export declare function resolveMeasureAxes({ dimensions, rows, }: {
|
|
41
|
+
readonly dimensions: ReadonlyArray<MeasureDimension>;
|
|
42
|
+
readonly rows: ReadonlyArray<MeasureRow>;
|
|
43
|
+
}): ReadonlyArray<MeasureAxis>;
|
|
44
|
+
/** The first reason rows cannot be drawn on these measures, or undefined. Nothing is clamped, dropped or reordered. */
|
|
45
|
+
export declare function measureInputError({ axes, rows, groups, limits, }: {
|
|
46
|
+
readonly axes: ReadonlyArray<MeasureAxis>;
|
|
47
|
+
readonly rows: ReadonlyArray<MeasureRow>;
|
|
48
|
+
readonly groups: ReadonlyArray<MeasureGroup>;
|
|
49
|
+
readonly limits: MeasureLimits;
|
|
50
|
+
}): string | undefined;
|
|
51
|
+
/** One chart item per row, in supplied order: its id and the sentence of its exact values. */
|
|
52
|
+
export declare function measureItems({ rows, axes, locale, groupLabel, consequence, }: {
|
|
53
|
+
readonly rows: ReadonlyArray<MeasureRow>;
|
|
54
|
+
readonly axes: ReadonlyArray<MeasureAxis>;
|
|
55
|
+
readonly locale: string;
|
|
56
|
+
readonly groupLabel: (row: MeasureRow) => string | undefined;
|
|
57
|
+
readonly consequence: string;
|
|
58
|
+
}): ReadonlyArray<{
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly label: string;
|
|
61
|
+
}>;
|
|
62
|
+
/** The columns and rows of the hidden table that gives a screen reader every exact value. */
|
|
63
|
+
export declare function measureTable({ rows, axes, locale, }: {
|
|
64
|
+
readonly rows: ReadonlyArray<MeasureRow>;
|
|
65
|
+
readonly axes: ReadonlyArray<MeasureAxis>;
|
|
66
|
+
readonly locale: string;
|
|
67
|
+
}): {
|
|
68
|
+
readonly columns: ReadonlyArray<{
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly label: string;
|
|
71
|
+
}>;
|
|
72
|
+
readonly rows: ReadonlyArray<{
|
|
73
|
+
readonly id: string;
|
|
74
|
+
readonly values: ReadonlyArray<string>;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The hue of each row and the legend that names them. Rows take their group's hue; with groups supplied, a row without
|
|
79
|
+
* one is gray, and with none every row shares the first hue.
|
|
80
|
+
*/
|
|
81
|
+
export declare function useMeasureTones(groups: ReadonlyArray<MeasureGroup>): {
|
|
82
|
+
readonly toneOf: (row: MeasureRow) => ChartTone;
|
|
83
|
+
readonly groupLabel: (row: MeasureRow) => string | undefined;
|
|
84
|
+
readonly legend: ReadonlyArray<ChartLegendItem>;
|
|
85
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChangeDetails } from '@ui-sdk/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
import type { MeasureDimension, MeasureGroup, MeasureRow } from './measures.ts';
|
|
6
|
+
import type { AxisRangeReason, AxisRanges } from './range-controls.tsx';
|
|
7
|
+
export type { AxisRangeReason, AxisRanges } from './range-controls.tsx';
|
|
8
|
+
export type ParallelCoordinatesProps = FigureProps & FigureSelectionProps & {
|
|
9
|
+
/** The measures, two to twelve, left to right. Each gets its own vertical axis, domain, scale and ticks. */
|
|
10
|
+
readonly dimensions: ReadonlyArray<MeasureDimension>;
|
|
11
|
+
/** The things measured. Each is one polyline. A missing value breaks the line at that axis. */
|
|
12
|
+
readonly rows: ReadonlyArray<MeasureRow>;
|
|
13
|
+
/** Names the sets rows belong to. Each group takes a hue. Without groups every row shares one. */
|
|
14
|
+
readonly groups?: ReadonlyArray<MeasureGroup> | undefined;
|
|
15
|
+
/** The value range kept on each axis. Rows outside any range are drawn as gray context. */
|
|
16
|
+
readonly ranges?: AxisRanges | undefined;
|
|
17
|
+
/** Asks the application to keep a range. Without it the ranges can be shown but not changed. */
|
|
18
|
+
readonly onRangesChange?: ((ranges: AxisRanges, details: ChangeDetails<AxisRangeReason>) => void) | undefined;
|
|
19
|
+
readonly height?: PlotHeight | undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const parallelLimits: {
|
|
22
|
+
readonly dimensions: 12;
|
|
23
|
+
readonly rows: 500;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Many measures per item on parallel vertical axes, one line per row: the way to read a hyperparameter sweep. Drag on
|
|
27
|
+
* an axis, or type bounds under the plot, to keep a range; rows outside every range turn gray. Use it to find which
|
|
28
|
+
* settings go with a good result, with the ranges and any selected row held by the application.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ParallelCoordinates(props: ParallelCoordinatesProps): ReactNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MeasureAxis } from './measures.ts';
|
|
3
|
+
/** The value range kept on each axis, by dimension id. An axis with no entry keeps every value. */
|
|
4
|
+
export type AxisRanges = Readonly<Record<string, readonly [number, number]>>;
|
|
5
|
+
/** Why the ranges changed: a drag on an axis, a typed bound, or the clear button. */
|
|
6
|
+
export type AxisRangeReason = 'drag' | 'input' | 'clear-press';
|
|
7
|
+
export type RangeControlsProps = {
|
|
8
|
+
readonly axes: ReadonlyArray<MeasureAxis>;
|
|
9
|
+
readonly ranges: AxisRanges;
|
|
10
|
+
readonly locale: string;
|
|
11
|
+
/** How many rows lie inside every range. */
|
|
12
|
+
readonly matching: number;
|
|
13
|
+
readonly total: number;
|
|
14
|
+
readonly onChange: (ranges: AxisRanges, reason: AxisRangeReason) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The same axis ranges a drag sets, as number inputs under the plot, for a keyboard, a touch screen or an agent. Each
|
|
18
|
+
* axis takes a minimum and a maximum inside its domain, and one button clears every range.
|
|
19
|
+
*/
|
|
20
|
+
export declare function RangeControls({ axes, ranges, locale, matching, total, onChange }: RangeControlsProps): ReactNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
3
|
+
import type { PlotHeight } from '../plot/plot-layout.ts';
|
|
4
|
+
import type { MeasureDimension, MeasureGroup, MeasureRow } from './measures.ts';
|
|
5
|
+
export type ScatterMatrixProps = FigureProps & FigureSelectionProps & {
|
|
6
|
+
/** The measures to compare, two to six. Every pair of them gets a panel. */
|
|
7
|
+
readonly dimensions: ReadonlyArray<MeasureDimension>;
|
|
8
|
+
/** The things measured, one dot per panel each. A row missing a value is left out of the panels that need it. */
|
|
9
|
+
readonly rows: ReadonlyArray<MeasureRow>;
|
|
10
|
+
/** Names the sets rows belong to. Each group takes a hue. */
|
|
11
|
+
readonly groups?: ReadonlyArray<MeasureGroup> | undefined;
|
|
12
|
+
/** The height of the largest panel. The matrix keeps its panels square and fits them to the width. */
|
|
13
|
+
readonly height?: PlotHeight | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare const scatterMatrixLimits: {
|
|
16
|
+
readonly dimensions: 6;
|
|
17
|
+
readonly rows: 500;
|
|
18
|
+
};
|
|
19
|
+
/** Every pair of a few measures as small scatter panels, the way a reader scans for what moves together. */
|
|
20
|
+
export declare function ScatterMatrix(props: ScatterMatrixProps): ReactNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FigureChart, FigureFamily, FigureSpec } from './figure-spec.ts';
|
|
2
|
+
/** What the guide says about a chart: the question it answers, when to choose it and when another chart is better. */
|
|
3
|
+
export type ChartGuideText = {
|
|
4
|
+
/** The question the chart answers, in a reader's words. */
|
|
5
|
+
readonly question: string;
|
|
6
|
+
/** When this chart is the right choice. */
|
|
7
|
+
readonly use: string;
|
|
8
|
+
/** When another chart is better, naming it. */
|
|
9
|
+
readonly avoid: string;
|
|
10
|
+
};
|
|
11
|
+
/** One chart in the guide, with a small, valid spec that shows it at its best. */
|
|
12
|
+
export type ChartGuideEntry = ChartGuideText & {
|
|
13
|
+
readonly chart: FigureChart;
|
|
14
|
+
readonly family: FigureFamily;
|
|
15
|
+
readonly example: FigureSpec;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One entry per registered chart: the question it answers, when to use it, when another chart is better, and a small
|
|
19
|
+
* valid spec to start from. An agent can read it to choose a chart; the figure wall draws every example.
|
|
20
|
+
*/
|
|
21
|
+
export declare const chartGuide: ReadonlyArray<ChartGuideEntry>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { ChartSelectDetails } from '../chart.tsx';
|
|
3
|
+
import type { FigureStatus } from '../figure/figure-props.ts';
|
|
4
|
+
import type { WaterfallSelectDetails } from '../timeline/waterfall.tsx';
|
|
5
|
+
import type { FigureChart, FigureChartProps, FigureFamily, JsonProps, RequiredKey } from './figure-spec.ts';
|
|
6
|
+
/** What a JSON value is, as a spec check names it. */
|
|
7
|
+
export type JsonKind = 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
8
|
+
type KindOf<Value> = Value extends string ? 'string' : Value extends number ? 'number' : Value extends boolean ? 'boolean' : Value extends ReadonlyArray<unknown> ? 'array' : Value extends object ? 'object' : never;
|
|
9
|
+
/** Each prop a chart cannot draw without, and the JSON kind its value must have. */
|
|
10
|
+
export type RequiredProps<Props> = {
|
|
11
|
+
readonly [Key in RequiredKey<Props>]: KindOf<Props[Key]>;
|
|
12
|
+
};
|
|
13
|
+
/** Why a selection changed: a press or a key in a chart, or a row press in a waterfall. */
|
|
14
|
+
export type FigureSelectDetails = ChartSelectDetails | WaterfallSelectDetails;
|
|
15
|
+
/**
|
|
16
|
+
* The application state a figure takes beside its spec. JSON cannot carry a callback, so selection arrives here, and
|
|
17
|
+
* the application can override the spec's status while it reads newer data.
|
|
18
|
+
*/
|
|
19
|
+
export type FigureState = {
|
|
20
|
+
readonly selected?: string | null | undefined;
|
|
21
|
+
readonly onSelectedChange?: ((id: string, details: FigureSelectDetails) => void) | undefined;
|
|
22
|
+
readonly status?: FigureStatus | undefined;
|
|
23
|
+
};
|
|
24
|
+
/** One registered chart: the component that draws it, its family and the props a spec must supply. */
|
|
25
|
+
export type FigureEntry<Chart extends FigureChart> = {
|
|
26
|
+
readonly chart: Chart;
|
|
27
|
+
readonly component: ComponentType<JsonProps<FigureChartProps[Chart]> & FigureState>;
|
|
28
|
+
readonly family: FigureFamily;
|
|
29
|
+
readonly required: RequiredProps<JsonProps<FigureChartProps[Chart]>>;
|
|
30
|
+
/** True when the chart takes a selection from the application. */
|
|
31
|
+
readonly isSelectable: 'onSelectedChange' extends keyof FigureChartProps[Chart] ? true : false;
|
|
32
|
+
};
|
|
33
|
+
/** Every chart a figure spec can name. This is the only place a chart is registered. */
|
|
34
|
+
export type FigureRegistry = {
|
|
35
|
+
readonly [Chart in FigureChart]: FigureEntry<Chart>;
|
|
36
|
+
};
|
|
37
|
+
/** The registered charts by name. */
|
|
38
|
+
export declare const figureRegistry: FigureRegistry;
|
|
39
|
+
/** Every registered chart's name and family, in the registry's order. */
|
|
40
|
+
export declare const figureCharts: ReadonlyArray<{
|
|
41
|
+
readonly chart: FigureChart;
|
|
42
|
+
readonly family: FigureFamily;
|
|
43
|
+
}>;
|
|
44
|
+
export {};
|