@krizaka/charts 0.0.0-stage → 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 +202 -0
- package/README.md +47 -2
- package/dist/bar.d.ts +17 -0
- package/dist/bar.js +16 -0
- package/dist/bar.js.map +1 -0
- package/dist/candlestick-IG626XL4.js +13 -0
- package/dist/candlestick-IG626XL4.js.map +1 -0
- package/dist/candlestick.d.ts +42 -0
- package/dist/candlestick.js +13 -0
- package/dist/candlestick.js.map +1 -0
- package/dist/canvas-4MSYDVFO.js +14 -0
- package/dist/canvas-4MSYDVFO.js.map +1 -0
- package/dist/cartesian-BRhNQ3ib.d.ts +34 -0
- package/dist/chart.d.ts +58 -0
- package/dist/chart.js +11 -0
- package/dist/chart.js.map +1 -0
- package/dist/chunk-3CJHBJXA.js +186 -0
- package/dist/chunk-3CJHBJXA.js.map +1 -0
- package/dist/chunk-6FINSUOS.js +49 -0
- package/dist/chunk-6FINSUOS.js.map +1 -0
- package/dist/chunk-7CSAGFBW.js +166 -0
- package/dist/chunk-7CSAGFBW.js.map +1 -0
- package/dist/chunk-7TIFCK5E.js +103 -0
- package/dist/chunk-7TIFCK5E.js.map +1 -0
- package/dist/chunk-AHQXJSAQ.js +38 -0
- package/dist/chunk-AHQXJSAQ.js.map +1 -0
- package/dist/chunk-ANUCSRUN.js +43 -0
- package/dist/chunk-ANUCSRUN.js.map +1 -0
- package/dist/chunk-BISL7DYW.js +66 -0
- package/dist/chunk-BISL7DYW.js.map +1 -0
- package/dist/chunk-BZ5CQFPH.js +19 -0
- package/dist/chunk-BZ5CQFPH.js.map +1 -0
- package/dist/chunk-DWJPPEMC.js +455 -0
- package/dist/chunk-DWJPPEMC.js.map +1 -0
- package/dist/chunk-DZB6HEVO.js +73 -0
- package/dist/chunk-DZB6HEVO.js.map +1 -0
- package/dist/chunk-EK3Z647J.js +133 -0
- package/dist/chunk-EK3Z647J.js.map +1 -0
- package/dist/chunk-I5QUZVU2.js +234 -0
- package/dist/chunk-I5QUZVU2.js.map +1 -0
- package/dist/chunk-OB5EFDDH.js +118 -0
- package/dist/chunk-OB5EFDDH.js.map +1 -0
- package/dist/chunk-OER6ETT4.js +155 -0
- package/dist/chunk-OER6ETT4.js.map +1 -0
- package/dist/chunk-PTSB3H5Q.js +205 -0
- package/dist/chunk-PTSB3H5Q.js.map +1 -0
- package/dist/chunk-TPJDOB7R.js +15 -0
- package/dist/chunk-TPJDOB7R.js.map +1 -0
- package/dist/chunk-UNK4MJVG.js +378 -0
- package/dist/chunk-UNK4MJVG.js.map +1 -0
- package/dist/chunk-VKO2OYYM.js +88 -0
- package/dist/chunk-VKO2OYYM.js.map +1 -0
- package/dist/chunk-VKTZD7UT.js +107 -0
- package/dist/chunk-VKTZD7UT.js.map +1 -0
- package/dist/chunk-W5FX4TU3.js +102 -0
- package/dist/chunk-W5FX4TU3.js.map +1 -0
- package/dist/chunk-WBH2QU77.js +178 -0
- package/dist/chunk-WBH2QU77.js.map +1 -0
- package/dist/chunk-WIRCIOLH.js +145 -0
- package/dist/chunk-WIRCIOLH.js.map +1 -0
- package/dist/chunk-XAJ3KCC4.js +116 -0
- package/dist/chunk-XAJ3KCC4.js.map +1 -0
- package/dist/chunk-XC6BQ3RN.js +92 -0
- package/dist/chunk-XC6BQ3RN.js.map +1 -0
- package/dist/chunk-XLLYNNC6.js +89 -0
- package/dist/chunk-XLLYNNC6.js.map +1 -0
- package/dist/chunk-XR4ZJDOV.js +15 -0
- package/dist/chunk-XR4ZJDOV.js.map +1 -0
- package/dist/context-BgYUymEO.d.ts +163 -0
- package/dist/frame-I7_xYGy5.d.ts +45 -0
- package/dist/full-S2MBPEEP.js +11 -0
- package/dist/full-S2MBPEEP.js.map +1 -0
- package/dist/funnel-QU5ZPC52.js +13 -0
- package/dist/funnel-QU5ZPC52.js.map +1 -0
- package/dist/funnel.d.ts +26 -0
- package/dist/funnel.js +13 -0
- package/dist/funnel.js.map +1 -0
- package/dist/gauge.d.ts +38 -0
- package/dist/gauge.js +12 -0
- package/dist/gauge.js.map +1 -0
- package/dist/geo.d.ts +37 -0
- package/dist/geo.js +13 -0
- package/dist/geo.js.map +1 -0
- package/dist/globe.d.ts +36 -0
- package/dist/globe.js +12 -0
- package/dist/globe.js.map +1 -0
- package/dist/heatmap-JWQOKUGM.js +13 -0
- package/dist/heatmap-JWQOKUGM.js.map +1 -0
- package/dist/heatmap.d.ts +47 -0
- package/dist/heatmap.js +15 -0
- package/dist/heatmap.js.map +1 -0
- package/dist/host-_F8RgiIz.d.ts +15 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -0
- package/dist/line.d.ts +25 -0
- package/dist/line.js +18 -0
- package/dist/line.js.map +1 -0
- package/dist/native.d.ts +300 -0
- package/dist/native.js +875 -0
- package/dist/native.js.map +1 -0
- package/dist/pie.d.ts +37 -0
- package/dist/pie.js +16 -0
- package/dist/pie.js.map +1 -0
- package/dist/provider.d.ts +73 -0
- package/dist/provider.js +24 -0
- package/dist/provider.js.map +1 -0
- package/dist/radar-75GRJ2IK.js +13 -0
- package/dist/radar-75GRJ2IK.js.map +1 -0
- package/dist/radar.d.ts +22 -0
- package/dist/radar.js +13 -0
- package/dist/radar.js.map +1 -0
- package/dist/sankey-XQTX2EG6.js +13 -0
- package/dist/sankey-XQTX2EG6.js.map +1 -0
- package/dist/sankey.d.ts +28 -0
- package/dist/sankey.js +13 -0
- package/dist/sankey.js.map +1 -0
- package/dist/scatter-XSNG4OKD.js +13 -0
- package/dist/scatter-XSNG4OKD.js.map +1 -0
- package/dist/scatter.d.ts +41 -0
- package/dist/scatter.js +15 -0
- package/dist/scatter.js.map +1 -0
- package/dist/sparkline.d.ts +26 -0
- package/dist/sparkline.js +15 -0
- package/dist/sparkline.js.map +1 -0
- package/dist/svg-BJUHYX3B.js +14 -0
- package/dist/svg-BJUHYX3B.js.map +1 -0
- package/dist/treemap-OMGGGB5U.js +13 -0
- package/dist/treemap-OMGGGB5U.js.map +1 -0
- package/dist/treemap.d.ts +24 -0
- package/dist/treemap.js +14 -0
- package/dist/treemap.js.map +1 -0
- package/dist/world-110m-DVFWXS42.js +18 -0
- package/dist/world-110m-DVFWXS42.js.map +1 -0
- package/package.json +518 -3
- package/registry/area-chart.json +784 -0
- package/registry/bar-chart.json +783 -0
- package/registry/calendar-heatmap.json +459 -0
- package/registry/candlestick.json +552 -0
- package/registry/chart.json +440 -0
- package/registry/charts-provider.json +190 -0
- package/registry/examples/area-chart/credits-usage.d.ts +4 -0
- package/registry/examples/area-chart/credits-usage.js +38 -0
- package/registry/examples/area-chart/credits-usage.tsx +32 -0
- package/registry/examples/area-chart/native/credits-usage.d.ts +4 -0
- package/registry/examples/area-chart/native/credits-usage.dark.png +0 -0
- package/registry/examples/area-chart/native/credits-usage.js +33 -0
- package/registry/examples/area-chart/native/credits-usage.light.png +0 -0
- package/registry/examples/area-chart/native/credits-usage.tsx +27 -0
- package/registry/examples/area-chart/storage.d.ts +4 -0
- package/registry/examples/area-chart/storage.js +27 -0
- package/registry/examples/area-chart/storage.tsx +21 -0
- package/registry/examples/bar-chart/jobs-by-status.d.ts +4 -0
- package/registry/examples/bar-chart/jobs-by-status.js +37 -0
- package/registry/examples/bar-chart/jobs-by-status.tsx +31 -0
- package/registry/examples/bar-chart/native/jobs-by-status.d.ts +4 -0
- package/registry/examples/bar-chart/native/jobs-by-status.dark.png +0 -0
- package/registry/examples/bar-chart/native/jobs-by-status.js +32 -0
- package/registry/examples/bar-chart/native/jobs-by-status.light.png +0 -0
- package/registry/examples/bar-chart/native/jobs-by-status.tsx +26 -0
- package/registry/examples/bar-chart/plans-by-quarter.d.ts +4 -0
- package/registry/examples/bar-chart/plans-by-quarter.js +31 -0
- package/registry/examples/bar-chart/plans-by-quarter.tsx +26 -0
- package/registry/examples/bar-chart/top-supporters.d.ts +4 -0
- package/registry/examples/bar-chart/top-supporters.js +32 -0
- package/registry/examples/bar-chart/top-supporters.tsx +27 -0
- package/registry/examples/calendar-heatmap/publishing.d.ts +4 -0
- package/registry/examples/calendar-heatmap/publishing.js +28 -0
- package/registry/examples/calendar-heatmap/publishing.tsx +23 -0
- package/registry/examples/candlestick/auction-bids.d.ts +4 -0
- package/registry/examples/candlestick/auction-bids.js +37 -0
- package/registry/examples/candlestick/auction-bids.tsx +32 -0
- package/registry/examples/chart/polar-uploads.d.ts +4 -0
- package/registry/examples/chart/polar-uploads.js +34 -0
- package/registry/examples/chart/polar-uploads.tsx +30 -0
- package/registry/examples/charts-provider/french-orazaka.d.ts +4 -0
- package/registry/examples/charts-provider/french-orazaka.js +26 -0
- package/registry/examples/charts-provider/french-orazaka.tsx +22 -0
- package/registry/examples/charts-provider/native/french-orazaka.d.ts +4 -0
- package/registry/examples/charts-provider/native/french-orazaka.dark.png +0 -0
- package/registry/examples/charts-provider/native/french-orazaka.js +17 -0
- package/registry/examples/charts-provider/native/french-orazaka.light.png +0 -0
- package/registry/examples/charts-provider/native/french-orazaka.tsx +17 -0
- package/registry/examples/funnel/signup.d.ts +4 -0
- package/registry/examples/funnel/signup.js +30 -0
- package/registry/examples/funnel/signup.tsx +24 -0
- package/registry/examples/gauge/challenge-goal.d.ts +4 -0
- package/registry/examples/gauge/challenge-goal.js +24 -0
- package/registry/examples/gauge/challenge-goal.tsx +18 -0
- package/registry/examples/gauge/credits-quota.d.ts +4 -0
- package/registry/examples/gauge/credits-quota.js +26 -0
- package/registry/examples/gauge/credits-quota.tsx +19 -0
- package/registry/examples/gauge/native/credits-quota.d.ts +4 -0
- package/registry/examples/gauge/native/credits-quota.dark.png +0 -0
- package/registry/examples/gauge/native/credits-quota.js +25 -0
- package/registry/examples/gauge/native/credits-quota.light.png +0 -0
- package/registry/examples/gauge/native/credits-quota.tsx +18 -0
- package/registry/examples/geo-map/viewers.d.ts +4 -0
- package/registry/examples/geo-map/viewers.js +43 -0
- package/registry/examples/geo-map/viewers.tsx +29 -0
- package/registry/examples/globe/deployment-regions.d.ts +4 -0
- package/registry/examples/globe/deployment-regions.js +36 -0
- package/registry/examples/globe/deployment-regions.tsx +30 -0
- package/registry/examples/heatmap/upload-activity.d.ts +4 -0
- package/registry/examples/heatmap/upload-activity.js +30 -0
- package/registry/examples/heatmap/upload-activity.tsx +25 -0
- package/registry/examples/line-chart/creator-earnings.d.ts +4 -0
- package/registry/examples/line-chart/creator-earnings.js +35 -0
- package/registry/examples/line-chart/creator-earnings.tsx +30 -0
- package/registry/examples/line-chart/forecast.d.ts +4 -0
- package/registry/examples/line-chart/forecast.js +36 -0
- package/registry/examples/line-chart/forecast.tsx +30 -0
- package/registry/examples/line-chart/live-jobs.d.ts +4 -0
- package/registry/examples/line-chart/live-jobs.js +21 -0
- package/registry/examples/line-chart/live-jobs.tsx +23 -0
- package/registry/examples/line-chart/native/creator-earnings.d.ts +4 -0
- package/registry/examples/line-chart/native/creator-earnings.dark.png +0 -0
- package/registry/examples/line-chart/native/creator-earnings.js +32 -0
- package/registry/examples/line-chart/native/creator-earnings.light.png +0 -0
- package/registry/examples/line-chart/native/creator-earnings.tsx +26 -0
- package/registry/examples/line-chart/states.d.ts +4 -0
- package/registry/examples/line-chart/states.js +16 -0
- package/registry/examples/line-chart/states.tsx +13 -0
- package/registry/examples/pie-chart/credit-spend.d.ts +4 -0
- package/registry/examples/pie-chart/credit-spend.js +30 -0
- package/registry/examples/pie-chart/credit-spend.tsx +24 -0
- package/registry/examples/pie-chart/native/credit-spend.d.ts +4 -0
- package/registry/examples/pie-chart/native/credit-spend.dark.png +0 -0
- package/registry/examples/pie-chart/native/credit-spend.js +17 -0
- package/registry/examples/pie-chart/native/credit-spend.light.png +0 -0
- package/registry/examples/pie-chart/native/credit-spend.tsx +12 -0
- package/registry/examples/pie-chart/storage-by-kind.d.ts +4 -0
- package/registry/examples/pie-chart/storage-by-kind.js +31 -0
- package/registry/examples/pie-chart/storage-by-kind.tsx +26 -0
- package/registry/examples/radar-chart/model-comparison.d.ts +4 -0
- package/registry/examples/radar-chart/model-comparison.js +33 -0
- package/registry/examples/radar-chart/model-comparison.tsx +28 -0
- package/registry/examples/sankey/credit-flow.d.ts +4 -0
- package/registry/examples/sankey/credit-flow.js +37 -0
- package/registry/examples/sankey/credit-flow.tsx +32 -0
- package/registry/examples/scatter-chart/watch-time.d.ts +4 -0
- package/registry/examples/scatter-chart/watch-time.js +36 -0
- package/registry/examples/scatter-chart/watch-time.tsx +31 -0
- package/registry/examples/sparkline/bars.d.ts +4 -0
- package/registry/examples/sparkline/bars.js +12 -0
- package/registry/examples/sparkline/bars.tsx +7 -0
- package/registry/examples/sparkline/native/stat-trend.d.ts +4 -0
- package/registry/examples/sparkline/native/stat-trend.dark.png +0 -0
- package/registry/examples/sparkline/native/stat-trend.js +12 -0
- package/registry/examples/sparkline/native/stat-trend.light.png +0 -0
- package/registry/examples/sparkline/native/stat-trend.tsx +7 -0
- package/registry/examples/sparkline/stat-trend.d.ts +4 -0
- package/registry/examples/sparkline/stat-trend.js +18 -0
- package/registry/examples/sparkline/stat-trend.tsx +15 -0
- package/registry/examples/sparkline/table-rows.d.ts +4 -0
- package/registry/examples/sparkline/table-rows.js +23 -0
- package/registry/examples/sparkline/table-rows.tsx +26 -0
- package/registry/examples/treemap/storage.d.ts +4 -0
- package/registry/examples/treemap/storage.js +17 -0
- package/registry/examples/treemap/storage.tsx +13 -0
- package/registry/funnel.json +486 -0
- package/registry/gauge.json +599 -0
- package/registry/geo-map.json +483 -0
- package/registry/globe.json +468 -0
- package/registry/heatmap.json +530 -0
- package/registry/index.json +420 -0
- package/registry/line-chart.json +792 -0
- package/registry/pie-chart.json +1287 -0
- package/registry/radar-chart.json +458 -0
- package/registry/sankey.json +502 -0
- package/registry/scatter-chart.json +558 -0
- package/registry/sparkline.json +562 -0
- package/registry/treemap.json +431 -0
package/dist/native.d.ts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ViewStyle } from 'react-native';
|
|
4
|
+
|
|
5
|
+
interface ChartLabels {
|
|
6
|
+
/** The button that shows the data table. */
|
|
7
|
+
showData: string;
|
|
8
|
+
/** The button that hides it. */
|
|
9
|
+
hideData: string;
|
|
10
|
+
/** The caption of the data table: `{title}`. */
|
|
11
|
+
tableCaption: string;
|
|
12
|
+
/** The export buttons. */
|
|
13
|
+
exportPng: string;
|
|
14
|
+
exportSvg: string;
|
|
15
|
+
exportCsv: string;
|
|
16
|
+
/** Announced while the data loads. */
|
|
17
|
+
loading: string;
|
|
18
|
+
/** Shown when there is nothing to draw. */
|
|
19
|
+
empty: string;
|
|
20
|
+
/** Shown when the data could not be loaded. */
|
|
21
|
+
error: string;
|
|
22
|
+
/** The keyboard hint, read once when the plot takes the focus. */
|
|
23
|
+
keyboardHint: string;
|
|
24
|
+
/** The role description of the plot (`chart`). */
|
|
25
|
+
roleDescription: string;
|
|
26
|
+
/** Summary pieces. `{kind}` is the chart's name (`Line chart`), `{count}` a number of points or series. */
|
|
27
|
+
summaryIntro: string;
|
|
28
|
+
summarySeries: string;
|
|
29
|
+
summaryRange: string;
|
|
30
|
+
summaryTrendUp: string;
|
|
31
|
+
summaryTrendDown: string;
|
|
32
|
+
summaryTrendFlat: string;
|
|
33
|
+
summaryTotal: string;
|
|
34
|
+
summaryThreshold: string;
|
|
35
|
+
summaryShare: string;
|
|
36
|
+
/** Scatter: the correlation of x and y (Pearson's r). */
|
|
37
|
+
summaryCorrelation: string;
|
|
38
|
+
/** Funnel: from one stage to the next, and from the first to the last. */
|
|
39
|
+
summaryConversion: string;
|
|
40
|
+
summaryOverall: string;
|
|
41
|
+
/** Heatmap, calendar: the largest cell and the number of cells with a value. */
|
|
42
|
+
summaryPeak: string;
|
|
43
|
+
summaryActive: string;
|
|
44
|
+
/** Candlestick: the period's range. */
|
|
45
|
+
summaryOhlc: string;
|
|
46
|
+
/** The names of the charts, read first in the summary. */
|
|
47
|
+
kinds: Record<ChartKind, string>;
|
|
48
|
+
/** The column of the values, when the chart has no value label. */
|
|
49
|
+
value: string;
|
|
50
|
+
/** The column of the categories in the data table, when the chart has no x label. */
|
|
51
|
+
category: string;
|
|
52
|
+
/** The total row of a stacked chart, a pie, a funnel. */
|
|
53
|
+
total: string;
|
|
54
|
+
/** What a missing value reads as. */
|
|
55
|
+
noValue: string;
|
|
56
|
+
}
|
|
57
|
+
type ChartKind = "line" | "area" | "bar" | "pie" | "donut" | "gauge" | "sparkline" | "radar" | "heatmap" | "calendar" | "sankey" | "funnel" | "candlestick" | "treemap" | "scatter" | "map" | "globe" | "chart";
|
|
58
|
+
declare const DEFAULT_LABELS: ChartLabels;
|
|
59
|
+
/** The words an app or a chart passes: any of them, and any of the chart names. */
|
|
60
|
+
type ChartLabelsInput = Partial<Omit<ChartLabels, "kinds">> & {
|
|
61
|
+
kinds?: Partial<Record<ChartKind, string>>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** A row of data: any object; the chart reads the fields its `x`, `y` and `series` name. */
|
|
65
|
+
type Datum = object;
|
|
66
|
+
/** A field of a row (`"month"`) or a function that reads it. */
|
|
67
|
+
type Accessor<T, V> = (keyof T & string) | ((datum: T, index: number) => V);
|
|
68
|
+
/** A Krizaka brand: its palette leads with the brand's own hue (Krizaka blue, Orazaka orange, Orochia violet). */
|
|
69
|
+
type BrandId = "krizaka" | "orazaka" | "orochia";
|
|
70
|
+
/** A BCP 47 locale (`"en-US"`, `"fr-FR"`), always explicit: server and client write the same figures. */
|
|
71
|
+
type Locale = string | readonly string[];
|
|
72
|
+
/**
|
|
73
|
+
* How a value is written, through `@krizaka/intl`:
|
|
74
|
+
* - `"number"` (default) `12,345.6`, `"integer"` `12,346`, `"compact"` `12.3K`, `"percent"` (a ratio: `0.42` → `42%`);
|
|
75
|
+
* - `{ style: "money", currency }`: the values are **integer minor units** (cents), as the ledger stores them;
|
|
76
|
+
* - `{ style: "unit", unit }`: an `Intl` unit (`"second"`, `"megabyte"`);
|
|
77
|
+
* - a function, for anything else.
|
|
78
|
+
*/
|
|
79
|
+
type ValueFormat = "number" | "integer" | "compact" | "percent" | {
|
|
80
|
+
readonly style: "money";
|
|
81
|
+
readonly currency: string;
|
|
82
|
+
readonly compact?: boolean;
|
|
83
|
+
} | {
|
|
84
|
+
readonly style: "unit";
|
|
85
|
+
readonly unit: string;
|
|
86
|
+
readonly compact?: boolean;
|
|
87
|
+
} | {
|
|
88
|
+
readonly style: "number";
|
|
89
|
+
readonly options: Intl.NumberFormatOptions;
|
|
90
|
+
} | ((value: number, locale: Locale) => string);
|
|
91
|
+
/**
|
|
92
|
+
* How a category of the x axis is written. A category that is a `Date`, an epoch or an ISO date (`"2026-04"`,
|
|
93
|
+
* `"2026-04-12"`) is a date: `"month"` (`Apr 2026`), `"day"` (`Apr 12`), `"date"` (`Apr 12, 2026`), `"time"`
|
|
94
|
+
* (`14:30`), `"datetime"`, `"year"`. `"text"` writes it as is (the default for anything that is not a date).
|
|
95
|
+
*/
|
|
96
|
+
type CategoryFormat = "text" | "year" | "month" | "day" | "date" | "time" | "datetime" | ((category: unknown, locale: Locale) => string);
|
|
97
|
+
/** A series to draw: the field holding its values and the words that name it. */
|
|
98
|
+
interface SeriesSpec<T extends Datum = Datum> {
|
|
99
|
+
/** The field (or a function) holding the series' value in each row. */
|
|
100
|
+
readonly key: Accessor<T, number | null | undefined>;
|
|
101
|
+
/** Its name: in the legend, the tooltip, the data table and the summary. */
|
|
102
|
+
readonly label: string;
|
|
103
|
+
/** A colour role instead of the next palette slot: `"accent"`, a status (`"success"`…) or a `var(--…)`. */
|
|
104
|
+
readonly color?: SeriesColor;
|
|
105
|
+
/** Draw it dashed (a forecast, a previous period). Lines and areas only. */
|
|
106
|
+
readonly dashed?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/** A status or brand role a series, a threshold or a marker may wear instead of a palette slot. */
|
|
109
|
+
type Tone = "neutral" | "accent" | "success" | "warning" | "danger" | "info";
|
|
110
|
+
/** A palette slot (1–8), a tone, or any CSS colour (`var(--kz-…)` preferred). */
|
|
111
|
+
type SeriesColor = Tone | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | (string & {});
|
|
112
|
+
/** A horizontal line at a value: a goal, a payout threshold, a quota. */
|
|
113
|
+
interface Threshold {
|
|
114
|
+
readonly value: number;
|
|
115
|
+
/** What it means, written beside the line and in the summary: “Payout threshold”. */
|
|
116
|
+
readonly label: string;
|
|
117
|
+
/** Default `"neutral"`; a goal reads well in `"success"`, a limit in `"danger"`. */
|
|
118
|
+
readonly tone?: Tone;
|
|
119
|
+
}
|
|
120
|
+
/** A vertical marker at a category: an event worth pointing at (“Campaign launch”). */
|
|
121
|
+
interface Marker {
|
|
122
|
+
/** The category it marks, as in the data (`"2026-04"`). */
|
|
123
|
+
readonly x: unknown;
|
|
124
|
+
readonly label: string;
|
|
125
|
+
readonly tone?: Tone;
|
|
126
|
+
}
|
|
127
|
+
/** What a series says about itself, for the written summary. */
|
|
128
|
+
interface SeriesSummary {
|
|
129
|
+
readonly label: string;
|
|
130
|
+
readonly count: number;
|
|
131
|
+
readonly min: {
|
|
132
|
+
readonly value: number;
|
|
133
|
+
readonly category: string;
|
|
134
|
+
} | null;
|
|
135
|
+
readonly max: {
|
|
136
|
+
readonly value: number;
|
|
137
|
+
readonly category: string;
|
|
138
|
+
} | null;
|
|
139
|
+
readonly first: number | null;
|
|
140
|
+
readonly last: number | null;
|
|
141
|
+
readonly total: number;
|
|
142
|
+
/** `last / first − 1`, or null when it cannot be said (no first value, a first value of 0). */
|
|
143
|
+
readonly change: number | null;
|
|
144
|
+
readonly trend: "up" | "down" | "flat" | "none";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
type Curve = "linear" | "monotone" | "step";
|
|
148
|
+
|
|
149
|
+
type Mode = "dark" | "light";
|
|
150
|
+
|
|
151
|
+
/** The colour roles a chart reads (a subset of @krizaka/tokens/native's `Theme`; `useTheme().theme` of @krizaka/ui/native fits). */
|
|
152
|
+
type ChartTheme = {
|
|
153
|
+
readonly surface1: string;
|
|
154
|
+
readonly surface2: string;
|
|
155
|
+
readonly surface3: string;
|
|
156
|
+
readonly borderSubtle: string;
|
|
157
|
+
readonly borderDefault: string;
|
|
158
|
+
readonly textPrimary: string;
|
|
159
|
+
readonly textSecondary: string;
|
|
160
|
+
readonly textMuted: string;
|
|
161
|
+
readonly accent: string;
|
|
162
|
+
readonly success: string;
|
|
163
|
+
readonly warning: string;
|
|
164
|
+
readonly danger: string;
|
|
165
|
+
readonly info: string;
|
|
166
|
+
};
|
|
167
|
+
interface NativeChartsSettings {
|
|
168
|
+
/** The locale of every figure and date. Default `"en-US"`. */
|
|
169
|
+
locale?: Locale;
|
|
170
|
+
/** The brand whose palette leads. Default Krizaka. */
|
|
171
|
+
brand?: BrandId;
|
|
172
|
+
/** The words: the readout, the summary. */
|
|
173
|
+
labels?: ChartLabelsInput;
|
|
174
|
+
/** Dark or light. Default: the device's (pass `useTheme().scheme` of @krizaka/ui/native to follow the app). */
|
|
175
|
+
scheme?: Mode;
|
|
176
|
+
/** The app's colour roles (`useTheme().theme` of @krizaka/ui/native): a product's brand overrides apply. */
|
|
177
|
+
theme?: Partial<ChartTheme>;
|
|
178
|
+
}
|
|
179
|
+
/** Sets the locale, brand, words, scheme and theme of every chart below it. */
|
|
180
|
+
declare function ChartsProvider({ children, ...settings }: NativeChartsSettings & {
|
|
181
|
+
children: ReactNode;
|
|
182
|
+
}): react.JSX.Element;
|
|
183
|
+
interface NativeFrameProps extends NativeChartsSettings {
|
|
184
|
+
/** What the chart shows: its heading and accessible name. */
|
|
185
|
+
title: string;
|
|
186
|
+
/** Hide the heading (it stays the accessible name). */
|
|
187
|
+
hideTitle?: boolean;
|
|
188
|
+
/** The plot's height. */
|
|
189
|
+
height?: number;
|
|
190
|
+
/** The data is on its way. */
|
|
191
|
+
loading?: boolean;
|
|
192
|
+
/** Shown instead of the plot when there is nothing to draw. Default: the `empty` label. */
|
|
193
|
+
empty?: ReactNode;
|
|
194
|
+
/** The style of the chart's container (layout only: colours come from the theme). */
|
|
195
|
+
style?: ViewStyle;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface NativeCartesianProps<T extends Datum> extends NativeFrameProps {
|
|
199
|
+
/** The rows, in the order of the x axis. */
|
|
200
|
+
data: readonly T[];
|
|
201
|
+
/** The field (or function) of the category. */
|
|
202
|
+
x?: Accessor<T, unknown>;
|
|
203
|
+
/** A single series: its field. */
|
|
204
|
+
y?: Accessor<T, number | null | undefined>;
|
|
205
|
+
/** The name of the single `y` series. */
|
|
206
|
+
yLabel?: string;
|
|
207
|
+
/** The series, each with its field and name. */
|
|
208
|
+
series?: readonly SeriesSpec<T>[];
|
|
209
|
+
/** How the values are written. */
|
|
210
|
+
format?: ValueFormat;
|
|
211
|
+
/** How the categories are written. */
|
|
212
|
+
xFormat?: CategoryFormat;
|
|
213
|
+
/** Horizontal lines at a value. */
|
|
214
|
+
thresholds?: readonly Threshold[];
|
|
215
|
+
}
|
|
216
|
+
interface NativeLineChartProps<T extends Datum> extends NativeCartesianProps<T> {
|
|
217
|
+
/** `monotone` (default), `linear` or `step`. */
|
|
218
|
+
curve?: Curve;
|
|
219
|
+
}
|
|
220
|
+
/** Change over time (React Native): one line per series. */
|
|
221
|
+
declare function LineChart<T extends Datum>({ curve, ...props }: NativeLineChartProps<T>): react.JSX.Element;
|
|
222
|
+
interface NativeAreaChartProps<T extends Datum> extends NativeLineChartProps<T> {
|
|
223
|
+
/** Stack the series: the parts of a total over time. */
|
|
224
|
+
stacked?: boolean;
|
|
225
|
+
}
|
|
226
|
+
interface NativeBarChartProps<T extends Datum> extends NativeCartesianProps<T> {
|
|
227
|
+
/** Stack the series in one bar per category; default: grouped side by side. */
|
|
228
|
+
stacked?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/** A volume over time (React Native): a line over a wash; `stacked` for the parts of a total. */
|
|
231
|
+
declare function AreaChart<T extends Datum>({ curve, stacked, ...props }: NativeAreaChartProps<T>): react.JSX.Element;
|
|
232
|
+
/** Amounts across categories (React Native): grouped or `stacked` bars. */
|
|
233
|
+
declare function BarChart<T extends Datum>({ stacked, ...props }: NativeBarChartProps<T>): react.JSX.Element;
|
|
234
|
+
|
|
235
|
+
interface NativePieChartProps<T extends Datum> extends NativeFrameProps {
|
|
236
|
+
/** One row per part. */
|
|
237
|
+
data: readonly T[];
|
|
238
|
+
/** The field naming the part. */
|
|
239
|
+
label: Accessor<T, string>;
|
|
240
|
+
/** The field of its amount. */
|
|
241
|
+
value: Accessor<T, number>;
|
|
242
|
+
/** How the amounts are written. */
|
|
243
|
+
format?: ValueFormat;
|
|
244
|
+
/** A ring with the total in its hole. */
|
|
245
|
+
donut?: boolean;
|
|
246
|
+
/** The words under the total of a donut. */
|
|
247
|
+
centerLabel?: string;
|
|
248
|
+
/** At most this many slices; the rest fold into `otherLabel`. Default 6. */
|
|
249
|
+
maxSlices?: number;
|
|
250
|
+
/** The name of the folded slice. Default “Other”. */
|
|
251
|
+
otherLabel?: string;
|
|
252
|
+
}
|
|
253
|
+
/** Part of a whole (React Native). */
|
|
254
|
+
declare function PieChart<T extends Datum>(props: NativePieChartProps<T>): react.JSX.Element;
|
|
255
|
+
/** A pie with a hole (React Native). */
|
|
256
|
+
declare function DonutChart<T extends Datum>(props: Omit<NativePieChartProps<T>, "donut">): react.JSX.Element;
|
|
257
|
+
interface NativeGaugeProps extends NativeFrameProps {
|
|
258
|
+
/** The value. */
|
|
259
|
+
value: number;
|
|
260
|
+
/** The start of the range. Default 0. */
|
|
261
|
+
min?: number;
|
|
262
|
+
/** The end of the range. Default 100. */
|
|
263
|
+
max?: number;
|
|
264
|
+
/** How the value is written. */
|
|
265
|
+
format?: ValueFormat;
|
|
266
|
+
/** The words under the value. */
|
|
267
|
+
caption?: string;
|
|
268
|
+
/** A tick on the arc: the objective. */
|
|
269
|
+
target?: Threshold;
|
|
270
|
+
/** Zones: the value takes the tone of the zone it is in. */
|
|
271
|
+
zones?: readonly {
|
|
272
|
+
readonly to: number;
|
|
273
|
+
readonly tone: Tone;
|
|
274
|
+
readonly label?: string;
|
|
275
|
+
}[];
|
|
276
|
+
/** The tone of the value without zones. Default `"accent"`. */
|
|
277
|
+
tone?: Tone;
|
|
278
|
+
}
|
|
279
|
+
/** One figure against its range (React Native). */
|
|
280
|
+
declare function Gauge(props: NativeGaugeProps): react.JSX.Element;
|
|
281
|
+
interface NativeSparklineProps extends Omit<NativeFrameProps, "hideTitle"> {
|
|
282
|
+
/** The values, oldest first (`null` for a gap). */
|
|
283
|
+
data: readonly (number | null)[];
|
|
284
|
+
/** The labels of the values (dates), for the summary. */
|
|
285
|
+
categories?: readonly unknown[];
|
|
286
|
+
/** `line` (default), `area` or `bar`. */
|
|
287
|
+
variant?: "line" | "area" | "bar";
|
|
288
|
+
/** A palette slot, a tone or a colour. */
|
|
289
|
+
color?: SeriesColor;
|
|
290
|
+
/** Colour by the trend (success up, danger down; `"inverse"` for costs). */
|
|
291
|
+
trendTone?: boolean | "inverse";
|
|
292
|
+
/** How the values are written in the summary. */
|
|
293
|
+
format?: ValueFormat;
|
|
294
|
+
/** A fixed width. Default: the container's. */
|
|
295
|
+
width?: number;
|
|
296
|
+
}
|
|
297
|
+
/** A word-sized trend (React Native). */
|
|
298
|
+
declare function Sparkline(props: NativeSparklineProps): react.JSX.Element;
|
|
299
|
+
|
|
300
|
+
export { type Accessor, AreaChart, BarChart, type BrandId, type CategoryFormat, type ChartLabels, type ChartLabelsInput, type ChartTheme, ChartsProvider, DEFAULT_LABELS, type Datum, DonutChart, Gauge, LineChart, type Locale, type Marker, type NativeAreaChartProps, type NativeBarChartProps, type NativeCartesianProps, type NativeChartsSettings, type NativeFrameProps, type NativeGaugeProps, type NativeLineChartProps, type NativePieChartProps, type NativeSparklineProps, PieChart, type SeriesColor, type SeriesSpec, type SeriesSummary, Sparkline, type Threshold, type Tone, type ValueFormat };
|