@asanchez-sa/abby 0.4.0 → 0.5.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.
@@ -0,0 +1,348 @@
1
+ "use client";
2
+ import { CategoryTable, EmptyChart, categoryScale, valueDomain } from "./categories.js";
3
+ import { rowId, seriesColor, stackTotal, tintOf } from "./scale.js";
4
+ import { Chart } from "./surface.js";
5
+ import { defaultTexts, nameOf } from "./types.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { barY, defineChart, group, stack, text } from "@tanstack/charts";
9
+ import { decorative } from "@tanstack/charts/mark/decorative";
10
+ import { tooltip } from "@tanstack/charts/tooltip";
11
+ // src/components/chart/parts/bar.tsx
12
+ /** Alma's bar: it fills 72% of its column when it's alone in it. */
13
+ const lone = .72;
14
+ /** Bars that share a column fill 86% of their part of it. */
15
+ const shared = .86;
16
+ /** A stacked bar is narrower: about a third of its column, as in Paper. */
17
+ const stackedFill = .32;
18
+ /** The air between two segments of a stack, in px. */
19
+ const segmentGap = 2;
20
+ /** A bar's corners; a stack's segments are squarer. */
21
+ const barRadius = 6;
22
+ const segmentRadius = 2;
23
+ /** An empty value still gets a 4px bar, in the hairline's color. */
24
+ const emptyHeight = 4;
25
+ /** Room for a total over the tallest bar: 6px of air and a 16px line. */
26
+ const totalRoom = 22;
27
+ /** What the x labels take under the plot, and the air TanStack leaves over it. */
28
+ const labelRoom = 24;
29
+ const topRoom = 8;
30
+ /**
31
+ * The group padding that leaves each of `columns` bars 86% of its share of the
32
+ * column. TanStack pads a group inside and at both ends, so a padding of `p`
33
+ * leaves each bar `n(1 - p) / (n + p)` of its share; this solves for `p`.
34
+ */
35
+ function groupPadding(columns) {
36
+ return columns * .14 / (columns + shared);
37
+ }
38
+ /** The bar's own look: the full color, its faint tint, or a forecast's outline. */
39
+ function barLook(bar, faint) {
40
+ const color = seriesColor(bar.series, bar.index);
41
+ if (bar.empty) return {
42
+ fill: "var(--border)",
43
+ stroke: "none",
44
+ dash: ""
45
+ };
46
+ if (bar.series.variant === "forecast") return {
47
+ fill: tintOf(color),
48
+ stroke: color,
49
+ dash: "3 3"
50
+ };
51
+ return {
52
+ fill: faint ? tintOf(color) : color,
53
+ stroke: "none",
54
+ dash: ""
55
+ };
56
+ }
57
+ /**
58
+ * Bars by day or by week: one column per category, one bar per series in it,
59
+ * in the order of `series`. `highlight` names the current category (today, this
60
+ * week): its bars take the full color and the rest their faint tint. A series
61
+ * with `variant: "forecast"` is drawn as an outline in the column of the first
62
+ * series. `stacked` piles the series into one bar, with `totals` over it.
63
+ *
64
+ * Drawn by TanStack Charts: the chart is one tab stop, the arrows move between
65
+ * bars (between whole stacks when stacked), and the tooltip announces each
66
+ * one. A table for a screen reader holds all the values. The chart's name
67
+ * (`aria-label` or `aria-labelledby`) is required.
68
+ */
69
+ function BarChart(props) {
70
+ const $ = c(32);
71
+ const { data, series, stacked: t0, totals: t1, note, height: t2, max, description, className, totalHeader: t3 } = props;
72
+ const stacked = t0 === void 0 ? false : t0;
73
+ const totals = t1 === void 0 ? false : t1;
74
+ const height = t2 === void 0 ? 120 : t2;
75
+ const totalHeader = t3 === void 0 ? defaultTexts.totalHeader : t3;
76
+ const isStack = stacked && series.length > 1;
77
+ if (data.length === 0) {
78
+ let t4;
79
+ if ($[0] !== isStack || $[1] !== props) {
80
+ t4 = /* @__PURE__ */ jsx(EmptyChart, {
81
+ props,
82
+ stack: isStack
83
+ });
84
+ $[0] = isStack;
85
+ $[1] = props;
86
+ $[2] = t4;
87
+ } else t4 = $[2];
88
+ return t4;
89
+ }
90
+ let t4;
91
+ if ($[3] !== data || $[4] !== height || $[5] !== isStack || $[6] !== max || $[7] !== note || $[8] !== props || $[9] !== series || $[10] !== totalHeader || $[11] !== totals) {
92
+ const scale = categoryScale(props);
93
+ const { current, text: show } = scale;
94
+ const plotHeight = Math.max(1, height - (props.xAxis === false ? 0 : labelRoom) - topRoom);
95
+ const domain = valueDomain(data, series, {
96
+ stack: isStack,
97
+ max
98
+ });
99
+ const unit = (domain.max - domain.min) * emptyHeight / plotHeight;
100
+ const headroom = totals ? totalRoom / plotHeight : 0;
101
+ let t5;
102
+ if ($[13] !== series) {
103
+ t5 = series.filter(_temp);
104
+ $[13] = series;
105
+ $[14] = t5;
106
+ } else t5 = $[14];
107
+ const solid = t5;
108
+ const columns = isStack ? 1 : Math.max(1, solid.length);
109
+ const firstColumn = solid[0]?.key ?? series[0]?.key ?? "";
110
+ let t6;
111
+ if ($[15] !== firstColumn || $[16] !== isStack || $[17] !== series || $[18] !== unit) {
112
+ t6 = (row) => {
113
+ const id = rowId(row);
114
+ const drawn = series.flatMap((each_0, index) => {
115
+ const value = row.values[each_0.key];
116
+ if (typeof value !== "number" || !Number.isFinite(value)) return [];
117
+ if (isStack && value <= 0) return [];
118
+ const empty = value <= 0;
119
+ const column = each_0.variant === "forecast" ? firstColumn : each_0.key;
120
+ return [{
121
+ row,
122
+ id,
123
+ column,
124
+ series: each_0,
125
+ index,
126
+ value,
127
+ drawn: empty ? unit : value,
128
+ empty
129
+ }];
130
+ });
131
+ if (isStack && stackTotal(row, series) <= 0) return [{
132
+ row,
133
+ id,
134
+ column: "",
135
+ series: series[0],
136
+ index: 0,
137
+ value: 0,
138
+ drawn: unit,
139
+ empty: true
140
+ }];
141
+ return drawn;
142
+ };
143
+ $[15] = firstColumn;
144
+ $[16] = isStack;
145
+ $[17] = series;
146
+ $[18] = unit;
147
+ $[19] = t6;
148
+ } else t6 = $[19];
149
+ const bars = data.flatMap(t6);
150
+ const faint = (bar) => current !== void 0 && bar.id !== current && !isStack;
151
+ const padding = isStack ? {
152
+ inner: .6799999999999999,
153
+ outer: .6799999999999999 / 2
154
+ } : columns > 1 ? {
155
+ inner: 0,
156
+ outer: 0
157
+ } : {
158
+ inner: .28,
159
+ outer: .28 / 2
160
+ };
161
+ const tops = data.map((row_0) => {
162
+ const id_0 = rowId(row_0);
163
+ const own = bars.filter((bar_0) => bar_0.id === id_0);
164
+ const top = isStack ? Math.max(stackTotal(row_0, series), own.length > 0 ? unit : 0) : Math.max(0, ...own.map(_temp2));
165
+ const last = own[own.length - 1];
166
+ return {
167
+ row: row_0,
168
+ id: id_0,
169
+ top,
170
+ middle: isStack && last ? top - (last.empty ? unit : last.value) / 2 : top / 2,
171
+ total: isStack ? stackTotal(row_0, series) : Math.max(0, ...own.map(_temp3))
172
+ };
173
+ });
174
+ const noted = note ? tops.find((each_1) => each_1.id === note.category || each_1.row.label === note.category) : void 0;
175
+ t4 = defineChart({
176
+ chart: (t7) => {
177
+ const { width } = t7;
178
+ const barWidth = Math.max(1, width - (props.yAxis === false ? 0 : 40)) / data.length * (isStack ? stackedFill : columns > 1 ? shared / columns : lone);
179
+ return {
180
+ marks: [
181
+ barY(bars, {
182
+ x: _temp4,
183
+ y: _temp5,
184
+ z: (bar_5) => isStack ? bar_5.series.key : bar_5.column,
185
+ key: _temp6,
186
+ ...isStack ? { layout: stack({ order: series.map(_temp7) }) } : columns > 1 ? { layout: group({ padding: groupPadding(columns) }) } : {},
187
+ fill: (bar_7) => barLook(bar_7, faint(bar_7)).fill,
188
+ stroke: (bar_8) => isStack ? "var(--background)" : barLook(bar_8, false).stroke,
189
+ strokeWidth: isStack ? segmentGap : 1,
190
+ strokeDasharray: _temp8,
191
+ radius: isStack ? segmentRadius : barRadius
192
+ }),
193
+ ...totals ? [false, true].map((isCurrent) => decorative(text(tops.filter((each_3) => each_3.id === current === isCurrent), {
194
+ x: _temp9,
195
+ y: _temp0,
196
+ text: (each_6) => show(each_6.total),
197
+ dy: -12,
198
+ fontSize: 12,
199
+ fontWeight: isCurrent ? 600 : 500,
200
+ fill: "var(--foreground)"
201
+ }))) : [],
202
+ ...note && noted ? [decorative(text([noted], {
203
+ x: _temp1,
204
+ y: _temp10,
205
+ text: () => note.text,
206
+ anchor: "end",
207
+ dx: -barWidth / 2 - 8,
208
+ fontSize: 12,
209
+ fontWeight: 500,
210
+ fill: note.color ? seriesColor({
211
+ key: "",
212
+ name: "",
213
+ color: note.color
214
+ }, 0) : "var(--muted-foreground)"
215
+ }))] : []
216
+ ],
217
+ scales: {
218
+ x: scale.xAxis("band", padding),
219
+ y: scale.yAxis({
220
+ ...domain,
221
+ headroom
222
+ })
223
+ }
224
+ };
225
+ },
226
+ focus: isStack ? "group-x" : "nearest-x",
227
+ tooltip: {
228
+ use: tooltip,
229
+ content: (found) => {
230
+ const points = found.filter(_temp11);
231
+ const first_0 = points[0]?.datum;
232
+ if (!first_0) return { rows: [] };
233
+ if (isStack) {
234
+ const row_1 = first_0.row;
235
+ return {
236
+ title: row_1.label,
237
+ rows: [...series.flatMap((each_10, index_0) => {
238
+ const value_0 = row_1.values[each_10.key];
239
+ return typeof value_0 === "number" && Number.isFinite(value_0) ? [{
240
+ label: each_10.name,
241
+ value: show(value_0),
242
+ color: seriesColor(each_10, index_0)
243
+ }] : [];
244
+ }), {
245
+ label: totalHeader,
246
+ value: show(stackTotal(row_1, series))
247
+ }]
248
+ };
249
+ }
250
+ return {
251
+ title: first_0.row.label,
252
+ rows: points.map((point) => ({
253
+ label: point.datum.series.name,
254
+ value: show(point.datum.value),
255
+ color: seriesColor(point.datum.series, point.datum.index)
256
+ }))
257
+ };
258
+ }
259
+ }
260
+ });
261
+ $[3] = data;
262
+ $[4] = height;
263
+ $[5] = isStack;
264
+ $[6] = max;
265
+ $[7] = note;
266
+ $[8] = props;
267
+ $[9] = series;
268
+ $[10] = totalHeader;
269
+ $[11] = totals;
270
+ $[12] = t4;
271
+ } else t4 = $[12];
272
+ const definition = t4;
273
+ let t5;
274
+ if ($[20] !== props) {
275
+ t5 = nameOf(props);
276
+ $[20] = props;
277
+ $[21] = t5;
278
+ } else t5 = $[21];
279
+ let t6;
280
+ if ($[22] !== isStack || $[23] !== props) {
281
+ t6 = /* @__PURE__ */ jsx(CategoryTable, {
282
+ props,
283
+ stack: isStack
284
+ });
285
+ $[22] = isStack;
286
+ $[23] = props;
287
+ $[24] = t6;
288
+ } else t6 = $[24];
289
+ let t7;
290
+ if ($[25] !== className || $[26] !== definition || $[27] !== description || $[28] !== height || $[29] !== t5 || $[30] !== t6) {
291
+ t7 = /* @__PURE__ */ jsx(Chart, {
292
+ ...t5,
293
+ definition,
294
+ height,
295
+ description,
296
+ className,
297
+ children: t6
298
+ });
299
+ $[25] = className;
300
+ $[26] = definition;
301
+ $[27] = description;
302
+ $[28] = height;
303
+ $[29] = t5;
304
+ $[30] = t6;
305
+ $[31] = t7;
306
+ } else t7 = $[31];
307
+ return t7;
308
+ }
309
+ function _temp11(each_9) {
310
+ return "series" in each_9.datum;
311
+ }
312
+ function _temp10(each_8) {
313
+ return each_8.middle;
314
+ }
315
+ function _temp1(each_7) {
316
+ return each_7.id;
317
+ }
318
+ function _temp0(each_5) {
319
+ return each_5.top;
320
+ }
321
+ function _temp9(each_4) {
322
+ return each_4.id;
323
+ }
324
+ function _temp8(bar_9) {
325
+ return barLook(bar_9, false).dash;
326
+ }
327
+ function _temp7(each_2) {
328
+ return each_2.key;
329
+ }
330
+ function _temp6(bar_6) {
331
+ return `${bar_6.id}:${bar_6.series.key}`;
332
+ }
333
+ function _temp5(bar_4) {
334
+ return bar_4.drawn;
335
+ }
336
+ function _temp4(bar_3) {
337
+ return bar_3.id;
338
+ }
339
+ function _temp3(bar_2) {
340
+ return bar_2.value;
341
+ }
342
+ function _temp2(bar_1) {
343
+ return bar_1.drawn;
344
+ }
345
+ function _temp(each) {
346
+ return each.variant !== "forecast";
347
+ }
348
+ export { BarChart };
@@ -1,12 +1,11 @@
1
- import "./points.js";
2
1
  import { ChartName, ChartRow, ChartSeries, ChartTexts } from "./types.js";
