@adecore/charts 0.41.1 → 0.43.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/dist/Root.d.ts +3 -1
- package/dist/Root.js +410 -339
- package/dist/annotations.js +210 -85
- package/dist/axes.d.ts +3 -2
- package/dist/axes.js +541 -74
- package/dist/band.d.ts +2 -0
- package/dist/band.js +10 -0
- package/dist/context.d.ts +3 -0
- package/dist/cursor.d.ts +1 -1
- package/dist/cursor.js +5 -4
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/nl.d.ts +1 -0
- package/dist/locales/nl.js +1 -0
- package/dist/overlays.js +204 -132
- package/dist/series.d.ts +4 -4
- package/dist/series.js +329 -195
- package/dist/store.d.ts +2 -0
- package/dist/store.js +2 -1
- package/package.json +3 -3
- package/src/Root.tsx +137 -44
- package/src/annotations.tsx +31 -4
- package/src/axes.tsx +182 -6
- package/src/band.ts +13 -0
- package/src/context.ts +9 -0
- package/src/cursor.ts +12 -4
- package/src/locales/en.ts +1 -0
- package/src/locales/nl.ts +1 -0
- package/src/overlays.tsx +51 -1
- package/src/series.tsx +144 -28
- package/src/store.ts +5 -1
package/dist/annotations.js
CHANGED
|
@@ -13,9 +13,12 @@ const MIN_BAND = 4;
|
|
|
13
13
|
const RULE_LABEL = 18;
|
|
14
14
|
/* Between the line and the label it carries, above it or below it. */
|
|
15
15
|
const RULE_GAP = 7;
|
|
16
|
-
/*
|
|
16
|
+
/*
|
|
17
|
+
* A line at a value across the plot, such as a reference to compare against, drawn above the series: horizontal over
|
|
18
|
+
* columns, vertical through the rows of a horizontal chart.
|
|
19
|
+
*/
|
|
17
20
|
export function ChartRule(t0) {
|
|
18
|
-
const $ = _c(
|
|
21
|
+
const $ = _c(87);
|
|
19
22
|
const {
|
|
20
23
|
value,
|
|
21
24
|
label,
|
|
@@ -52,7 +55,7 @@ export function ChartRule(t0) {
|
|
|
52
55
|
let t8;
|
|
53
56
|
let t9;
|
|
54
57
|
let target;
|
|
55
|
-
if ($[3] !== chart || $[4] !== className || $[5] !== dashed || $[6] !==
|
|
58
|
+
if ($[3] !== chart || $[4] !== className || $[5] !== dashed || $[6] !== label || $[7] !== ref || $[8] !== tone || $[9] !== value) {
|
|
56
59
|
t12 = Symbol.for("react.early_return_sentinel");
|
|
57
60
|
bb0: {
|
|
58
61
|
const pixel = chart.pixelOfY(value);
|
|
@@ -61,37 +64,158 @@ export function ChartRule(t0) {
|
|
|
61
64
|
t12 = null;
|
|
62
65
|
break bb0;
|
|
63
66
|
}
|
|
67
|
+
if (chart.horizontal) {
|
|
68
|
+
const left = Math.round(pixel) + 0.5;
|
|
69
|
+
const toward = pixel > (chart.plot.left + chart.plot.right) / 2 ? "end" : "start";
|
|
70
|
+
let t13;
|
|
71
|
+
if ($[21] !== className) {
|
|
72
|
+
t13 = clsx("pointer-events-none", className);
|
|
73
|
+
$[21] = className;
|
|
74
|
+
$[22] = t13;
|
|
75
|
+
} else {
|
|
76
|
+
t13 = $[22];
|
|
77
|
+
}
|
|
78
|
+
let t14;
|
|
79
|
+
if ($[23] !== tone) {
|
|
80
|
+
t14 = colorOf(tone);
|
|
81
|
+
$[23] = tone;
|
|
82
|
+
$[24] = t14;
|
|
83
|
+
} else {
|
|
84
|
+
t14 = $[24];
|
|
85
|
+
}
|
|
86
|
+
let t15;
|
|
87
|
+
if ($[25] !== t14) {
|
|
88
|
+
t15 = {
|
|
89
|
+
color: t14
|
|
90
|
+
};
|
|
91
|
+
$[25] = t14;
|
|
92
|
+
$[26] = t15;
|
|
93
|
+
} else {
|
|
94
|
+
t15 = $[26];
|
|
95
|
+
}
|
|
96
|
+
const t16 = dashed ? "4 4" : undefined;
|
|
97
|
+
let t17;
|
|
98
|
+
if ($[27] !== chart.plot.bottom || $[28] !== chart.plot.top || $[29] !== left || $[30] !== t16) {
|
|
99
|
+
t17 = /*#__PURE__*/_jsx("line", {
|
|
100
|
+
x1: left,
|
|
101
|
+
x2: left,
|
|
102
|
+
y1: chart.plot.top,
|
|
103
|
+
y2: chart.plot.bottom,
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeDasharray: t16
|
|
106
|
+
});
|
|
107
|
+
$[27] = chart.plot.bottom;
|
|
108
|
+
$[28] = chart.plot.top;
|
|
109
|
+
$[29] = left;
|
|
110
|
+
$[30] = t16;
|
|
111
|
+
$[31] = t17;
|
|
112
|
+
} else {
|
|
113
|
+
t17 = $[31];
|
|
114
|
+
}
|
|
115
|
+
const t18 = Math.round(pixel) + (toward === "end" ? 4 : -4);
|
|
116
|
+
const t19 = chart.plot.top - RULE_GAP;
|
|
117
|
+
let t20;
|
|
118
|
+
if ($[32] !== chart.halo) {
|
|
119
|
+
t20 = {
|
|
120
|
+
stroke: chart.halo
|
|
121
|
+
};
|
|
122
|
+
$[32] = chart.halo;
|
|
123
|
+
$[33] = t20;
|
|
124
|
+
} else {
|
|
125
|
+
t20 = $[33];
|
|
126
|
+
}
|
|
127
|
+
let t21;
|
|
128
|
+
if ($[34] !== chart || $[35] !== value) {
|
|
129
|
+
t21 = chart.formatY(value);
|
|
130
|
+
$[34] = chart;
|
|
131
|
+
$[35] = value;
|
|
132
|
+
$[36] = t21;
|
|
133
|
+
} else {
|
|
134
|
+
t21 = $[36];
|
|
135
|
+
}
|
|
136
|
+
const t22 = `${label} · ${t21}`;
|
|
137
|
+
let t23;
|
|
138
|
+
if ($[37] !== t18 || $[38] !== t19 || $[39] !== t20 || $[40] !== t22 || $[41] !== toward) {
|
|
139
|
+
t23 = /*#__PURE__*/_jsx("text", {
|
|
140
|
+
x: t18,
|
|
141
|
+
y: t19,
|
|
142
|
+
textAnchor: toward,
|
|
143
|
+
strokeWidth: 4,
|
|
144
|
+
paintOrder: "stroke",
|
|
145
|
+
className: "fill-text text-xs font-medium tabular-nums",
|
|
146
|
+
style: t20,
|
|
147
|
+
children: t22
|
|
148
|
+
});
|
|
149
|
+
$[37] = t18;
|
|
150
|
+
$[38] = t19;
|
|
151
|
+
$[39] = t20;
|
|
152
|
+
$[40] = t22;
|
|
153
|
+
$[41] = toward;
|
|
154
|
+
$[42] = t23;
|
|
155
|
+
} else {
|
|
156
|
+
t23 = $[42];
|
|
157
|
+
}
|
|
158
|
+
let t24;
|
|
159
|
+
if ($[43] !== ref || $[44] !== t13 || $[45] !== t15 || $[46] !== t17 || $[47] !== t23) {
|
|
160
|
+
t24 = /*#__PURE__*/_jsxs("g", {
|
|
161
|
+
ref: ref,
|
|
162
|
+
className: t13,
|
|
163
|
+
style: t15,
|
|
164
|
+
"aria-hidden": true,
|
|
165
|
+
children: [t17, t23]
|
|
166
|
+
});
|
|
167
|
+
$[43] = ref;
|
|
168
|
+
$[44] = t13;
|
|
169
|
+
$[45] = t15;
|
|
170
|
+
$[46] = t17;
|
|
171
|
+
$[47] = t23;
|
|
172
|
+
$[48] = t24;
|
|
173
|
+
} else {
|
|
174
|
+
t24 = $[48];
|
|
175
|
+
}
|
|
176
|
+
let t25;
|
|
177
|
+
if ($[49] !== t24 || $[50] !== target) {
|
|
178
|
+
t25 = createPortal(t24, target);
|
|
179
|
+
$[49] = t24;
|
|
180
|
+
$[50] = target;
|
|
181
|
+
$[51] = t25;
|
|
182
|
+
} else {
|
|
183
|
+
t25 = $[51];
|
|
184
|
+
}
|
|
185
|
+
t12 = t25;
|
|
186
|
+
break bb0;
|
|
187
|
+
}
|
|
64
188
|
const top = Math.round(pixel) + 0.5;
|
|
65
189
|
below = top - RULE_LABEL < 0;
|
|
66
190
|
t11 = createPortal;
|
|
67
191
|
t6 = ref;
|
|
68
|
-
if ($[
|
|
192
|
+
if ($[52] !== className) {
|
|
69
193
|
t7 = clsx("pointer-events-none", className);
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
194
|
+
$[52] = className;
|
|
195
|
+
$[53] = t7;
|
|
72
196
|
} else {
|
|
73
|
-
t7 = $[
|
|
197
|
+
t7 = $[53];
|
|
74
198
|
}
|
|
75
199
|
let t13;
|
|
76
|
-
if ($[
|
|
200
|
+
if ($[54] !== tone) {
|
|
77
201
|
t13 = colorOf(tone);
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
202
|
+
$[54] = tone;
|
|
203
|
+
$[55] = t13;
|
|
80
204
|
} else {
|
|
81
|
-
t13 = $[
|
|
205
|
+
t13 = $[55];
|
|
82
206
|
}
|
|
83
|
-
if ($[
|
|
207
|
+
if ($[56] !== t13) {
|
|
84
208
|
t8 = {
|
|
85
209
|
color: t13
|
|
86
210
|
};
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
211
|
+
$[56] = t13;
|
|
212
|
+
$[57] = t8;
|
|
89
213
|
} else {
|
|
90
|
-
t8 = $[
|
|
214
|
+
t8 = $[57];
|
|
91
215
|
}
|
|
92
216
|
t9 = true;
|
|
93
217
|
const t14 = dashed ? "4 4" : undefined;
|
|
94
|
-
if ($[
|
|
218
|
+
if ($[58] !== chart.plot.left || $[59] !== chart.plot.right || $[60] !== t14 || $[61] !== top) {
|
|
95
219
|
t10 = /*#__PURE__*/_jsx("line", {
|
|
96
220
|
x1: chart.plot.left,
|
|
97
221
|
x2: chart.plot.right,
|
|
@@ -100,52 +224,53 @@ export function ChartRule(t0) {
|
|
|
100
224
|
stroke: "currentColor",
|
|
101
225
|
strokeDasharray: t14
|
|
102
226
|
});
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
227
|
+
$[58] = chart.plot.left;
|
|
228
|
+
$[59] = chart.plot.right;
|
|
229
|
+
$[60] = t14;
|
|
230
|
+
$[61] = top;
|
|
231
|
+
$[62] = t10;
|
|
108
232
|
} else {
|
|
109
|
-
t10 = $[
|
|
233
|
+
t10 = $[62];
|
|
110
234
|
}
|
|
111
|
-
if ($[
|
|
235
|
+
if ($[63] !== chart.plot.right) {
|
|
112
236
|
t5 = Math.round(chart.plot.right);
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
237
|
+
$[63] = chart.plot.right;
|
|
238
|
+
$[64] = t5;
|
|
115
239
|
} else {
|
|
116
|
-
t5 = $[
|
|
240
|
+
t5 = $[64];
|
|
117
241
|
}
|
|
118
242
|
t4 = Math.round(pixel);
|
|
119
243
|
}
|
|
120
244
|
$[3] = chart;
|
|
121
245
|
$[4] = className;
|
|
122
246
|
$[5] = dashed;
|
|
123
|
-
$[6] =
|
|
124
|
-
$[7] =
|
|
125
|
-
$[8] =
|
|
126
|
-
$[9] =
|
|
127
|
-
$[10] =
|
|
128
|
-
$[11] =
|
|
129
|
-
$[12] =
|
|
130
|
-
$[13] =
|
|
131
|
-
$[14] =
|
|
132
|
-
$[15] =
|
|
133
|
-
$[16] =
|
|
134
|
-
$[17] =
|
|
135
|
-
$[18] =
|
|
136
|
-
$[19] =
|
|
247
|
+
$[6] = label;
|
|
248
|
+
$[7] = ref;
|
|
249
|
+
$[8] = tone;
|
|
250
|
+
$[9] = value;
|
|
251
|
+
$[10] = below;
|
|
252
|
+
$[11] = t10;
|
|
253
|
+
$[12] = t11;
|
|
254
|
+
$[13] = t12;
|
|
255
|
+
$[14] = t4;
|
|
256
|
+
$[15] = t5;
|
|
257
|
+
$[16] = t6;
|
|
258
|
+
$[17] = t7;
|
|
259
|
+
$[18] = t8;
|
|
260
|
+
$[19] = t9;
|
|
261
|
+
$[20] = target;
|
|
137
262
|
} else {
|
|
138
|
-
below = $[
|
|
139
|
-
t10 = $[
|
|
140
|
-
t11 = $[
|
|
141
|
-
t12 = $[
|
|
142
|
-
t4 = $[
|
|
143
|
-
t5 = $[
|
|
144
|
-
t6 = $[
|
|
145
|
-
t7 = $[
|
|
146
|
-
t8 = $[
|
|
147
|
-
t9 = $[
|
|
148
|
-
target = $[
|
|
263
|
+
below = $[10];
|
|
264
|
+
t10 = $[11];
|
|
265
|
+
t11 = $[12];
|
|
266
|
+
t12 = $[13];
|
|
267
|
+
t4 = $[14];
|
|
268
|
+
t5 = $[15];
|
|
269
|
+
t6 = $[16];
|
|
270
|
+
t7 = $[17];
|
|
271
|
+
t8 = $[18];
|
|
272
|
+
t9 = $[19];
|
|
273
|
+
target = $[20];
|
|
149
274
|
}
|
|
150
275
|
if (t12 !== Symbol.for("react.early_return_sentinel")) {
|
|
151
276
|
return t12;
|
|
@@ -153,27 +278,27 @@ export function ChartRule(t0) {
|
|
|
153
278
|
const t13 = t4 + (below ? RULE_GAP : -RULE_GAP);
|
|
154
279
|
const t14 = below ? "0.8em" : undefined;
|
|
155
280
|
let t15;
|
|
156
|
-
if ($[
|
|
281
|
+
if ($[65] !== chart.halo) {
|
|
157
282
|
t15 = {
|
|
158
283
|
stroke: chart.halo
|
|
159
284
|
};
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
285
|
+
$[65] = chart.halo;
|
|
286
|
+
$[66] = t15;
|
|
162
287
|
} else {
|
|
163
|
-
t15 = $[
|
|
288
|
+
t15 = $[66];
|
|
164
289
|
}
|
|
165
290
|
let t16;
|
|
166
|
-
if ($[
|
|
291
|
+
if ($[67] !== chart || $[68] !== value) {
|
|
167
292
|
t16 = chart.formatY(value);
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
293
|
+
$[67] = chart;
|
|
294
|
+
$[68] = value;
|
|
295
|
+
$[69] = t16;
|
|
171
296
|
} else {
|
|
172
|
-
t16 = $[
|
|
297
|
+
t16 = $[69];
|
|
173
298
|
}
|
|
174
299
|
const t17 = `${label} · ${t16}`;
|
|
175
300
|
let t18;
|
|
176
|
-
if ($[
|
|
301
|
+
if ($[70] !== t13 || $[71] !== t14 || $[72] !== t15 || $[73] !== t17 || $[74] !== t5) {
|
|
177
302
|
t18 = /*#__PURE__*/_jsx("text", {
|
|
178
303
|
x: t5,
|
|
179
304
|
y: t13,
|
|
@@ -185,17 +310,17 @@ export function ChartRule(t0) {
|
|
|
185
310
|
style: t15,
|
|
186
311
|
children: t17
|
|
187
312
|
});
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
313
|
+
$[70] = t13;
|
|
314
|
+
$[71] = t14;
|
|
315
|
+
$[72] = t15;
|
|
316
|
+
$[73] = t17;
|
|
317
|
+
$[74] = t5;
|
|
318
|
+
$[75] = t18;
|
|
194
319
|
} else {
|
|
195
|
-
t18 = $[
|
|
320
|
+
t18 = $[75];
|
|
196
321
|
}
|
|
197
322
|
let t19;
|
|
198
|
-
if ($[
|
|
323
|
+
if ($[76] !== t10 || $[77] !== t18 || $[78] !== t6 || $[79] !== t7 || $[80] !== t8 || $[81] !== t9) {
|
|
199
324
|
t19 = /*#__PURE__*/_jsxs("g", {
|
|
200
325
|
ref: t6,
|
|
201
326
|
className: t7,
|
|
@@ -203,25 +328,25 @@ export function ChartRule(t0) {
|
|
|
203
328
|
"aria-hidden": t9,
|
|
204
329
|
children: [t10, t18]
|
|
205
330
|
});
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
331
|
+
$[76] = t10;
|
|
332
|
+
$[77] = t18;
|
|
333
|
+
$[78] = t6;
|
|
334
|
+
$[79] = t7;
|
|
335
|
+
$[80] = t8;
|
|
336
|
+
$[81] = t9;
|
|
337
|
+
$[82] = t19;
|
|
213
338
|
} else {
|
|
214
|
-
t19 = $[
|
|
339
|
+
t19 = $[82];
|
|
215
340
|
}
|
|
216
341
|
let t20;
|
|
217
|
-
if ($[
|
|
342
|
+
if ($[83] !== t11 || $[84] !== t19 || $[85] !== target) {
|
|
218
343
|
t20 = t11(t19, target);
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
344
|
+
$[83] = t11;
|
|
345
|
+
$[84] = t19;
|
|
346
|
+
$[85] = target;
|
|
347
|
+
$[86] = t20;
|
|
223
348
|
} else {
|
|
224
|
-
t20 = $[
|
|
349
|
+
t20 = $[86];
|
|
225
350
|
}
|
|
226
351
|
return t20;
|
|
227
352
|
}
|
|
@@ -248,7 +373,7 @@ export function ChartMarker(t0) {
|
|
|
248
373
|
color
|
|
249
374
|
});
|
|
250
375
|
const pixel = chart.pixelOfX(x);
|
|
251
|
-
if (pixel === null || pixel < chart.plot.left || pixel > chart.plot.right) {
|
|
376
|
+
if (chart.horizontal || pixel === null || pixel < chart.plot.left || pixel > chart.plot.right) {
|
|
252
377
|
return null;
|
|
253
378
|
}
|
|
254
379
|
const left = Math.round(pixel) + 0.5;
|
|
@@ -383,7 +508,7 @@ export function ChartBand(t0) {
|
|
|
383
508
|
}
|
|
384
509
|
}
|
|
385
510
|
}
|
|
386
|
-
if (left === null || right === null || right <= left) {
|
|
511
|
+
if (chart.horizontal || left === null || right === null || right <= left) {
|
|
387
512
|
return null;
|
|
388
513
|
}
|
|
389
514
|
const x = Math.round(left);
|
package/dist/axes.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface ChartXAxisProps {
|
|
|
17
17
|
readonly label?: string;
|
|
18
18
|
readonly logLabel?: string;
|
|
19
19
|
readonly onThinnedChange?: (thinned: boolean) => void;
|
|
20
|
+
readonly maxWidth?: number;
|
|
20
21
|
readonly className?: string;
|
|
21
22
|
readonly ref?: Ref<SVGGElement>;
|
|
22
23
|
}
|
|
@@ -42,6 +43,6 @@ export interface ChartGroupAxisProps<Row> {
|
|
|
42
43
|
}
|
|
43
44
|
export declare const LABEL_GAP = 8;
|
|
44
45
|
export declare function ChartGrid({ axis, dashed, lines, className, ref }: ChartGridProps): import("react").JSX.Element | null;
|
|
45
|
-
export declare function ChartXAxis(
|
|
46
|
-
export declare function ChartYAxis(
|
|
46
|
+
export declare function ChartXAxis(props: ChartXAxisProps): import("react").JSX.Element;
|
|
47
|
+
export declare function ChartYAxis(props: ChartYAxisProps): import("react").JSX.Element;
|
|
47
48
|
export declare function ChartGroupAxis<Row>({ children, className, ref }: ChartGroupAxisProps<Row>): import("react").ReactPortal | null;
|