@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,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotCategory, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
/** The bounds of an interval around a value, such as a confidence interval. */
|
|
6
|
+
export type DotPlotInterval = {
|
|
7
|
+
readonly lower: number;
|
|
8
|
+
readonly upper: number;
|
|
9
|
+
};
|
|
10
|
+
export type DotPlotSeries = {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly tone?: ChartTone | undefined;
|
|
14
|
+
/** The value of each row, by row id. A row left out or set to null has no value and draws no dot. */
|
|
15
|
+
readonly values: Readonly<Record<string, number | null>>;
|
|
16
|
+
/** The interval around each row's value, by row id. It is drawn behind the dot. */
|
|
17
|
+
readonly intervals?: Readonly<Record<string, DotPlotInterval>> | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type DotPlotProps = FigureProps & FigureSelectionProps & {
|
|
20
|
+
/** The categories compared, listed down the side in the order given. */
|
|
21
|
+
readonly rows: ReadonlyArray<PlotCategory>;
|
|
22
|
+
readonly series: ReadonlyArray<DotPlotSeries>;
|
|
23
|
+
/** The measured axis. Position carries the value, so it need not start at zero. */
|
|
24
|
+
readonly value: PlotAxis;
|
|
25
|
+
/**
|
|
26
|
+
* The series drawn at full strength while the others fade. Emphasis only. Left out, it follows the enclosing chart
|
|
27
|
+
* link: a table row or a term in the prose that inspects a series id highlights that series.
|
|
28
|
+
*/
|
|
29
|
+
readonly highlighted?: string | null | undefined;
|
|
30
|
+
readonly height?: PlotHeight | undefined;
|
|
31
|
+
};
|
|
32
|
+
export declare const dotPlotLimits: {
|
|
33
|
+
readonly rows: 60;
|
|
34
|
+
readonly series: 6;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* One dot per series on each row, along one shared measured axis: a Cleveland dot plot. Use it to compare named
|
|
38
|
+
* categories, such as the accuracy of several models per task, when position reads better than bar length and the axis
|
|
39
|
+
* need not start at zero. An optional interval is drawn behind its dot, and the application supplies every value.
|
|
40
|
+
*/
|
|
41
|
+
export declare function DotPlot(props: DotPlotProps): ReactNode;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
export type DumbbellRow = {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** The first value, such as the score before. Null where it was not measured. */
|
|
9
|
+
readonly from: number | null;
|
|
10
|
+
/** The second value, such as the score after. Null where it was not measured. */
|
|
11
|
+
readonly to: number | null;
|
|
12
|
+
};
|
|
13
|
+
export type DumbbellPlotProps = FigureProps & FigureSelectionProps & {
|
|
14
|
+
readonly rows: ReadonlyArray<DumbbellRow>;
|
|
15
|
+
/** What the first value is: "Before fine-tuning". */
|
|
16
|
+
readonly fromLabel: string;
|
|
17
|
+
/** What the second value is: "After fine-tuning". */
|
|
18
|
+
readonly toLabel: string;
|
|
19
|
+
readonly fromTone?: ChartTone | undefined;
|
|
20
|
+
readonly toTone?: ChartTone | undefined;
|
|
21
|
+
/** The measured axis. Position carries the value, so it need not start at zero. */
|
|
22
|
+
readonly value: PlotAxis;
|
|
23
|
+
readonly height?: PlotHeight | undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare const dumbbellLimits: {
|
|
26
|
+
readonly rows: 60;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Two values per row joined by a segment, before and after or one condition against another, to show how far each
|
|
30
|
+
* category moved. The joining segment is gray context, and the two ends are dots in two hues named in the legend. A row
|
|
31
|
+
* with one end missing draws the present dot only, and the application supplies every value.
|
|
32
|
+
*/
|
|
33
|
+
export declare function DumbbellPlot(props: DumbbellPlotProps): ReactNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { BulletBarProps, BulletRange, BulletRow } from './bullet-bar.tsx';
|
|
2
|
+
export { BulletBar, bulletLimits } from './bullet-bar.tsx';
|
|
3
|
+
export type { DotPlotInterval, DotPlotProps, DotPlotSeries } from './dot-plot.tsx';
|
|
4
|
+
export { DotPlot, dotPlotLimits } from './dot-plot.tsx';
|
|
5
|
+
export type { DumbbellPlotProps, DumbbellRow } from './dumbbell-plot.tsx';
|
|
6
|
+
export { DumbbellPlot, dumbbellLimits } from './dumbbell-plot.tsx';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { FigureProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
import type { GroupDirection } from './group-plot-layout.ts';
|
|
6
|
+
/** One group's five-number summary, computed by the application, with the outliers it left out of the whiskers. */
|
|
7
|
+
export type BoxGroup = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly tone?: ChartTone | undefined;
|
|
11
|
+
/** The end of the lower whisker. */
|
|
12
|
+
readonly low: number;
|
|
13
|
+
readonly q1: number;
|
|
14
|
+
readonly median: number;
|
|
15
|
+
readonly q3: number;
|
|
16
|
+
/** The end of the upper whisker. */
|
|
17
|
+
readonly high: number;
|
|
18
|
+
/** Observations beyond the whiskers. They are drawn as hollow dots and never extend a whisker. */
|
|
19
|
+
readonly outliers?: ReadonlyArray<number> | undefined;
|
|
20
|
+
/** How many observations the summary covers. */
|
|
21
|
+
readonly count?: number | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type BoxPlotProps = FigureProps & {
|
|
24
|
+
readonly groups: ReadonlyArray<BoxGroup>;
|
|
25
|
+
readonly value: PlotAxis;
|
|
26
|
+
readonly direction?: GroupDirection | undefined;
|
|
27
|
+
/** What the whiskers mean, as a phrase without a final period: "Whiskers reach 1.5 × IQR". */
|
|
28
|
+
readonly whiskerLabel: string;
|
|
29
|
+
readonly height?: PlotHeight | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare const boxLimits: {
|
|
32
|
+
readonly groups: 40;
|
|
33
|
+
readonly outliers: 200;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* One box per group, with the middle half of its values as a tinted box and the median as a line. Whiskers reach the
|
|
37
|
+
* ends of the ordinary range and hollow dots mark outliers beyond them, and the application computes every number and
|
|
38
|
+
* says what the whiskers mean. Use it to compare spread and center across groups such as models, layers or runs.
|
|
39
|
+
*/
|
|
40
|
+
export declare function BoxPlot(props: BoxPlotProps): ReactNode;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NumericDomain, ScaleType } from '../plot/scale.ts';
|
|
2
|
+
/** The most records each distribution chart draws. Larger input is refused with a message that names the limit. */
|
|
2
3
|
export declare const distributionLimits: {
|
|
3
4
|
readonly bins: 200;
|
|
4
5
|
readonly cumulativePoints: 2000;
|
|
5
6
|
readonly rows: 200;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
/** Why a distribution chart cannot draw its records on a domain, or undefined when it can. */
|
|
9
|
+
export declare function distributionInputError({ items, domain, scale, maxEntries, }: {
|
|
8
10
|
readonly items: ReadonlyArray<{
|
|
9
11
|
readonly id: string;
|
|
10
12
|
}>;
|
|
11
13
|
readonly domain: NumericDomain;
|
|
14
|
+
readonly scale?: ScaleType | undefined;
|
|
12
15
|
readonly maxEntries: number;
|
|
13
16
|
}): string | undefined;
|
|
14
|
-
export declare function outsideDomain(value: number, domain: NumericDomain): boolean;
|
|
@@ -1,162 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ComponentProps, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { ChartItem } from '../chart.tsx';
|
|
3
|
+
import type { FigureFrameInput } from '../figure/figure-props.ts';
|
|
4
|
+
import type { NumericPlotLayout, PlotAxis } from '../plot/plot-layout.ts';
|
|
5
|
+
export type DistributionFigureProps = {
|
|
6
|
+
readonly frame: FigureFrameInput;
|
|
7
|
+
/** The chart part's own props, from `Chart`'s render. */
|
|
8
|
+
readonly figure: ComponentProps<'figure'>;
|
|
9
|
+
readonly items: ReadonlyArray<ChartItem>;
|
|
10
|
+
readonly inspected: string | null;
|
|
11
|
+
readonly plotRef: Ref<HTMLDivElement>;
|
|
12
|
+
readonly plot: NumericPlotLayout;
|
|
13
|
+
readonly x: PlotAxis;
|
|
14
|
+
readonly y: PlotAxis;
|
|
15
|
+
readonly isSelectable: boolean;
|
|
16
|
+
readonly emptyLabel: string;
|
|
17
|
+
/** The marks, drawn inside the axes. */
|
|
18
|
+
readonly children: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Marks drawn over the axes without the clip: dots that may sit on the plot's edge, and the keyboard cursor, whose
|
|
21
|
+
* underline sits below the plot.
|
|
22
|
+
*/
|
|
23
|
+
readonly overlay: ReactNode;
|
|
6
24
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
13
|
-
}>;
|
|
14
|
-
readonly yAxis: Readonly<{
|
|
15
|
-
readonly height: stylex.StyleXClassNameFor<"height", 160>;
|
|
16
|
-
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
17
|
-
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
18
|
-
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "space-between">;
|
|
19
|
-
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "end">;
|
|
20
|
-
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
21
|
-
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
22
|
-
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
23
|
-
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
24
|
-
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
25
|
-
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", 120>;
|
|
26
|
-
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
27
|
-
}>;
|
|
28
|
-
readonly plotArea: Readonly<{
|
|
29
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
30
|
-
}>;
|
|
31
|
-
readonly svg: Readonly<{
|
|
32
|
-
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
33
|
-
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
34
|
-
readonly height: stylex.StyleXClassNameFor<"height", 160>;
|
|
35
|
-
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
36
|
-
}>;
|
|
37
|
-
readonly grid: Readonly<{
|
|
38
|
-
readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
|
|
39
|
-
readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
|
|
40
|
-
}>;
|
|
41
|
-
readonly axis: Readonly<{
|
|
42
|
-
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
43
|
-
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "space-between">;
|
|
44
|
-
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
45
|
-
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
46
|
-
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
47
|
-
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
48
|
-
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
49
|
-
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
50
|
-
}>;
|
|
51
|
-
readonly tick: Readonly<{
|
|
52
|
-
readonly flex: stylex.StyleXClassNameFor<"flex", "1 1 0">;
|
|
53
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
54
|
-
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
55
|
-
}>;
|
|
56
|
-
readonly middleTick: Readonly<{
|
|
57
|
-
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "center">;
|
|
58
|
-
}>;
|
|
59
|
-
readonly endTick: Readonly<{
|
|
60
|
-
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "end">;
|
|
61
|
-
}>;
|
|
62
|
-
readonly axisNames: Readonly<{
|
|
63
|
-
readonly gridColumn: stylex.StyleXClassNameFor<"gridColumn", "1 / -1">;
|
|
64
|
-
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
65
|
-
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "space-between">;
|
|
66
|
-
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
67
|
-
}>;
|
|
68
|
-
readonly label: Readonly<{
|
|
69
|
-
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
70
|
-
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
71
|
-
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
72
|
-
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
73
|
-
}>;
|
|
74
|
-
readonly values: Readonly<{
|
|
75
|
-
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
76
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
77
|
-
readonly containerType: stylex.StyleXClassNameFor<"containerType", "inline-size">;
|
|
78
|
-
}>;
|
|
79
|
-
readonly value: Readonly<{
|
|
80
|
-
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
81
|
-
readonly flexWrap: stylex.StyleXClassNameFor<"flexWrap", "wrap">;
|
|
82
|
-
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "space-between">;
|
|
83
|
-
readonly columnGap: stylex.StyleXClassNameFor<"columnGap", string>;
|
|
84
|
-
readonly rowGap: stylex.StyleXClassNameFor<"rowGap", string>;
|
|
85
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
86
|
-
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
87
|
-
}>;
|
|
88
|
-
readonly summary: Readonly<{
|
|
89
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
90
|
-
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
91
|
-
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
92
|
-
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "end">;
|
|
93
|
-
}>;
|
|
94
|
-
readonly row: Readonly<{
|
|
95
|
-
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
96
|
-
readonly gridTemplateColumns: stylex.StyleXClassNameFor<"gridTemplateColumns", "minmax(0, 1fr)" | "minmax(100px, 1fr) minmax(120px, 2fr)">;
|
|
97
|
-
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
98
|
-
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
99
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
100
|
-
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
101
|
-
}>;
|
|
102
|
-
readonly rowAxis: Readonly<{
|
|
103
|
-
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
104
|
-
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
105
|
-
}>;
|
|
106
|
-
readonly axisSpacer: Readonly<{
|
|
107
|
-
readonly display: stylex.StyleXClassNameFor<"display", "block" | "none">;
|
|
108
|
-
}>;
|
|
109
|
-
readonly rowLabel: Readonly<{
|
|
110
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
111
|
-
readonly display: stylex.StyleXClassNameFor<"display", "grid">;
|
|
112
|
-
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
113
|
-
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
114
|
-
}>;
|
|
115
|
-
readonly rowValue: Readonly<{
|
|
116
|
-
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
117
|
-
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
118
|
-
}>;
|
|
119
|
-
readonly rowSvg: Readonly<{
|
|
120
|
-
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
121
|
-
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
122
|
-
readonly height: stylex.StyleXClassNameFor<"height", 28>;
|
|
123
|
-
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
124
|
-
}>;
|
|
125
|
-
readonly empty: Readonly<{
|
|
126
|
-
readonly margin: stylex.StyleXClassNameFor<"margin", 0>;
|
|
127
|
-
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
128
|
-
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
129
|
-
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
130
|
-
}>;
|
|
131
|
-
readonly baseline: Readonly<{
|
|
132
|
-
readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
|
|
133
|
-
readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
|
|
134
|
-
}>;
|
|
135
|
-
readonly track: Readonly<{
|
|
136
|
-
readonly fill: stylex.StyleXClassNameFor<"fill", string>;
|
|
137
|
-
}>;
|
|
138
|
-
readonly missing: Readonly<{
|
|
139
|
-
readonly fill: stylex.StyleXClassNameFor<"fill", string>;
|
|
140
|
-
readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
|
|
141
|
-
readonly strokeDasharray: stylex.StyleXClassNameFor<"strokeDasharray", "3 3">;
|
|
142
|
-
readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
|
|
143
|
-
}>;
|
|
144
|
-
}>;
|
|
145
|
-
type NumericPlotProps = {
|
|
146
|
-
/** The plot's accessible name and the id of the readout that describes it. */
|
|
147
|
-
readonly label: string;
|
|
148
|
-
readonly readoutId: string;
|
|
149
|
-
readonly xDomain: NumericDomain;
|
|
150
|
-
readonly yDomain: NumericDomain;
|
|
151
|
-
readonly xLabel: string;
|
|
152
|
-
readonly yLabel: string;
|
|
153
|
-
readonly formatX: (value: number) => string;
|
|
154
|
-
readonly formatY: (value: number) => string;
|
|
155
|
-
readonly children: (width: number) => ReactNode;
|
|
156
|
-
};
|
|
157
|
-
export declare function NumericPlot({ label, readoutId, xDomain, yDomain, xLabel, yLabel, formatX, formatY, children, }: NumericPlotProps): ReactNode;
|
|
158
|
-
export declare function DomainLabels({ domain, formatValue, }: {
|
|
159
|
-
readonly domain: NumericDomain;
|
|
160
|
-
readonly formatValue: (value: number) => string;
|
|
161
|
-
}): ReactNode;
|
|
162
|
-
export {};
|
|
25
|
+
/**
|
|
26
|
+
* The frame, axes, readout and exact-value table that a histogram and a cumulative distribution share. Each chart
|
|
27
|
+
* supplies its own marks.
|
|
28
|
+
*/
|
|
29
|
+
export declare function DistributionFigure({ frame, figure, items, inspected, plotRef, plot, x, y, isSelectable, emptyLabel, children, overlay, }: DistributionFigureProps): ReactNode;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
/** One prepared step of an empirical cumulative distribution: the share of observations at or below `value`. */
|
|
5
6
|
export type ECDFPoint = {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly value: number;
|
|
8
9
|
readonly probability: number | null;
|
|
9
10
|
};
|
|
10
|
-
export type ECDFProps = {
|
|
11
|
-
|
|
12
|
-
readonly report?: ChartReport | undefined;
|
|
13
|
-
readonly description?: string;
|
|
11
|
+
export type ECDFProps = FigureProps & FigureSelectionProps & {
|
|
12
|
+
/** Points in increasing `value` whose probability never decreases. A null probability breaks the line. */
|
|
14
13
|
readonly points: ReadonlyArray<ECDFPoint>;
|
|
15
|
-
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly selection?: ChartSelection;
|
|
22
|
-
readonly emptyLabel?: string;
|
|
14
|
+
/** The measured variable, with its unit. */
|
|
15
|
+
readonly value: PlotAxis;
|
|
16
|
+
/** The cumulative share. Its domain is zero to one when left out. */
|
|
17
|
+
readonly probability: PlotAxis;
|
|
18
|
+
readonly tone?: ChartTone | undefined;
|
|
19
|
+
readonly height?: PlotHeight | undefined;
|
|
23
20
|
};
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The share of observations at or below each value, drawn as a step line from prepared points: latency percentiles,
|
|
23
|
+
* score thresholds, calibration. Read a percentile across from the probability axis. Use `Histogram` for counts.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ECDF(props: ECDFProps): ReactNode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { NumericDomain, ScaleType } from '../plot/scale.ts';
|
|
2
|
+
/** One point of a density curve the application computed: how much of the data lies near `value`. */
|
|
3
|
+
export type DensityPoint = {
|
|
4
|
+
readonly value: number;
|
|
5
|
+
readonly density: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Why a chart of named groups cannot draw, or undefined when it can. The reasons are a domain the scale cannot carry,
|
|
9
|
+
* groups that share an identifier, or more groups than the chart draws.
|
|
10
|
+
*/
|
|
11
|
+
export declare function groupFrameError({ records, limit, noun, domain, scale, }: {
|
|
12
|
+
readonly records: ReadonlyArray<{
|
|
13
|
+
readonly id: string;
|
|
14
|
+
}>;
|
|
15
|
+
readonly limit: number;
|
|
16
|
+
/** What the records are, in the plural: "groups" or "rows". */
|
|
17
|
+
readonly noun: string;
|
|
18
|
+
readonly domain: NumericDomain;
|
|
19
|
+
readonly scale?: ScaleType | undefined;
|
|
20
|
+
}): string | undefined;
|
|
21
|
+
/** The first problem in the density curves of a chart, or undefined when each can be drawn. */
|
|
22
|
+
export declare function densitiesError({ records, domain, limit, }: {
|
|
23
|
+
readonly records: ReadonlyArray<{
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly density: ReadonlyArray<DensityPoint>;
|
|
26
|
+
}>;
|
|
27
|
+
readonly domain: NumericDomain;
|
|
28
|
+
readonly limit: number;
|
|
29
|
+
}): string | undefined;
|
|
30
|
+
/** The highest density among all curves. Charts that share one density scale divide by it. */
|
|
31
|
+
export declare function maxDensity(records: ReadonlyArray<{
|
|
32
|
+
readonly density: ReadonlyArray<DensityPoint>;
|
|
33
|
+
}>): number;
|
|
34
|
+
/** The point where a curve is highest, the first one when several tie. It reads a supplied point, computing nothing. */
|
|
35
|
+
export declare function peakPoint(density: ReadonlyArray<DensityPoint>): DensityPoint | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ChartPoint } from '../chart.tsx';
|
|
2
|
+
import type { PlotGrid } from '../plot/plot-axes.tsx';
|
|
3
|
+
import type { PlotAxis, PlotBox, PlotCategory, PlotHeight, PlotTick } from '../plot/plot-layout.ts';
|
|
4
|
+
import type { Segment } from '../plot/plot-marks.tsx';
|
|
5
|
+
import type { ContinuousScale, NumericDomain } from '../plot/scale.ts';
|
|
6
|
+
/** Which way the groups run: `columns` stand along the bottom, `rows` list down the side. */
|
|
7
|
+
export type GroupDirection = 'columns' | 'rows';
|
|
8
|
+
/** A position in the plot's drawn pixels. */
|
|
9
|
+
export type Vertex = {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
};
|
|
13
|
+
/** A rectangle in the plot's drawn pixels. */
|
|
14
|
+
export type Slot = {
|
|
15
|
+
readonly x: number;
|
|
16
|
+
readonly y: number;
|
|
17
|
+
readonly width: number;
|
|
18
|
+
readonly height: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Turns a position across the groups and a position along the value axis into a drawn position, so one set of marks
|
|
22
|
+
* serves both directions.
|
|
23
|
+
*/
|
|
24
|
+
export type Orientation = {
|
|
25
|
+
readonly point: (across: number, along: number) => Vertex;
|
|
26
|
+
};
|
|
27
|
+
/** The box, ticks, titles and grid a chart of named groups draws its axes from. */
|
|
28
|
+
export type GroupAxes = {
|
|
29
|
+
readonly box: PlotBox;
|
|
30
|
+
readonly xTicks: ReadonlyArray<PlotTick>;
|
|
31
|
+
readonly yTicks: ReadonlyArray<PlotTick>;
|
|
32
|
+
readonly xTitle?: string | undefined;
|
|
33
|
+
readonly yTitle?: string | undefined;
|
|
34
|
+
readonly grid: PlotGrid;
|
|
35
|
+
};
|
|
36
|
+
export type GroupLayout<Group extends PlotCategory> = GroupAxes & {
|
|
37
|
+
readonly value: ContinuousScale;
|
|
38
|
+
/** The width of one group's band. */
|
|
39
|
+
readonly bandwidth: number;
|
|
40
|
+
/** The groups with the position of each band's center across the groups. */
|
|
41
|
+
readonly placed: ReadonlyArray<Group & {
|
|
42
|
+
readonly center: number;
|
|
43
|
+
}>;
|
|
44
|
+
readonly orient: Orientation;
|
|
45
|
+
/** The pointer inspects the group whose band is nearest. */
|
|
46
|
+
readonly locate: (point: ChartPoint) => string | undefined;
|
|
47
|
+
/** The whole band of the group centered at `center`, for the keyboard cursor. */
|
|
48
|
+
readonly slot: (center: number) => Slot;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The plot height of a chart that lists one row per record. It is the named height, grown when the rows would otherwise
|
|
52
|
+
* be shorter than a readable line.
|
|
53
|
+
*/
|
|
54
|
+
export declare function rowsPlotHeight({ height, count }: {
|
|
55
|
+
readonly height: PlotHeight;
|
|
56
|
+
readonly count: number;
|
|
57
|
+
}): number;
|
|
58
|
+
/** The segment between two positions. */
|
|
59
|
+
export declare function segmentBetween(first: Vertex, second: Vertex): Segment;
|
|
60
|
+
/** The SVG path of the closed shape through the vertices. */
|
|
61
|
+
export declare function shapePath(vertices: ReadonlyArray<Vertex>): string;
|
|
62
|
+
/**
|
|
63
|
+
* The layout shared by charts that set one measured value against named groups. It holds the category plot, the groups
|
|
64
|
+
* placed along it, axes written for the direction, and a pointer that finds the nearest group.
|
|
65
|
+
*/
|
|
66
|
+
export declare function groupLayout<Group extends PlotCategory>({ width, height, direction, groups, value, valueDomain, locale, }: {
|
|
67
|
+
readonly width: number;
|
|
68
|
+
readonly height: number;
|
|
69
|
+
readonly direction: GroupDirection;
|
|
70
|
+
readonly groups: ReadonlyArray<Group>;
|
|
71
|
+
readonly value: PlotAxis;
|
|
72
|
+
readonly valueDomain: NumericDomain;
|
|
73
|
+
readonly locale: string;
|
|
74
|
+
}): GroupLayout<Group>;
|
|
75
|
+
/**
|
|
76
|
+
* Where the nth dot of a group sits across its band, from -0.5 to 0.5 of the band's width. The golden ratio spreads
|
|
77
|
+
* neighbors apart and the same dot always lands in the same place.
|
|
78
|
+
*/
|
|
79
|
+
export declare function stripOffset(ordinal: number): number;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { ChartItem, ChartPoint, ChartView } from '../chart.tsx';
|
|
4
|
+
import type { FigureFrameInput, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
5
|
+
import type { Segment } from '../plot/plot-marks.tsx';
|
|
6
|
+
import type { usePlotSize } from '../plot/plot-surface.tsx';
|
|
7
|
+
import type { GroupAxes, Slot } from './group-plot-layout.ts';
|
|
8
|
+
/**
|
|
9
|
+
* Gives each record the tone it draws in: its own, the enclosing scope's, or the hue its place in the figure assigns.
|
|
10
|
+
* Call it before any early return, because it reads the tone scope.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useToned<Item extends {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly tone?: ChartTone | undefined;
|
|
15
|
+
}>(records: ReadonlyArray<Item>): ReadonlyArray<Item & {
|
|
16
|
+
readonly tone: ChartTone;
|
|
17
|
+
}>;
|
|
18
|
+
/** A closed shape tinted in a group's hue with a crisp edge: a box, a violin or a ridge. */
|
|
19
|
+
export declare function ShapeMark({ d, tone, fill, isInspected, isSelected, }: {
|
|
20
|
+
/** The path from `shapePath`. */
|
|
21
|
+
readonly d: string;
|
|
22
|
+
readonly tone: ChartTone;
|
|
23
|
+
/** `soft` lets what lies behind show through; `strong` is a filled body. */
|
|
24
|
+
readonly fill: 'soft' | 'strong';
|
|
25
|
+
readonly isInspected?: boolean | undefined;
|
|
26
|
+
readonly isSelected?: boolean | undefined;
|
|
27
|
+
}): ReactNode;
|
|
28
|
+
/** A segment in ink that marks a summary on top of the data: a median, a typical value or an interquartile bar. */
|
|
29
|
+
export declare function InkBarMark({ weight, ...segment }: Segment & {
|
|
30
|
+
readonly weight: 'thin' | 'thick';
|
|
31
|
+
}): ReactNode;
|
|
32
|
+
/** A dot in ink on a surface-colored fill, for the median inside a violin. */
|
|
33
|
+
export declare function InkDotMark({ x, y }: {
|
|
34
|
+
readonly x: number;
|
|
35
|
+
readonly y: number;
|
|
36
|
+
}): ReactNode;
|
|
37
|
+
/** The keyboard cursor around one group's band. */
|
|
38
|
+
export declare function BandCursor({ x, y, width, height }: Slot): ReactNode;
|
|
39
|
+
/** The keyboard cursor around one dot. */
|
|
40
|
+
export declare function PointCursor({ x, y, radius, }: {
|
|
41
|
+
readonly x: number;
|
|
42
|
+
readonly y: number;
|
|
43
|
+
readonly radius: number;
|
|
44
|
+
}): ReactNode;
|
|
45
|
+
export type GroupFigureProps = FigureSelectionProps & {
|
|
46
|
+
/** The figure's shared props, without the empty label. */
|
|
47
|
+
readonly frame: FigureFrameInput;
|
|
48
|
+
readonly emptyLabel: string;
|
|
49
|
+
/** What the figure measured with `usePlotSize`. */
|
|
50
|
+
readonly size: ReturnType<typeof usePlotSize>;
|
|
51
|
+
readonly axes: GroupAxes;
|
|
52
|
+
/** What the arrow keys step through. No items means there is nothing to draw. */
|
|
53
|
+
readonly items: ReadonlyArray<ChartItem>;
|
|
54
|
+
readonly locate: (point: ChartPoint) => string | undefined;
|
|
55
|
+
/** Where each item sits, so the arrow keys move to the nearest one in their direction. */
|
|
56
|
+
readonly place?: ((id: string) => {
|
|
57
|
+
left: number;
|
|
58
|
+
top: number;
|
|
59
|
+
right: number;
|
|
60
|
+
bottom: number;
|
|
61
|
+
} | undefined) | undefined;
|
|
62
|
+
/** Names what the arrow keys step through, for the plot's accessible name: "groups". */
|
|
63
|
+
readonly marksLabel: string;
|
|
64
|
+
/** A line under the readout that says how to read the marks. */
|
|
65
|
+
readonly note?: string | undefined;
|
|
66
|
+
readonly marks: (view: ChartView) => ReactNode;
|
|
67
|
+
readonly cursor: (id: string) => ReactNode;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The frame, axes, readout, keyboard cursor and exact-value table that charts of named groups share. Each chart
|
|
71
|
+
* supplies its marks and what its items say.
|
|
72
|
+
*/
|
|
73
|
+
export declare function GroupFigure({ frame, emptyLabel, size, axes, items, locate, place, marksLabel, note, marks, cursor, selected, onSelectedChange, }: GroupFigureProps): ReactNode;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
/** One prepared bin: its bounds on the value axis and the number of observations in it, or null when unrecorded. */
|
|
5
6
|
export type HistogramBin = {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly label: string;
|
|
@@ -9,19 +10,18 @@ export type HistogramBin = {
|
|
|
9
10
|
readonly upperBound: number;
|
|
10
11
|
readonly count: number | null;
|
|
11
12
|
};
|
|
12
|
-
export type HistogramProps = {
|
|
13
|
-
|
|
14
|
-
readonly report?: ChartReport | undefined;
|
|
15
|
-
readonly description?: string;
|
|
13
|
+
export type HistogramProps = FigureProps & FigureSelectionProps & {
|
|
14
|
+
/** Bins in increasing order that do not overlap. The application computes them. */
|
|
16
15
|
readonly bins: ReadonlyArray<HistogramBin>;
|
|
17
|
-
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly tone?: ChartTone;
|
|
24
|
-
readonly selection?: ChartSelection;
|
|
25
|
-
readonly emptyLabel?: string;
|
|
16
|
+
/** The measured variable the bins divide, with its unit. */
|
|
17
|
+
readonly value: PlotAxis;
|
|
18
|
+
/** The count axis. It starts at zero; leave its domain out to fit the largest count. */
|
|
19
|
+
readonly count: PlotAxis;
|
|
20
|
+
readonly tone?: ChartTone | undefined;
|
|
21
|
+
readonly height?: PlotHeight | undefined;
|
|
26
22
|
};
|
|
27
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Counts of observations in prepared bins along a measured value, such as request latency or token length. Bars start
|
|
25
|
+
* at zero; a bin with no recorded count is drawn hollow, never as zero. Use `ECDF` to read cumulative shares instead.
|
|
26
|
+
*/
|
|
27
|
+
export declare function Histogram(props: HistogramProps): ReactNode;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { distributionLimits } from './distribution-input.ts';
|
|
1
2
|
export type { ECDFPoint, ECDFProps } from './ecdf.tsx';
|
|
2
3
|
export { ECDF } from './ecdf.tsx';
|
|
3
4
|
export type { HistogramBin, HistogramProps } from './histogram.tsx';
|
|
@@ -6,3 +7,13 @@ export type { IntervalDatum, IntervalPlotProps } from './interval-plot.tsx';
|
|
|
6
7
|
export { IntervalPlot } from './interval-plot.tsx';
|
|
7
8
|
export type { RankedBarDatum, RankedBarsProps } from './ranked-bars.tsx';
|
|
8
9
|
export { RankedBars } from './ranked-bars.tsx';
|
|
10
|
+
export type { BoxGroup, BoxPlotProps } from './box-plot.tsx';
|
|
11
|
+
export { BoxPlot, boxLimits } from './box-plot.tsx';
|
|
12
|
+
export type { DensityPoint } from './group-plot-input.ts';
|
|
13
|
+
export type { GroupDirection } from './group-plot-layout.ts';
|
|
14
|
+
export type { RidgeRow, RidgelineProps } from './ridgeline.tsx';
|
|
15
|
+
export { Ridgeline, ridgelineLimits } from './ridgeline.tsx';
|
|
16
|
+
export type { StripGroup, StripPlotProps, StripPoint } from './strip-plot.tsx';
|
|
17
|
+
export { StripPlot, stripLimits } from './strip-plot.tsx';
|
|
18
|
+
export type { ViolinGroup, ViolinPlotProps } from './violin-plot.tsx';
|
|
19
|
+
export { ViolinPlot, violinLimits } from './violin-plot.tsx';
|