@sckyzo/cosmos-charts 0.2.0 → 0.3.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/CHANGELOG.md +91 -0
- package/README.md +107 -22
- package/THIRD_PARTY_NOTICES.md +81 -0
- package/dist/BarChart.cjs +137 -0
- package/dist/BarChart.cjs.map +1 -0
- package/dist/BarChart.js +135 -0
- package/dist/BarChart.js.map +1 -0
- package/dist/BoxPlotChart.cjs +214 -0
- package/dist/BoxPlotChart.cjs.map +1 -0
- package/dist/BoxPlotChart.js +212 -0
- package/dist/BoxPlotChart.js.map +1 -0
- package/dist/BumpChart.cjs +328 -0
- package/dist/BumpChart.cjs.map +1 -0
- package/dist/BumpChart.js +326 -0
- package/dist/BumpChart.js.map +1 -0
- package/dist/CalendarChart.cjs +216 -0
- package/dist/CalendarChart.cjs.map +1 -0
- package/dist/CalendarChart.js +214 -0
- package/dist/CalendarChart.js.map +1 -0
- package/dist/DonutChart.cjs +122 -0
- package/dist/DonutChart.cjs.map +1 -0
- package/dist/DonutChart.js +120 -0
- package/dist/DonutChart.js.map +1 -0
- package/dist/FunnelChart.cjs +422 -0
- package/dist/FunnelChart.cjs.map +1 -0
- package/dist/FunnelChart.js +420 -0
- package/dist/FunnelChart.js.map +1 -0
- package/dist/GradientRadial.cjs +51 -0
- package/dist/GradientRadial.cjs.map +1 -0
- package/dist/GradientRadial.js +49 -0
- package/dist/GradientRadial.js.map +1 -0
- package/dist/HeatmapChart.cjs +146 -0
- package/dist/HeatmapChart.cjs.map +1 -0
- package/dist/HeatmapChart.js +144 -0
- package/dist/HeatmapChart.js.map +1 -0
- package/dist/LineAreaChart.cjs +98 -0
- package/dist/LineAreaChart.cjs.map +1 -0
- package/dist/LineAreaChart.js +96 -0
- package/dist/LineAreaChart.js.map +1 -0
- package/dist/MixedChart.cjs +195 -0
- package/dist/MixedChart.cjs.map +1 -0
- package/dist/MixedChart.js +193 -0
- package/dist/MixedChart.js.map +1 -0
- package/dist/RadarChart.cjs +109 -0
- package/dist/RadarChart.cjs.map +1 -0
- package/dist/RadarChart.js +107 -0
- package/dist/RadarChart.js.map +1 -0
- package/dist/RadialBarChart.cjs +99 -0
- package/dist/RadialBarChart.cjs.map +1 -0
- package/dist/RadialBarChart.js +97 -0
- package/dist/RadialBarChart.js.map +1 -0
- package/dist/RangeBarChart.cjs +218 -0
- package/dist/RangeBarChart.cjs.map +1 -0
- package/dist/RangeBarChart.js +216 -0
- package/dist/RangeBarChart.js.map +1 -0
- package/dist/RealtimeChart.cjs +173 -0
- package/dist/RealtimeChart.cjs.map +1 -0
- package/dist/RealtimeChart.js +171 -0
- package/dist/RealtimeChart.js.map +1 -0
- package/dist/ScatterChart.cjs +134 -0
- package/dist/ScatterChart.cjs.map +1 -0
- package/dist/ScatterChart.js +131 -0
- package/dist/ScatterChart.js.map +1 -0
- package/dist/SemiCircleGauge.cjs +142 -0
- package/dist/SemiCircleGauge.cjs.map +1 -0
- package/dist/SemiCircleGauge.js +140 -0
- package/dist/SemiCircleGauge.js.map +1 -0
- package/dist/Sparkline.cjs +117 -0
- package/dist/Sparkline.cjs.map +1 -0
- package/dist/Sparkline.js +115 -0
- package/dist/Sparkline.js.map +1 -0
- package/dist/StrokedGauge.cjs +94 -0
- package/dist/StrokedGauge.cjs.map +1 -0
- package/dist/StrokedGauge.js +92 -0
- package/dist/StrokedGauge.js.map +1 -0
- package/dist/TreemapChart.cjs +263 -0
- package/dist/TreemapChart.cjs.map +1 -0
- package/dist/TreemapChart.js +261 -0
- package/dist/TreemapChart.js.map +1 -0
- package/dist/WaterfallChart.cjs +235 -0
- package/dist/WaterfallChart.cjs.map +1 -0
- package/dist/WaterfallChart.js +233 -0
- package/dist/WaterfallChart.js.map +1 -0
- package/dist/WorldMap.cjs +2088 -0
- package/dist/WorldMap.cjs.map +1 -0
- package/dist/WorldMap.js +603 -0
- package/dist/WorldMap.js.map +1 -0
- package/dist/chunk-3N43QT36.js +60 -0
- package/dist/chunk-3N43QT36.js.map +1 -0
- package/dist/chunk-5C2RLJYZ.js +11 -0
- package/dist/chunk-5C2RLJYZ.js.map +1 -0
- package/dist/chunk-6ALKZLN2.js +127 -0
- package/dist/chunk-6ALKZLN2.js.map +1 -0
- package/dist/chunk-6BKLL7LZ.cjs +30 -0
- package/dist/chunk-6BKLL7LZ.cjs.map +1 -0
- package/dist/chunk-6NRRABPF.cjs +64 -0
- package/dist/chunk-6NRRABPF.cjs.map +1 -0
- package/dist/chunk-AAYHG7YK.cjs +30 -0
- package/dist/chunk-AAYHG7YK.cjs.map +1 -0
- package/dist/chunk-AOSO5QHL.js +19 -0
- package/dist/chunk-AOSO5QHL.js.map +1 -0
- package/dist/chunk-BFEDLXVW.js +12 -0
- package/dist/chunk-BFEDLXVW.js.map +1 -0
- package/dist/chunk-DBZQI4HM.cjs +14 -0
- package/dist/chunk-DBZQI4HM.cjs.map +1 -0
- package/dist/chunk-F2PMFYJ5.cjs +40 -0
- package/dist/chunk-F2PMFYJ5.cjs.map +1 -0
- package/dist/chunk-FUZW3H5X.js +38 -0
- package/dist/chunk-FUZW3H5X.js.map +1 -0
- package/dist/chunk-GDZLYYL2.js +27 -0
- package/dist/chunk-GDZLYYL2.js.map +1 -0
- package/dist/chunk-GVTMZYOM.cjs +30 -0
- package/dist/chunk-GVTMZYOM.cjs.map +1 -0
- package/dist/chunk-GZRMVE4X.cjs +131 -0
- package/dist/chunk-GZRMVE4X.cjs.map +1 -0
- package/dist/chunk-HMH6DI7U.js +27 -0
- package/dist/chunk-HMH6DI7U.js.map +1 -0
- package/dist/chunk-ICL5K2CW.js +280 -0
- package/dist/chunk-ICL5K2CW.js.map +1 -0
- package/dist/chunk-IW6EWB26.cjs +21 -0
- package/dist/chunk-IW6EWB26.cjs.map +1 -0
- package/dist/chunk-K3R7JGOW.cjs +18 -0
- package/dist/chunk-K3R7JGOW.cjs.map +1 -0
- package/dist/chunk-LT3UC65O.cjs +68 -0
- package/dist/chunk-LT3UC65O.cjs.map +1 -0
- package/dist/chunk-MN4CDVOS.cjs +63 -0
- package/dist/chunk-MN4CDVOS.cjs.map +1 -0
- package/dist/chunk-OCD6JIIX.js +23 -0
- package/dist/chunk-OCD6JIIX.js.map +1 -0
- package/dist/chunk-RILUG7JB.js +44 -0
- package/dist/chunk-RILUG7JB.js.map +1 -0
- package/dist/chunk-RLHGPHC7.cjs +51 -0
- package/dist/chunk-RLHGPHC7.cjs.map +1 -0
- package/dist/chunk-SGG7XKOY.js +58 -0
- package/dist/chunk-SGG7XKOY.js.map +1 -0
- package/dist/chunk-T3K6Q34U.cjs +82 -0
- package/dist/chunk-T3K6Q34U.cjs.map +1 -0
- package/dist/chunk-TPH5T3DA.cjs +282 -0
- package/dist/chunk-TPH5T3DA.cjs.map +1 -0
- package/dist/chunk-TYQWZR3S.cjs +13 -0
- package/dist/chunk-TYQWZR3S.cjs.map +1 -0
- package/dist/chunk-UATB2IRY.js +51 -0
- package/dist/chunk-UATB2IRY.js.map +1 -0
- package/dist/chunk-UJIV5PVI.js +13 -0
- package/dist/chunk-UJIV5PVI.js.map +1 -0
- package/dist/chunk-URNXLVSK.js +44 -0
- package/dist/chunk-URNXLVSK.js.map +1 -0
- package/dist/chunk-VIOSQN4Z.js +79 -0
- package/dist/chunk-VIOSQN4Z.js.map +1 -0
- package/dist/chunk-X3YZP5WF.cjs +46 -0
- package/dist/chunk-X3YZP5WF.cjs.map +1 -0
- package/dist/chunk-YWYF5CCJ.js +61 -0
- package/dist/chunk-YWYF5CCJ.js.map +1 -0
- package/dist/chunk-Z4LZFMDH.cjs +60 -0
- package/dist/chunk-Z4LZFMDH.cjs.map +1 -0
- package/dist/index.cjs +154 -1166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +470 -80
- package/dist/index.d.ts +470 -80
- package/dist/index.js +23 -1144
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +88 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.js +84 -0
- package/dist/theme.js.map +1 -0
- package/package.json +23 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
import * as apexcharts from 'apexcharts';
|
|
2
1
|
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Topology } from 'topojson-specification';
|
|
3
4
|
|
|
4
|
-
/** Default brand color (the blue accent).
|
|
5
|
+
/** Default brand color (the blue accent). The charts themselves follow the accent through `--color-brand-500`. */
|
|
5
6
|
declare const COSMOS_BRAND = "#465fff";
|
|
6
|
-
declare const COSMOS_PALETTE: string[];
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The default series colors without the theme CSS: eight categorical colors,
|
|
9
|
+
* the blue accent first. With the theme, the charts draw `--color-brand-500`
|
|
10
|
+
* and `--color-chart-2` to `--color-chart-8` instead, and each accent skips the
|
|
11
|
+
* hues that look like it (a cyan accent drops the cyan and the teal).
|
|
12
|
+
*
|
|
13
|
+
* Series do not read as statuses: green, amber and red are absent from the
|
|
14
|
+
* first four places, and the status colors are never the default. A chart that
|
|
15
|
+
* means a status passes them as `colors`. A palette is a categorical scale: it
|
|
16
|
+
* names things, it does not rank them.
|
|
10
17
|
*/
|
|
11
|
-
declare const
|
|
18
|
+
declare const COSMOS_PALETTE: string[];
|
|
12
19
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
20
|
+
* The text color, white or black, that reads best on `background`, a
|
|
21
|
+
* `#rrggbb` color (white when it is not one). White text drops under 3:1 on
|
|
22
|
+
* the palette's green and amber, and black text drops to 4.34:1 on the brand
|
|
23
|
+
* blue, where white gets 4.84:1: the pick reaches 4.5:1 on every color of the palette.
|
|
17
24
|
*/
|
|
18
|
-
declare const
|
|
19
|
-
dark: boolean;
|
|
20
|
-
grid: apexcharts.ApexGrid;
|
|
21
|
-
axisLabels: {
|
|
22
|
-
style: {
|
|
23
|
-
colors: string;
|
|
24
|
-
fontSize: string;
|
|
25
|
-
fontFamily: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
brand: string;
|
|
29
|
-
brandScale: string[];
|
|
30
|
-
surface: string;
|
|
31
|
-
palette: string[];
|
|
32
|
-
};
|
|
25
|
+
declare const readableOn: (background: string) => string;
|
|
33
26
|
|
|
34
27
|
type ChartSeriesPoint = [number, number] | {
|
|
35
28
|
x: number | string;
|
|
@@ -39,92 +32,295 @@ type ChartSize = {
|
|
|
39
32
|
height?: number | string;
|
|
40
33
|
width?: number | string;
|
|
41
34
|
};
|
|
35
|
+
/** Props of the charts that can have no data to draw. */
|
|
36
|
+
type ChartEmptyProps = {
|
|
37
|
+
/**
|
|
38
|
+
* Text drawn in place of the plot when the chart has no series, or only
|
|
39
|
+
* empty ones. Default `No data`; an empty string draws nothing. It is drawn
|
|
40
|
+
* as plain text: markup in it shows as written.
|
|
41
|
+
*/
|
|
42
|
+
emptyMessage?: string;
|
|
43
|
+
};
|
|
44
|
+
/** Props of the charts with a horizontal and a vertical axis. */
|
|
45
|
+
type ChartAxisTitleProps = {
|
|
46
|
+
/** Title under the horizontal axis, such as "Time (UTC)". Drawn as plain text. */
|
|
47
|
+
xTitle?: string;
|
|
48
|
+
/** Title beside the vertical axis, such as "Requests / s". Drawn as plain text. */
|
|
49
|
+
yTitle?: string;
|
|
50
|
+
};
|
|
51
|
+
/** The meaning of a reference line or band: its color comes from the theme. */
|
|
52
|
+
type ChartIntent = 'neutral' | 'warning' | 'danger' | 'success';
|
|
53
|
+
/** A line across the plot at a value of the value axis: a threshold, a target, a limit. */
|
|
54
|
+
type ChartReferenceLine = {
|
|
55
|
+
/** Where the line sits, in the units of the value axis. */
|
|
56
|
+
value: number;
|
|
57
|
+
/** Written next to the line, as plain text: markup in it shows as written. */
|
|
58
|
+
label?: string;
|
|
59
|
+
/** `neutral` (default) is the muted text color; the others are the theme's status colors. */
|
|
60
|
+
intent?: ChartIntent;
|
|
61
|
+
/** Draw the line dashed. Default solid. */
|
|
62
|
+
dashed?: boolean;
|
|
63
|
+
};
|
|
64
|
+
/** A band across the plot between two values of the value axis: a target range, a safe zone. */
|
|
65
|
+
type ChartReferenceBand = {
|
|
66
|
+
/** One end of the band, in the units of the value axis. */
|
|
67
|
+
from: number;
|
|
68
|
+
/** The other end of the band. */
|
|
69
|
+
to: number;
|
|
70
|
+
/** Written in the band, as plain text: markup in it shows as written. */
|
|
71
|
+
label?: string;
|
|
72
|
+
/** `neutral` (default) is the muted text color; the others are the theme's status colors. */
|
|
73
|
+
intent?: ChartIntent;
|
|
74
|
+
};
|
|
75
|
+
/** Props of the charts that can draw lines and bands at values of their value axis. */
|
|
76
|
+
type ChartReferenceProps = {
|
|
77
|
+
/**
|
|
78
|
+
* Lines across the plot at a value of the value axis: the vertical axis,
|
|
79
|
+
* or the horizontal one on a chart of horizontal bars. A line outside the
|
|
80
|
+
* data makes the axis reach it. On `MixedChart` they read the left axis (the
|
|
81
|
+
* right one when no series is on the left). Drawn above the series.
|
|
82
|
+
*/
|
|
83
|
+
referenceLines?: ChartReferenceLine[];
|
|
84
|
+
/** Bands across the plot between two values of the value axis, behind the series. Same axis rules as `referenceLines`. */
|
|
85
|
+
referenceBands?: ChartReferenceBand[];
|
|
86
|
+
};
|
|
87
|
+
type ChartLegendPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
88
|
+
/** Props of the charts that draw a legend. */
|
|
89
|
+
type ChartLegendProps = {
|
|
90
|
+
/**
|
|
91
|
+
* The side of the plot the legend sits on. Default `top` (`bottom` on
|
|
92
|
+
* `DonutChart`). The legend is a row on `top` and `bottom` and a column on
|
|
93
|
+
* `left` and `right`, and takes its room from the plot.
|
|
94
|
+
*/
|
|
95
|
+
legendPosition?: ChartLegendPosition;
|
|
96
|
+
};
|
|
97
|
+
/** Props every chart wrapper takes. */
|
|
98
|
+
type ChartProps = ChartSize & {
|
|
99
|
+
/**
|
|
100
|
+
* Name screen readers read for the chart, such as "CPU usage per hour".
|
|
101
|
+
* Without it, the chart is named from its type and its series.
|
|
102
|
+
*/
|
|
103
|
+
ariaLabel?: string;
|
|
104
|
+
/**
|
|
105
|
+
* [Recharts](https://recharts.github.io/) elements drawn inside the chart,
|
|
106
|
+
* after the ones the wrapper builds: a `ReferenceLine` for a threshold, a
|
|
107
|
+
* `ReferenceArea`, a `Brush`, an extra axis. They read the chart's data and
|
|
108
|
+
* axes, so a reference line takes a `y` in the units of the series.
|
|
109
|
+
*
|
|
110
|
+
* Add `recharts` at the version this package depends on (`3.10.1`): two
|
|
111
|
+
* copies of it do not share a chart's context. Colors take CSS variables
|
|
112
|
+
* (`stroke="var(--color-status-warn)"`), which follow the theme.
|
|
113
|
+
*/
|
|
114
|
+
children?: ReactNode;
|
|
115
|
+
};
|
|
42
116
|
|
|
43
|
-
type
|
|
117
|
+
type LineAreaChartVariant = 'area' | 'line';
|
|
118
|
+
/** How a series is drawn: a `solid` smooth curve, a `dashed` one, or a `step` line that jumps from value to value. */
|
|
119
|
+
type LineAreaChartSeriesStyle = 'solid' | 'dashed' | 'step';
|
|
120
|
+
type LineAreaChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & ChartAxisTitleProps & ChartReferenceProps & {
|
|
44
121
|
series: {
|
|
45
122
|
name: string;
|
|
46
123
|
data: number[];
|
|
124
|
+
/** `solid` (default), `dashed` or `step`: a line that jumps from one value to the next, such as a quota or a replica count. */
|
|
125
|
+
style?: LineAreaChartSeriesStyle;
|
|
47
126
|
}[];
|
|
48
127
|
categories: (string | number)[];
|
|
128
|
+
/** Override the default Cosmos palette. */
|
|
129
|
+
colors?: string[];
|
|
130
|
+
/** Format the y-axis labels and the tooltip values. */
|
|
131
|
+
formatValue?: (value: number) => string;
|
|
132
|
+
/** Show the legend (auto-true when 2+ series). */
|
|
133
|
+
showLegend?: boolean;
|
|
134
|
+
/** `area` (default) fills under each line with a gradient; `line` draws the lines alone. */
|
|
135
|
+
variant?: LineAreaChartVariant;
|
|
136
|
+
/** Pile the series on each other, so the top line is the sum: the share of each in a total. */
|
|
137
|
+
stacked?: boolean;
|
|
138
|
+
/** Mark every data point with a dot. Default off: a dot appears under the pointer only. */
|
|
139
|
+
markers?: boolean;
|
|
49
140
|
};
|
|
50
|
-
declare const LineAreaChart: ({ series, categories, height, width, }: LineAreaChartProps) => react.JSX.Element;
|
|
141
|
+
declare const LineAreaChart: ({ series, categories, colors, formatValue, xTitle, yTitle, referenceLines, referenceBands, emptyMessage, ariaLabel, children, height, width, showLegend, legendPosition, variant, stacked, markers, }: LineAreaChartProps) => react.JSX.Element;
|
|
51
142
|
|
|
52
|
-
type RealtimeChartProps =
|
|
143
|
+
type RealtimeChartProps = ChartProps & ChartAxisTitleProps & {
|
|
53
144
|
/** Sample generator — defaults to a noisy walk between 30 and 80. */
|
|
54
145
|
generator?: () => number;
|
|
55
146
|
/** Interval in ms — defaults to 2000. */
|
|
56
147
|
intervalMs?: number;
|
|
57
148
|
windowSize?: number;
|
|
149
|
+
/** Bottom of the y axis. Default 0. */
|
|
150
|
+
min?: number;
|
|
151
|
+
/** Top of the y axis, above `min`. Default 100. */
|
|
152
|
+
max?: number;
|
|
58
153
|
warnThreshold?: number;
|
|
59
154
|
critThreshold?: number;
|
|
155
|
+
/** Text of the warning threshold's label. Default `WARN`; an empty string draws the line alone. */
|
|
156
|
+
warnLabel?: string;
|
|
157
|
+
/** Text of the critical threshold's label. Default `CRIT`; an empty string draws the line alone. */
|
|
158
|
+
critLabel?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Label the x axis with the time of each sample (`14:03:25`, in local time), and the
|
|
161
|
+
* tooltip with it, and `xTitle` has an axis to name. Default off: no x axis.
|
|
162
|
+
*/
|
|
163
|
+
showTimeAxis?: boolean;
|
|
164
|
+
/** Format the y-axis labels and the tooltip values. */
|
|
165
|
+
formatValue?: (value: number) => string;
|
|
60
166
|
};
|
|
61
|
-
declare const RealtimeChart: ({ generator, intervalMs, windowSize, warnThreshold, critThreshold, height, width, }: RealtimeChartProps) => react.JSX.Element;
|
|
167
|
+
declare const RealtimeChart: ({ generator, intervalMs, windowSize, min, max, warnThreshold, critThreshold, warnLabel, critLabel, showTimeAxis, xTitle, yTitle, formatValue, ariaLabel, children, height, width, }: RealtimeChartProps) => react.JSX.Element;
|
|
62
168
|
|
|
63
|
-
type RadialBarChartProps =
|
|
169
|
+
type RadialBarChartProps = ChartProps & ChartEmptyProps & {
|
|
64
170
|
series: number[];
|
|
65
171
|
labels: string[];
|
|
172
|
+
/** Override the default Cosmos palette. */
|
|
173
|
+
colors?: string[];
|
|
174
|
+
/** Format the ring values and their average, on the 0–100 scale of the rings. Default: `78%`. */
|
|
175
|
+
formatValue?: (value: number) => string;
|
|
66
176
|
};
|
|
67
|
-
declare const RadialBarChart: ({ series, labels, height, width, }: RadialBarChartProps) => react.JSX.Element;
|
|
177
|
+
declare const RadialBarChart: ({ series, labels, colors, formatValue, emptyMessage, ariaLabel, children, height, width, }: RadialBarChartProps) => react.JSX.Element;
|
|
68
178
|
|
|
69
|
-
type GradientRadialProps =
|
|
179
|
+
type GradientRadialProps = ChartProps & {
|
|
70
180
|
value: number;
|
|
71
181
|
label?: string;
|
|
182
|
+
/** Color the arc starts from, fading to the theme's success color. Default: the accent. */
|
|
183
|
+
color?: string;
|
|
184
|
+
/** Value at the start of the arc. Default 0. */
|
|
185
|
+
min?: number;
|
|
186
|
+
/** Value at the end of the arc, above `min`. Default 100. Out of range, the arc stops at an end. */
|
|
187
|
+
max?: number;
|
|
188
|
+
/** Format the center value, from `value` itself (not its share of the range). Default: `84%`. */
|
|
189
|
+
formatValue?: (value: number) => string;
|
|
72
190
|
};
|
|
73
|
-
declare const GradientRadial: ({ value, label, height, width, }: GradientRadialProps) => react.JSX.Element;
|
|
191
|
+
declare const GradientRadial: ({ value, label, color, min, max, formatValue, ariaLabel, children, height, width, }: GradientRadialProps) => react.JSX.Element;
|
|
74
192
|
|
|
75
|
-
type SemiCircleGaugeProps =
|
|
193
|
+
type SemiCircleGaugeProps = Omit<ChartProps, 'height'> & {
|
|
76
194
|
value: number;
|
|
77
195
|
label?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Color of the arc. Default: the accent, or the theme's status colors when
|
|
198
|
+
* `warnAt` or `critAt` is set.
|
|
199
|
+
*/
|
|
78
200
|
color?: string;
|
|
201
|
+
/** Value at the start of the arc. Default 0. */
|
|
202
|
+
min?: number;
|
|
203
|
+
/** Value at the end of the arc, above `min`. Default 100. Out of range, the arc stops at an end. */
|
|
204
|
+
max?: number;
|
|
205
|
+
/**
|
|
206
|
+
* Value from which the arc turns to the theme's warning color. Setting it (or
|
|
207
|
+
* `critAt`) colors the arc by status: the theme's success color below, the
|
|
208
|
+
* warning color from `warnAt`, the critical color from `critAt`. Without
|
|
209
|
+
* either, the arc keeps one color, so a gauge where higher is better (an
|
|
210
|
+
* uptime, a score) does not turn red.
|
|
211
|
+
*/
|
|
212
|
+
warnAt?: number;
|
|
213
|
+
/** Value from which the arc turns to the theme's critical color. See `warnAt`. */
|
|
214
|
+
critAt?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Format the center value, from `value` itself (not its share of the range), and the
|
|
217
|
+
* `showRange` labels. Default: `67%`.
|
|
218
|
+
*/
|
|
219
|
+
formatValue?: (value: number) => string;
|
|
220
|
+
/** Write `min` and `max`, formatted, under the two ends of the arc. Default off. */
|
|
221
|
+
showRange?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* A goal on the scale of `min`–`max`, drawn as a mark across the arc. Out of range, the mark
|
|
224
|
+
* stops at an end of the arc, as the arc does. The target, formatted by `formatValue`, is read
|
|
225
|
+
* after the value in the name of the gauge.
|
|
226
|
+
*/
|
|
227
|
+
target?: number;
|
|
228
|
+
/**
|
|
229
|
+
* The most the gauge takes, in pixels (default 120). The arc is as wide as the box allows, up
|
|
230
|
+
* to this height: in a narrower box the gauge is shorter, never taller.
|
|
231
|
+
*/
|
|
232
|
+
height?: number;
|
|
79
233
|
};
|
|
80
|
-
declare const SemiCircleGauge: ({ value, label, color, height, width, }: SemiCircleGaugeProps) => react.JSX.Element;
|
|
234
|
+
declare const SemiCircleGauge: ({ value, label, color, min, max, warnAt, critAt, formatValue, showRange, target, ariaLabel, children, height, width, }: SemiCircleGaugeProps) => react.JSX.Element;
|
|
81
235
|
|
|
82
|
-
type StrokedGaugeProps =
|
|
236
|
+
type StrokedGaugeProps = ChartProps & {
|
|
83
237
|
value: number;
|
|
84
238
|
label?: string;
|
|
239
|
+
/** Color of the arc. Default: the accent. */
|
|
240
|
+
color?: string;
|
|
241
|
+
/** Value at the start of the arc. Default 0. */
|
|
242
|
+
min?: number;
|
|
243
|
+
/** Value at the end of the arc, above `min`. Default 100. Out of range, the arc stops at an end. */
|
|
244
|
+
max?: number;
|
|
245
|
+
/** Format the center value, from `value` itself (not its share of the range). Default: `92%`. */
|
|
246
|
+
formatValue?: (value: number) => string;
|
|
85
247
|
};
|
|
86
|
-
declare const StrokedGauge: ({ value, label, height, width, }: StrokedGaugeProps) => react.JSX.Element;
|
|
248
|
+
declare const StrokedGauge: ({ value, label, color, min, max, formatValue, ariaLabel, children, height, width, }: StrokedGaugeProps) => react.JSX.Element;
|
|
87
249
|
|
|
88
|
-
type
|
|
250
|
+
type DonutChartVariant = 'donut' | 'pie';
|
|
251
|
+
type DonutChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & {
|
|
89
252
|
series: number[];
|
|
90
253
|
labels: string[];
|
|
91
|
-
/**
|
|
92
|
-
|
|
254
|
+
/** Override the default Cosmos palette. */
|
|
255
|
+
colors?: string[];
|
|
256
|
+
/** Format the slice values in the center and the tooltip, and the total. */
|
|
257
|
+
formatValue?: (value: number) => string;
|
|
258
|
+
/** `donut` (default) leaves a hole with the total in it; `pie` fills the disc, with no center text. */
|
|
259
|
+
variant?: DonutChartVariant;
|
|
260
|
+
/** The small text under the center value, in place of "Total". An empty string draws nothing. Ignored by `pie`. Drawn as plain text. */
|
|
261
|
+
centerLabel?: string;
|
|
262
|
+
/** The center value, in place of the total (which `formatValue` formats). Ignored by `pie`. Drawn as plain text. */
|
|
263
|
+
centerValue?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Write each slice's value (through `formatValue`) and its share of the total in the
|
|
266
|
+
* legend, in whole percents that add up to 100. With the legend on the left or the right
|
|
267
|
+
* the figures sit in columns at the right edge of the legend.
|
|
268
|
+
*/
|
|
269
|
+
legendValues?: boolean;
|
|
93
270
|
};
|
|
94
|
-
declare const DonutChart: ({ series, labels,
|
|
95
|
-
declare const DonutRightLegend: (props: Omit<DonutChartProps, "rightLegend">) => react.JSX.Element;
|
|
271
|
+
declare const DonutChart: ({ series, labels, colors, formatValue, variant, centerLabel, centerValue, legendValues, legendPosition, emptyMessage, ariaLabel, children, height, width, }: DonutChartProps) => react.JSX.Element;
|
|
96
272
|
|
|
97
|
-
type SparklineProps =
|
|
98
|
-
data: number[];
|
|
99
|
-
color?: string;
|
|
100
|
-
variant?: 'line' | 'area';
|
|
101
|
-
};
|
|
102
|
-
declare const Sparkline: ({ data, color, variant, height, width, }: SparklineProps) => react.JSX.Element;
|
|
103
|
-
type SparklineGroupItem = {
|
|
104
|
-
label: string;
|
|
105
|
-
value: number | string;
|
|
273
|
+
type SparklineProps = ChartProps & ChartEmptyProps & {
|
|
106
274
|
data: number[];
|
|
275
|
+
/** A CSS color. Default: the accent. */
|
|
107
276
|
color?: string;
|
|
277
|
+
/**
|
|
278
|
+
* `area` (default), `line`, or `bar`: narrow columns in `color`, the ones below zero in the
|
|
279
|
+
* danger color under a dashed zero line.
|
|
280
|
+
*/
|
|
281
|
+
variant?: 'line' | 'area' | 'bar';
|
|
282
|
+
/** Names the value in the tooltip. Default `value`. Drawn as plain text. */
|
|
283
|
+
label?: string;
|
|
284
|
+
/** Format the tooltip value (default `String`). */
|
|
285
|
+
formatValue?: (value: number) => string;
|
|
286
|
+
/**
|
|
287
|
+
* Bottom of the scale. Default: the lowest value of `data`, so each sparkline fills its
|
|
288
|
+
* height; for `bar`, the lower of 0 and the lowest value, since a bar scale that does not
|
|
289
|
+
* start at zero exaggerates the differences. Set the same `min` and `max` on sparklines that
|
|
290
|
+
* are read against each other.
|
|
291
|
+
*/
|
|
292
|
+
min?: number;
|
|
293
|
+
/** Top of the scale. Default: the highest value of `data` (for `bar`, at least 0). */
|
|
294
|
+
max?: number;
|
|
108
295
|
};
|
|
109
|
-
declare const
|
|
110
|
-
items: SparklineGroupItem[];
|
|
111
|
-
className?: string;
|
|
112
|
-
}) => react.JSX.Element;
|
|
296
|
+
declare const Sparkline: ({ data, color, variant, label, formatValue, min, max, emptyMessage, ariaLabel, children, height, width, }: SparklineProps) => react.JSX.Element;
|
|
113
297
|
|
|
114
298
|
type TreemapDatum = {
|
|
115
299
|
x: string;
|
|
116
300
|
y: number;
|
|
117
301
|
};
|
|
118
|
-
type TreemapChartProps =
|
|
302
|
+
type TreemapChartProps = ChartProps & ChartEmptyProps & {
|
|
119
303
|
series: {
|
|
120
304
|
name?: string;
|
|
121
305
|
data: TreemapDatum[];
|
|
122
306
|
}[];
|
|
307
|
+
/**
|
|
308
|
+
* Override the default Cosmos palette. Tiles are colored by name, in the
|
|
309
|
+
* order the names first appear: one name keeps its color in every group.
|
|
310
|
+
*/
|
|
311
|
+
colors?: string[];
|
|
312
|
+
/** Format the values in the tooltip and on the tiles. */
|
|
313
|
+
formatValue?: (value: number) => string;
|
|
314
|
+
/**
|
|
315
|
+
* Write each tile's value, formatted, under its name. Default off: the name alone, and the
|
|
316
|
+
* value in the tooltip.
|
|
317
|
+
*/
|
|
318
|
+
showValues?: boolean;
|
|
123
319
|
};
|
|
124
|
-
declare const TreemapChart: ({ series, height, width }: TreemapChartProps) => react.JSX.Element;
|
|
320
|
+
declare const TreemapChart: ({ series, colors, formatValue, showValues, emptyMessage, ariaLabel, children, height, width, }: TreemapChartProps) => react.JSX.Element;
|
|
125
321
|
|
|
126
322
|
type BarChartOrientation = 'vertical' | 'horizontal';
|
|
127
|
-
type BarChartProps =
|
|
323
|
+
type BarChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & ChartAxisTitleProps & ChartReferenceProps & {
|
|
128
324
|
series: {
|
|
129
325
|
name: string;
|
|
130
326
|
data: number[];
|
|
@@ -136,14 +332,24 @@ type BarChartProps = ChartSize & {
|
|
|
136
332
|
stacked?: boolean;
|
|
137
333
|
/** Override the default Cosmos palette. */
|
|
138
334
|
colors?: string[];
|
|
139
|
-
/** Format the numeric axis labels
|
|
335
|
+
/** Format the numeric axis labels and the tooltip values. */
|
|
140
336
|
formatValue?: (value: number) => string;
|
|
141
337
|
/** Show the legend (auto-true when 2+ series). */
|
|
142
338
|
showLegend?: boolean;
|
|
143
|
-
/**
|
|
339
|
+
/** Radius, in px, of the end of a bar away from the axis; only the outer end of a stack is rounded. Default 4. */
|
|
144
340
|
borderRadius?: number;
|
|
341
|
+
/**
|
|
342
|
+
* The color of a bar from its value and the index of its category, for a threshold or a
|
|
343
|
+
* ranking. Return `undefined` to keep the color the other rules give. Applies to every
|
|
344
|
+
* series; the tooltip chip of a bar follows it, the legend keeps the series color.
|
|
345
|
+
*/
|
|
346
|
+
colorByValue?: (value: number, index: number) => string | undefined;
|
|
347
|
+
/** One palette color per category (`colors` cycles), instead of one per series. For a single series. */
|
|
348
|
+
distributed?: boolean;
|
|
349
|
+
/** The color of the bars below zero, for diverging bars. `colorByValue` wins over it. */
|
|
350
|
+
negativeColor?: string;
|
|
145
351
|
};
|
|
146
|
-
declare const BarChart: ({ series, categories, orientation, stacked, colors, formatValue, showLegend, borderRadius, height, width, }: BarChartProps) => react.JSX.Element;
|
|
352
|
+
declare const BarChart: ({ series, categories, orientation, stacked, colors, formatValue, xTitle, yTitle, referenceLines, referenceBands, showLegend, legendPosition, borderRadius, colorByValue, distributed, negativeColor, emptyMessage, ariaLabel, children, height, width, }: BarChartProps) => react.JSX.Element;
|
|
147
353
|
|
|
148
354
|
type HeatmapColorRange = {
|
|
149
355
|
/** Lowest value of the range, inclusive. */
|
|
@@ -154,7 +360,7 @@ type HeatmapColorRange = {
|
|
|
154
360
|
/** Legend label. Default: `from – to`, formatted with `formatValue`. */
|
|
155
361
|
name?: string;
|
|
156
362
|
};
|
|
157
|
-
type HeatmapChartProps =
|
|
363
|
+
type HeatmapChartProps = Omit<ChartProps, 'children'> & ChartEmptyProps & ChartLegendProps & ChartAxisTitleProps & {
|
|
158
364
|
/** One row per series, drawn top to bottom; one value per category. */
|
|
159
365
|
series: {
|
|
160
366
|
name: string;
|
|
@@ -163,7 +369,8 @@ type HeatmapChartProps = ChartSize & {
|
|
|
163
369
|
categories: (string | number)[];
|
|
164
370
|
/**
|
|
165
371
|
* Color steps, low to high, spread over the data range in buckets with
|
|
166
|
-
* round bounds. Default: five
|
|
372
|
+
* round bounds. Default: five steps of the current accent, mixed over the
|
|
373
|
+
* card.
|
|
167
374
|
*/
|
|
168
375
|
colors?: string[];
|
|
169
376
|
/**
|
|
@@ -179,9 +386,45 @@ type HeatmapChartProps = ChartSize & {
|
|
|
179
386
|
/** Show the color legend. Default true. */
|
|
180
387
|
showLegend?: boolean;
|
|
181
388
|
};
|
|
182
|
-
declare const HeatmapChart: ({ series, categories, colors, ranges, formatValue, showValues, showLegend, height, width, }: HeatmapChartProps) => react.JSX.Element;
|
|
389
|
+
declare const HeatmapChart: ({ series, categories, colors, ranges, formatValue, xTitle, yTitle, showValues, showLegend, legendPosition, emptyMessage, ariaLabel, height, width, }: HeatmapChartProps) => react.JSX.Element;
|
|
183
390
|
|
|
184
|
-
|
|
391
|
+
/** The weekday a week starts on: 0 is Sunday, 1 is Monday. */
|
|
392
|
+
type WeekStart = 0 | 1;
|
|
393
|
+
|
|
394
|
+
type CalendarDay = {
|
|
395
|
+
/** The date, `YYYY-MM-DD`. A day listed twice adds up; anything else is ignored. */
|
|
396
|
+
day: string;
|
|
397
|
+
value: number;
|
|
398
|
+
};
|
|
399
|
+
type CalendarChartProps = Omit<ChartProps, 'children' | 'height'> & ChartEmptyProps & {
|
|
400
|
+
data: CalendarDay[];
|
|
401
|
+
/**
|
|
402
|
+
* First day shown, `YYYY-MM-DD`. Default: the first day of the earliest
|
|
403
|
+
* year of `data` in the `calendar` layout, the earliest day in `range`.
|
|
404
|
+
*/
|
|
405
|
+
from?: string;
|
|
406
|
+
/** Last day shown, `YYYY-MM-DD`. Default: the end of the latest year, or the latest day in `range`. */
|
|
407
|
+
to?: string;
|
|
408
|
+
/**
|
|
409
|
+
* `calendar` draws one block per year, with the months named above their
|
|
410
|
+
* first full week. `range` draws one continuous grid from `from` to `to`,
|
|
411
|
+
* with larger cells when the range is short. Default `calendar`.
|
|
412
|
+
*/
|
|
413
|
+
layout?: 'calendar' | 'range';
|
|
414
|
+
/** The weekday a week starts on: 1 for Monday (default), 0 for Sunday. */
|
|
415
|
+
weekStart?: WeekStart;
|
|
416
|
+
/** Format the value in the tooltip and in the name of each day. */
|
|
417
|
+
formatValue?: (value: number) => string;
|
|
418
|
+
/** Text at the low end of the scale under the grid. Default `Less`. */
|
|
419
|
+
lessLabel?: string;
|
|
420
|
+
/** Text at the high end of the scale under the grid. Default `More`. */
|
|
421
|
+
moreLabel?: string;
|
|
422
|
+
/** The language of the month, weekday and date names (BCP 47). Default `en-US`. */
|
|
423
|
+
locale?: string;
|
|
424
|
+
};
|
|
425
|
+
declare const CalendarChart: ({ data, from, to, layout, weekStart, formatValue, locale, lessLabel, moreLabel, emptyMessage, ariaLabel, width, }: CalendarChartProps) => react.JSX.Element;
|
|
426
|
+
|
|
427
|
+
type RadarChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & {
|
|
185
428
|
/** One polygon per series; one value per category, in the same order. */
|
|
186
429
|
series: {
|
|
187
430
|
name: string;
|
|
@@ -197,8 +440,13 @@ type RadarChartProps = ChartSize & {
|
|
|
197
440
|
showLegend?: boolean;
|
|
198
441
|
/** Top of the scale, e.g. 100 for scores. Default: rounded up from the data. */
|
|
199
442
|
max?: number;
|
|
443
|
+
/**
|
|
444
|
+
* Write the scale on the polygons (0, 20 … 100). Default off: the labels sit on the
|
|
445
|
+
* polygons and the tooltip gives the values. `max` and `formatValue` still apply.
|
|
446
|
+
*/
|
|
447
|
+
showScale?: boolean;
|
|
200
448
|
};
|
|
201
|
-
declare const RadarChart: ({ series, categories, colors, formatValue, showLegend, max, height, width, }: RadarChartProps) => react.JSX.Element;
|
|
449
|
+
declare const RadarChart: ({ series, categories, colors, formatValue, showLegend, legendPosition, max, showScale, emptyMessage, ariaLabel, children, height, width, }: RadarChartProps) => react.JSX.Element;
|
|
202
450
|
|
|
203
451
|
type ScatterPoint = {
|
|
204
452
|
x: number;
|
|
@@ -210,7 +458,7 @@ type BubblePoint = ScatterPoint & {
|
|
|
210
458
|
/** Third measure, drawn as the bubble size. */
|
|
211
459
|
z: number;
|
|
212
460
|
};
|
|
213
|
-
type XYChartProps =
|
|
461
|
+
type XYChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & ChartReferenceProps & {
|
|
214
462
|
/** Title under the x-axis. Also labels the x value in the tooltip (default `x`). */
|
|
215
463
|
xTitle?: string;
|
|
216
464
|
/** Title beside the y-axis. Also labels the y value in the tooltip (default `y`). */
|
|
@@ -241,14 +489,14 @@ type BubbleChartProps = XYChartProps & {
|
|
|
241
489
|
formatSize?: (value: number) => string;
|
|
242
490
|
};
|
|
243
491
|
/** Points on two numeric axes, e.g. latency against load, one point per node. */
|
|
244
|
-
declare const ScatterChart: (
|
|
492
|
+
declare const ScatterChart: (props: ScatterChartProps) => react.JSX.Element;
|
|
245
493
|
/** A scatter chart whose bubble size carries a third measure (`z`), e.g. request volume. */
|
|
246
|
-
declare const BubbleChart: ({ sizeTitle, formatSize,
|
|
494
|
+
declare const BubbleChart: ({ sizeTitle, formatSize, ...props }: BubbleChartProps) => react.JSX.Element;
|
|
247
495
|
|
|
248
496
|
type BoxPlotChartOrientation = 'vertical' | 'horizontal';
|
|
249
497
|
/** One box, the five-number summary of a distribution. */
|
|
250
498
|
type BoxPlotSummary = [min: number, q1: number, median: number, q3: number, max: number];
|
|
251
|
-
type BoxPlotChartProps =
|
|
499
|
+
type BoxPlotChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & ChartAxisTitleProps & ChartReferenceProps & {
|
|
252
500
|
/** One summary per category, in the order of `categories`. */
|
|
253
501
|
series: {
|
|
254
502
|
name: string;
|
|
@@ -265,7 +513,7 @@ type BoxPlotChartProps = ChartSize & {
|
|
|
265
513
|
showLegend?: boolean;
|
|
266
514
|
};
|
|
267
515
|
/** Distributions per category (min, quartiles, median, max), e.g. response times per service. */
|
|
268
|
-
declare const BoxPlotChart: ({ series, categories, orientation, colors, formatValue, showLegend, height, width, }: BoxPlotChartProps) => react.JSX.Element;
|
|
516
|
+
declare const BoxPlotChart: ({ series, categories, orientation, colors, formatValue, xTitle, yTitle, referenceLines, referenceBands, showLegend, legendPosition, emptyMessage, ariaLabel, children, height, width, }: BoxPlotChartProps) => react.JSX.Element;
|
|
269
517
|
|
|
270
518
|
type RangeBarPoint = {
|
|
271
519
|
/** Row label: the service, rack or host the range belongs to. */
|
|
@@ -273,8 +521,8 @@ type RangeBarPoint = {
|
|
|
273
521
|
/** Start and end, as timestamps in milliseconds. */
|
|
274
522
|
y: [number, number];
|
|
275
523
|
};
|
|
276
|
-
type RangeBarChartProps =
|
|
277
|
-
/** One series per kind of range (maintenance, deploy, incident…), drawn on a
|
|
524
|
+
type RangeBarChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & ChartAxisTitleProps & ChartReferenceProps & {
|
|
525
|
+
/** One series per kind of range (maintenance, deploy, incident…), drawn on a time axis. */
|
|
278
526
|
series: {
|
|
279
527
|
name: string;
|
|
280
528
|
data: RangeBarPoint[];
|
|
@@ -288,19 +536,19 @@ type RangeBarChartProps = ChartSize & {
|
|
|
288
536
|
/** Show the legend (auto-true when 2+ series). */
|
|
289
537
|
showLegend?: boolean;
|
|
290
538
|
};
|
|
291
|
-
declare const RangeBarChart: ({ series, groupRows, colors, formatDate, showLegend, height, width, }: RangeBarChartProps) => react.JSX.Element;
|
|
539
|
+
declare const RangeBarChart: ({ series, groupRows, colors, formatDate, xTitle, yTitle, referenceLines, referenceBands, showLegend, legendPosition, emptyMessage, ariaLabel, children, height, width, }: RangeBarChartProps) => react.JSX.Element;
|
|
292
540
|
|
|
293
541
|
type MixedChartAxis = 'left' | 'right';
|
|
294
542
|
type MixedChartSeries = {
|
|
295
543
|
name: string;
|
|
296
|
-
/** `column` draws bars, `line` draws a line over them. */
|
|
297
|
-
type: 'line' | 'column';
|
|
544
|
+
/** `column` draws bars, `line` draws a line over them, `area` fills under a line, behind the bars. */
|
|
545
|
+
type: 'line' | 'column' | 'area';
|
|
298
546
|
data: number[];
|
|
299
547
|
/** The y axis the series is read on. Any `right` series adds a second axis. Default `left`. */
|
|
300
548
|
axis?: MixedChartAxis;
|
|
301
549
|
};
|
|
302
|
-
type MixedChartProps =
|
|
303
|
-
/** Lines and columns on one category axis.
|
|
550
|
+
type MixedChartProps = ChartProps & ChartEmptyProps & ChartLegendProps & ChartAxisTitleProps & ChartReferenceProps & {
|
|
551
|
+
/** Lines and columns on one category axis. */
|
|
304
552
|
series: MixedChartSeries[];
|
|
305
553
|
categories: (string | number)[];
|
|
306
554
|
/** Override the default Cosmos palette. */
|
|
@@ -309,9 +557,151 @@ type MixedChartProps = ChartSize & {
|
|
|
309
557
|
formatValue?: (value: number) => string;
|
|
310
558
|
/** Format the right axis labels and the tooltip values of its series. */
|
|
311
559
|
formatRightValue?: (value: number) => string;
|
|
560
|
+
/**
|
|
561
|
+
* Title beside the right axis. `yTitle` names the left one. With one axis only, that axis
|
|
562
|
+
* takes the title of its side.
|
|
563
|
+
*/
|
|
564
|
+
yRightTitle?: string;
|
|
312
565
|
/** Show the legend (auto-true when 2+ series). */
|
|
313
566
|
showLegend?: boolean;
|
|
567
|
+
/** Pile the `column` series on each other instead of grouping them side by side; the columns of each axis stack apart. */
|
|
568
|
+
stackedColumns?: boolean;
|
|
569
|
+
};
|
|
570
|
+
declare const MixedChart: ({ series, categories, colors, formatValue, formatRightValue, xTitle, yTitle, yRightTitle, referenceLines, referenceBands, showLegend, legendPosition, stackedColumns, emptyMessage, ariaLabel, children, height, width, }: MixedChartProps) => react.JSX.Element;
|
|
571
|
+
|
|
572
|
+
type BumpPoint = {
|
|
573
|
+
x: string;
|
|
574
|
+
rank: number;
|
|
575
|
+
};
|
|
576
|
+
type BumpSeries = {
|
|
577
|
+
name: string;
|
|
578
|
+
data: BumpPoint[];
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
type BumpChartPoints = 'rank' | 'dot';
|
|
582
|
+
type BumpChartProps = ChartProps & ChartEmptyProps & {
|
|
583
|
+
/**
|
|
584
|
+
* One entry per ranked item. `data` lists the rank (1 is the top) of the
|
|
585
|
+
* item in each period. The periods are every `x` once, in the order they
|
|
586
|
+
* first appear, so list them in order in the series that has them all. A
|
|
587
|
+
* period an item has no point in (it enters late, or leaves) is a gap in
|
|
588
|
+
* its line. Ties are allowed: items tied on a rank are drawn apart around it.
|
|
589
|
+
*/
|
|
590
|
+
series: BumpSeries[];
|
|
591
|
+
/** Override the default Cosmos palette. */
|
|
592
|
+
colors?: string[];
|
|
593
|
+
/** Format a rank in the tooltip. Default `#1`, `#2`…; the points keep the bare number. */
|
|
594
|
+
formatValue?: (rank: number) => string;
|
|
595
|
+
/**
|
|
596
|
+
* `rank` (default) draws a disc ringed with the series color with the rank
|
|
597
|
+
* written in it; `dot` draws a small filled dot.
|
|
598
|
+
*/
|
|
599
|
+
points?: BumpChartPoints;
|
|
600
|
+
};
|
|
601
|
+
declare const BumpChart: ({ series, colors, formatValue, points, emptyMessage, ariaLabel, children, height, width, }: BumpChartProps) => react.JSX.Element;
|
|
602
|
+
|
|
603
|
+
type FunnelStage = {
|
|
604
|
+
label: string;
|
|
605
|
+
value: number;
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
type FunnelChartProps = Omit<ChartProps, 'children'> & ChartEmptyProps & {
|
|
609
|
+
/**
|
|
610
|
+
* The stages, drawn top to bottom in the order given: the wrapper does not
|
|
611
|
+
* sort them. Each bar is as wide as its value against the largest stage,
|
|
612
|
+
* which is the first one unless a stage grows.
|
|
613
|
+
*/
|
|
614
|
+
stages: {
|
|
615
|
+
label: string;
|
|
616
|
+
value: number;
|
|
617
|
+
}[];
|
|
618
|
+
/**
|
|
619
|
+
* One color per stage, cycling when there are fewer. Default: the accent,
|
|
620
|
+
* fading from the first stage to the last.
|
|
621
|
+
*/
|
|
622
|
+
colors?: string[];
|
|
623
|
+
/** Format the values, in the labels and the tooltip. Percentages always have one decimal. */
|
|
624
|
+
formatValue?: (value: number) => string;
|
|
625
|
+
/**
|
|
626
|
+
* Show the conversion: a chip with the rate from the previous stage, the
|
|
627
|
+
* rate from the first stage beside it, and both in the tooltip. Off, only
|
|
628
|
+
* the values show. Default true.
|
|
629
|
+
*/
|
|
630
|
+
showConversion?: boolean;
|
|
631
|
+
};
|
|
632
|
+
declare const FunnelChart: ({ stages, colors, formatValue, showConversion, emptyMessage, ariaLabel, height, width, }: FunnelChartProps) => react.JSX.Element;
|
|
633
|
+
|
|
634
|
+
type WaterfallDatum = {
|
|
635
|
+
label: string;
|
|
636
|
+
/** A step: the signed change. A total: sets the running total to it (an opening balance). */
|
|
637
|
+
value?: number;
|
|
638
|
+
/** Default `step`. `subtotal` and `total` are drawn from 0 to the running total. */
|
|
639
|
+
kind?: 'step' | 'subtotal' | 'total';
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
type WaterfallChartProps = ChartProps & ChartEmptyProps & ChartAxisTitleProps & {
|
|
643
|
+
/**
|
|
644
|
+
* The bars, left to right. A step (default) carries a signed `value`. A
|
|
645
|
+
* `subtotal` is drawn from 0 to the running total at that point. A
|
|
646
|
+
* `total` is drawn the same way, and a `value` on it sets the running
|
|
647
|
+
* total to it: an opening balance, or a known balance mid-walk.
|
|
648
|
+
*/
|
|
649
|
+
data: WaterfallDatum[];
|
|
650
|
+
/** Format the value axis, the labels and the tooltip. The sign of a step is written apart: the function gets the magnitude. */
|
|
651
|
+
formatValue?: (value: number) => string;
|
|
652
|
+
/**
|
|
653
|
+
* Write the value above each bar. Default: on with 12 bars or fewer in a chart at least
|
|
654
|
+
* 480px wide, off otherwise (the values stay in the tooltip and the keyboard walk).
|
|
655
|
+
*/
|
|
656
|
+
showLabels?: boolean;
|
|
657
|
+
/** Dashed lines from the top of a bar to the next one. Default true. */
|
|
658
|
+
showConnectors?: boolean;
|
|
659
|
+
/** Override the colors: increases, decreases, totals and subtotals. Defaults: the theme's success, error and accent. */
|
|
660
|
+
colors?: {
|
|
661
|
+
positive?: string;
|
|
662
|
+
negative?: string;
|
|
663
|
+
total?: string;
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
declare const WaterfallChart: ({ data, formatValue, showLabels, showConnectors, colors, xTitle, yTitle, emptyMessage, ariaLabel, children, height, width, }: WaterfallChartProps) => react.JSX.Element;
|
|
667
|
+
|
|
668
|
+
type WorldMapProps = Omit<ChartProps, 'children'> & {
|
|
669
|
+
/**
|
|
670
|
+
* The value of each country, keyed by ISO 3166-1 alpha-2 code in upper case
|
|
671
|
+
* (`FR`, `US`). A code the `geography` does not hold is not drawn, and a
|
|
672
|
+
* value that is not a finite number counts as none.
|
|
673
|
+
*/
|
|
674
|
+
data: Record<string, number>;
|
|
675
|
+
/**
|
|
676
|
+
* The map: a TopoJSON `Topology` with a `countries` object, such as
|
|
677
|
+
* `world-atlas/countries-110m.json` or `countries-50m.json`. The package
|
|
678
|
+
* ships no map data. A country is a feature whose `id` is its ISO 3166-1
|
|
679
|
+
* numeric code and whose `properties.name` is the name the tooltip and the
|
|
680
|
+
* reading table give; a feature without an id (Kosovo) is drawn and never
|
|
681
|
+
* takes a value. Antarctica is left out.
|
|
682
|
+
*/
|
|
683
|
+
geography: Topology;
|
|
684
|
+
/** Format the values, in the tooltip, the legend and the table. Default `String`. */
|
|
685
|
+
formatValue?: (value: number) => string;
|
|
686
|
+
/** Names the value in the tooltip, such as `visitors`. Default `Value`. */
|
|
687
|
+
label?: string;
|
|
688
|
+
/**
|
|
689
|
+
* Clamp the values to this end before the color steps are cut: a value under
|
|
690
|
+
* `min` counts as `min`. The legend starts at `min`. Default: the lowest value.
|
|
691
|
+
*/
|
|
692
|
+
min?: number;
|
|
693
|
+
/** Clamp the values to this end before the color steps are cut: a value over `max` counts as `max`. Default: no limit. */
|
|
694
|
+
max?: number;
|
|
695
|
+
/** Show the legend: the lower bound of each step, and a swatch for countries without data. Default true. Never shown without a value to draw. */
|
|
696
|
+
showLegend?: boolean;
|
|
697
|
+
/**
|
|
698
|
+
* Called with the code of a country that has a value when it is clicked, or
|
|
699
|
+
* when Enter or Space is pressed on the one the keyboard is on. Without it,
|
|
700
|
+
* the map only shows.
|
|
701
|
+
*/
|
|
702
|
+
onSelect?: (code: string) => void;
|
|
314
703
|
};
|
|
315
|
-
declare const
|
|
704
|
+
declare const WorldMap: ({ data, geography, formatValue, label, min, max, showLegend, onSelect, ariaLabel, height, width, }: WorldMapProps) => react.JSX.Element;
|
|
316
705
|
|
|
317
|
-
export { BarChart,
|
|
706
|
+
export { BarChart, BoxPlotChart, BubbleChart, BumpChart, COSMOS_BRAND, COSMOS_PALETTE, CalendarChart, DonutChart, FunnelChart, GradientRadial, HeatmapChart, LineAreaChart, MixedChart, RadarChart, RadialBarChart, RangeBarChart, RealtimeChart, ScatterChart, SemiCircleGauge, Sparkline, StrokedGauge, TreemapChart, WaterfallChart, WorldMap, readableOn };
|
|
707
|
+
export type { BarChartOrientation, BarChartProps, BoxPlotChartOrientation, BoxPlotChartProps, BoxPlotSummary, BubbleChartProps, BubblePoint, BumpChartPoints, BumpChartProps, BumpPoint, BumpSeries, CalendarChartProps, CalendarDay, ChartAxisTitleProps, ChartEmptyProps, ChartIntent, ChartLegendPosition, ChartLegendProps, ChartProps, ChartReferenceBand, ChartReferenceLine, ChartReferenceProps, ChartSeriesPoint, ChartSize, DonutChartProps, DonutChartVariant, FunnelChartProps, FunnelStage, GradientRadialProps, HeatmapChartProps, HeatmapColorRange, LineAreaChartProps, LineAreaChartSeriesStyle, LineAreaChartVariant, MixedChartAxis, MixedChartProps, MixedChartSeries, RadarChartProps, RadialBarChartProps, RangeBarChartProps, RangeBarPoint, RealtimeChartProps, ScatterChartProps, ScatterPoint, SemiCircleGaugeProps, SparklineProps, StrokedGaugeProps, TreemapChartProps, TreemapDatum, WaterfallChartProps, WaterfallDatum, WorldMapProps };
|