@sckyzo/cosmos-charts 0.2.0 → 0.3.1
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 +98 -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 +218 -0
- package/dist/CalendarChart.cjs.map +1 -0
- package/dist/CalendarChart.js +216 -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 +424 -0
- package/dist/FunnelChart.cjs.map +1 -0
- package/dist/FunnelChart.js +422 -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 +148 -0
- package/dist/HeatmapChart.cjs.map +1 -0
- package/dist/HeatmapChart.js +146 -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-4AKHZNWP.js +127 -0
- package/dist/chunk-4AKHZNWP.js.map +1 -0
- package/dist/chunk-56WD3OHA.js +62 -0
- package/dist/chunk-56WD3OHA.js.map +1 -0
- package/dist/chunk-5C2RLJYZ.js +11 -0
- package/dist/chunk-5C2RLJYZ.js.map +1 -0
- package/dist/chunk-6FGJZBTC.js +61 -0
- package/dist/chunk-6FGJZBTC.js.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-CMBNNLIV.cjs +63 -0
- package/dist/chunk-CMBNNLIV.cjs.map +1 -0
- package/dist/chunk-DBZQI4HM.cjs +14 -0
- package/dist/chunk-DBZQI4HM.cjs.map +1 -0
- package/dist/chunk-DI2FBGKM.js +44 -0
- package/dist/chunk-DI2FBGKM.js.map +1 -0
- package/dist/chunk-ESVGCUJN.js +58 -0
- package/dist/chunk-ESVGCUJN.js.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-G4WOPX4D.cjs +51 -0
- package/dist/chunk-G4WOPX4D.cjs.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-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-OCD6JIIX.js +23 -0
- package/dist/chunk-OCD6JIIX.js.map +1 -0
- package/dist/chunk-RCDTBZC2.cjs +131 -0
- package/dist/chunk-RCDTBZC2.cjs.map +1 -0
- package/dist/chunk-SR2ESX3R.cjs +66 -0
- package/dist/chunk-SR2ESX3R.cjs.map +1 -0
- package/dist/chunk-T3K6Q34U.cjs +82 -0
- package/dist/chunk-T3K6Q34U.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-UL3SNXQR.js +280 -0
- package/dist/chunk-UL3SNXQR.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-XMFBVMW7.cjs +30 -0
- package/dist/chunk-XMFBVMW7.cjs.map +1 -0
- package/dist/chunk-XUGQ6VXO.cjs +60 -0
- package/dist/chunk-XUGQ6VXO.cjs.map +1 -0
- package/dist/chunk-YMRNTIOK.js +27 -0
- package/dist/chunk-YMRNTIOK.js.map +1 -0
- package/dist/chunk-ZWHCUYIN.cjs +282 -0
- package/dist/chunk-ZWHCUYIN.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.cjs
CHANGED
|
@@ -1,1174 +1,162 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
|
-
var
|
|
4
|
-
require('
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
require('
|
|
8
|
-
require('
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
11
|
-
require('
|
|
12
|
-
require('
|
|
13
|
-
require('
|
|
14
|
-
require('
|
|
15
|
-
require('
|
|
16
|
-
require('
|
|
4
|
+
var theme_cjs = require('./theme.cjs');
|
|
5
|
+
var LineAreaChart_cjs = require('./LineAreaChart.cjs');
|
|
6
|
+
var RealtimeChart_cjs = require('./RealtimeChart.cjs');
|
|
7
|
+
var RadialBarChart_cjs = require('./RadialBarChart.cjs');
|
|
8
|
+
var GradientRadial_cjs = require('./GradientRadial.cjs');
|
|
9
|
+
var SemiCircleGauge_cjs = require('./SemiCircleGauge.cjs');
|
|
10
|
+
var StrokedGauge_cjs = require('./StrokedGauge.cjs');
|
|
11
|
+
var DonutChart_cjs = require('./DonutChart.cjs');
|
|
12
|
+
var Sparkline_cjs = require('./Sparkline.cjs');
|
|
13
|
+
var TreemapChart_cjs = require('./TreemapChart.cjs');
|
|
14
|
+
var BarChart_cjs = require('./BarChart.cjs');
|
|
15
|
+
var HeatmapChart_cjs = require('./HeatmapChart.cjs');
|
|
16
|
+
var CalendarChart_cjs = require('./CalendarChart.cjs');
|
|
17
|
+
var RadarChart_cjs = require('./RadarChart.cjs');
|
|
18
|
+
var ScatterChart_cjs = require('./ScatterChart.cjs');
|
|
19
|
+
var BoxPlotChart_cjs = require('./BoxPlotChart.cjs');
|
|
20
|
+
var RangeBarChart_cjs = require('./RangeBarChart.cjs');
|
|
21
|
+
var MixedChart_cjs = require('./MixedChart.cjs');
|
|
22
|
+
var BumpChart_cjs = require('./BumpChart.cjs');
|
|
23
|
+
var FunnelChart_cjs = require('./FunnelChart.cjs');
|
|
24
|
+
var WaterfallChart_cjs = require('./WaterfallChart.cjs');
|
|
25
|
+
var WorldMap_cjs = require('./WorldMap.cjs');
|
|
17
26
|
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
27
|
|
|
20
|
-
var ReactApexChart13__default = /*#__PURE__*/_interopDefault(ReactApexChart13);
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
154
|
-
var defaultGenerator = /* @__PURE__ */ (() => {
|
|
155
|
-
let last = 50;
|
|
156
|
-
return () => {
|
|
157
|
-
last += (Math.random() - 0.5) * 8;
|
|
158
|
-
last = Math.max(20, Math.min(95, last));
|
|
159
|
-
return Math.round(last);
|
|
160
|
-
};
|
|
161
|
-
})();
|
|
162
|
-
var RealtimeChart = ({
|
|
163
|
-
generator = defaultGenerator,
|
|
164
|
-
intervalMs = 2e3,
|
|
165
|
-
windowSize = 30,
|
|
166
|
-
warnThreshold = 70,
|
|
167
|
-
critThreshold = 85,
|
|
168
|
-
height = 240,
|
|
169
|
-
width = "100%"
|
|
170
|
-
}) => {
|
|
171
|
-
const { grid, axisLabels, brand } = useChartTheme();
|
|
172
|
-
const [series, setSeries] = react.useState(() => Array.from({ length: windowSize }, () => generator()));
|
|
173
|
-
react.useEffect(() => {
|
|
174
|
-
const id = setInterval(() => {
|
|
175
|
-
setSeries((current) => [...current.slice(1), generator()]);
|
|
176
|
-
}, intervalMs);
|
|
177
|
-
return () => clearInterval(id);
|
|
178
|
-
}, [generator, intervalMs]);
|
|
179
|
-
const options = {
|
|
180
|
-
chart: {
|
|
181
|
-
type: "line",
|
|
182
|
-
animations: { enabled: true, dynamicAnimation: { enabled: true, speed: 800 } },
|
|
183
|
-
toolbar: { show: false },
|
|
184
|
-
zoom: { enabled: false },
|
|
185
|
-
fontFamily: "inherit"
|
|
186
|
-
},
|
|
187
|
-
colors: [brand],
|
|
188
|
-
stroke: { curve: "smooth", width: 2 },
|
|
189
|
-
dataLabels: { enabled: false },
|
|
190
|
-
grid,
|
|
191
|
-
xaxis: {
|
|
192
|
-
type: "numeric",
|
|
193
|
-
labels: { show: false },
|
|
194
|
-
axisBorder: { show: false },
|
|
195
|
-
axisTicks: { show: false }
|
|
196
|
-
},
|
|
197
|
-
yaxis: { min: 0, max: 100, labels: axisLabels },
|
|
198
|
-
annotations: {
|
|
199
|
-
yaxis: [
|
|
200
|
-
{
|
|
201
|
-
y: warnThreshold,
|
|
202
|
-
borderColor: "#f59e0b",
|
|
203
|
-
label: { text: "WARN", style: { color: "#fff", background: "#f59e0b" } }
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
y: critThreshold,
|
|
207
|
-
borderColor: "#ef4444",
|
|
208
|
-
label: { text: "CRIT", style: { color: "#fff", background: "#ef4444" } }
|
|
209
|
-
}
|
|
210
|
-
]
|
|
211
|
-
},
|
|
212
|
-
tooltip: { theme: "dark" }
|
|
213
|
-
};
|
|
214
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
-
ReactApexChart13__default.default,
|
|
216
|
-
{
|
|
217
|
-
type: "line",
|
|
218
|
-
options,
|
|
219
|
-
series: [{ name: "value", data: series }],
|
|
220
|
-
height,
|
|
221
|
-
width
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
};
|
|
225
|
-
var RadialBarChart = ({
|
|
226
|
-
series,
|
|
227
|
-
labels,
|
|
228
|
-
height = 320,
|
|
229
|
-
width = "100%"
|
|
230
|
-
}) => {
|
|
231
|
-
const { palette } = useChartTheme();
|
|
232
|
-
const options = {
|
|
233
|
-
chart: { type: "radialBar", fontFamily: "inherit" },
|
|
234
|
-
colors: palette,
|
|
235
|
-
labels,
|
|
236
|
-
plotOptions: {
|
|
237
|
-
radialBar: {
|
|
238
|
-
track: { background: "rgba(150,150,150,0.15)" },
|
|
239
|
-
dataLabels: {
|
|
240
|
-
name: { fontSize: "12px" },
|
|
241
|
-
value: { fontSize: "14px", formatter: (v) => `${v}%` },
|
|
242
|
-
total: {
|
|
243
|
-
show: true,
|
|
244
|
-
label: "Avg",
|
|
245
|
-
formatter: () => `${Math.round(series.reduce((a, b) => a + b, 0) / series.length)}%`
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
252
|
-
ReactApexChart13__default.default,
|
|
253
|
-
{
|
|
254
|
-
type: "radialBar",
|
|
255
|
-
options,
|
|
256
|
-
series,
|
|
257
|
-
height,
|
|
258
|
-
width
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
};
|
|
262
|
-
var GradientRadial = ({
|
|
263
|
-
value,
|
|
264
|
-
label = "Score",
|
|
265
|
-
height = 280,
|
|
266
|
-
width = "100%"
|
|
267
|
-
}) => {
|
|
268
|
-
const { brand } = useChartTheme();
|
|
269
|
-
const options = {
|
|
270
|
-
chart: { type: "radialBar", fontFamily: "inherit" },
|
|
271
|
-
colors: [brand],
|
|
272
|
-
fill: {
|
|
273
|
-
type: "gradient",
|
|
274
|
-
gradient: {
|
|
275
|
-
shade: "dark",
|
|
276
|
-
type: "horizontal",
|
|
277
|
-
shadeIntensity: 0.5,
|
|
278
|
-
gradientToColors: ["#10b981"],
|
|
279
|
-
inverseColors: false,
|
|
280
|
-
opacityFrom: 1,
|
|
281
|
-
opacityTo: 1,
|
|
282
|
-
stops: [0, 100]
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
plotOptions: {
|
|
286
|
-
radialBar: {
|
|
287
|
-
hollow: { size: "70%" },
|
|
288
|
-
dataLabels: {
|
|
289
|
-
name: { fontSize: "12px", offsetY: -10 },
|
|
290
|
-
value: { fontSize: "32px", fontWeight: 700, formatter: (v) => `${v}%` }
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
labels: [label]
|
|
295
|
-
};
|
|
296
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
297
|
-
ReactApexChart13__default.default,
|
|
298
|
-
{
|
|
299
|
-
type: "radialBar",
|
|
300
|
-
options,
|
|
301
|
-
series: [value],
|
|
302
|
-
height,
|
|
303
|
-
width
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
};
|
|
307
|
-
var SemiCircleGauge = ({
|
|
308
|
-
value,
|
|
309
|
-
label = "",
|
|
310
|
-
color,
|
|
311
|
-
height = 200,
|
|
312
|
-
width = "100%"
|
|
313
|
-
}) => {
|
|
314
|
-
const { brand } = useChartTheme();
|
|
315
|
-
const options = {
|
|
316
|
-
chart: { type: "radialBar", fontFamily: "inherit", sparkline: { enabled: true } },
|
|
317
|
-
colors: [color ?? brand],
|
|
318
|
-
plotOptions: {
|
|
319
|
-
radialBar: {
|
|
320
|
-
startAngle: -90,
|
|
321
|
-
endAngle: 90,
|
|
322
|
-
track: { background: "rgba(150,150,150,0.15)", strokeWidth: "100%" },
|
|
323
|
-
dataLabels: {
|
|
324
|
-
name: { offsetY: -10, fontSize: "12px" },
|
|
325
|
-
value: { offsetY: -45, fontSize: "24px", fontWeight: 700, formatter: (v) => `${v}%` }
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
labels: [label]
|
|
330
|
-
};
|
|
331
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
|
-
ReactApexChart13__default.default,
|
|
333
|
-
{
|
|
334
|
-
type: "radialBar",
|
|
335
|
-
options,
|
|
336
|
-
series: [value],
|
|
337
|
-
height,
|
|
338
|
-
width
|
|
339
|
-
}
|
|
340
|
-
);
|
|
341
|
-
};
|
|
342
|
-
var StrokedGauge = ({
|
|
343
|
-
value,
|
|
344
|
-
label = "",
|
|
345
|
-
height = 280,
|
|
346
|
-
width = "100%"
|
|
347
|
-
}) => {
|
|
348
|
-
const { brand } = useChartTheme();
|
|
349
|
-
const options = {
|
|
350
|
-
chart: { type: "radialBar", fontFamily: "inherit" },
|
|
351
|
-
colors: [brand],
|
|
352
|
-
stroke: { lineCap: "round", dashArray: 4 },
|
|
353
|
-
plotOptions: {
|
|
354
|
-
radialBar: {
|
|
355
|
-
hollow: { size: "70%" },
|
|
356
|
-
track: { background: "rgba(150,150,150,0.15)", strokeWidth: "100%" },
|
|
357
|
-
dataLabels: {
|
|
358
|
-
name: { fontSize: "12px", offsetY: -10 },
|
|
359
|
-
value: { fontSize: "32px", fontWeight: 700, formatter: (v) => `${v}%` }
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
labels: [label]
|
|
364
|
-
};
|
|
365
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
366
|
-
ReactApexChart13__default.default,
|
|
367
|
-
{
|
|
368
|
-
type: "radialBar",
|
|
369
|
-
options,
|
|
370
|
-
series: [value],
|
|
371
|
-
height,
|
|
372
|
-
width
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
};
|
|
376
|
-
var DonutChart = ({
|
|
377
|
-
series,
|
|
378
|
-
labels,
|
|
379
|
-
rightLegend = false,
|
|
380
|
-
height = 280,
|
|
381
|
-
width = "100%"
|
|
382
|
-
}) => {
|
|
383
|
-
const { palette } = useChartTheme();
|
|
384
|
-
const options = {
|
|
385
|
-
chart: { type: "donut", fontFamily: "inherit" },
|
|
386
|
-
colors: palette,
|
|
387
|
-
labels,
|
|
388
|
-
// The legend and the tooltip are HTML: escape the labels.
|
|
389
|
-
legend: { position: rightLegend ? "right" : "bottom", formatter: (name) => escapeHtml(name) },
|
|
390
|
-
tooltip: { y: { title: { formatter: (name) => `${escapeHtml(name)}: ` } } },
|
|
391
|
-
dataLabels: { enabled: false },
|
|
392
|
-
plotOptions: {
|
|
393
|
-
pie: {
|
|
394
|
-
donut: { size: "68%", labels: { show: true, total: { show: true, label: "Total" } } }
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReactApexChart13__default.default, { type: "donut", options, series, height, width });
|
|
399
|
-
};
|
|
400
|
-
var DonutRightLegend = (props) => /* @__PURE__ */ jsxRuntime.jsx(DonutChart, { ...props, rightLegend: true });
|
|
401
|
-
var Sparkline = ({
|
|
402
|
-
data,
|
|
403
|
-
color,
|
|
404
|
-
variant = "area",
|
|
405
|
-
height = 60,
|
|
406
|
-
width = "100%"
|
|
407
|
-
}) => {
|
|
408
|
-
const { brand } = useChartTheme();
|
|
409
|
-
const options = {
|
|
410
|
-
chart: { sparkline: { enabled: true }, fontFamily: "inherit", type: variant },
|
|
411
|
-
colors: [color ?? brand],
|
|
412
|
-
stroke: { curve: "smooth", width: 2 },
|
|
413
|
-
fill: variant === "area" ? { type: "gradient", gradient: { opacityFrom: 0.45, opacityTo: 0.05 } } : void 0,
|
|
414
|
-
tooltip: { fixed: { enabled: false }, x: { show: false }, marker: { show: false } }
|
|
415
|
-
};
|
|
416
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
417
|
-
ReactApexChart13__default.default,
|
|
418
|
-
{
|
|
419
|
-
type: variant,
|
|
420
|
-
options,
|
|
421
|
-
series: [{ name: "value", data }],
|
|
422
|
-
height,
|
|
423
|
-
width
|
|
424
|
-
}
|
|
425
|
-
);
|
|
426
|
-
};
|
|
427
|
-
var SparklineGroup = ({
|
|
428
|
-
items,
|
|
429
|
-
className
|
|
430
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
431
|
-
"div",
|
|
432
|
-
{
|
|
433
|
-
className,
|
|
434
|
-
style: {
|
|
435
|
-
display: "grid",
|
|
436
|
-
gap: "1rem",
|
|
437
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))"
|
|
438
|
-
},
|
|
439
|
-
children: items.map((it) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
440
|
-
"div",
|
|
441
|
-
{
|
|
442
|
-
className: "rounded-2xl border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900",
|
|
443
|
-
children: [
|
|
444
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium tracking-wider text-gray-500 uppercase dark:text-gray-400", children: it.label }),
|
|
445
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-2xl font-bold text-gray-900 dark:text-white", children: it.value }),
|
|
446
|
-
/* @__PURE__ */ jsxRuntime.jsx(Sparkline, { data: it.data, color: it.color, height: 50 })
|
|
447
|
-
]
|
|
448
|
-
},
|
|
449
|
-
it.label
|
|
450
|
-
))
|
|
451
|
-
}
|
|
452
|
-
);
|
|
453
|
-
var TreemapChart = ({ series, height = 320, width = "100%" }) => {
|
|
454
|
-
const { palette } = useChartTheme();
|
|
455
|
-
const options = {
|
|
456
|
-
chart: { type: "treemap", fontFamily: "inherit", toolbar: { show: false } },
|
|
457
|
-
colors: palette,
|
|
458
|
-
legend: { show: false },
|
|
459
|
-
dataLabels: { enabled: true, style: { fontSize: "12px" } },
|
|
460
|
-
plotOptions: { treemap: { distributed: true, enableShades: false } }
|
|
461
|
-
};
|
|
462
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
463
|
-
ReactApexChart13__default.default,
|
|
464
|
-
{
|
|
465
|
-
type: "treemap",
|
|
466
|
-
options,
|
|
467
|
-
series,
|
|
468
|
-
height,
|
|
469
|
-
width
|
|
470
|
-
}
|
|
471
|
-
);
|
|
472
|
-
};
|
|
473
|
-
var BarChart = ({
|
|
474
|
-
series,
|
|
475
|
-
categories,
|
|
476
|
-
orientation = "vertical",
|
|
477
|
-
stacked = false,
|
|
478
|
-
colors,
|
|
479
|
-
formatValue,
|
|
480
|
-
showLegend,
|
|
481
|
-
borderRadius = 4,
|
|
482
|
-
height = 320,
|
|
483
|
-
width = "100%"
|
|
484
|
-
}) => {
|
|
485
|
-
const { grid, axisLabels, palette } = useChartTheme();
|
|
486
|
-
const horizontal = orientation === "horizontal";
|
|
487
|
-
const legendVisible = showLegend ?? series.length > 1;
|
|
488
|
-
const valueFormatter = formatValue ?? ((v) => String(v));
|
|
489
|
-
const options = {
|
|
490
|
-
chart: {
|
|
491
|
-
type: "bar",
|
|
492
|
-
toolbar: { show: false },
|
|
493
|
-
zoom: { enabled: false },
|
|
494
|
-
stacked,
|
|
495
|
-
fontFamily: "inherit"
|
|
496
|
-
},
|
|
497
|
-
colors: colors ?? palette,
|
|
498
|
-
dataLabels: { enabled: false },
|
|
499
|
-
plotOptions: {
|
|
500
|
-
bar: {
|
|
501
|
-
horizontal,
|
|
502
|
-
borderRadius,
|
|
503
|
-
borderRadiusApplication: "end",
|
|
504
|
-
columnWidth: "55%"
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
grid,
|
|
508
|
-
xaxis: {
|
|
509
|
-
categories,
|
|
510
|
-
labels: {
|
|
511
|
-
...axisLabels,
|
|
512
|
-
formatter: horizontal ? (val) => valueFormatter(Number(val)) : void 0
|
|
513
|
-
},
|
|
514
|
-
axisBorder: { show: false },
|
|
515
|
-
axisTicks: { show: false }
|
|
516
|
-
},
|
|
517
|
-
yaxis: {
|
|
518
|
-
labels: {
|
|
519
|
-
...axisLabels,
|
|
520
|
-
formatter: horizontal ? void 0 : (val) => valueFormatter(Number(val))
|
|
521
|
-
}
|
|
522
|
-
},
|
|
523
|
-
legend: {
|
|
524
|
-
show: legendVisible,
|
|
525
|
-
position: "top",
|
|
526
|
-
horizontalAlign: "right",
|
|
527
|
-
labels: { colors: axisLabels.style.colors },
|
|
528
|
-
markers: { size: 5 },
|
|
529
|
-
formatter: (name) => escapeHtml(name)
|
|
530
|
-
},
|
|
531
|
-
// Tooltips and the legend are HTML: escape names, categories and values.
|
|
532
|
-
tooltip: {
|
|
533
|
-
theme: "dark",
|
|
534
|
-
x: { formatter: (v) => escapeHtml(v) },
|
|
535
|
-
y: {
|
|
536
|
-
formatter: (v) => escapeHtml(valueFormatter(Number(v))),
|
|
537
|
-
title: { formatter: (name) => `${escapeHtml(name)}: ` }
|
|
538
|
-
}
|
|
539
|
-
},
|
|
540
|
-
fill: { opacity: 1 },
|
|
541
|
-
stroke: { show: false }
|
|
542
|
-
};
|
|
543
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReactApexChart13__default.default, { type: "bar", options, series, height, width });
|
|
544
|
-
};
|
|
545
|
-
var NICE_STEPS = [1, 2, 2.5, 3, 4, 5, 6, 8, 10];
|
|
546
|
-
var niceStep = (value) => {
|
|
547
|
-
const magnitude = 10 ** Math.floor(Math.log10(value));
|
|
548
|
-
const step = NICE_STEPS.find((m) => m * magnitude >= value) ?? 10;
|
|
549
|
-
return step * magnitude;
|
|
550
|
-
};
|
|
551
|
-
var round = (value) => Number(value.toPrecision(12));
|
|
552
|
-
var evenRanges = (values, colors) => {
|
|
553
|
-
const finite = values.filter(Number.isFinite);
|
|
554
|
-
if (finite.length === 0 || colors.length === 0) return [];
|
|
555
|
-
const min = finite.reduce((a, b) => Math.min(a, b));
|
|
556
|
-
const max = finite.reduce((a, b) => Math.max(a, b));
|
|
557
|
-
let step = niceStep((max - min) / colors.length || Math.abs(max) || 1);
|
|
558
|
-
let start = Math.floor(min / step) * step;
|
|
559
|
-
while (start + step * colors.length < max) {
|
|
560
|
-
step = niceStep(step * 1.001);
|
|
561
|
-
start = Math.floor(min / step) * step;
|
|
562
|
-
}
|
|
563
|
-
return colors.map((color, i) => ({
|
|
564
|
-
from: round(start + step * i),
|
|
565
|
-
to: round(start + step * (i + 1)),
|
|
566
|
-
color
|
|
567
|
-
}));
|
|
568
|
-
};
|
|
569
|
-
var textColorOn = (color) => {
|
|
570
|
-
const hex = /^#([0-9a-f]{6})$/i.exec(color)?.[1];
|
|
571
|
-
if (!hex) return void 0;
|
|
572
|
-
const [r, g, b] = [0, 2, 4].map((i) => {
|
|
573
|
-
const c = parseInt(hex.slice(i, i + 2), 16) / 255;
|
|
574
|
-
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
575
|
-
});
|
|
576
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.2 ? "#101828" : "#ffffff";
|
|
577
|
-
};
|
|
578
|
-
var HeatmapChart = ({
|
|
579
|
-
series,
|
|
580
|
-
categories,
|
|
581
|
-
colors,
|
|
582
|
-
ranges,
|
|
583
|
-
formatValue,
|
|
584
|
-
showValues = false,
|
|
585
|
-
showLegend = true,
|
|
586
|
-
height = 320,
|
|
587
|
-
width = "100%"
|
|
588
|
-
}) => {
|
|
589
|
-
const { axisLabels, brandScale, surface } = useChartTheme();
|
|
590
|
-
const valueFormatter = formatValue ?? ((v) => String(v));
|
|
591
|
-
const colorRanges = (ranges ?? evenRanges(
|
|
592
|
-
series.flatMap((s) => s.data),
|
|
593
|
-
colors ?? brandScale
|
|
594
|
-
)).map((range) => ({
|
|
595
|
-
...range,
|
|
596
|
-
name: range.name ?? `${valueFormatter(range.from)} \u2013 ${valueFormatter(range.to)}`,
|
|
597
|
-
foreColor: textColorOn(range.color)
|
|
598
|
-
}));
|
|
599
|
-
const options = {
|
|
600
|
-
chart: {
|
|
601
|
-
type: "heatmap",
|
|
602
|
-
toolbar: { show: false },
|
|
603
|
-
fontFamily: "inherit"
|
|
604
|
-
},
|
|
605
|
-
dataLabels: {
|
|
606
|
-
enabled: showValues,
|
|
607
|
-
formatter: (v) => valueFormatter(Number(v)),
|
|
608
|
-
style: { fontSize: "11px", fontWeight: 500 }
|
|
609
|
-
},
|
|
610
|
-
plotOptions: {
|
|
611
|
-
heatmap: {
|
|
612
|
-
radius: 3,
|
|
613
|
-
// The ranges carry the exact colors: no shading on top of them.
|
|
614
|
-
enableShades: false,
|
|
615
|
-
colorScale: { ranges: colorRanges }
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
// Gaps between the cells, in the card's color.
|
|
619
|
-
stroke: { width: 2, colors: [surface] },
|
|
620
|
-
grid: { show: false },
|
|
621
|
-
// One labels object per axis: ApexCharts mutates them. Narrow columns
|
|
622
|
-
// skip the labels that would overlap instead of rotating them into a
|
|
623
|
-
// pile; the tooltip still names every column.
|
|
624
|
-
xaxis: {
|
|
625
|
-
categories,
|
|
626
|
-
labels: { ...axisLabels, rotate: 0 },
|
|
627
|
-
axisBorder: { show: false },
|
|
628
|
-
axisTicks: { show: false },
|
|
629
|
-
tooltip: { enabled: false }
|
|
630
|
-
},
|
|
631
|
-
// ApexCharts draws the first series at the bottom; read top-down instead.
|
|
632
|
-
yaxis: { reversed: true, labels: { ...axisLabels } },
|
|
633
|
-
legend: {
|
|
634
|
-
show: showLegend,
|
|
635
|
-
position: "top",
|
|
636
|
-
horizontalAlign: "right",
|
|
637
|
-
labels: { colors: axisLabels.style.colors },
|
|
638
|
-
// The default stroke outlines the swatches in white, glaring in dark themes.
|
|
639
|
-
markers: { size: 5, strokeWidth: 0 },
|
|
640
|
-
formatter: (name) => escapeHtml(name)
|
|
641
|
-
},
|
|
642
|
-
// The tooltip and the legend are HTML: escape row names, categories,
|
|
643
|
-
// range names and values. The title is the hovered column's category.
|
|
644
|
-
tooltip: {
|
|
645
|
-
theme: "dark",
|
|
646
|
-
x: {
|
|
647
|
-
show: true,
|
|
648
|
-
formatter: (v, opts) => escapeHtml(opts === void 0 ? v : categories[opts.dataPointIndex] ?? v)
|
|
649
|
-
},
|
|
650
|
-
y: {
|
|
651
|
-
formatter: (v) => escapeHtml(valueFormatter(Number(v))),
|
|
652
|
-
title: { formatter: (name) => `${escapeHtml(name)}: ` }
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
657
|
-
ReactApexChart13__default.default,
|
|
658
|
-
{
|
|
659
|
-
type: "heatmap",
|
|
660
|
-
options,
|
|
661
|
-
series,
|
|
662
|
-
height,
|
|
663
|
-
width
|
|
664
|
-
}
|
|
665
|
-
);
|
|
666
|
-
};
|
|
667
|
-
var RadarChart = ({
|
|
668
|
-
series,
|
|
669
|
-
categories,
|
|
670
|
-
colors,
|
|
671
|
-
formatValue,
|
|
672
|
-
showLegend,
|
|
673
|
-
max,
|
|
674
|
-
height = 340,
|
|
675
|
-
width = "100%"
|
|
676
|
-
}) => {
|
|
677
|
-
const { grid, axisLabels, palette } = useChartTheme();
|
|
678
|
-
const legendVisible = showLegend ?? series.length > 1;
|
|
679
|
-
const valueFormatter = formatValue ?? ((v) => String(v));
|
|
680
|
-
const options = {
|
|
681
|
-
chart: {
|
|
682
|
-
type: "radar",
|
|
683
|
-
toolbar: { show: false },
|
|
684
|
-
fontFamily: "inherit"
|
|
685
|
-
},
|
|
686
|
-
colors: colors ?? palette,
|
|
687
|
-
dataLabels: { enabled: false },
|
|
688
|
-
stroke: { width: 2 },
|
|
689
|
-
fill: { opacity: 0.15 },
|
|
690
|
-
// The tooltip is hit-tested on the markers: keep them.
|
|
691
|
-
markers: { size: 3, strokeWidth: 0 },
|
|
692
|
-
// ApexCharts reserves part of an axis name's width only, so on a narrow
|
|
693
|
-
// chart the names at the side vertices ran off the edge. No effect on a
|
|
694
|
-
// wide chart: its size follows the height.
|
|
695
|
-
grid: { padding: { left: 24, right: 24 } },
|
|
696
|
-
plotOptions: {
|
|
697
|
-
radar: {
|
|
698
|
-
polygons: {
|
|
699
|
-
strokeColors: grid?.borderColor,
|
|
700
|
-
connectorColors: grid?.borderColor,
|
|
701
|
-
fill: { colors: ["transparent"] }
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
},
|
|
705
|
-
// One labels object per axis: ApexCharts mutates them.
|
|
706
|
-
xaxis: { categories, labels: { ...axisLabels } },
|
|
707
|
-
yaxis: {
|
|
708
|
-
max,
|
|
709
|
-
labels: { ...axisLabels, formatter: (val) => valueFormatter(Number(val)) }
|
|
710
|
-
},
|
|
711
|
-
legend: {
|
|
712
|
-
show: legendVisible,
|
|
713
|
-
position: "top",
|
|
714
|
-
horizontalAlign: "right",
|
|
715
|
-
labels: { colors: axisLabels.style.colors },
|
|
716
|
-
// The default stroke outlines the swatches in white, glaring in dark themes.
|
|
717
|
-
markers: { size: 5, strokeWidth: 0 },
|
|
718
|
-
formatter: (name) => escapeHtml(name)
|
|
719
|
-
},
|
|
720
|
-
// The tooltip and the legend are HTML: escape names, categories and
|
|
721
|
-
// values. The title is the hovered axis.
|
|
722
|
-
tooltip: {
|
|
723
|
-
theme: "dark",
|
|
724
|
-
x: {
|
|
725
|
-
formatter: (v, opts) => escapeHtml(opts === void 0 ? v : categories[opts.dataPointIndex] ?? v)
|
|
726
|
-
},
|
|
727
|
-
y: {
|
|
728
|
-
formatter: (v) => escapeHtml(valueFormatter(Number(v))),
|
|
729
|
-
title: { formatter: (name) => `${escapeHtml(name)}: ` }
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReactApexChart13__default.default, { type: "radar", options, series, height, width });
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
// src/tooltip.ts
|
|
737
|
-
var line = (content) => `<div class="apexcharts-tooltip-series-group apexcharts-active" style="display:flex">${content}</div>`;
|
|
738
|
-
var tooltipHtml = ({ title, series, rows }) => (title === void 0 ? "" : `<div class="apexcharts-tooltip-title">${escapeHtml(title)}</div>`) + (series === void 0 ? "" : line(
|
|
739
|
-
`<span class="apexcharts-tooltip-marker" style="background-color:${escapeHtml(series.color)};border-radius:50%"></span><span class="apexcharts-tooltip-text-y-label">${escapeHtml(series.name)}</span>`
|
|
740
|
-
)) + rows.map(
|
|
741
|
-
([label, value]) => line(
|
|
742
|
-
`<span class="apexcharts-tooltip-text-y-label">${escapeHtml(label)}:</span><span class="apexcharts-tooltip-text-y-value">${escapeHtml(value)}</span>`
|
|
743
|
-
)
|
|
744
|
-
).join("");
|
|
745
|
-
var formatNumber = (value) => String(Number(value.toFixed(2)));
|
|
746
|
-
var niceAxis = (values, pad = 0, ticks = 5) => {
|
|
747
|
-
const low = Math.min(...values);
|
|
748
|
-
const high = Math.max(...values);
|
|
749
|
-
const margin = (high - low) * pad;
|
|
750
|
-
const min = low >= 0 ? Math.max(low - margin, 0) : low - margin;
|
|
751
|
-
const max = high <= 0 ? Math.min(high + margin, 0) : high + margin;
|
|
752
|
-
if (!(max > min)) return {};
|
|
753
|
-
const rough = (max - min) / ticks;
|
|
754
|
-
const magnitude = 10 ** Math.floor(Math.log10(rough));
|
|
755
|
-
const step = [1, 2, 2.5, 5, 10].map((f) => f * magnitude).find((s) => s >= rough) ?? rough;
|
|
756
|
-
const round2 = (value) => Number(value.toPrecision(12));
|
|
757
|
-
const niceMin = round2(Math.floor(min / step) * step);
|
|
758
|
-
const niceMax = round2(Math.ceil(max / step) * step);
|
|
759
|
-
return { min: niceMin, max: niceMax, tickAmount: Math.round((niceMax - niceMin) / step) };
|
|
760
|
-
};
|
|
761
|
-
var xyOptions = ({ grid, axisLabels, palette }, {
|
|
762
|
-
series,
|
|
763
|
-
xTitle,
|
|
764
|
-
yTitle,
|
|
765
|
-
colors,
|
|
766
|
-
formatX = formatNumber,
|
|
767
|
-
formatY = formatNumber,
|
|
768
|
-
showLegend
|
|
769
|
-
}, { pad = 0, extraRows = () => [] } = {}) => {
|
|
770
|
-
const seriesColors = colors ?? palette;
|
|
771
|
-
const points = series.flatMap(({ data }) => data);
|
|
772
|
-
const axisTitle = (text) => text === void 0 ? void 0 : {
|
|
773
|
-
text,
|
|
774
|
-
style: {
|
|
775
|
-
color: axisLabels.style.colors,
|
|
776
|
-
fontSize: "12px",
|
|
777
|
-
fontFamily: "inherit",
|
|
778
|
-
fontWeight: 500
|
|
779
|
-
}
|
|
780
|
-
};
|
|
781
|
-
return {
|
|
782
|
-
chart: { toolbar: { show: false }, zoom: { enabled: false }, fontFamily: "inherit" },
|
|
783
|
-
colors: seriesColors,
|
|
784
|
-
dataLabels: { enabled: false },
|
|
785
|
-
grid,
|
|
786
|
-
// One labels object per axis: ApexCharts writes formatters onto them.
|
|
787
|
-
// Axis labels and titles are SVG text and stay unescaped.
|
|
788
|
-
xaxis: {
|
|
789
|
-
type: "numeric",
|
|
790
|
-
...niceAxis(
|
|
791
|
-
points.map(({ x }) => x),
|
|
792
|
-
pad
|
|
793
|
-
),
|
|
794
|
-
title: axisTitle(xTitle),
|
|
795
|
-
labels: { ...axisLabels, formatter: (value) => formatX(Number(value)) },
|
|
796
|
-
axisBorder: { show: false },
|
|
797
|
-
axisTicks: { show: false },
|
|
798
|
-
// The x-axis tooltip is HTML and repeats the x value of the tooltip.
|
|
799
|
-
tooltip: { enabled: false }
|
|
800
|
-
},
|
|
801
|
-
yaxis: {
|
|
802
|
-
...niceAxis(
|
|
803
|
-
points.map(({ y }) => y),
|
|
804
|
-
pad
|
|
805
|
-
),
|
|
806
|
-
title: axisTitle(yTitle),
|
|
807
|
-
labels: { ...axisLabels, formatter: (value) => formatY(value) }
|
|
808
|
-
},
|
|
809
|
-
legend: {
|
|
810
|
-
show: showLegend ?? series.length > 1,
|
|
811
|
-
position: "top",
|
|
812
|
-
horizontalAlign: "right",
|
|
813
|
-
labels: { colors: axisLabels.style.colors },
|
|
814
|
-
markers: { size: 5 },
|
|
815
|
-
formatter: (name) => escapeHtml(name)
|
|
816
|
-
},
|
|
817
|
-
// The tooltip is HTML: tooltipHtml escapes the label, the series name and
|
|
818
|
-
// the values.
|
|
819
|
-
tooltip: {
|
|
820
|
-
theme: "dark",
|
|
821
|
-
custom: ({ seriesIndex, dataPointIndex }) => {
|
|
822
|
-
const { name, data } = series[seriesIndex];
|
|
823
|
-
const point = data[dataPointIndex];
|
|
824
|
-
return tooltipHtml({
|
|
825
|
-
title: point.label,
|
|
826
|
-
series: { name, color: seriesColors[seriesIndex % seriesColors.length] },
|
|
827
|
-
rows: [
|
|
828
|
-
[xTitle ?? "x", formatX(point.x)],
|
|
829
|
-
[yTitle ?? "y", formatY(point.y)],
|
|
830
|
-
...extraRows(point)
|
|
831
|
-
]
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
};
|
|
837
|
-
var ScatterChart = ({ height = 320, width = "100%", ...props }) => {
|
|
838
|
-
const base = xyOptions(useChartTheme(), props);
|
|
839
|
-
const options = {
|
|
840
|
-
...base,
|
|
841
|
-
chart: { ...base.chart, type: "scatter" },
|
|
842
|
-
markers: { size: 6, strokeWidth: 0, hover: { sizeOffset: 2 } }
|
|
843
|
-
};
|
|
844
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
845
|
-
ReactApexChart13__default.default,
|
|
846
|
-
{
|
|
847
|
-
type: "scatter",
|
|
848
|
-
options,
|
|
849
|
-
series: props.series,
|
|
850
|
-
height,
|
|
851
|
-
width
|
|
852
|
-
}
|
|
853
|
-
);
|
|
854
|
-
};
|
|
855
|
-
var BubbleChart = ({
|
|
856
|
-
sizeTitle = "Size",
|
|
857
|
-
formatSize = formatNumber,
|
|
858
|
-
height = 320,
|
|
859
|
-
width = "100%",
|
|
860
|
-
...props
|
|
861
|
-
}) => {
|
|
862
|
-
const theme = useChartTheme();
|
|
863
|
-
const base = xyOptions(theme, props, {
|
|
864
|
-
// Room for the bubbles at the edges of the plot.
|
|
865
|
-
pad: 0.08,
|
|
866
|
-
extraRows: (point) => [[sizeTitle, formatSize(point.z)]]
|
|
867
|
-
});
|
|
868
|
-
const options = {
|
|
869
|
-
...base,
|
|
870
|
-
chart: { ...base.chart, type: "bubble" },
|
|
871
|
-
plotOptions: { bubble: { minBubbleRadius: 4 } },
|
|
872
|
-
// Translucent bubbles, outlined in their own color (ApexCharts' white
|
|
873
|
-
// outline glares on the dark themes), keep the overlapping ones readable.
|
|
874
|
-
fill: { opacity: 0.55 },
|
|
875
|
-
markers: { strokeWidth: 1, strokeColors: props.colors ?? theme.palette }
|
|
876
|
-
};
|
|
877
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
878
|
-
ReactApexChart13__default.default,
|
|
879
|
-
{
|
|
880
|
-
type: "bubble",
|
|
881
|
-
options,
|
|
882
|
-
series: props.series,
|
|
883
|
-
height,
|
|
884
|
-
width
|
|
885
|
-
}
|
|
886
|
-
);
|
|
887
|
-
};
|
|
888
|
-
var ROWS = [
|
|
889
|
-
["Max", 4],
|
|
890
|
-
["Q3", 3],
|
|
891
|
-
["Median", 2],
|
|
892
|
-
["Q1", 1],
|
|
893
|
-
["Min", 0]
|
|
894
|
-
];
|
|
895
|
-
var BoxPlotChart = ({
|
|
896
|
-
series,
|
|
897
|
-
categories,
|
|
898
|
-
orientation = "vertical",
|
|
899
|
-
colors,
|
|
900
|
-
formatValue,
|
|
901
|
-
showLegend,
|
|
902
|
-
height = 320,
|
|
903
|
-
width = "100%"
|
|
904
|
-
}) => {
|
|
905
|
-
const { grid, axisLabels, palette } = useChartTheme();
|
|
906
|
-
const horizontal = orientation === "horizontal";
|
|
907
|
-
const seriesColors = colors ?? palette;
|
|
908
|
-
const valueFormatter = formatValue ?? ((v) => String(v));
|
|
909
|
-
const categoryLabels = () => ({ ...axisLabels });
|
|
910
|
-
const valueLabels = () => ({
|
|
911
|
-
...axisLabels,
|
|
912
|
-
formatter: (value) => valueFormatter(Number(value))
|
|
913
|
-
});
|
|
914
|
-
const options = {
|
|
915
|
-
chart: {
|
|
916
|
-
type: "boxPlot",
|
|
917
|
-
toolbar: { show: false },
|
|
918
|
-
zoom: { enabled: false },
|
|
919
|
-
fontFamily: "inherit"
|
|
920
|
-
},
|
|
921
|
-
colors: seriesColors,
|
|
922
|
-
plotOptions: {
|
|
923
|
-
bar: { horizontal, columnWidth: "50%", barHeight: "50%" },
|
|
924
|
-
// Both halves take the series color: a translucent fill, and an outline,
|
|
925
|
-
// median and whiskers drawn in the full color (ApexCharts' defaults are
|
|
926
|
-
// fixed colors, with a near-black stroke lost on the dark themes).
|
|
927
|
-
boxPlot: { colors: { upper: seriesColors, lower: seriesColors } }
|
|
928
|
-
},
|
|
929
|
-
fill: { opacity: 0.35 },
|
|
930
|
-
stroke: { width: 1.5, colors: seriesColors },
|
|
931
|
-
grid,
|
|
932
|
-
xaxis: {
|
|
933
|
-
labels: horizontal ? valueLabels() : categoryLabels(),
|
|
934
|
-
axisBorder: { show: false },
|
|
935
|
-
axisTicks: { show: false },
|
|
936
|
-
// The x-axis tooltip is HTML and repeats the tooltip title.
|
|
937
|
-
tooltip: { enabled: false }
|
|
938
|
-
},
|
|
939
|
-
yaxis: { labels: horizontal ? categoryLabels() : valueLabels() },
|
|
940
|
-
// Horizontal, the value labels sit side by side and run into each other
|
|
941
|
-
// on a phone: keep three of them.
|
|
942
|
-
responsive: horizontal ? [{ breakpoint: 640, options: { xaxis: { tickAmount: 2 } } }] : [],
|
|
943
|
-
legend: {
|
|
944
|
-
show: showLegend ?? series.length > 1,
|
|
945
|
-
position: "top",
|
|
946
|
-
horizontalAlign: "right",
|
|
947
|
-
labels: { colors: axisLabels.style.colors },
|
|
948
|
-
markers: { size: 5 },
|
|
949
|
-
formatter: (name) => escapeHtml(name)
|
|
950
|
-
},
|
|
951
|
-
// ApexCharts' own box plot tooltip prints the values raw. This one is
|
|
952
|
-
// HTML too: tooltipHtml escapes the category, the series name and values.
|
|
953
|
-
tooltip: {
|
|
954
|
-
theme: "dark",
|
|
955
|
-
custom: ({ seriesIndex, dataPointIndex }) => {
|
|
956
|
-
const { name, data } = series[seriesIndex];
|
|
957
|
-
const summary = data[dataPointIndex];
|
|
958
|
-
return tooltipHtml({
|
|
959
|
-
title: categories[dataPointIndex],
|
|
960
|
-
series: series.length > 1 ? { name, color: seriesColors[seriesIndex % seriesColors.length] } : void 0,
|
|
961
|
-
rows: ROWS.map(([label, index]) => [label, valueFormatter(summary[index])])
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
const chartSeries = series.map(({ name, data }) => ({
|
|
967
|
-
name,
|
|
968
|
-
data: data.map((y, index) => ({ x: categories[index], y }))
|
|
969
|
-
}));
|
|
970
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
971
|
-
ReactApexChart13__default.default,
|
|
972
|
-
{
|
|
973
|
-
type: "boxPlot",
|
|
974
|
-
options,
|
|
975
|
-
series: chartSeries,
|
|
976
|
-
height,
|
|
977
|
-
width
|
|
978
|
-
}
|
|
979
|
-
);
|
|
980
|
-
};
|
|
981
|
-
var UTC_DATE_TIME = new Intl.DateTimeFormat("en-GB", {
|
|
982
|
-
day: "2-digit",
|
|
983
|
-
month: "short",
|
|
984
|
-
hour: "2-digit",
|
|
985
|
-
minute: "2-digit",
|
|
986
|
-
hourCycle: "h23",
|
|
987
|
-
timeZone: "UTC"
|
|
29
|
+
Object.keys(theme_cjs).forEach(function (k) {
|
|
30
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return theme_cjs[k]; }
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
Object.keys(LineAreaChart_cjs).forEach(function (k) {
|
|
36
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return LineAreaChart_cjs[k]; }
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
Object.keys(RealtimeChart_cjs).forEach(function (k) {
|
|
42
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return RealtimeChart_cjs[k]; }
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
Object.keys(RadialBarChart_cjs).forEach(function (k) {
|
|
48
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return RadialBarChart_cjs[k]; }
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
Object.keys(GradientRadial_cjs).forEach(function (k) {
|
|
54
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return GradientRadial_cjs[k]; }
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
Object.keys(SemiCircleGauge_cjs).forEach(function (k) {
|
|
60
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return SemiCircleGauge_cjs[k]; }
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
Object.keys(StrokedGauge_cjs).forEach(function (k) {
|
|
66
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return StrokedGauge_cjs[k]; }
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
Object.keys(DonutChart_cjs).forEach(function (k) {
|
|
72
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return DonutChart_cjs[k]; }
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
Object.keys(Sparkline_cjs).forEach(function (k) {
|
|
78
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () { return Sparkline_cjs[k]; }
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
Object.keys(TreemapChart_cjs).forEach(function (k) {
|
|
84
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return TreemapChart_cjs[k]; }
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
Object.keys(BarChart_cjs).forEach(function (k) {
|
|
90
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () { return BarChart_cjs[k]; }
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
Object.keys(HeatmapChart_cjs).forEach(function (k) {
|
|
96
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return HeatmapChart_cjs[k]; }
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
Object.keys(CalendarChart_cjs).forEach(function (k) {
|
|
102
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () { return CalendarChart_cjs[k]; }
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
Object.keys(RadarChart_cjs).forEach(function (k) {
|
|
108
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () { return RadarChart_cjs[k]; }
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
Object.keys(ScatterChart_cjs).forEach(function (k) {
|
|
114
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () { return ScatterChart_cjs[k]; }
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
Object.keys(BoxPlotChart_cjs).forEach(function (k) {
|
|
120
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () { return BoxPlotChart_cjs[k]; }
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
Object.keys(RangeBarChart_cjs).forEach(function (k) {
|
|
126
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () { return RangeBarChart_cjs[k]; }
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
Object.keys(MixedChart_cjs).forEach(function (k) {
|
|
132
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () { return MixedChart_cjs[k]; }
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
Object.keys(BumpChart_cjs).forEach(function (k) {
|
|
138
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () { return BumpChart_cjs[k]; }
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
Object.keys(FunnelChart_cjs).forEach(function (k) {
|
|
144
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () { return FunnelChart_cjs[k]; }
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
Object.keys(WaterfallChart_cjs).forEach(function (k) {
|
|
150
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () { return WaterfallChart_cjs[k]; }
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
Object.keys(WorldMap_cjs).forEach(function (k) {
|
|
156
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () { return WorldMap_cjs[k]; }
|
|
159
|
+
});
|
|
988
160
|
});
|
|
989
|
-
var defaultFormatDate = (timestamp) => UTC_DATE_TIME.format(timestamp);
|
|
990
|
-
var RangeBarChart = ({
|
|
991
|
-
series,
|
|
992
|
-
groupRows = false,
|
|
993
|
-
colors,
|
|
994
|
-
formatDate = defaultFormatDate,
|
|
995
|
-
showLegend,
|
|
996
|
-
height = 320,
|
|
997
|
-
width = "100%"
|
|
998
|
-
}) => {
|
|
999
|
-
const { grid, axisLabels, palette } = useChartTheme();
|
|
1000
|
-
const seriesColors = colors ?? palette;
|
|
1001
|
-
const legendVisible = showLegend ?? series.length > 1;
|
|
1002
|
-
const lanes = groupRows ? 1 : series.length;
|
|
1003
|
-
const tooltip = ({
|
|
1004
|
-
seriesIndex,
|
|
1005
|
-
dataPointIndex
|
|
1006
|
-
}) => {
|
|
1007
|
-
const s = series[seriesIndex];
|
|
1008
|
-
const point = s?.data[dataPointIndex];
|
|
1009
|
-
if (!point) return "";
|
|
1010
|
-
const [start, end] = point.y;
|
|
1011
|
-
return tooltipHtml({
|
|
1012
|
-
title: point.x,
|
|
1013
|
-
series: { name: s.name, color: seriesColors[seriesIndex % seriesColors.length] },
|
|
1014
|
-
rows: [
|
|
1015
|
-
["Start", formatDate(start)],
|
|
1016
|
-
["End", formatDate(end)]
|
|
1017
|
-
]
|
|
1018
|
-
});
|
|
1019
|
-
};
|
|
1020
|
-
const options = {
|
|
1021
|
-
chart: {
|
|
1022
|
-
type: "rangeBar",
|
|
1023
|
-
toolbar: { show: false },
|
|
1024
|
-
zoom: { enabled: false },
|
|
1025
|
-
fontFamily: "inherit"
|
|
1026
|
-
},
|
|
1027
|
-
colors: seriesColors,
|
|
1028
|
-
dataLabels: { enabled: false },
|
|
1029
|
-
plotOptions: {
|
|
1030
|
-
bar: {
|
|
1031
|
-
horizontal: true,
|
|
1032
|
-
// Without groupRows each series gets its own lane in the row: give
|
|
1033
|
-
// the bars more of their (thinner) lane.
|
|
1034
|
-
barHeight: lanes > 1 ? "80%" : "60%",
|
|
1035
|
-
borderRadius: 3,
|
|
1036
|
-
borderRadiusApplication: "around",
|
|
1037
|
-
rangeBarGroupRows: groupRows
|
|
1038
|
-
}
|
|
1039
|
-
},
|
|
1040
|
-
// Time runs left to right: vertical grid lines, plus a line between rows.
|
|
1041
|
-
grid: { ...grid, xaxis: { lines: { show: true } }, yaxis: { lines: { show: true } } },
|
|
1042
|
-
// One labels object per axis: ApexCharts mutates them.
|
|
1043
|
-
xaxis: {
|
|
1044
|
-
type: "datetime",
|
|
1045
|
-
labels: { ...axisLabels, datetimeUTC: true },
|
|
1046
|
-
axisBorder: { show: false },
|
|
1047
|
-
axisTicks: { show: false }
|
|
1048
|
-
},
|
|
1049
|
-
yaxis: { labels: { ...axisLabels } },
|
|
1050
|
-
legend: {
|
|
1051
|
-
show: legendVisible,
|
|
1052
|
-
position: "top",
|
|
1053
|
-
horizontalAlign: "right",
|
|
1054
|
-
labels: { colors: axisLabels.style.colors },
|
|
1055
|
-
markers: { size: 5 },
|
|
1056
|
-
formatter: (name) => escapeHtml(name)
|
|
1057
|
-
},
|
|
1058
|
-
tooltip: { theme: "dark", custom: tooltip },
|
|
1059
|
-
fill: { opacity: 1 }
|
|
1060
|
-
};
|
|
1061
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1062
|
-
ReactApexChart13__default.default,
|
|
1063
|
-
{
|
|
1064
|
-
type: "rangeBar",
|
|
1065
|
-
options,
|
|
1066
|
-
series,
|
|
1067
|
-
height,
|
|
1068
|
-
width
|
|
1069
|
-
}
|
|
1070
|
-
);
|
|
1071
|
-
};
|
|
1072
|
-
var SIDES = ["left", "right"];
|
|
1073
|
-
var axisOf = (s) => s.axis ?? "left";
|
|
1074
|
-
var MixedChart = ({
|
|
1075
|
-
series,
|
|
1076
|
-
categories,
|
|
1077
|
-
colors,
|
|
1078
|
-
formatValue,
|
|
1079
|
-
formatRightValue,
|
|
1080
|
-
showLegend,
|
|
1081
|
-
height = 320,
|
|
1082
|
-
width = "100%"
|
|
1083
|
-
}) => {
|
|
1084
|
-
const { grid, axisLabels, palette } = useChartTheme();
|
|
1085
|
-
const legendVisible = showLegend ?? series.length > 1;
|
|
1086
|
-
const formatters = { left: formatValue, right: formatRightValue };
|
|
1087
|
-
const usedSides = SIDES.filter((side) => series.some((s) => axisOf(s) === side));
|
|
1088
|
-
const sides = usedSides.length > 0 ? usedSides : SIDES.slice(0, 1);
|
|
1089
|
-
const yaxis = sides.map((side) => ({
|
|
1090
|
-
seriesName: sides.length > 1 ? series.filter((s) => axisOf(s) === side).map((s) => s.name) : void 0,
|
|
1091
|
-
opposite: side === "right",
|
|
1092
|
-
labels: { ...axisLabels, formatter: formatters[side] }
|
|
1093
|
-
}));
|
|
1094
|
-
const options = {
|
|
1095
|
-
chart: {
|
|
1096
|
-
type: "line",
|
|
1097
|
-
toolbar: { show: false },
|
|
1098
|
-
zoom: { enabled: false },
|
|
1099
|
-
fontFamily: "inherit"
|
|
1100
|
-
},
|
|
1101
|
-
colors: colors ?? palette,
|
|
1102
|
-
dataLabels: { enabled: false },
|
|
1103
|
-
// Lines only: columns have no stroke. monotoneCubic stays smooth without
|
|
1104
|
-
// overshooting the samples, so a latency line never dips below its data.
|
|
1105
|
-
stroke: { width: series.map((s) => s.type === "line" ? 3 : 0), curve: "monotoneCubic" },
|
|
1106
|
-
plotOptions: {
|
|
1107
|
-
bar: { columnWidth: "55%", borderRadius: 4, borderRadiusApplication: "end" }
|
|
1108
|
-
},
|
|
1109
|
-
grid,
|
|
1110
|
-
xaxis: {
|
|
1111
|
-
categories,
|
|
1112
|
-
labels: { ...axisLabels },
|
|
1113
|
-
axisBorder: { show: false },
|
|
1114
|
-
axisTicks: { show: false }
|
|
1115
|
-
},
|
|
1116
|
-
yaxis,
|
|
1117
|
-
legend: {
|
|
1118
|
-
show: legendVisible,
|
|
1119
|
-
position: "top",
|
|
1120
|
-
horizontalAlign: "right",
|
|
1121
|
-
labels: { colors: axisLabels.style.colors },
|
|
1122
|
-
markers: { size: 5 },
|
|
1123
|
-
// ApexCharts stacks the series of each y axis in a column of their own:
|
|
1124
|
-
// keep one row, like the other charts.
|
|
1125
|
-
clusterGroupedSeries: false,
|
|
1126
|
-
formatter: (name) => escapeHtml(name)
|
|
1127
|
-
},
|
|
1128
|
-
// The tooltip is HTML: escape the category, the series names and the
|
|
1129
|
-
// values. ApexCharts hands the x formatter the point's position on a line
|
|
1130
|
-
// chart's axis, not its category, so read the category back by index.
|
|
1131
|
-
tooltip: {
|
|
1132
|
-
theme: "dark",
|
|
1133
|
-
x: {
|
|
1134
|
-
formatter: (v, opts) => escapeHtml(opts === void 0 ? v : categories[opts.dataPointIndex] ?? v)
|
|
1135
|
-
},
|
|
1136
|
-
y: {
|
|
1137
|
-
formatter: (v, opts) => {
|
|
1138
|
-
const s = opts && series[opts.seriesIndex];
|
|
1139
|
-
const format = (s && formatters[axisOf(s)]) ?? String;
|
|
1140
|
-
return escapeHtml(format(Number(v)));
|
|
1141
|
-
},
|
|
1142
|
-
title: { formatter: (name) => `${escapeHtml(name)}: ` }
|
|
1143
|
-
}
|
|
1144
|
-
},
|
|
1145
|
-
fill: { opacity: 1 }
|
|
1146
|
-
};
|
|
1147
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReactApexChart13__default.default, { type: "line", options, series, height, width });
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
exports.BarChart = BarChart;
|
|
1151
|
-
exports.BoxPlotChart = BoxPlotChart;
|
|
1152
|
-
exports.BubbleChart = BubbleChart;
|
|
1153
|
-
exports.COSMOS_BRAND = COSMOS_BRAND;
|
|
1154
|
-
exports.COSMOS_PALETTE = COSMOS_PALETTE;
|
|
1155
|
-
exports.DonutChart = DonutChart;
|
|
1156
|
-
exports.DonutRightLegend = DonutRightLegend;
|
|
1157
|
-
exports.GradientRadial = GradientRadial;
|
|
1158
|
-
exports.HeatmapChart = HeatmapChart;
|
|
1159
|
-
exports.LineAreaChart = LineAreaChart;
|
|
1160
|
-
exports.MixedChart = MixedChart;
|
|
1161
|
-
exports.RadarChart = RadarChart;
|
|
1162
|
-
exports.RadialBarChart = RadialBarChart;
|
|
1163
|
-
exports.RangeBarChart = RangeBarChart;
|
|
1164
|
-
exports.RealtimeChart = RealtimeChart;
|
|
1165
|
-
exports.ScatterChart = ScatterChart;
|
|
1166
|
-
exports.SemiCircleGauge = SemiCircleGauge;
|
|
1167
|
-
exports.Sparkline = Sparkline;
|
|
1168
|
-
exports.SparklineGroup = SparklineGroup;
|
|
1169
|
-
exports.StrokedGauge = StrokedGauge;
|
|
1170
|
-
exports.TreemapChart = TreemapChart;
|
|
1171
|
-
exports.useChartTheme = useChartTheme;
|
|
1172
|
-
exports.useDarkMode = useDarkMode;
|
|
1173
161
|
//# sourceMappingURL=index.cjs.map
|
|
1174
162
|
//# sourceMappingURL=index.cjs.map
|