@reactloom/charts 0.0.0-stage → 1.0.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 +39 -2
- package/dist/LICENSE +21 -0
- package/dist/_internal/hooks/use-isomorphic-layout-effect.js +7 -0
- package/dist/_internal/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/_internal/primitives/visually-hidden.js +29 -0
- package/dist/_internal/primitives/visually-hidden.js.map +1 -0
- package/dist/_internal/utils/cx.js +10 -0
- package/dist/_internal/utils/cx.js.map +1 -0
- package/dist/_internal/utils/warn.js +13 -0
- package/dist/_internal/utils/warn.js.map +1 -0
- package/dist/advanced-charts.d.ts +37 -0
- package/dist/advanced-charts.d.ts.map +1 -0
- package/dist/advanced-charts.js +587 -0
- package/dist/advanced-charts.js.map +1 -0
- package/dist/cartesian.d.ts +25 -0
- package/dist/cartesian.d.ts.map +1 -0
- package/dist/cartesian.js +461 -0
- package/dist/cartesian.js.map +1 -0
- package/dist/chart-frame.d.ts +55 -0
- package/dist/chart-frame.d.ts.map +1 -0
- package/dist/chart-frame.js +148 -0
- package/dist/chart-frame.js.map +1 -0
- package/dist/charts.d.ts +35 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +47 -0
- package/dist/charts.js.map +1 -0
- package/dist/charts.module.js +126 -0
- package/dist/charts.module.js.map +1 -0
- package/dist/format.d.ts +42 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +101 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/item-charts.d.ts +140 -0
- package/dist/item-charts.d.ts.map +1 -0
- package/dist/item-charts.js +1476 -0
- package/dist/item-charts.js.map +1 -0
- package/dist/pie-chart.d.ts +23 -0
- package/dist/pie-chart.d.ts.map +1 -0
- package/dist/pie-chart.js +216 -0
- package/dist/pie-chart.js.map +1 -0
- package/dist/sparkline.d.ts +25 -0
- package/dist/sparkline.d.ts.map +1 -0
- package/dist/sparkline.js +88 -0
- package/dist/sparkline.js.map +1 -0
- package/dist/styles.css +3 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +76 -3
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Accessor, ChartBaseProps, ChartMessages, ChartSeries } from './types.js';
|
|
2
|
+
export interface HeatmapProps<Row> extends ChartBaseProps {
|
|
3
|
+
data: readonly Row[];
|
|
4
|
+
/** Column of each cell (categories in first-seen order). */
|
|
5
|
+
x: Accessor<Row, string>;
|
|
6
|
+
/** Row of each cell. */
|
|
7
|
+
y: Accessor<Row, string>;
|
|
8
|
+
value: Accessor<Row, number | null | undefined>;
|
|
9
|
+
/** Fix the colour scale instead of fitting the data. */
|
|
10
|
+
domain?: readonly [number, number];
|
|
11
|
+
/** Show values in the cells. @default false */
|
|
12
|
+
showValues?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Values across two categories (weekday × hour, team × metric) as a colour grid. Arrow keys move in two dimensions. */
|
|
15
|
+
export declare function Heatmap<Row>(props: HeatmapProps<Row>): import("react").JSX.Element;
|
|
16
|
+
export interface HistogramProps extends ChartBaseProps {
|
|
17
|
+
/** The raw values; the chart counts them into bins. */
|
|
18
|
+
values: readonly number[];
|
|
19
|
+
/** Number of bins. @default Sturges' rule */
|
|
20
|
+
bins?: number;
|
|
21
|
+
/** Label of the value axis (counts). @default 'Count' */
|
|
22
|
+
countLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
/** The distribution of one measure: values counted into equal-width bins. */
|
|
25
|
+
export declare function Histogram(props: HistogramProps): import("react").JSX.Element;
|
|
26
|
+
export interface BoxPlotProps<Row> extends ChartBaseProps {
|
|
27
|
+
data: readonly Row[];
|
|
28
|
+
/** Name of each group. */
|
|
29
|
+
label: Accessor<Row, string>;
|
|
30
|
+
/** The group's raw values. */
|
|
31
|
+
values: Accessor<Row, readonly number[]>;
|
|
32
|
+
}
|
|
33
|
+
export interface BoxStats {
|
|
34
|
+
label: string;
|
|
35
|
+
min: number;
|
|
36
|
+
q1: number;
|
|
37
|
+
median: number;
|
|
38
|
+
q3: number;
|
|
39
|
+
max: number;
|
|
40
|
+
/** Values beyond 1.5 × IQR from the box. */
|
|
41
|
+
outliers: number[];
|
|
42
|
+
count: number;
|
|
43
|
+
}
|
|
44
|
+
export declare function boxStats(label: string, values: readonly number[]): BoxStats;
|
|
45
|
+
/** Compares distributions: median, quartiles, whiskers (1.5 × IQR) and outliers per group. */
|
|
46
|
+
export declare function BoxPlot<Row>(props: BoxPlotProps<Row>): import("react").JSX.Element;
|
|
47
|
+
export interface WaterfallChartProps<Row> extends ChartBaseProps {
|
|
48
|
+
data: readonly Row[];
|
|
49
|
+
label: Accessor<Row, string>;
|
|
50
|
+
/** The change at this step (negative for decreases). Ignored for totals. */
|
|
51
|
+
value: Accessor<Row, number>;
|
|
52
|
+
/** Rows that show the running total so far (subtotals, the final total). */
|
|
53
|
+
isTotal?: (row: Row) => boolean;
|
|
54
|
+
/** Words for increases and decreases (colour is not the only cue). */
|
|
55
|
+
messages?: Partial<ChartMessages & {
|
|
56
|
+
increase: string;
|
|
57
|
+
decrease: string;
|
|
58
|
+
total: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
/** How a starting value becomes an end value through increases and decreases. */
|
|
62
|
+
export declare function WaterfallChart<Row>(props: WaterfallChartProps<Row>): import("react").JSX.Element;
|
|
63
|
+
export interface FunnelChartProps<Row> extends ChartBaseProps {
|
|
64
|
+
data: readonly Row[];
|
|
65
|
+
label: Accessor<Row, string>;
|
|
66
|
+
value: Accessor<Row, number>;
|
|
67
|
+
}
|
|
68
|
+
/** Stages of a process (visits → sign-ups → purchases) with the conversion between them. */
|
|
69
|
+
export declare function FunnelChart<Row>(props: FunnelChartProps<Row>): import("react").JSX.Element;
|
|
70
|
+
export interface GaugeBand {
|
|
71
|
+
/** Upper bound of the band. */
|
|
72
|
+
to: number;
|
|
73
|
+
label: string;
|
|
74
|
+
color?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface GaugeProps extends Omit<ChartBaseProps, 'table'> {
|
|
77
|
+
value: number;
|
|
78
|
+
/** @default 0 */
|
|
79
|
+
min?: number;
|
|
80
|
+
/** @default 100 */
|
|
81
|
+
max?: number;
|
|
82
|
+
/** Ranges such as good / warning / critical, in ascending order. Their labels are read with the value. */
|
|
83
|
+
bands?: readonly GaugeBand[];
|
|
84
|
+
}
|
|
85
|
+
/** A single value against its range, as a half-circle meter (`role="meter"`). */
|
|
86
|
+
export declare function Gauge(props: GaugeProps): import("react").JSX.Element;
|
|
87
|
+
export interface RadarChartProps<Row> extends ChartBaseProps {
|
|
88
|
+
data: readonly Row[];
|
|
89
|
+
/** The axis (category) of each row. */
|
|
90
|
+
category: Accessor<Row, string>;
|
|
91
|
+
series: ReadonlyArray<ChartSeries<Row>>;
|
|
92
|
+
/** Fix the scale's maximum. Default: the largest value. */
|
|
93
|
+
max?: number;
|
|
94
|
+
/** @default true when there is more than one series */
|
|
95
|
+
legend?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** Several measures per series on spokes around a centre (skills, product attributes). */
|
|
98
|
+
export declare function RadarChart<Row>(props: RadarChartProps<Row>): import("react").JSX.Element;
|
|
99
|
+
export interface TreemapNode {
|
|
100
|
+
label: string;
|
|
101
|
+
/** Size of a leaf; parents are the sum of their children. */
|
|
102
|
+
value?: number;
|
|
103
|
+
children?: readonly TreemapNode[];
|
|
104
|
+
}
|
|
105
|
+
export interface TreemapProps extends ChartBaseProps {
|
|
106
|
+
data: readonly TreemapNode[];
|
|
107
|
+
}
|
|
108
|
+
/** Parts of a whole by size, for many items or two levels (folders and files, regions and products). */
|
|
109
|
+
export declare function Treemap(props: TreemapProps): import("react").JSX.Element;
|
|
110
|
+
export interface SankeyNode {
|
|
111
|
+
id: string;
|
|
112
|
+
label: string;
|
|
113
|
+
}
|
|
114
|
+
export interface SankeyLink {
|
|
115
|
+
source: string;
|
|
116
|
+
target: string;
|
|
117
|
+
value: number;
|
|
118
|
+
}
|
|
119
|
+
export interface SankeyProps extends ChartBaseProps {
|
|
120
|
+
nodes: readonly SankeyNode[];
|
|
121
|
+
links: readonly SankeyLink[];
|
|
122
|
+
}
|
|
123
|
+
/** Flows between stages (budget → departments → costs, traffic sources → pages). Arrow keys move through the flows. */
|
|
124
|
+
export declare function Sankey(props: SankeyProps): import("react").JSX.Element;
|
|
125
|
+
/**
|
|
126
|
+
* The chart's drawing as a standalone SVG string: theme colours and fonts are resolved and
|
|
127
|
+
* inlined, so the file looks the same outside the page. Pass the chart's `<figure>` (or any
|
|
128
|
+
* element containing it).
|
|
129
|
+
*/
|
|
130
|
+
export declare function chartToSvg(root: Element, { title }?: {
|
|
131
|
+
title?: string;
|
|
132
|
+
}): string;
|
|
133
|
+
/** Downloads the chart as an SVG or PNG file (PNG at `scale` × the on-screen size). */
|
|
134
|
+
export declare function downloadChart(root: Element, { format, filename, scale, background }?: {
|
|
135
|
+
format?: 'png' | 'svg';
|
|
136
|
+
filename?: string;
|
|
137
|
+
scale?: number;
|
|
138
|
+
background?: string;
|
|
139
|
+
}): Promise<void>;
|
|
140
|
+
//# sourceMappingURL=item-charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-charts.d.ts","sourceRoot":"","sources":["../src/item-charts.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA6HvF,MAAM,WAAW,YAAY,CAAC,GAAG,CAAE,SAAQ,cAAc;IACvD,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC;IACrB,4DAA4D;IAC5D,CAAC,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACzB,wBAAwB;IACxB,CAAC,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACzB,KAAK,E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