@tensor_1/react 2.37.0 → 2.39.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.
Files changed (40) hide show
  1. package/README.md +50 -0
  2. package/dist/{chart-theme-Cl0IrkKQ.d.cts → ChartCore-BKK2HEfi.d.cts} +77 -50
  3. package/dist/chart-analytic-guide.d.ts +6 -0
  4. package/dist/chart-analytic-guide.js +10 -0
  5. package/dist/chart-analytic-model.d.ts +141 -0
  6. package/dist/chart-analytic-model.js +252 -0
  7. package/dist/chart-analytic.cjs +1372 -0
  8. package/dist/chart-analytic.d.cts +335 -0
  9. package/dist/chart-analytic.d.ts +19 -0
  10. package/dist/chart-analytic.js +95 -0
  11. package/dist/chart-panels-model.d.ts +92 -0
  12. package/dist/chart-panels-model.js +284 -0
  13. package/dist/chart-preset.cjs +41 -4
  14. package/dist/chart-preset.d.cts +2 -2
  15. package/dist/chart-preset.d.ts +1 -1
  16. package/dist/chart-stats-o4zDhpVm.d.cts +46 -0
  17. package/dist/chart-stats.d.ts +46 -0
  18. package/dist/chart-stats.js +89 -0
  19. package/dist/chart-theme.d.ts +3 -0
  20. package/dist/chart-theme.js +2 -0
  21. package/dist/chart.cjs +41 -4
  22. package/dist/chart.d.cts +2 -2
  23. package/dist/chart.d.ts +1 -1
  24. package/dist/components/Chart.d.ts +1 -1
  25. package/dist/components/ChartCore.d.ts +23 -3
  26. package/dist/components/ChartCore.js +40 -5
  27. package/dist/components/ChartPanels.d.ts +52 -0
  28. package/dist/components/ChartPanels.js +170 -0
  29. package/dist/components/InsightCard.d.ts +86 -0
  30. package/dist/components/InsightCard.js +118 -0
  31. package/dist/components/Stat.d.ts +7 -0
  32. package/dist/components/Stat.js +6 -3
  33. package/dist/correlation-scatter-model.d.ts +68 -0
  34. package/dist/correlation-scatter-model.js +179 -0
  35. package/dist/icons/Icon.d.ts +23 -23
  36. package/dist/index.cjs +1185 -961
  37. package/dist/index.d.cts +91 -1
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +10 -0
  40. package/package.json +6 -1