3
- import { ReactNode } from "react";
4
- export type ChartFrameProps = ChartName & ChartTexts & {
2
+ import "@tanstack/charts";
3
+ export type CategoryChartProps = ChartName & ChartTexts & {
5
4
  data: ChartRow[];
6
5
  series: ChartSeries[];
7
6
  /** The category that is the current one (today, this week): its `id` or `label`. */
8
7
  highlight?: string;
9
- /** The plot's height in px. */
8
+ /** The chart's height in px, axes included. */
10
9
  height?: number;
11
10
  /** Shows the value of each tick to the left of the plot. */
12
11
  yAxis?: boolean;
@@ -27,5 +26,7 @@ export type ChartFrameProps = ChartName & ChartTexts & {
27
26
  labels?: "auto" | "ends";
28
27
  /** Replaces the top of the scale, when two charts must share one. */
29
28
  max?: number;
29
+ /** Read after the name: the units, the period, what a gap means. */
30
+ description?: string;
30
31
  className?: string;
31
32
  };
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ import { cn } from "../../../utilities/cn/index.js";
3
+ import { labelIndices, niceScale, rowId, stackTotal, valueFormatter } from "./scale.js";
4
+ import { ChartTable } from "./table.js";
5
+ import { defaultTexts } from "./types.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { scaleBand } from "@tanstack/charts/scales/band";
9
+ import { scaleLinear } from "@tanstack/charts/scales/linear";
10
+ import { scalePoint } from "@tanstack/charts/scales/point";
11
+ /** The geometry and texts every category chart reads from its props. */
12
+ function categoryScale({ data, highlight, xAxis = true, yAxis = true, grid = true, maxLabels = 8, labels = "auto", format, locale, missing = defaultTexts.missing }) {
13
+ const ids = data.map((row) => rowId(row));
14
+ const highlighted = highlight === void 0 ? -1 : ids.indexOf(highlight);
15
+ const current = highlighted >= 0 ? ids[highlighted] : void 0;
16
+ const formatter = valueFormatter(locale, format);
17
+ const text = (value) => formatter(value, missing);
18
+ const labelOf = new Map(data.map((row) => [rowId(row), row.label]));
19
+ const shownIds = (labels === "ends" ? Array.from(/* @__PURE__ */ new Set([
20
+ 0,
21
+ data.length - 1,
22
+ ...highlighted >= 0 ? [highlighted] : []
23
+ ])) : labelIndices(data.length, maxLabels, highlighted)).sort((a, b) => a - b).map((index) => ids[index]);
24
+ return {
25
+ ids,
26
+ current,
27
+ text,
28
+ xAxis: (kind, padding = {
29
+ inner: 0,
30
+ outer: 0
31
+ }) => ({
32
+ scale: kind === "band" ? scaleBand().domain(ids).paddingInner(padding.inner).paddingOuter(padding.outer) : scalePoint().domain(ids).padding(.5),
33
+ axis: xAxis ? {
34
+ line: false,
35
+ ticks: {
36
+ values: shownIds,
37
+ size: 0,
38
+ line: false,
39
+ padding: 6,
40
+ format: (id) => labelOf.get(id) ?? id
41
+ },
42
+ tickLabels: {
43
+ thin: false,
44
+ fontSize: 11,
45
+ fontWeight: ({ value }) => value === current ? 500 : 400
46
+ }
47
+ } : false
48
+ }),
49
+ yAxis: ({ min, max, ticks, headroom = 0 }) => ({
50
+ scale: scaleLinear().domain([min, max + (max - min) * headroom]).clamp(true),
51
+ grid,
52
+ axis: yAxis ? {
53
+ line: false,
54
+ ticks: {
55
+ values: ticks,
56
+ size: 0,
57
+ line: false,
58
+ padding: 8,
59
+ format: (value) => formatter(value, "")
60
+ },
61
+ tickLabels: { fontSize: 11 }
62
+ } : false
63
+ })
64
+ };
65
+ }
66
+ /** The value scale of a category chart: a round top, or the app's `max` or `domain`. */
67
+ function valueDomain(data, series, { stack = false, max, domain }) {
68
+ if (domain) {
69
+ const [first, second] = domain;
70
+ const min = Math.min(first, second);
71
+ const top = Math.max(first, second);
72
+ const end = top > min ? top : min + 1;
73
+ return {
74
+ min,
75
+ max: end,
76
+ ticks: [
77
+ min,
78
+ (min + end) / 2,
79
+ end
80
+ ].map((tick) => Number(tick.toPrecision(12)))
81
+ };
82
+ }
83
+ let largest = 0;
84
+ for (const row of data) {
85
+ if (stack) {
86
+ largest = Math.max(largest, stackTotal(row, series));
87
+ continue;
88
+ }
89
+ for (const each of series) {
90
+ const value = row.values[each.key];
91
+ if (typeof value === "number" && Number.isFinite(value) && value > largest) largest = value;
92
+ }
93
+ }
94
+ return {
95
+ min: 0,
96
+ ...niceScale(max ?? largest)
97
+ };
98
+ }
99
+ /** The table a screen reader reads: every category and every value. */
100
+ function CategoryTable(t0) {
101
+ const $ = c(14);
102
+ const { props, stack: t1 } = t0;
103
+ const stack = t1 === void 0 ? false : t1;
104
+ const { data, series, categoryHeader: t2, missing: t3, totalHeader: t4, format, locale } = props;
105
+ const categoryHeader = t2 === void 0 ? defaultTexts.categoryHeader : t2;
106
+ const missing = t3 === void 0 ? defaultTexts.missing : t3;
107
+ const totalHeader = t4 === void 0 ? defaultTexts.totalHeader : t4;
108
+ let t5;
109
+ if ($[0] !== format || $[1] !== locale) {
110
+ t5 = valueFormatter(locale, format);
111
+ $[0] = format;
112
+ $[1] = locale;
113
+ $[2] = t5;
114
+ } else t5 = $[2];
115
+ const t6 = props["aria-label"];
116
+ const t7 = props["aria-labelledby"];
117
+ let t8;
118
+ if ($[3] !== t6 || $[4] !== t7) {
119
+ t8 = {
120
+ "aria-label": t6,
121
+ "aria-labelledby": t7
122
+ };
123
+ $[3] = t6;
124
+ $[4] = t7;
125
+ $[5] = t8;
126
+ } else t8 = $[5];
127
+ const t9 = stack ? totalHeader : void 0;
128
+ let t10;
129
+ if ($[6] !== categoryHeader || $[7] !== data || $[8] !== missing || $[9] !== series || $[10] !== t5 || $[11] !== t8 || $[12] !== t9) {
130
+ t10 = /* @__PURE__ */ jsx(ChartTable, {
131
+ rows: data,
132
+ series,
133
+ categoryHeader,
134
+ missing,
135
+ format: t5,
136
+ name: t8,
137
+ totalHeader: t9
138
+ });
139
+ $[6] = categoryHeader;
140
+ $[7] = data;
141
+ $[8] = missing;
142
+ $[9] = series;
143
+ $[10] = t5;
144
+ $[11] = t8;
145
+ $[12] = t9;
146
+ $[13] = t10;
147
+ } else t10 = $[13];
148
+ return t10;
149
+ }
150
+ /** A chart with no rows: its text where the plot would be, under the chart's name. */
151
+ function EmptyChart(t0) {
152
+ const $ = c(16);
153
+ const { props, stack } = t0;
154
+ const { height: t1, empty: t2, className } = props;
155
+ const height = t1 === void 0 ? 120 : t1;
156
+ const empty = t2 === void 0 ? defaultTexts.empty : t2;
157
+ const t3 = props["aria-label"];
158
+ const t4 = props["aria-labelledby"];
159
+ let t5;
160
+ if ($[0] !== className) {
161
+ t5 = cn("flex w-full min-w-0 flex-col gap-3", className);
162
+ $[0] = className;
163
+ $[1] = t5;
164
+ } else t5 = $[1];
165
+ let t6;
166
+ if ($[2] !== height) {
167
+ t6 = { height };
168
+ $[2] = height;
169
+ $[3] = t6;
170
+ } else t6 = $[3];
171
+ let t7;
172
+ if ($[4] !== empty || $[5] !== t6) {
173
+ t7 = /* @__PURE__ */ jsx("div", {
174
+ "data-slot": "chart-empty",
175
+ className: "flex items-center justify-center text-sm text-muted-foreground",
176
+ style: t6,
177
+ children: empty
178
+ });
179
+ $[4] = empty;
180
+ $[5] = t6;
181
+ $[6] = t7;
182
+ } else t7 = $[6];
183
+ let t8;
184
+ if ($[7] !== props || $[8] !== stack) {
185
+ t8 = /* @__PURE__ */ jsx(CategoryTable, {
186
+ props,
187
+ stack
188
+ });
189
+ $[7] = props;
190
+ $[8] = stack;
191
+ $[9] = t8;
192
+ } else t8 = $[9];
193
+ let t9;
194
+ if ($[10] !== t3 || $[11] !== t4 || $[12] !== t5 || $[13] !== t7 || $[14] !== t8) {
195
+ t9 = /* @__PURE__ */ jsxs("div", {
196
+ role: "group",
197
+ "data-slot": "chart",
198
+ "aria-label": t3,
199
+ "aria-labelledby": t4,
200
+ className: t5,
201
+ children: [t7, t8]
202
+ });
203
+ $[10] = t3;
204
+ $[11] = t4;
205
+ $[12] = t5;
206
+ $[13] = t7;
207
+ $[14] = t8;
208
+ $[15] = t9;
209
+ } else t9 = $[15];
210
+ return t9;
211
+ }
212
+ export { CategoryTable, EmptyChart, categoryScale, valueDomain };
@@ -0,0 +1,43 @@
1
+ import { CategoryChartProps } from "./categories.js";
2
+ import { ChartColor } from "./types.js";
3
+ export type LineReference = {
4
+ /** Where the line goes, in the chart's own unit. */
5
+ value: number;
6
+ /** The text at the line's start. Defaults to the value, formatted. */
7
+ label?: string;
8
+ /** Defaults to `border`, a hairline. */
9
+ color?: ChartColor;
10
+ };
11
+ export type LineChartProps = CategoryChartProps & {
12
+ /**
13
+ * Which points get a dot and their value: `ends` the first and the last,
14
+ * `last` only the last. A small chart always marks only the last.
15
+ */
16
+ mark?: "ends" | "last";
17
+ /** Horizontal lines to compare against, each with its label at the start. */
18
+ references?: LineReference[];
19
+ /**
20
+ * `sm` is a chart to put side by side with others: no axes and no grid, only
21
+ * the line with its last point and its value to the right.
22
+ */
23
+ size?: "default" | "sm";
24
+ /**
25
+ * The scale's minimum and maximum, used exactly. Charts that get the same
26
+ * `domain` (and `height`) draw the same value at the same height. Without it
27
+ * the scale runs from 0 to a round number above the largest value.
28
+ */
29
+ domain?: [number, number];
30
+ };
31
+ /**
32
+ * A trend by day or by week: one line over one series, one point per
33
+ * category. `mark` dots the first and last points and writes their values;
34
+ * `references` draws lines to compare against; `size="sm"` is the small chart
35
+ * for a grid of them, which get the same scale from `domain`. A missing value
36
+ * breaks the line.
37
+ *
38
+ * Drawn by TanStack Charts, like `BarChart`: one tab stop, the arrows move
39
+ * between points and the tooltip announces each one, and a table holds all the
40
+ * values. The chart's name (`aria-label` or `aria-labelledby`) is required.
41
+ * Only the first series is drawn: a chart has one line.
42
+ */
43
+ export declare function LineChart(props: LineChartProps): import("react").JSX.Element;