@lilt-ui/charts 0.1.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/LICENSE +21 -0
- package/README.md +107 -0
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/dist/activity-ring.d.ts +44 -0
- package/dist/analysis-BLLWEKBw.js +105 -0
- package/dist/cards/activity-ring-card.d.ts +60 -0
- package/dist/cards/area-chart-card.d.ts +19 -0
- package/dist/cards/area-chart-card.typecheck.d.ts +9 -0
- package/dist/cards/bar-chart-card.d.ts +34 -0
- package/dist/cards/cartesian-card.d.ts +206 -0
- package/dist/cards/chart-card.d.ts +77 -0
- package/dist/cards/combo-chart-card.d.ts +51 -0
- package/dist/cards/format.d.ts +36 -0
- package/dist/cards/funnel-chart-card.d.ts +62 -0
- package/dist/cards/heatmap-chart-card.d.ts +107 -0
- package/dist/cards/horizontal-bar-chart-card.d.ts +60 -0
- package/dist/cards/keys.d.ts +19 -0
- package/dist/cards/line-chart-card.d.ts +19 -0
- package/dist/cards/progress-card.d.ts +55 -0
- package/dist/cards/radar-chart-card.d.ts +93 -0
- package/dist/cards/radial-chart-card.d.ts +79 -0
- package/dist/cards/rank.d.ts +21 -0
- package/dist/cards/sankey-chart-card.d.ts +69 -0
- package/dist/cards/scatter-chart-card.d.ts +91 -0
- package/dist/cards/slope-chart-card.d.ts +73 -0
- package/dist/cards/stat-card.d.ts +68 -0
- package/dist/chart-context.d.ts +102 -0
- package/dist/chart-plot.d.ts +13 -0
- package/dist/chart.d.ts +17 -0
- package/dist/data/chart-data.d.ts +24 -0
- package/dist/data.d.ts +5 -0
- package/dist/data.js +2 -0
- package/dist/engine/analysis.d.ts +11 -0
- package/dist/engine/bars.d.ts +38 -0
- package/dist/engine/comparison.d.ts +3 -0
- package/dist/engine/composition.d.ts +6 -0
- package/dist/engine/domains.d.ts +13 -0
- package/dist/engine/geometry.d.ts +73 -0
- package/dist/engine/lifecycle.d.ts +10 -0
- package/dist/engine/lookup.d.ts +3 -0
- package/dist/engine/normalize.d.ts +21 -0
- package/dist/engine/ranking.d.ts +20 -0
- package/dist/engine/sankey.d.ts +36 -0
- package/dist/engine/scatter.d.ts +15 -0
- package/dist/engine/slope.d.ts +46 -0
- package/dist/engine/stack.d.ts +11 -0
- package/dist/export-chart-svg.d.ts +8 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +11309 -0
- package/dist/interaction/adaptive-readout.d.ts +16 -0
- package/dist/interaction/axis-cursor.d.ts +30 -0
- package/dist/interaction/brush-gesture.d.ts +15 -0
- package/dist/interaction/brush-view.d.ts +12 -0
- package/dist/interaction/chart-controller.d.ts +6 -0
- package/dist/interaction/chart-sync.d.ts +35 -0
- package/dist/interaction/comparison-answer.d.ts +11 -0
- package/dist/interaction/comparison-layer.d.ts +19 -0
- package/dist/interaction/comparison-tooltip.d.ts +14 -0
- package/dist/interaction/focus-overview.d.ts +10 -0
- package/dist/interaction/inspection-layer.d.ts +29 -0
- package/dist/interaction/legend.d.ts +50 -0
- package/dist/interaction/pin-marker.d.ts +12 -0
- package/dist/interaction/tooltip-context.d.ts +4 -0
- package/dist/interaction/tooltip-view.d.ts +26 -0
- package/dist/interaction/tooltip.d.ts +10 -0
- package/dist/interaction/use-category-state.d.ts +24 -0
- package/dist/interaction/use-pinned-selection.d.ts +3 -0
- package/dist/interaction/value-legend.d.ts +32 -0
- package/dist/interaction/visibility.d.ts +8 -0
- package/dist/lifecycle/loading-layer.d.ts +38 -0
- package/dist/lifecycle/skeleton-sheen.d.ts +18 -0
- package/dist/lifecycle/status-content.d.ts +6 -0
- package/dist/model/cartesian-model.d.ts +132 -0
- package/dist/model/cartesian-model.typecheck.d.ts +1 -0
- package/dist/model/use-chart-state.d.ts +6 -0
- package/dist/motion/animated-number.d.ts +54 -0
- package/dist/motion/bounded-text.d.ts +13 -0
- package/dist/motion/entrance.d.ts +9 -0
- package/dist/motion/number-format.d.ts +4 -0
- package/dist/motion/use-chart-motion.d.ts +10 -0
- package/dist/motion/use-focus-domain.d.ts +7 -0
- package/dist/motion/use-glide.d.ts +13 -0
- package/dist/motion/use-series-weights.d.ts +2 -0
- package/dist/paint.d.ts +11 -0
- package/dist/primitives/annotations.d.ts +4 -0
- package/dist/primitives/area.d.ts +8 -0
- package/dist/primitives/axes.d.ts +9 -0
- package/dist/primitives/bar-shape.d.ts +39 -0
- package/dist/primitives/bar.d.ts +7 -0
- package/dist/primitives/change-comparison.d.ts +3 -0
- package/dist/primitives/grid.d.ts +3 -0
- package/dist/primitives/interval-band.d.ts +4 -0
- package/dist/primitives/line.d.ts +8 -0
- package/dist/primitives/plot-background.d.ts +10 -0
- package/dist/primitives/reference-line.d.ts +4 -0
- package/dist/primitives/runoff.d.ts +49 -0
- package/dist/runtime/chart-runtime.d.ts +95 -0
- package/dist/styles.css +2 -0
- package/dist/toolkit/chart-brush.d.ts +3 -0
- package/dist/toolkit/chart-overview.d.ts +3 -0
- package/dist/toolkit/chart-range-summary.d.ts +5 -0
- package/dist/toolkit/chart-readout.d.ts +3 -0
- package/dist/toolkit/chart-toolbar.d.ts +3 -0
- package/dist/toolkit/comparison-details.d.ts +7 -0
- package/dist/types.d.ts +555 -0
- package/dist/use-chart-width.d.ts +5 -0
- package/media/cards-dark.webp +0 -0
- package/media/cards-light.webp +0 -0
- package/media/hero-dark.webp +0 -0
- package/media/hero-light.webp +0 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lilt UI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<h1 align="center">Lilt Charts</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
React chart cards with feeling.<br />
|
|
5
|
+
Pass your rows, name the fields, and get a finished card.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://www.npmjs.com/package/@lilt-ui/charts"><img alt="npm version" src="https://img.shields.io/npm/v/@lilt-ui/charts?color=7c5cff&label=npm" /></a>
|
|
10
|
+
<img alt="TypeScript types included" src="https://img.shields.io/npm/types/@lilt-ui/charts?color=7c5cff" />
|
|
11
|
+
<img alt="MIT license" src="https://img.shields.io/npm/l/@lilt-ui/charts?color=7c5cff" />
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://liltui.vercel.app"><strong>Documentation</strong></a> ·
|
|
16
|
+
<a href="https://liltui.vercel.app/charts/area">Charts</a> ·
|
|
17
|
+
<a href="https://liltui.vercel.app/llms.txt">llms.txt</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<picture>
|
|
21
|
+
<source media="(prefers-color-scheme: light)" srcset="https://cdn.jsdelivr.net/npm/@lilt-ui/charts/media/hero-light.webp" />
|
|
22
|
+
<img alt="A Lilt sales card with segmented stacked bars beside the headline “Give your data a little Lilt.”" src="https://cdn.jsdelivr.net/npm/@lilt-ui/charts/media/hero-dark.webp" />
|
|
23
|
+
</picture>
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @lilt-ui/charts
|
|
29
|
+
# or: pnpm add @lilt-ui/charts
|
|
30
|
+
# or: yarn add @lilt-ui/charts
|
|
31
|
+
# or: bun add @lilt-ui/charts
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Lilt needs React and React DOM 19. Every card, variant, and prop is documented at [liltui.vercel.app](https://liltui.vercel.app). Import the stylesheet once, in your root layout or app entry:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import '@lilt-ui/charts/styles.css';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Your first card
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
'use client';
|
|
44
|
+
|
|
45
|
+
import { AreaChartCard } from '@lilt-ui/charts';
|
|
46
|
+
|
|
47
|
+
const visitors = [
|
|
48
|
+
{ month: 'Jan', organic: 2400, paid: 800 },
|
|
49
|
+
{ month: 'Feb', organic: 2800, paid: 700 },
|
|
50
|
+
{ month: 'Mar', organic: 3100, paid: 900 },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export function VisitorsCard() {
|
|
54
|
+
return (
|
|
55
|
+
<AreaChartCard
|
|
56
|
+
title="Visitors"
|
|
57
|
+
data={visitors}
|
|
58
|
+
x="month"
|
|
59
|
+
series={[
|
|
60
|
+
{ key: 'organic', label: 'Organic' },
|
|
61
|
+
{ key: 'paid', label: 'Paid' },
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That's the whole card: the headline, the change chip, value tiles, and hover all come from your rows. `x` and each series `key` are checked against your data, so a typo is a type error, not a blank chart.
|
|
69
|
+
|
|
70
|
+
## Every card, finished
|
|
71
|
+
|
|
72
|
+
<picture>
|
|
73
|
+
<source media="(prefers-color-scheme: light)" srcset="https://cdn.jsdelivr.net/npm/@lilt-ui/charts/media/cards-light.webp" />
|
|
74
|
+
<img alt="Stat cards with sparklines, bars, and a goal meter above a needle bar chart and a retention heatmap" src="https://cdn.jsdelivr.net/npm/@lilt-ui/charts/media/cards-dark.webp" />
|
|
75
|
+
</picture>
|
|
76
|
+
|
|
77
|
+
| For | Cards |
|
|
78
|
+
| -------------------- | -------------------------------------------------------------------- |
|
|
79
|
+
| **Trends** | Area, Line, Bar, and Combo cards, overlapping, stacked, or as shares |
|
|
80
|
+
| **At a glance** | Stat cards with a sparkline, bars, a meter, or a ring |
|
|
81
|
+
| **Parts and goals** | Radial, Progress, and Activity ring |
|
|
82
|
+
| **Rankings** | Horizontal bar, with shares and an "Other" row |
|
|
83
|
+
| **Flows and change** | Funnel, Sankey, and Slope |
|
|
84
|
+
| **Patterns** | Heatmap, Scatter, and Radar |
|
|
85
|
+
|
|
86
|
+
## Built in, one prop away
|
|
87
|
+
|
|
88
|
+
- **Linked hover.** Give cards the same `sync` name and they read the same moment together.
|
|
89
|
+
- **Targets and forecasts.** `target` draws a goal line and counts the points that reach it. `forecast` marks projected rows and keeps them out of the headline.
|
|
90
|
+
- **Pin and compare.** Click to pin a point. Add `compare` and drag across a chart to see what changed.
|
|
91
|
+
- **Honest data.** `null` is a gap, never a zero, and missing values say so.
|
|
92
|
+
- **Calm by default.** Keyboard navigation, screen reader labels, and motion that respects reduced-motion settings.
|
|
93
|
+
|
|
94
|
+
## Fits your design system
|
|
95
|
+
|
|
96
|
+
Cards follow shadcn theme variables when your app defines them: `--card`, `--card-foreground`, `--muted-foreground`, `--border`, `--ring`, and `--chart-1` to `--chart-5`. Anything you leave out falls back to Lilt's own palette.
|
|
97
|
+
|
|
98
|
+
Every Lilt style lives in the `lilt` cascade layer, so your CSS wins without specificity tricks. With Tailwind, declare the layer order once at the top of your global stylesheet:
|
|
99
|
+
|
|
100
|
+
```css
|
|
101
|
+
@layer theme, base, lilt, components, utilities;
|
|
102
|
+
@import 'tailwindcss';
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT © Lilt UI
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The legend's isolate glyph uses the CenterFocusIcon SVG paths from Hugeicons Free.
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2025 Hugeicons
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChartMotion } from './types';
|
|
3
|
+
export interface ActivitySelection<Row> {
|
|
4
|
+
hour: number;
|
|
5
|
+
row: Row | null;
|
|
6
|
+
value: number | null;
|
|
7
|
+
pinned: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ActivityRingProps<Row> {
|
|
10
|
+
data: readonly Row[];
|
|
11
|
+
hour: (row: Row) => number;
|
|
12
|
+
value: (row: Row) => number | null;
|
|
13
|
+
/** Explicit positive upper bound for dot intensity. Values must be in [0, maximum]. */
|
|
14
|
+
maximum: number;
|
|
15
|
+
/** Minutes per position across a full 24-hour cycle. Must divide 1,440. */
|
|
16
|
+
bucketMinutes?: number;
|
|
17
|
+
/** Number of radial dots used to show intensity. */
|
|
18
|
+
dotDensity?: number;
|
|
19
|
+
unit: string;
|
|
20
|
+
formatValue?: (value: number) => string;
|
|
21
|
+
/** Content at the centre; defaults to the peak reading. */
|
|
22
|
+
center?: ReactNode;
|
|
23
|
+
onSelectionChange?: (selection: ActivitySelection<Row> | null) => void;
|
|
24
|
+
/** `loading` keeps showing the last accepted day until new data is ready. */
|
|
25
|
+
status?: 'ready' | 'loading';
|
|
26
|
+
/** A new key drops the accepted day and any selection. */
|
|
27
|
+
resetKey?: string | number;
|
|
28
|
+
motion?: ChartMotion;
|
|
29
|
+
height?: number;
|
|
30
|
+
'aria-label': string;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
interface Slot<Row> {
|
|
34
|
+
hour: number;
|
|
35
|
+
row: Row | null;
|
|
36
|
+
value: number | null;
|
|
37
|
+
}
|
|
38
|
+
export declare function activitySlots<Row>(data: readonly Row[], hour: (row: Row) => number, value: (row: Row) => number | null, maximum: number, bucketMinutes?: number): readonly Slot<Row>[];
|
|
39
|
+
/**
|
|
40
|
+
* The 24-hour dot ring inside `ActivityRingCard`: one column of dots per time slot, filled by
|
|
41
|
+
* how much happened then. One tab stop; arrow keys step around the day and Enter pins a slot.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ActivityRing<Row>({ data, hour, value, maximum, bucketMinutes, dotDensity, unit, formatValue, center, onSelectionChange, status, resetKey, motion, height, className, 'aria-label': ariaLabel, }: ActivityRingProps<Row>): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
//#region src/data/chart-data.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = t.range;
|
|
4
|
+
if (n && (!Number.isFinite(n.startX) || !Number.isFinite(n.endX))) throw Error("Range bounds must be finite.");
|
|
5
|
+
let r = n ? Math.min(n.startX, n.endX) : -Infinity, i = n ? Math.max(n.startX, n.endX) : Infinity, a = 0, o = 0, s = 0, c = Infinity, l = -Infinity, u = Infinity, d = -Infinity, f = null, p = null, m = /* @__PURE__ */ new Set();
|
|
6
|
+
for (let n of e) {
|
|
7
|
+
let e = Number(t.x(n));
|
|
8
|
+
if (!Number.isFinite(e)) throw Error("Summary positions must be finite numbers or valid dates.");
|
|
9
|
+
if (e < r || e > i) continue;
|
|
10
|
+
if (m.has(e)) throw Error("Summary positions must be unique.");
|
|
11
|
+
m.add(e);
|
|
12
|
+
let h = t.value(n);
|
|
13
|
+
if (h !== null && (typeof h != "number" || !Number.isFinite(h))) throw Error("Summary values must be finite numbers or null.");
|
|
14
|
+
if (e < u && (u = e, f = h), e > d && (d = e, p = h), h === null) {
|
|
15
|
+
o++;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
a++, s += h, c = Math.min(c, h), l = Math.max(l, h);
|
|
19
|
+
}
|
|
20
|
+
if (!Number.isFinite(s)) throw Error("Summary total exceeds the finite numeric range.");
|
|
21
|
+
return {
|
|
22
|
+
count: a,
|
|
23
|
+
missing: o,
|
|
24
|
+
total: a ? s : null,
|
|
25
|
+
mean: a ? s / a : null,
|
|
26
|
+
min: a ? c : null,
|
|
27
|
+
max: a ? l : null,
|
|
28
|
+
first: f,
|
|
29
|
+
last: p,
|
|
30
|
+
change: f === null || p === null ? null : p - f
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function t(e, t) {
|
|
34
|
+
if (!t.length) throw Error("CSV needs at least one column.");
|
|
35
|
+
let n = (e) => {
|
|
36
|
+
if (typeof e == "number" && !Number.isFinite(e)) throw Error("CSV numbers must be finite.");
|
|
37
|
+
if (e instanceof Date && !Number.isFinite(e.getTime())) throw Error("CSV dates must be valid.");
|
|
38
|
+
let t = e === null ? "" : e instanceof Date ? e.toISOString() : String(e);
|
|
39
|
+
return typeof e == "string" && /^[\s]*[=+\-@]|^[\t\r\n]/.test(t) && (t = "'" + t), /[",\r\n]/.test(t) ? `"${t.replaceAll("\"", "\"\"")}"` : t;
|
|
40
|
+
};
|
|
41
|
+
return [t.map((e) => n(e.header)).join(","), ...e.map((e) => t.map((t) => n(t.value(e))).join(","))].join("\r\n") + "\r\n";
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/engine/ranking.ts
|
|
45
|
+
function n(e, t, n) {
|
|
46
|
+
let r = /* @__PURE__ */ new Set();
|
|
47
|
+
return e.map((e, i) => {
|
|
48
|
+
let a = t.id(e), o = t.label(e), s = n(e);
|
|
49
|
+
if (typeof a != "string" || !a.trim()) throw Error(`Invalid category at row ${i + 1}: a non-empty string ID is required.`);
|
|
50
|
+
if (r.has(a)) throw Error(`Duplicate category ID "${a}".`);
|
|
51
|
+
if (typeof o != "string" || !o.trim()) throw Error(`Invalid label for category "${a}".`);
|
|
52
|
+
if (s !== null && (typeof s != "number" || !Number.isFinite(s))) throw Error(`Invalid value for category "${a}": expected a finite number or null.`);
|
|
53
|
+
return r.add(a), {
|
|
54
|
+
id: a,
|
|
55
|
+
label: o,
|
|
56
|
+
datum: e,
|
|
57
|
+
value: s
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function r(e, t) {
|
|
62
|
+
return t === "input" ? [...e] : [...e].sort((e, n) => {
|
|
63
|
+
if (e.value === null && n.value !== null) return 1;
|
|
64
|
+
if (n.value === null && e.value !== null) return -1;
|
|
65
|
+
let r = (e.value ?? 0) - (n.value ?? 0);
|
|
66
|
+
return r ? r * (t === "descending" ? -1 : 1) : e.id < n.id ? -1 : +(e.id > n.id);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function i(e) {
|
|
70
|
+
let t = 0, n = 0;
|
|
71
|
+
for (let r of e) r.value !== null && (t = Math.min(t, r.value), n = Math.max(n, r.value));
|
|
72
|
+
return t === n ? [0, 1] : [t, n];
|
|
73
|
+
}
|
|
74
|
+
function a(e, t) {
|
|
75
|
+
let n = (e) => (e - t[0]) / (t[1] - t[0]) * 100, r = n(0), i = e === null ? r : n(e);
|
|
76
|
+
return {
|
|
77
|
+
zero: r,
|
|
78
|
+
left: Math.min(r, i),
|
|
79
|
+
width: Math.abs(i - r)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/engine/analysis.ts
|
|
84
|
+
function o(e, t) {
|
|
85
|
+
if (e !== null && (!Number.isFinite(e) || e < 0)) throw Error(`${t} must be a non-negative finite number or null.`);
|
|
86
|
+
}
|
|
87
|
+
function s(e) {
|
|
88
|
+
let t = n(e.data, e.category, e.value), r = Infinity;
|
|
89
|
+
for (let e of t) if (o(e.value, `Stage ${e.id}`), e.value !== null) {
|
|
90
|
+
if (e.value > r) throw Error(`Stage ${e.id} exceeds a preceding stage; cumulative funnel counts must not increase.`);
|
|
91
|
+
r = e.value;
|
|
92
|
+
}
|
|
93
|
+
let i = t[0]?.value;
|
|
94
|
+
return t.map((e, n) => {
|
|
95
|
+
let r = t[n - 1]?.value;
|
|
96
|
+
return {
|
|
97
|
+
...e,
|
|
98
|
+
share: e.value !== null && i != null && i > 0 ? e.value / i : null,
|
|
99
|
+
conversion: e.value !== null && r != null && r > 0 ? e.value / r : null,
|
|
100
|
+
drop: e.value !== null && r != null ? r - e.value : null
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { i as a, a as i, n, e as o, r, t as s, s as t };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types';
|
|
3
|
+
import { CardRange } from './cartesian-card';
|
|
4
|
+
import { NumericKey } from './keys';
|
|
5
|
+
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
6
|
+
/** How the resting headline sums up the day. */
|
|
7
|
+
export type ActivityAggregate = 'sum' | 'mean' | 'max';
|
|
8
|
+
export interface ActivityRingCardProps<Row, Key extends NumericKey<Row>> {
|
|
9
|
+
title: string;
|
|
10
|
+
/** One row per time slot. Omit when `ranges` supplies the data. */
|
|
11
|
+
data?: readonly Row[];
|
|
12
|
+
/** Numeric field with the time of day in hours, from 0 up to 24; 14.5 is 14:30. */
|
|
13
|
+
hour: NumericKey<Row>;
|
|
14
|
+
/** How much happened in the slot. `null` means not recorded; zero means nothing happened. */
|
|
15
|
+
value: Key;
|
|
16
|
+
/** Minutes per slot around the day. Must divide 1,440. Defaults to 60. */
|
|
17
|
+
bucketMinutes?: number;
|
|
18
|
+
/** What `value` counts, e.g. "requests". Defaults to the `value` field's name. */
|
|
19
|
+
unit?: string;
|
|
20
|
+
/** Value that fills a slot's dots completely. Defaults to a round number above the peak. */
|
|
21
|
+
maximum?: number;
|
|
22
|
+
/** How the resting headline sums up the day: `sum` (default), `mean`, or `max`. */
|
|
23
|
+
aggregate?: ActivityAggregate;
|
|
24
|
+
/** Ring height in pixels, at least 180. Defaults to 280. */
|
|
25
|
+
height?: number;
|
|
26
|
+
/** Resting headline. Defaults to the `aggregate` of every recorded slot. */
|
|
27
|
+
headline?: number;
|
|
28
|
+
/** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */
|
|
29
|
+
delta?: number;
|
|
30
|
+
deltaTone?: 'default' | 'inverse' | 'neutral';
|
|
31
|
+
/** Static period label, e.g. "Today". */
|
|
32
|
+
range?: string;
|
|
33
|
+
/** Period select. Each range replaces data, delta, and headline. */
|
|
34
|
+
ranges?: readonly CardRange<Row>[];
|
|
35
|
+
defaultRange?: string;
|
|
36
|
+
valueFormat?: Intl.NumberFormatOptions;
|
|
37
|
+
locale?: string;
|
|
38
|
+
formatValue?: (value: number) => string;
|
|
39
|
+
/** Any CSS color for the dots. Defaults to the palette's first color. */
|
|
40
|
+
color?: string;
|
|
41
|
+
surface?: ChartSurface;
|
|
42
|
+
/** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
|
|
43
|
+
badge?: ReactNode;
|
|
44
|
+
/** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
|
|
45
|
+
numberStyle?: AnimatedNumberVariant;
|
|
46
|
+
palette?: ChartPalette;
|
|
47
|
+
loading?: boolean;
|
|
48
|
+
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
49
|
+
motion?: ChartMotion;
|
|
50
|
+
className?: string;
|
|
51
|
+
style?: CSSProperties | ChartStyle;
|
|
52
|
+
}
|
|
53
|
+
/** "14:00" for 14, "03:20" for 3.333…; the day wraps at 24:00. */
|
|
54
|
+
export declare function clockLabel(hour: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* An activity ring card: a 24-hour day wrapped into a ring of dot columns, each slot's dots
|
|
57
|
+
* filled by how much happened then. Hovering or stepping around the ring reads each slot in the
|
|
58
|
+
* headline; tiles name the busiest and quietest times.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ActivityRingCard<Row, const Key extends NumericKey<Row>>({ title, data: suppliedData, hour, value, bucketMinutes, unit, maximum: suppliedMaximum, aggregate, height, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, motion, className, style, }: ActivityRingCardProps<Row, Key>): ReactElement;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CartesianCardProps } from './cartesian-card';
|
|
3
|
+
import { NumericKey } from './keys';
|
|
4
|
+
export type { CardRange, CardSeries } from './cartesian-card';
|
|
5
|
+
export interface AreaChartCardProps<Row, Key extends NumericKey<Row>> extends CartesianCardProps<Row, Key> {
|
|
6
|
+
/**
|
|
7
|
+
* Stack the areas: `true` adds them, `'percent'` shows each series' share of its period, and
|
|
8
|
+
* the headline and tiles then read shares of the latest period. Omit to overlap them. Dashed
|
|
9
|
+
* series stay reference lines over the stack.
|
|
10
|
+
*/
|
|
11
|
+
stack?: boolean | 'percent';
|
|
12
|
+
/** `smooth` uses a monotone curve; `linear` draws straight segments. */
|
|
13
|
+
curve?: 'smooth' | 'linear';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A complete area chart card: headline, delta, period, plot, and value tiles.
|
|
17
|
+
* The headline and tiles follow the hovered point.
|
|
18
|
+
*/
|
|
19
|
+
export declare function AreaChartCard<Row, const Key extends NumericKey<Row>>({ stack, curve, ...props }: AreaChartCardProps<Row, Key>): ReactElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const valid: import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const wrongKey: import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const textSeries: import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const wrongX: import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ranged: import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const lineCard: import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const lineTypo: import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const barCard: import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const barTypo: import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CartesianCardProps } from './cartesian-card';
|
|
3
|
+
import { NumericKey } from './keys';
|
|
4
|
+
import { ChartBarAppearance } from '../types';
|
|
5
|
+
export interface BarChartCardProps<Row, Key extends NumericKey<Row>> extends CartesianCardProps<Row, Key> {
|
|
6
|
+
/**
|
|
7
|
+
* Stack the bars: `true` adds them, `'percent'` shows each series' share of its period, and
|
|
8
|
+
* the headline and tiles then read shares of the latest period. Omit to group them side by
|
|
9
|
+
* side. Dashed series stay reference lines over the bars, such as a target.
|
|
10
|
+
*/
|
|
11
|
+
stack?: boolean | 'percent';
|
|
12
|
+
/** Corner radius in pixels. Defaults to 6. */
|
|
13
|
+
radius?: number;
|
|
14
|
+
/**
|
|
15
|
+
* `end` (default) rounds each bar's value end; `all` rounds every corner, so stacked segments
|
|
16
|
+
* read as separate rounded blocks.
|
|
17
|
+
*/
|
|
18
|
+
corners?: 'end' | 'all';
|
|
19
|
+
/** Quiet full-height lanes behind each bar or stack. Defaults to false. */
|
|
20
|
+
tracks?: boolean;
|
|
21
|
+
/** Maximum bar width in pixels; bars never exceed their slot. */
|
|
22
|
+
barWidth?: number;
|
|
23
|
+
/**
|
|
24
|
+
* How bars are drawn: `solid` (default), `segmented` into small cells, `needle` (thin segmented
|
|
25
|
+
* lines; the hovered bar expands), `gradient` fading toward the baseline, or `outline`.
|
|
26
|
+
*/
|
|
27
|
+
barStyle?: ChartBarAppearance;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A complete bar chart card: headline, delta, period, plot, and value tiles.
|
|
31
|
+
* Dashed series draw as reference lines over the bars. Bars stay inside the card padding by
|
|
32
|
+
* default, so every label centers on its bar.
|
|
33
|
+
*/
|
|
34
|
+
export declare function BarChartCard<Row, const Key extends NumericKey<Row>>({ stack, radius, corners, tracks, barWidth, barStyle, ...props }: BarChartCardProps<Row, Key>): ReactElement;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ChartAxisStyle, ChartBarAppearance, ChartBackground, ChartCurve, ChartMotion, ChartPalette, ChartHoverReadout, ChartHoverStyle, ChartTooltipIndicator, ChartStyle, ChartSurface } from '../types';
|
|
3
|
+
import { NumericKey, ResolvedX, XKey, XKind } from './keys';
|
|
4
|
+
import { CardAggregate } from './format';
|
|
5
|
+
import { AnimatedNumberVariant } from '../motion/animated-number';
|
|
6
|
+
export interface CardSeries<Key extends string> {
|
|
7
|
+
/** A numeric field of each row. */
|
|
8
|
+
key: Key;
|
|
9
|
+
/** Defaults to the key. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Any CSS color. Defaults to the next palette color. */
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A reference such as a previous period or target: drawn as a dashed line without a fill and
|
|
15
|
+
* left out of the headline total.
|
|
16
|
+
*/
|
|
17
|
+
dashed?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** A goal each point should reach. A number, or a value with its own line label. */
|
|
20
|
+
export type CardTarget = number | {
|
|
21
|
+
value: number;
|
|
22
|
+
label?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Rows from `from` onward are projections rather than measurements. */
|
|
25
|
+
export interface CardForecast<Row> {
|
|
26
|
+
/** The x value of the first projected row: a label, number, or Date. */
|
|
27
|
+
from: string | number | Date;
|
|
28
|
+
/** Fields holding the low and high end of the projection, drawn as a band around it. */
|
|
29
|
+
lower?: NumericKey<Row>;
|
|
30
|
+
upper?: NumericKey<Row>;
|
|
31
|
+
/** Names the projected region and the hover caption. Defaults to "Forecast". */
|
|
32
|
+
label?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface CardRange<Row> {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
data: readonly Row[];
|
|
38
|
+
delta?: number;
|
|
39
|
+
headline?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Props every Cartesian card shares. Each card adds its own shape options. */
|
|
42
|
+
export interface CartesianCardProps<Row, Key extends NumericKey<Row>> {
|
|
43
|
+
title: string;
|
|
44
|
+
/** One row per x position. Omit when `ranges` supplies the data. */
|
|
45
|
+
data?: readonly Row[];
|
|
46
|
+
/** Field used for the x axis: labels, numbers, or dates. */
|
|
47
|
+
x: XKey<Row>;
|
|
48
|
+
series: readonly CardSeries<Key>[];
|
|
49
|
+
/** Resting headline. Defaults to the total of every series except dashed references. */
|
|
50
|
+
headline?: number;
|
|
51
|
+
/**
|
|
52
|
+
* How the headline and tiles summarize the period at rest: `sum` (default) for counts and
|
|
53
|
+
* money, `mean` or `max` for rates such as latency, `last` for levels such as seats.
|
|
54
|
+
*/
|
|
55
|
+
aggregate?: CardAggregate;
|
|
56
|
+
/** Make the headline follow one series instead of the total, e.g. p95 latency. */
|
|
57
|
+
headlineSeries?: NoInfer<Key>;
|
|
58
|
+
/** Fractional change shown as a chip, e.g. 0.082 → +8.2%. */
|
|
59
|
+
delta?: number;
|
|
60
|
+
deltaTone?: 'default' | 'inverse' | 'neutral';
|
|
61
|
+
/** Static period label, e.g. "This year". */
|
|
62
|
+
range?: string;
|
|
63
|
+
/** Period select. Each range replaces data, delta and headline. */
|
|
64
|
+
ranges?: readonly CardRange<Row>[];
|
|
65
|
+
defaultRange?: string;
|
|
66
|
+
/** Per-series stat tiles under the plot. Defaults to true. */
|
|
67
|
+
tiles?: boolean;
|
|
68
|
+
/** Plot height in pixels. Defaults to 240. */
|
|
69
|
+
height?: number;
|
|
70
|
+
/** Number format for the headline, tiles, and axis, e.g. `{ style: 'currency', currency: 'USD' }`. */
|
|
71
|
+
valueFormat?: Intl.NumberFormatOptions;
|
|
72
|
+
locale?: string;
|
|
73
|
+
/** Full control over value text. Takes precedence over `valueFormat`. */
|
|
74
|
+
formatValue?: (value: number) => string;
|
|
75
|
+
formatAxisValue?: (value: number) => string;
|
|
76
|
+
formatX?: (value: string | number | Date) => string;
|
|
77
|
+
/** Override x inference. Numbers default to `number`; use `time` for timestamps. */
|
|
78
|
+
xType?: XKind;
|
|
79
|
+
/** Axis preset: `minimal` (default), `dots`, `inline`, `ruler`, or `classic`. */
|
|
80
|
+
axis?: ChartAxisStyle;
|
|
81
|
+
/** Texture behind the plot: `dots` (default), `grid`, `lines`, or `none`. */
|
|
82
|
+
background?: ChartBackground;
|
|
83
|
+
/** Brighten the background around the hovered point. Defaults to true. */
|
|
84
|
+
spotlight?: boolean;
|
|
85
|
+
/** Card treatment: `elevated` (default), `outline`, or `ghost` inside your own card. */
|
|
86
|
+
surface?: ChartSurface;
|
|
87
|
+
/** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */
|
|
88
|
+
badge?: ReactNode;
|
|
89
|
+
/** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */
|
|
90
|
+
numberStyle?: AnimatedNumberVariant;
|
|
91
|
+
/** Series color set. Explicit series colors still win. */
|
|
92
|
+
palette?: ChartPalette;
|
|
93
|
+
/**
|
|
94
|
+
* Run marks to the card's edges. Line and area cards fade past the first and last
|
|
95
|
+
* observations. With `false`, data starts and ends at the plot edges and edge labels hang into
|
|
96
|
+
* the card padding to stay centered.
|
|
97
|
+
*/
|
|
98
|
+
bleed?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Padding in pixels between the plot edges and axis labels or pills.
|
|
101
|
+
* Defaults to the card padding (20) when `bleed` is on, otherwise 0.
|
|
102
|
+
*/
|
|
103
|
+
axisInset?: number;
|
|
104
|
+
/**
|
|
105
|
+
* What the hovered point shows, one readout at a time: `pills` (default) on the axes, a
|
|
106
|
+
* `tooltip` with every series, or `headline`, which leaves the plot to the hover dots.
|
|
107
|
+
*/
|
|
108
|
+
hover?: ChartHoverReadout;
|
|
109
|
+
/** How the pills or tooltip look: `soft` (default), `solid`, or `accent`. */
|
|
110
|
+
hoverStyle?: ChartHoverStyle;
|
|
111
|
+
/**
|
|
112
|
+
* Which series the y pill follows and the tooltip leads with: `nearest` (default) tracks the
|
|
113
|
+
* line closest to the pointer, a series key locks it, and `total` follows the top of a stack.
|
|
114
|
+
*/
|
|
115
|
+
pillSeries?: 'nearest' | 'total' | NoInfer<Key>;
|
|
116
|
+
/** Stacks: show the series' own value (`series`, default) or its stacked height (`stack`). */
|
|
117
|
+
pillValue?: 'series' | 'stack';
|
|
118
|
+
/**
|
|
119
|
+
* Where the value pill sits: `mark` above the hovered bar or point, `axis` on the y axis.
|
|
120
|
+
* `auto` (default) uses `mark` when the axis shows no y labels.
|
|
121
|
+
*/
|
|
122
|
+
pillPosition?: 'auto' | 'axis' | 'mark';
|
|
123
|
+
/** Series marker on each tooltip row: `square` (default), `dot`, or `line`. */
|
|
124
|
+
tooltipIndicator?: ChartTooltipIndicator;
|
|
125
|
+
/**
|
|
126
|
+
* Enable range comparison by dragging across the plot. Off by default. `true` or `'headline'`
|
|
127
|
+
* reads the change out in the headline; `'badge'` reads it out in the card's badge tab and
|
|
128
|
+
* leaves the headline and tiles at rest.
|
|
129
|
+
*/
|
|
130
|
+
compare?: boolean | 'headline' | 'badge';
|
|
131
|
+
/**
|
|
132
|
+
* The value each point should reach, drawn as a dashed line. The hovered point reads against
|
|
133
|
+
* it, and at rest the header counts points on target. With `deltaTone="inverse"`, on target
|
|
134
|
+
* means at or below it.
|
|
135
|
+
*/
|
|
136
|
+
target?: CardTarget;
|
|
137
|
+
/**
|
|
138
|
+
* Mark rows from `forecast.from` onward as projections: drawn dotted, left out of the headline
|
|
139
|
+
* and tiles, and captioned "Forecast" on hover. `lower` and `upper` add a range band on line
|
|
140
|
+
* and unstacked area cards; each bound must contain the projected value.
|
|
141
|
+
*/
|
|
142
|
+
forecast?: CardForecast<Row>;
|
|
143
|
+
/**
|
|
144
|
+
* Link hover and pins with every card that uses the same name. Cards match by x: labels
|
|
145
|
+
* exactly, dates and numbers to the nearest row. Every linked card shows its hover marks,
|
|
146
|
+
* pills, and headline at that point; only the card that owns a pin shows its release control.
|
|
147
|
+
*/
|
|
148
|
+
sync?: string;
|
|
149
|
+
loading?: boolean;
|
|
150
|
+
/** `none` turns off decorative motion; reduced-motion users get this automatically. */
|
|
151
|
+
motion?: ChartMotion;
|
|
152
|
+
className?: string;
|
|
153
|
+
style?: CSSProperties | ChartStyle;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Series options only some cards expose. The Combo card draws `as: 'line'` series over its bars,
|
|
157
|
+
* optionally on their own scale and with their own number format and summary.
|
|
158
|
+
*/
|
|
159
|
+
export interface CoreSeries<Key extends string> extends CardSeries<Key> {
|
|
160
|
+
as?: 'line';
|
|
161
|
+
scale?: 'secondary';
|
|
162
|
+
valueFormat?: Intl.NumberFormatOptions;
|
|
163
|
+
aggregate?: CardAggregate;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* How a card combines its series: `false` side by side (bars) or overlapping (areas), `sum`
|
|
167
|
+
* adds them, `percent` shows each series' share of its period.
|
|
168
|
+
*/
|
|
169
|
+
export type CardStack = false | 'sum' | 'percent';
|
|
170
|
+
/** The public `stack` prop: `true` adds series, `'percent'` shows shares. */
|
|
171
|
+
export declare function cardStack(stack: boolean | 'percent' | undefined): CardStack;
|
|
172
|
+
/** How a specific card draws its marks; everything else is shared. */
|
|
173
|
+
export type CardShape = {
|
|
174
|
+
kind: 'area';
|
|
175
|
+
stack: CardStack;
|
|
176
|
+
curve: ChartCurve;
|
|
177
|
+
} | {
|
|
178
|
+
kind: 'line';
|
|
179
|
+
curve: ChartCurve;
|
|
180
|
+
points: boolean;
|
|
181
|
+
zero: boolean;
|
|
182
|
+
} | {
|
|
183
|
+
kind: 'bar';
|
|
184
|
+
stack: CardStack;
|
|
185
|
+
radius: number;
|
|
186
|
+
/** `end` rounds each bar's value end; `all` rounds every corner of every bar and segment. */
|
|
187
|
+
corners: 'end' | 'all';
|
|
188
|
+
tracks: boolean;
|
|
189
|
+
barWidth?: number;
|
|
190
|
+
appearance: ChartBarAppearance;
|
|
191
|
+
/** Curve and point markers of lines drawn over the bars. */
|
|
192
|
+
curve?: ChartCurve;
|
|
193
|
+
points?: boolean;
|
|
194
|
+
};
|
|
195
|
+
/** Matches the default `--lilt-card-padding`. */
|
|
196
|
+
export declare const CARD_PADDING = 20;
|
|
197
|
+
/**
|
|
198
|
+
* The shared card body: headline, delta, period, plot, and value tiles, with hover sync and
|
|
199
|
+
* range comparison. Area, Line, and Bar cards differ only in their `shape`.
|
|
200
|
+
*/
|
|
201
|
+
export declare function CartesianCard<Row, Key extends NumericKey<Row>>({ shape, title, data: suppliedData, x, series: seriesInput, headline: suppliedHeadline, aggregate: suppliedAggregate, headlineSeries, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, tiles, height, valueFormat, locale, formatValue: suppliedFormatValue, formatAxisValue: suppliedFormatAxisValue, formatX, xType, compare, target: suppliedTarget, forecast, sync, axis, hover, hoverStyle, background, spotlight, surface, badge, numberStyle, palette, bleed, axisInset, pillSeries, pillValue, pillPosition, tooltipIndicator, loading, motion, className, style, }: Omit<CartesianCardProps<Row, Key>, 'series'> & {
|
|
202
|
+
series: readonly CoreSeries<Key>[];
|
|
203
|
+
shape: CardShape;
|
|
204
|
+
}): ReactElement;
|
|
205
|
+
/** The plot position where projections begin: a label's row, or the date or number itself. */
|
|
206
|
+
export declare function forecastPosition<Row>(data: readonly Row[], x: string, resolved: ResolvedX<Row>, from: string | number): number | null;
|