@@ -0,0 +1,335 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { U as UixChartTokens, C as ChartLabels, a as ChartProps } from './ChartCore-BKK2HEfi.cjs';
4
+ export { b as ChartEngine, c as ChartEventHandler, d as ChartLegend, e as ChartLegendItem, f as ChartLegendItemProps, g as ChartLegendProps, h as ChartMetric, i as ChartMetricProps, j as ChartOption, k as ChartTable, l as ChartTableRow, m as ChartTokenSource, D as DEFAULT_CHART_LABELS, n as mergeChartTheme, u as uixChartAreaGradient, o as uixChartPalette, p as uixChartTheme, q as uixChartTokens } from './ChartCore-BKK2HEfi.cjs';
5
+ import { ScatterSeriesOption, MarkLineComponentOption, MarkAreaComponentOption, MarkPointComponentOption, LineSeriesOption, EChartsOption } from 'echarts';
6
+ import { L as LinearFit } from './chart-stats-o4zDhpVm.cjs';
7
+ export { C as ChartStatPoint, P as PredictionBandPoint, l as linearFit, n as normalQuantile, p as predictionBand, q as quantiles, s as studentTQuantile } from './chart-stats-o4zDhpVm.cjs';
8
+
9
+ /** A position on the x axis: a category name, or a time value (ms or ISO string) on a time axis. */
10
+ type ChartX = string | number;
11
+ /** A target line, a limit or a zone. `to` turns a line into a zone between `value` and `to`. */
12
+ interface ChartThreshold {
13
+ value: number;
14
+ to?: number;
15
+ kind: 'target' | 'limit' | 'floor' | 'budget';
16
+ tone: 'neutral' | 'warning' | 'danger';
17
+ label: string;
18
+ /** The side that is bad: shades from the line to the edge of the axis on that side. */
19
+ badSide?: 'above' | 'below';
20
+ }
21
+ /** Something that happened at (or from `at` to `to`) on the time axis. */
22
+ interface ChartEvent {
23
+ at: ChartX;
24
+ to?: ChartX;
25
+ kind: string;
26
+ label: string;
27
+ href?: string;
28
+ tone?: 'neutral' | 'warning' | 'danger';
29
+ }
30
+ /** A projection with its uncertainty, computed by the consumer. `from` is the last actual x. */
31
+ interface ChartForecast {
32
+ from: ChartX;
33
+ points: {
34
+ x: ChartX;
35
+ y: number;
36
+ lower: number;
37
+ upper: number;
38
+ }[];
39
+ /** Central coverage of the band, 0–1 (0.8 = 80 %). */
40
+ level: number;
41
+ /** How it was computed, for the tooltip and the table ("linear over 8 weeks"). */
42
+ method: string;
43
+ }
44
+ /** The previous period's values on the same x positions (a ghost line). */
45
+ interface ChartComparison {
46
+ label: string;
47
+ values: (number | null)[];
48
+ }
49
+ /** Every word the overlays draw. English defaults in {@link DEFAULT_ANALYTIC_LABELS}. */
50
+ interface ChartAnalyticLabels {
51
+ projection: string;
52
+ /** The band's name in the legend, the tooltip and the table, e.g. "80 % range". */
53
+ range: (level: number) => string;
54
+ partial: string;
55
+ crossed: (x: string) => string;
56
+ lower: string;
57
+ upper: string;
58
+ threshold: string;
59
+ event: string;
60
+ /** How an x value is written in labels and tables. */
61
+ formatX: (x: ChartX) => string;
62
+ }
63
+ declare const DEFAULT_ANALYTIC_LABELS: ChartAnalyticLabels;
64
+ /** Series-level mark fragments; spread into one series, or combine several with {@link combineMarks}. */
65
+ interface ChartMarks {
66
+ markLine?: MarkLineComponentOption;
67
+ markArea?: MarkAreaComponentOption;
68
+ markPoint?: MarkPointComponentOption;
69
+ }
70
+ /** Merge mark fragments into one (a series carries one markLine, one markArea and one markPoint). */
71
+ declare function combineMarks(...fragments: (ChartMarks | null | undefined)[]): ChartMarks;
72
+ /**
73
+ * Threshold lines and zones. A line is solid reference ink with its label in the right gutter
74
+ * (the plot needs `grid.right` ≥ 96 px; ChartPanels reserves it). A zone (`to`, or `badSide` with an
75
+ * axis `extent`) is a token wash. Lines never take a status hue: the zone carries the tone.
76
+ */
77
+ declare function thresholdMarks(thresholds: readonly ChartThreshold[], options: {
78
+ tokens: UixChartTokens;
79
+ extent?: [number, number];
80
+ }): ChartMarks;
81
+ /** One pin in the event lane: [x, 0, index into the events]. */
82
+ type ChartEventPin = [ChartX, number, number];
83
+ /** The event lane: a thin row above the plot that owns the events' tooltip and click-through. */
84
+ interface ChartEventLane {
85
+ series: ScatterSeriesOption;
86
+ }
87
+ /**
88
+ * Events: unlabeled solid lines through the plot (ranges as a light wash) plus the pins of the lane.
89
+ * The tone is carried by the pin's shape (circle, triangle, diamond) in event ink, never by a status
90
+ * hue, so the lane stays calm. Put `lane.series` on the lane's grid (ChartPanels does).
91
+ */
92
+ declare function eventMarks(events: readonly ChartEvent[], options: {
93
+ tokens: UixChartTokens;
94
+ xAxisIndex?: number;
95
+ yAxisIndex?: number;
96
+ seriesId?: string;
97
+ }): ChartMarks & {
98
+ lane: ChartEventLane;
99
+ };
100
+ /**
101
+ * A forecast as three series: a hidden lower bound, the band stacked on it (upper − lower) in
102
+ * `--uix-chart-forecast-band`, and the dashed centre line in the series colour, starting at `from`.
103
+ * The centre carries a light "Projection" wash from `from` to the last point.
104
+ */
105
+ declare function forecastSeries(forecast: ChartForecast, options: {
106
+ name: string;
107
+ colorIndex?: number;
108
+ tokens: UixChartTokens;
109
+ labels?: Partial<ChartAnalyticLabels>;
110
+ /** The last actual value, so the dashed line starts where the solid one ends. */
111
+ fromValue?: number | null;
112
+ xAxisIndex?: number;
113
+ yAxisIndex?: number;
114
+ idPrefix?: string;
115
+ }): LineSeriesOption[];
116
+ /** The previous period as a thin SOLID ghost line (dashes are reserved for projections). */
117
+ declare function comparisonSeries(comparison: ChartComparison, options: {
118
+ x: readonly ChartX[];
119
+ tokens: UixChartTokens;
120
+ xAxisIndex?: number;
121
+ yAxisIndex?: number;
122
+ id?: string;
123
+ }): LineSeriesOption;
124
+ /**
125
+ * The last, still-filling period: a shaded wash from the previous bucket (`from`) to `lastX`,
126
+ * labelled "Partial" at the foot of the plot. On a category line axis the points sit on the
127
+ * categories, so the wash spans the segment that leads into the partial point.
128
+ */
129
+ declare function partialPeriod(lastX: ChartX, options: {
130
+ tokens: UixChartTokens;
131
+ from?: ChartX;
132
+ labels?: Partial<ChartAnalyticLabels>;
133
+ }): ChartMarks;
134
+ /**
135
+ * Indexes where the series first enters the bad side of a threshold (after being on the good side
136
+ * or at the start of a run of nulls). `badSide` defaults to `above` (`floor` thresholds: `below`).
137
+ */
138
+ declare function findCrossings(values: readonly (number | null)[], threshold: Pick<ChartThreshold, 'value' | 'badSide' | 'kind'>): number[];
139
+ /** A ringed point at each first crossing, labelled "Crossed <x>" above it. */
140
+ declare function crossingPoints(values: readonly (number | null)[], threshold: ChartThreshold, options: {
141
+ x: readonly ChartX[];
142
+ tokens: UixChartTokens;
143
+ labels?: Partial<ChartAnalyticLabels>;
144
+ }): ChartMarks;
145
+
146
+ /** One variable in a panel. `values` align with `x.values`. */
147
+ interface ChartPanelSeries {
148
+ id: string;
149
+ label: string;
150
+ values: (number | null)[];
151
+ /** Slot in the categorical palette (0-based). Defaults to the series' index in its panel. */
152
+ colorIndex?: number;
153
+ }
154
+ /** One panel: one unit, one y axis. */
155
+ interface ChartPanel {
156
+ id: string;
157
+ title: string;
158
+ /** Written after values ("h", "%", "items"). `%` is attached, anything else follows a space. */
159
+ unit?: string;
160
+ /** Plot height in px (without the title row). Default 112. */
161
+ height?: number;
162
+ kind: 'line' | 'bar' | 'area';
163
+ series: ChartPanelSeries[];
164
+ thresholds?: ChartThreshold[];
165
+ /** A projection of the panel's first series. */
166
+ forecast?: ChartForecast;
167
+ comparison?: ChartComparison;
168
+ }
169
+ interface ChartPanelsX {
170
+ type: 'category' | 'time';
171
+ values: ChartX[];
172
+ }
173
+ /** Words ChartPanels draws or writes into its tables, on top of the overlay words. */
174
+ interface ChartPanelsLabels extends ChartAnalyticLabels {
175
+ /** Header of the x column in each panel's data table. */
176
+ x: string;
177
+ /** A panel table's caption. */
178
+ table: (panelTitle: string) => string;
179
+ formatValue: (value: number, unit?: string) => string;
180
+ }
181
+ declare const DEFAULT_CHART_PANELS_LABELS: ChartPanelsLabels;
182
+ interface ChartPanelsSpec {
183
+ x: ChartPanelsX;
184
+ panels: ChartPanel[];
185
+ /** One event lane on top; lines through every panel. */
186
+ events?: ChartEvent[];
187
+ /** The last x is a period still filling up: shaded and labelled in every panel. */
188
+ partialLast?: boolean;
189
+ /** Linked inside zoom (wheel / pinch) on every panel. */
190
+ zoom?: boolean;
191
+ }
192
+ /** A legend entry: identity is never colour alone (dataviz), so the swatch shape says the role. */
193
+ interface ChartPanelsLegendItem {
194
+ label: string;
195
+ color: string;
196
+ swatch: 'line' | 'dash' | 'block';
197
+ }
198
+ interface ChartPanelsTable {
199
+ caption: string;
200
+ headers: string[];
201
+ rows: Record<string, string | number>[];
202
+ }
203
+ interface ChartPanelsModel {
204
+ option: EChartsOption;
205
+ /** Total chart height in px, from the panels. */
206
+ height: number;
207
+ legend: ChartPanelsLegendItem[];
208
+ tables: ChartPanelsTable[];
209
+ /** The x positions on the axis: `x.values` plus forecast positions past them. */
210
+ categories: ChartX[];
211
+ /** Series id → panel id, for click handling. */
212
+ seriesPanel: Record<string, string>;
213
+ /** The id of the event lane's series ('' when there are no events). */
214
+ laneSeriesId: string;
215
+ }
216
+ declare const CHART_PANELS_LAYOUT: {
217
+ readonly top: 8;
218
+ readonly lane: 14;
219
+ readonly laneGap: 10;
220
+ readonly title: 28;
221
+ readonly panelHeight: 112;
222
+ readonly panelGap: 14;
223
+ readonly axisBand: 30;
224
+ readonly left: 52;
225
+ readonly right: 16;
226
+ readonly gutter: 100;
227
+ };
228
+ /** A "nice" upper bound (1, 2, 2.5, 5 × 10ⁿ) at or above `value`. */
229
+ declare function niceCeil(value: number): number;
230
+ /** Build the panels' option, height, legend and tables from typed data. */
231
+ declare function chartPanelsModel(spec: ChartPanelsSpec, tokens: UixChartTokens, labelOverrides?: Partial<ChartPanelsLabels>): ChartPanelsModel;
232
+
233
+ interface CorrelationPoint {
234
+ x: number;
235
+ y: number;
236
+ label: string;
237
+ href?: string;
238
+ /** A point that matters (a breach): a status hue AND a distinct shape, never colour alone. */
239
+ emphasis?: 'danger' | 'warning';
240
+ }
241
+ interface CorrelationScatterLabels {
242
+ /** The stats caption. `r` is null when it is undefined (y constant). */
243
+ stats: (stats: {
244
+ r: number | null;
245
+ n: number;
246
+ }) => string;
247
+ notEnough: (n: number, min: number) => string;
248
+ percentile: (p: number) => string;
249
+ trend: string;
250
+ /** Header of the label column in the data table. */
251
+ point: string;
252
+ formatX: (x: number) => string;
253
+ formatY: (y: number) => string;
254
+ }
255
+ /** r to two decimals, truncated toward zero so an imperfect fit never reads "r = 1.00". */
256
+ declare function formatCorrelation(r: number): string;
257
+ declare const DEFAULT_CORRELATION_SCATTER_LABELS: CorrelationScatterLabels;
258
+ interface CorrelationScatterSpec {
259
+ points: CorrelationPoint[];
260
+ xLabel: string;
261
+ yLabel: string;
262
+ trend?: 'linear' | 'none';
263
+ /** Percentile lines of y, in percent (e.g. [50, 90]). */
264
+ percentiles?: number[];
265
+ thresholds?: {
266
+ x?: ChartThreshold[];
267
+ y?: ChartThreshold[];
268
+ };
269
+ breakpoint?: {
270
+ x: number;
271
+ label: string;
272
+ };
273
+ /** Below this many points there is no trend and no stats. Default 8. */
274
+ minPoints?: number;
275
+ }
276
+ interface CorrelationScatterModel {
277
+ /** False below `minPoints`: render the "not enough data" state instead of a trend. */
278
+ enough: boolean;
279
+ n: number;
280
+ minPoints: number;
281
+ fit: LinearFit | null;
282
+ option: EChartsOption;
283
+ statsText: string;
284
+ table: {
285
+ headers: string[];
286
+ rows: Record<string, string | number>[];
287
+ };
288
+ /** Index into `points` for each data item of the hit series. */
289
+ hitSeriesId: string;
290
+ }
291
+ /** Hit target for every point, in px: above the 24 px accessible minimum (WCAG 2.5.8) with the 2 px gap around it. */
292
+ declare const SCATTER_HIT_SIZE = 26;
293
+ declare function correlationScatterModel(spec: CorrelationScatterSpec, tokens: UixChartTokens, labelOverrides?: Partial<CorrelationScatterLabels>): CorrelationScatterModel;
294
+
295
+ interface ChartFrameProps {
296
+ /** Accessible name of the whole chart. Required: a chart without one tells a screen reader nothing. */
297
+ ariaLabel: string;
298
+ title?: string;
299
+ subtitle?: string;
300
+ header?: ReactNode;
301
+ headerAction?: ReactNode;
302
+ footer?: ReactNode;
303
+ loading?: boolean;
304
+ empty?: ReactNode;
305
+ className?: string;
306
+ /** Charts with the same group share one crosshair across cards. */
307
+ group?: string;
308
+ }
309
+ interface ChartPanelsProps extends ChartPanelsSpec, ChartFrameProps {
310
+ labels?: Partial<ChartPanelsLabels> & Partial<ChartLabels>;
311
+ /** A click on a panel's point. */
312
+ onPointClick?: (panelId: string, x: ChartX) => void;
313
+ /** A click on an event pin. Without a handler, an event with `href` navigates there. */
314
+ onEventClick?: (event: ChartEvent) => void;
315
+ /** Show the legend (series of multi-series panels, comparison, projection). Default: when there is one. */
316
+ legend?: boolean;
317
+ }
318
+ interface CorrelationScatterProps extends CorrelationScatterSpec, ChartFrameProps {
319
+ labels?: Partial<CorrelationScatterLabels> & Partial<ChartLabels>;
320
+ /** Show r, n and "association, not cause" under the plot. Default true. */
321
+ showStats?: boolean;
322
+ /** Plot height in px. Default 280. */
323
+ height?: number;
324
+ /** A click on a point. Without a handler, a point with `href` navigates there. */
325
+ onPointClick?: (point: CorrelationPoint) => void;
326
+ }
327
+
328
+ /** Chart on the analytic build: everything the lean preset has for line and bar, plus the overlays. */
329
+ declare function Chart(props: ChartProps): react.JSX.Element;
330
+ /** Aligned panels on one x axis with one crosshair; thresholds, events, forecasts, comparison, partial period. */
331
+ declare function ChartPanels(props: ChartPanelsProps): react.JSX.Element;
332
+ /** Two variables against each other: dots, OLS trend, r and n, percentiles, thresholds, a breaking point. */
333
+ declare function CorrelationScatter(props: CorrelationScatterProps): react.JSX.Element;
334
+
335
+ export { CHART_PANELS_LAYOUT, Chart, type ChartAnalyticLabels, type ChartComparison, type ChartEvent, type ChartEventLane, type ChartEventPin, type ChartForecast, ChartLabels, type ChartMarks, type ChartPanel, type ChartPanelSeries, ChartPanels, type ChartPanelsLabels, type ChartPanelsLegendItem, type ChartPanelsModel, type ChartPanelsProps, type ChartPanelsSpec, type ChartPanelsTable, type ChartPanelsX, ChartProps, type ChartThreshold, type ChartX, type CorrelationPoint, CorrelationScatter, type CorrelationScatterLabels, type CorrelationScatterModel, type CorrelationScatterProps, type CorrelationScatterSpec, DEFAULT_ANALYTIC_LABELS, DEFAULT_CHART_PANELS_LABELS, DEFAULT_CORRELATION_SCATTER_LABELS, LinearFit, SCATTER_HIT_SIZE, UixChartTokens, chartPanelsModel, combineMarks, comparisonSeries, correlationScatterModel, crossingPoints, eventMarks, findCrossings, forecastSeries, formatCorrelation, niceCeil, partialPeriod, thresholdMarks };
@@ -0,0 +1,19 @@
1
+ import * as react from 'react';
2
+ import { ChartProps } from './components/ChartCore.js';
3
+ export { ChartEngine, ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartMetric, ChartMetricProps, ChartOption, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './components/ChartCore.js';
4
+ import { ChartPanelsProps, CorrelationScatterProps } from './components/ChartPanels.js';
5
+ export { ChartTokenSource, UixChartTokens, mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from './chart-theme.js';
6
+ export { ChartAnalyticLabels, ChartComparison, ChartEvent, ChartEventLane, ChartEventPin, ChartForecast, ChartMarks, ChartThreshold, ChartX, DEFAULT_ANALYTIC_LABELS, combineMarks, comparisonSeries, crossingPoints, eventMarks, findCrossings, forecastSeries, partialPeriod, thresholdMarks } from './chart-analytic-model.js';
7
+ export { CHART_PANELS_LAYOUT, ChartPanel, ChartPanelSeries, ChartPanelsLabels, ChartPanelsLegendItem, ChartPanelsModel, ChartPanelsSpec, ChartPanelsTable, ChartPanelsX, DEFAULT_CHART_PANELS_LABELS, chartPanelsModel, niceCeil } from './chart-panels-model.js';
8
+ export { CorrelationPoint, CorrelationScatterLabels, CorrelationScatterModel, CorrelationScatterSpec, DEFAULT_CORRELATION_SCATTER_LABELS, SCATTER_HIT_SIZE, correlationScatterModel, formatCorrelation } from './correlation-scatter-model.js';
9
+ export { ChartStatPoint, LinearFit, PredictionBandPoint, linearFit, normalQuantile, predictionBand, quantiles, studentTQuantile } from './chart-stats.js';
10
+ import 'echarts';
11
+
12
+ /** Chart on the analytic build: everything the lean preset has for line and bar, plus the overlays. */
13
+ declare function Chart(props: ChartProps): react.JSX.Element;
14
+ /** Aligned panels on one x axis with one crosshair; thresholds, events, forecasts, comparison, partial period. */
15
+ declare function ChartPanels(props: ChartPanelsProps): react.JSX.Element;
16
+ /** Two variables against each other: dots, OLS trend, r and n, percentiles, thresholds, a breaking point. */
17
+ declare function CorrelationScatter(props: CorrelationScatterProps): react.JSX.Element;
18
+
19
+ export { Chart, ChartPanels, ChartPanelsProps, ChartProps, CorrelationScatter, CorrelationScatterProps };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import * as echarts from "echarts/core";
4
+ import { BarChart, LineChart, ScatterChart } from "echarts/charts";
5
+ import {
6
+ AxisPointerComponent,
7
+ DataZoomInsideComponent,
8
+ GridComponent,
9
+ LegendComponent,
10
+ MarkAreaComponent,
11
+ MarkLineComponent,
12
+ MarkPointComponent,
13
+ TooltipComponent,
14
+ VisualMapPiecewiseComponent
15
+ } from "echarts/components";
16
+ import { SVGRenderer } from "echarts/renderers";
17
+ import { ChartCore } from "./components/ChartCore.js";
18
+ import { ChartPanelsCore, CorrelationScatterCore } from "./components/ChartPanels.js";
19
+ echarts.use([
20
+ BarChart,
21
+ LineChart,
22
+ ScatterChart,
23
+ AxisPointerComponent,
24
+ DataZoomInsideComponent,
25
+ GridComponent,
26
+ LegendComponent,
27
+ MarkAreaComponent,
28
+ MarkLineComponent,
29
+ MarkPointComponent,
30
+ TooltipComponent,
31
+ VisualMapPiecewiseComponent,
32
+ SVGRenderer
33
+ ]);
34
+ const analyticEngine = echarts;
35
+ function Chart(props) {
36
+ return /* @__PURE__ */ jsx(ChartCore, { ...props, engine: analyticEngine });
37
+ }
38
+ function ChartPanels(props) {
39
+ return /* @__PURE__ */ jsx(ChartPanelsCore, { ...props, engine: analyticEngine });
40
+ }
41
+ function CorrelationScatter(props) {
42
+ return /* @__PURE__ */ jsx(CorrelationScatterCore, { ...props, engine: analyticEngine });
43
+ }
44
+ import { ChartLegend, ChartLegendItem, ChartMetric, DEFAULT_CHART_LABELS, uixChartPalette } from "./components/ChartCore.js";
45
+ import { mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from "./chart-theme.js";
46
+ import {
47
+ DEFAULT_ANALYTIC_LABELS,
48
+ combineMarks,
49
+ comparisonSeries,
50
+ crossingPoints,
51
+ eventMarks,
52
+ findCrossings,
53
+ forecastSeries,
54
+ partialPeriod,
55
+ thresholdMarks
56
+ } from "./chart-analytic-model.js";
57
+ import { CHART_PANELS_LAYOUT, DEFAULT_CHART_PANELS_LABELS, chartPanelsModel, niceCeil } from "./chart-panels-model.js";
58
+ import { DEFAULT_CORRELATION_SCATTER_LABELS, SCATTER_HIT_SIZE, correlationScatterModel, formatCorrelation } from "./correlation-scatter-model.js";
59
+ import { linearFit, normalQuantile, predictionBand, quantiles, studentTQuantile } from "./chart-stats.js";
60
+ export {
61
+ CHART_PANELS_LAYOUT,
62
+ Chart,
63
+ ChartLegend,
64
+ ChartLegendItem,
65
+ ChartMetric,
66
+ ChartPanels,
67
+ CorrelationScatter,
68
+ DEFAULT_ANALYTIC_LABELS,
69
+ DEFAULT_CHART_LABELS,
70
+ DEFAULT_CHART_PANELS_LABELS,
71
+ DEFAULT_CORRELATION_SCATTER_LABELS,
72
+ SCATTER_HIT_SIZE,
73
+ chartPanelsModel,
74
+ combineMarks,
75
+ comparisonSeries,
76
+ correlationScatterModel,
77
+ crossingPoints,
78
+ eventMarks,
79
+ findCrossings,
80
+ forecastSeries,
81
+ formatCorrelation,
82
+ linearFit,
83
+ mergeChartTheme,
84
+ niceCeil,
85
+ normalQuantile,
86
+ partialPeriod,
87
+ predictionBand,
88
+ quantiles,
89
+ studentTQuantile,
90
+ thresholdMarks,
91
+ uixChartAreaGradient,
92
+ uixChartPalette,
93
+ uixChartTheme,
94
+ uixChartTokens
95
+ };
@@ -0,0 +1,92 @@
1
+ import { EChartsOption } from 'echarts';
2
+ import { UixChartTokens } from './chart-theme.js';
3
+ import { ChartAnalyticLabels, ChartX, ChartThreshold, ChartForecast, ChartComparison, ChartEvent } from './chart-analytic-model.js';
4
+
5
+ /** One variable in a panel. `values` align with `x.values`. */
6
+ interface ChartPanelSeries {
7
+ id: string;
8
+ label: string;
9
+ values: (number | null)[];
10
+ /** Slot in the categorical palette (0-based). Defaults to the series' index in its panel. */
11
+ colorIndex?: number;
12
+ }
13
+ /** One panel: one unit, one y axis. */
14
+ interface ChartPanel {
15
+ id: string;
16
+ title: string;
17
+ /** Written after values ("h", "%", "items"). `%` is attached, anything else follows a space. */
18
+ unit?: string;
19
+ /** Plot height in px (without the title row). Default 112. */
20
+ height?: number;
21
+ kind: 'line' | 'bar' | 'area';
22
+ series: ChartPanelSeries[];
23
+ thresholds?: ChartThreshold[];
24
+ /** A projection of the panel's first series. */
25
+ forecast?: ChartForecast;
26
+ comparison?: ChartComparison;
27
+ }
28
+ interface ChartPanelsX {
29
+ type: 'category' | 'time';
30
+ values: ChartX[];
31
+ }
32
+ /** Words ChartPanels draws or writes into its tables, on top of the overlay words. */
33
+ interface ChartPanelsLabels extends ChartAnalyticLabels {
34
+ /** Header of the x column in each panel's data table. */
35
+ x: string;
36
+ /** A panel table's caption. */
37
+ table: (panelTitle: string) => string;
38
+ formatValue: (value: number, unit?: string) => string;
39
+ }
40
+ declare const DEFAULT_CHART_PANELS_LABELS: ChartPanelsLabels;
41
+ interface ChartPanelsSpec {
42
+ x: ChartPanelsX;
43
+ panels: ChartPanel[];
44
+ /** One event lane on top; lines through every panel. */
45
+ events?: ChartEvent[];
46
+ /** The last x is a period still filling up: shaded and labelled in every panel. */
47
+ partialLast?: boolean;
48
+ /** Linked inside zoom (wheel / pinch) on every panel. */
49
+ zoom?: boolean;
50
+ }
51
+ /** A legend entry: identity is never colour alone (dataviz), so the swatch shape says the role. */
52
+ interface ChartPanelsLegendItem {
53
+ label: string;
54
+ color: string;
55
+ swatch: 'line' | 'dash' | 'block';
56
+ }
57
+ interface ChartPanelsTable {
58
+ caption: string;
59
+ headers: string[];
60
+ rows: Record<string, string | number>[];
61
+ }
62
+ interface ChartPanelsModel {
63
+ option: EChartsOption;
64
+ /** Total chart height in px, from the panels. */
65
+ height: number;
66
+ legend: ChartPanelsLegendItem[];
67
+ tables: ChartPanelsTable[];
68
+ /** The x positions on the axis: `x.values` plus forecast positions past them. */
69
+ categories: ChartX[];
70
+ /** Series id → panel id, for click handling. */
71
+ seriesPanel: Record<string, string>;
72
+ /** The id of the event lane's series ('' when there are no events). */
73
+ laneSeriesId: string;
74
+ }
75
+ declare const CHART_PANELS_LAYOUT: {
76
+ readonly top: 8;
77
+ readonly lane: 14;
78
+ readonly laneGap: 10;
79
+ readonly title: 28;
80
+ readonly panelHeight: 112;
81
+ readonly panelGap: 14;
82
+ readonly axisBand: 30;
83
+ readonly left: 52;
84
+ readonly right: 16;
85
+ readonly gutter: 100;
86
+ };
87
+ /** A "nice" upper bound (1, 2, 2.5, 5 × 10ⁿ) at or above `value`. */
88
+ declare function niceCeil(value: number): number;
89
+ /** Build the panels' option, height, legend and tables from typed data. */
90
+ declare function chartPanelsModel(spec: ChartPanelsSpec, tokens: UixChartTokens, labelOverrides?: Partial<ChartPanelsLabels>): ChartPanelsModel;
91
+
92
+ export { CHART_PANELS_LAYOUT, type ChartPanel, type ChartPanelSeries, type ChartPanelsLabels, type ChartPanelsLegendItem, type ChartPanelsModel, type ChartPanelsSpec, type ChartPanelsTable, type ChartPanelsX, DEFAULT_CHART_PANELS_LABELS, chartPanelsModel, niceCeil };