@hybridcore/ui 1.6.21 → 1.6.23
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/CATALOG.md +1 -0
- package/dist/components/button/index.js +10 -7
- package/dist/components/charts/chart-wrapper/index.js +34 -32
- package/dist/components/charts/column-line-mix/logic.js +65 -69
- package/dist/components/charts/forecast-cone/index.js +58 -45
- package/dist/components/charts/forecast-cone/logic.js +347 -244
- package/dist/components/charts/histogram/index.js +11 -0
- package/dist/components/charts/histogram/logic.js +133 -0
- package/dist/components/charts/histogram/styled.js +12 -0
- package/dist/components/charts/line/logic.js +48 -48
- package/dist/components/charts/logaritmic-scale/logic.js +257 -91
- package/dist/components/charts/multiple-value-axes/logic.js +70 -70
- package/dist/components/charts/xy-chart/logic.js +9 -1
- package/dist/main.d.ts +65 -8
- package/dist/main.js +158 -156
- package/package.json +1 -1
- package/dist/Scrollbar-CTI7_8Qw.js +0 -171
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import { useState as
|
|
5
|
-
import { getTooltipDateFormat as
|
|
6
|
-
import { applyValueFormat as
|
|
7
|
-
import { c as
|
|
8
|
-
import { X as
|
|
9
|
-
import { X as
|
|
10
|
-
import { A as
|
|
11
|
-
import { L as
|
|
12
|
-
import { L as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { R as Be, A as je } from "../../../AnimatedTheme-ktdO3Bel.js";
|
|
2
|
+
import { useTheme as Ue, useThemeProps as $e } from "@mui/material";
|
|
3
|
+
import Q from "lodash";
|
|
4
|
+
import { useState as Ne, useRef as M, useLayoutEffect as Ge, useEffect as He } from "react";
|
|
5
|
+
import { getTooltipDateFormat as We, attachCursorTooltip as ze } from "../_common/tooltip.js";
|
|
6
|
+
import { applyValueFormat as Ze } from "../_common/utils.js";
|
|
7
|
+
import { c as O, a as Ae } from "../../../Entity-BJCuhdq_.js";
|
|
8
|
+
import { X as qe, V as Je } from "../../../AxisRenderer-BCQoUJw6.js";
|
|
9
|
+
import { X as Ke } from "../../../XYCursor-CVUSpqb9.js";
|
|
10
|
+
import { A as Qe, a as et } from "../../../AxisRendererY-AXWvGU6r.js";
|
|
11
|
+
import { L as tt } from "../../../Legend-CFvQiIfn.js";
|
|
12
|
+
import { L as G } from "../../../LineSeries-D_IL2qGF.js";
|
|
13
|
+
import { C as it } from "../../../Circle-BnfBNKBD.js";
|
|
14
|
+
import { B as rt } from "../../../Bullet-Djj7Vs9T.js";
|
|
15
|
+
import { G as nt, D as st } from "../../../GaplessDateAxis-B2g2jgSG.js";
|
|
16
|
+
import { D as ot } from "../../../DateAxis-DEXKps1S.js";
|
|
17
|
+
class at {
|
|
18
|
+
constructor(r, a) {
|
|
17
19
|
Object.defineProperty(this, "_line", {
|
|
18
20
|
enumerable: !0,
|
|
19
21
|
configurable: !0,
|
|
@@ -59,7 +61,7 @@ class Ge {
|
|
|
59
61
|
configurable: !0,
|
|
60
62
|
writable: !0,
|
|
61
63
|
value: 0
|
|
62
|
-
}), this._context =
|
|
64
|
+
}), this._context = r, this._tension = a;
|
|
63
65
|
}
|
|
64
66
|
areaStart() {
|
|
65
67
|
this._line = 0;
|
|
@@ -76,77 +78,77 @@ class Ge {
|
|
|
76
78
|
this._context.lineTo(this._x1, this._y1);
|
|
77
79
|
break;
|
|
78
80
|
case 3:
|
|
79
|
-
|
|
81
|
+
ae(this, this._t0, Oe(this, this._t0));
|
|
80
82
|
break;
|
|
81
83
|
}
|
|
82
84
|
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
83
85
|
}
|
|
84
|
-
point(
|
|
85
|
-
let
|
|
86
|
-
if (
|
|
86
|
+
point(r, a) {
|
|
87
|
+
let h = NaN;
|
|
88
|
+
if (r = +r, a = +a, !(r === this._x1 && a === this._y1)) {
|
|
87
89
|
switch (this._point) {
|
|
88
90
|
case 0:
|
|
89
|
-
this._point = 1, this._line ? this._context.lineTo(
|
|
91
|
+
this._point = 1, this._line ? this._context.lineTo(r, a) : this._context.moveTo(r, a);
|
|
90
92
|
break;
|
|
91
93
|
case 1:
|
|
92
94
|
this._point = 2;
|
|
93
95
|
break;
|
|
94
96
|
case 2:
|
|
95
|
-
this._point = 3,
|
|
97
|
+
this._point = 3, ae(this, Oe(this, h = De(this, r, a)), h);
|
|
96
98
|
break;
|
|
97
99
|
default:
|
|
98
|
-
|
|
100
|
+
ae(this, this._t0, h = De(this, r, a));
|
|
99
101
|
break;
|
|
100
102
|
}
|
|
101
|
-
this._x0 = this._x1, this._x1 =
|
|
103
|
+
this._x0 = this._x1, this._x1 = r, this._y0 = this._y1, this._y1 = a, this._t0 = h;
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
|
-
function
|
|
106
|
-
function
|
|
107
|
-
return new
|
|
107
|
+
function Ie(i) {
|
|
108
|
+
function r(a) {
|
|
109
|
+
return new at(a, i);
|
|
108
110
|
}
|
|
109
|
-
return
|
|
111
|
+
return r;
|
|
110
112
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
113
|
+
function ke(i) {
|
|
114
|
+
return i < 0 ? -1 : 1;
|
|
113
115
|
}
|
|
114
|
-
function
|
|
115
|
-
let
|
|
116
|
-
return (
|
|
116
|
+
function De(i, r, a) {
|
|
117
|
+
let h = i._x1 - i._x0, s = r - i._x1, f = (i._y1 - i._y0) / (h || s < 0 && -0), c = (a - i._y1) / (s || h < 0 && -0), x = (f * s + c * h) / (h + s);
|
|
118
|
+
return (ke(f) + ke(c)) * Math.min(Math.abs(f), Math.abs(c), 0.5 * Math.abs(x)) || 0;
|
|
117
119
|
}
|
|
118
|
-
function
|
|
119
|
-
let
|
|
120
|
-
return
|
|
120
|
+
function Oe(i, r) {
|
|
121
|
+
let a = i._x1 - i._x0;
|
|
122
|
+
return a ? (3 * (i._y1 - i._y0) / a - r) / 2 : r;
|
|
121
123
|
}
|
|
122
|
-
function
|
|
123
|
-
let
|
|
124
|
-
|
|
124
|
+
function ae(i, r, a) {
|
|
125
|
+
let h = i._x0, s = i._y0, f = i._x1, c = i._y1, x = (f - h) / 1.5 * (1 - i._tension);
|
|
126
|
+
i._context.bezierCurveTo(h + x, s + x * r, f - x, c - x * a, f, c);
|
|
125
127
|
}
|
|
126
|
-
class
|
|
128
|
+
class H extends G {
|
|
127
129
|
_afterNew() {
|
|
128
|
-
this._setDefault("curveFactory",
|
|
130
|
+
this._setDefault("curveFactory", Ie(this.get("tension", 0.5))), super._afterNew();
|
|
129
131
|
}
|
|
130
132
|
_updateChildren() {
|
|
131
|
-
this.isDirty("tension") && (this.set("curveFactory",
|
|
133
|
+
this.isDirty("tension") && (this.set("curveFactory", Ie(this.get("tension", 0.5))), this._valuesDirty = !0), super._updateChildren();
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
|
-
Object.defineProperty(
|
|
136
|
+
Object.defineProperty(H, "className", {
|
|
135
137
|
enumerable: !0,
|
|
136
138
|
configurable: !0,
|
|
137
139
|
writable: !0,
|
|
138
140
|
value: "SmoothedXLineSeries"
|
|
139
141
|
});
|
|
140
|
-
Object.defineProperty(
|
|
142
|
+
Object.defineProperty(H, "classNames", {
|
|
141
143
|
enumerable: !0,
|
|
142
144
|
configurable: !0,
|
|
143
145
|
writable: !0,
|
|
144
|
-
value:
|
|
146
|
+
value: G.classNames.concat([H.className])
|
|
145
147
|
});
|
|
146
|
-
const
|
|
148
|
+
const lt = [
|
|
147
149
|
{ lowerField: "low95", upperField: "high95", label: "95% expected move" },
|
|
148
150
|
{ lowerField: "low68", upperField: "high68", label: "68% expected move" }
|
|
149
|
-
],
|
|
151
|
+
], ct = [0.15, 0.3, 0.45], le = 1.1, ut = "spineValue", Te = 5, pt = 7.5, mt = {
|
|
150
152
|
millisecond: 1,
|
|
151
153
|
second: 1e3,
|
|
152
154
|
minute: 6e4,
|
|
@@ -155,62 +157,67 @@ const We = [
|
|
|
155
157
|
week: 6048e5,
|
|
156
158
|
month: 2592e6,
|
|
157
159
|
year: 31536e6
|
|
158
|
-
}, T = (
|
|
160
|
+
}, T = (i) => new Date(i).getTime(), dt = (i) => new Intl.DateTimeFormat("en-US", {
|
|
159
161
|
month: "short",
|
|
160
162
|
day: "numeric",
|
|
161
163
|
hour: "2-digit",
|
|
162
164
|
minute: "2-digit"
|
|
163
|
-
}).format(new Date(
|
|
164
|
-
const
|
|
165
|
-
data:
|
|
166
|
-
dateField:
|
|
167
|
-
historyField:
|
|
168
|
-
centreField:
|
|
169
|
-
bands:
|
|
170
|
-
forecasts:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
ie
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
165
|
+
}).format(new Date(i)), Ce = (i) => i.label ?? dt(i.origin), Et = (i) => {
|
|
166
|
+
const r = Ue(), a = $e({ props: i, name: "HCForecastCone" }), {
|
|
167
|
+
data: h = [],
|
|
168
|
+
dateField: s = "date",
|
|
169
|
+
historyField: f = "close",
|
|
170
|
+
centreField: c = "center",
|
|
171
|
+
bands: x = lt,
|
|
172
|
+
forecasts: _,
|
|
173
|
+
showOriginMarkers: ee = !0,
|
|
174
|
+
nowValue: te,
|
|
175
|
+
color: ce = r.palette.warning.main,
|
|
176
|
+
connectMissingData: R = !0,
|
|
177
|
+
skipEmptyDates: ue = !0,
|
|
178
|
+
baseInterval: pe,
|
|
179
|
+
chartId: me = "forecast-cone-chart",
|
|
180
|
+
height: Ee = "100%",
|
|
181
|
+
width: Pe = "100%",
|
|
182
|
+
loading: de = !1,
|
|
183
|
+
emptyMessage: he = "No data available",
|
|
184
|
+
sx: Le,
|
|
185
|
+
...Se
|
|
186
|
+
} = a, C = Array.isArray(_) && _.length > 0, [fe, be] = Ne(
|
|
187
|
+
() => C ? _.length - 1 : 0
|
|
188
|
+
), [W, ie] = Ne(
|
|
189
|
+
null
|
|
190
|
+
), Y = W ?? fe, z = M(Y);
|
|
191
|
+
z.current = Y;
|
|
192
|
+
const ge = M(W !== null);
|
|
193
|
+
ge.current = W !== null;
|
|
194
|
+
const w = Q.orderBy(h, [s]).map((e) => ({ ...e }));
|
|
195
|
+
if (!C) {
|
|
196
|
+
const e = w.findIndex(
|
|
197
|
+
(p) => p[c] !== null && p[c] !== void 0
|
|
191
198
|
);
|
|
192
|
-
|
|
199
|
+
R && e > 0 && (w[e][f] === null || w[e][f] === void 0) && (w[e][f] = w[e][c]);
|
|
193
200
|
}
|
|
194
|
-
const
|
|
195
|
-
...
|
|
196
|
-
height:
|
|
197
|
-
width:
|
|
198
|
-
chartId:
|
|
199
|
-
loading:
|
|
200
|
-
emptyMessage:
|
|
201
|
-
baseInterval:
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
var
|
|
205
|
-
if (!
|
|
206
|
-
const e =
|
|
207
|
-
|
|
208
|
-
text:
|
|
209
|
-
grid:
|
|
210
|
-
stroke:
|
|
211
|
-
}),
|
|
212
|
-
const
|
|
213
|
-
|
|
201
|
+
const Xe = {
|
|
202
|
+
...a,
|
|
203
|
+
height: Ee,
|
|
204
|
+
width: Pe,
|
|
205
|
+
chartId: me,
|
|
206
|
+
loading: de,
|
|
207
|
+
emptyMessage: he,
|
|
208
|
+
baseInterval: pe
|
|
209
|
+
}, _e = M(null), ve = M(null), re = M(null), V = M(null);
|
|
210
|
+
Ge(() => {
|
|
211
|
+
var xe, we;
|
|
212
|
+
if (!re.current) return;
|
|
213
|
+
const e = Be.new(re.current);
|
|
214
|
+
ve.current = e, e.setThemes([je.new(e)]), e.interfaceColors.setAll({
|
|
215
|
+
text: O(r.palette.text.primary),
|
|
216
|
+
grid: O(r.palette.divider),
|
|
217
|
+
stroke: O(r.palette.divider)
|
|
218
|
+
}), Ze(e);
|
|
219
|
+
const p = e.container.children.push(
|
|
220
|
+
qe.new(e, {
|
|
214
221
|
panX: !0,
|
|
215
222
|
panY: !1,
|
|
216
223
|
wheelX: "none",
|
|
@@ -220,206 +227,302 @@ const We = [
|
|
|
220
227
|
layout: e.verticalLayout
|
|
221
228
|
})
|
|
222
229
|
);
|
|
223
|
-
|
|
230
|
+
_e.current = p, p.set(
|
|
224
231
|
"cursor",
|
|
225
|
-
|
|
232
|
+
Ke.new(e, { behavior: "none" })
|
|
226
233
|
).lineY.set("visible", !1);
|
|
227
|
-
const
|
|
228
|
-
|
|
234
|
+
const Z = pe ?? { timeUnit: "hour", count: 1 }, ne = ue, Re = ne ? nt : ot, b = p.xAxes.push(
|
|
235
|
+
Re.new(e, {
|
|
229
236
|
maxDeviation: 0.1,
|
|
230
237
|
groupData: !1,
|
|
231
|
-
baseInterval:
|
|
232
|
-
renderer:
|
|
238
|
+
baseInterval: Z,
|
|
239
|
+
renderer: Qe.new(e, {})
|
|
233
240
|
})
|
|
234
241
|
);
|
|
235
|
-
(
|
|
236
|
-
stroke:
|
|
242
|
+
(xe = b.get("renderer")) == null || xe.grid.template.setAll({
|
|
243
|
+
stroke: O(r.palette.divider),
|
|
237
244
|
strokeOpacity: 1
|
|
238
245
|
});
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
renderer:
|
|
246
|
+
const E = p.yAxes.push(
|
|
247
|
+
Je.new(e, {
|
|
248
|
+
renderer: et.new(e, {})
|
|
242
249
|
})
|
|
243
250
|
);
|
|
244
|
-
(
|
|
245
|
-
stroke:
|
|
251
|
+
(we = E.get("renderer")) == null || we.grid.template.setAll({
|
|
252
|
+
stroke: O(r.palette.divider),
|
|
246
253
|
strokeOpacity: 1
|
|
247
254
|
});
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
),
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
name:
|
|
255
|
-
xAxis:
|
|
256
|
-
yAxis:
|
|
257
|
-
valueYField:
|
|
258
|
-
openValueYField:
|
|
259
|
-
valueXField:
|
|
260
|
-
|
|
261
|
-
|
|
255
|
+
const B = O(ce), Ye = p.children.push(
|
|
256
|
+
tt.new(e, { centerX: Ae, x: Ae })
|
|
257
|
+
), se = () => st.new(e, { dateFormat: "i", dateFields: [s] }), ye = C ? [] : w, q = [];
|
|
258
|
+
x.forEach((u, d) => {
|
|
259
|
+
const l = p.series.push(
|
|
260
|
+
H.new(e, {
|
|
261
|
+
name: u.label ?? `Band ${d + 1}`,
|
|
262
|
+
xAxis: b,
|
|
263
|
+
yAxis: E,
|
|
264
|
+
valueYField: u.upperField,
|
|
265
|
+
openValueYField: u.lowerField,
|
|
266
|
+
valueXField: s,
|
|
267
|
+
connect: R,
|
|
268
|
+
autoGapCount: le,
|
|
269
|
+
fill: B,
|
|
270
|
+
stroke: B
|
|
262
271
|
})
|
|
263
272
|
);
|
|
264
|
-
|
|
273
|
+
l.strokes.template.set("strokeOpacity", 0), l.fills.template.setAll({
|
|
265
274
|
visible: !0,
|
|
266
|
-
fill:
|
|
267
|
-
fillOpacity:
|
|
268
|
-
}),
|
|
275
|
+
fill: B,
|
|
276
|
+
fillOpacity: u.fillOpacity ?? ct[d] ?? 0.2
|
|
277
|
+
}), l.data.processor = se(), l.data.setAll(ye), q.push(l);
|
|
269
278
|
});
|
|
270
|
-
let
|
|
271
|
-
|
|
272
|
-
|
|
279
|
+
let F;
|
|
280
|
+
c && (F = p.series.push(
|
|
281
|
+
H.new(e, {
|
|
273
282
|
name: "Forecast centre",
|
|
274
|
-
xAxis:
|
|
275
|
-
yAxis:
|
|
276
|
-
valueYField:
|
|
277
|
-
valueXField:
|
|
278
|
-
|
|
283
|
+
xAxis: b,
|
|
284
|
+
yAxis: E,
|
|
285
|
+
valueYField: c,
|
|
286
|
+
valueXField: s,
|
|
287
|
+
connect: R,
|
|
288
|
+
autoGapCount: le,
|
|
289
|
+
stroke: O(r.palette.error.main)
|
|
279
290
|
})
|
|
280
|
-
),
|
|
291
|
+
), F.strokes.template.setAll({
|
|
281
292
|
strokeWidth: 1.5,
|
|
282
293
|
strokeDasharray: [4, 4]
|
|
283
|
-
}),
|
|
284
|
-
const
|
|
285
|
-
|
|
294
|
+
}), F.fills.template.set("visible", !1), F.data.processor = se(), F.data.setAll(ye));
|
|
295
|
+
const L = C ? Q.orderBy(h, [s]).map((u) => ({ ...u })) : w, J = p.series.push(
|
|
296
|
+
G.new(e, {
|
|
286
297
|
name: "History",
|
|
287
|
-
xAxis:
|
|
288
|
-
yAxis:
|
|
289
|
-
valueYField:
|
|
290
|
-
valueXField:
|
|
298
|
+
xAxis: b,
|
|
299
|
+
yAxis: E,
|
|
300
|
+
valueYField: f,
|
|
301
|
+
valueXField: s,
|
|
291
302
|
// When false, the history line breaks at missing dates (gap > ~1 base
|
|
292
303
|
// interval) instead of bridging across them.
|
|
293
|
-
connect:
|
|
294
|
-
autoGapCount:
|
|
295
|
-
stroke:
|
|
304
|
+
connect: R,
|
|
305
|
+
autoGapCount: le,
|
|
306
|
+
stroke: O(r.palette.primary.main)
|
|
296
307
|
})
|
|
297
308
|
);
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
var
|
|
301
|
-
return (
|
|
309
|
+
J.strokes.template.setAll({ strokeWidth: 2 }), J.data.processor = se(), J.data.setAll(L), Ye.data.setAll(p.series.values);
|
|
310
|
+
const K = (mt[Z.timeUnit] ?? 0) * Z.count / 2, oe = (u, d) => {
|
|
311
|
+
var l;
|
|
312
|
+
return (l = u.get("grid")) == null ? void 0 : l.setAll({
|
|
302
313
|
visible: !0,
|
|
303
|
-
stroke:
|
|
304
|
-
strokeOpacity:
|
|
314
|
+
stroke: O(r.palette.text.secondary),
|
|
315
|
+
strokeOpacity: d,
|
|
305
316
|
strokeDasharray: [2, 3]
|
|
306
317
|
});
|
|
307
318
|
};
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
319
|
+
if (C) {
|
|
320
|
+
const u = /* @__PURE__ */ new Set();
|
|
321
|
+
let d = 1 / 0, l = -1 / 0, v = -1 / 0;
|
|
322
|
+
const A = (t) => {
|
|
323
|
+
typeof t == "number" && Number.isFinite(t) && (t < d && (d = t), t > l && (l = t));
|
|
312
324
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
325
|
+
L.forEach((t) => {
|
|
326
|
+
A(t[f]);
|
|
327
|
+
const n = T(t[s]);
|
|
328
|
+
Number.isFinite(n) && u.add(n);
|
|
329
|
+
});
|
|
330
|
+
const y = L.length ? T(L[0][s]) : NaN;
|
|
331
|
+
if (_.forEach(
|
|
332
|
+
(t) => t.rows.forEach((n) => {
|
|
333
|
+
x.forEach((g) => {
|
|
334
|
+
A(n[g.lowerField]), A(n[g.upperField]);
|
|
335
|
+
}), c && A(n[c]);
|
|
336
|
+
const m = T(n[s]);
|
|
337
|
+
Number.isFinite(m) && (u.add(m), m > v && (v = m));
|
|
322
338
|
})
|
|
323
|
-
),
|
|
324
|
-
const
|
|
325
|
-
Number.isFinite(
|
|
339
|
+
), L.length) {
|
|
340
|
+
const t = T(L[L.length - 1][s]);
|
|
341
|
+
Number.isFinite(t) && t > v && (v = t);
|
|
326
342
|
}
|
|
327
|
-
if (Number.isFinite(
|
|
328
|
-
const
|
|
329
|
-
|
|
343
|
+
if (Number.isFinite(d) && Number.isFinite(l)) {
|
|
344
|
+
const t = (l - d) * 0.05 || 1;
|
|
345
|
+
E.set("min", d - t), E.set("max", l + t), E.set("strictMinMax", !0);
|
|
330
346
|
}
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
347
|
+
if (ne) {
|
|
348
|
+
const t = p.series.push(
|
|
349
|
+
G.new(e, {
|
|
350
|
+
name: "Timeline",
|
|
351
|
+
xAxis: b,
|
|
352
|
+
yAxis: E,
|
|
353
|
+
valueXField: s,
|
|
354
|
+
valueYField: ut
|
|
355
|
+
})
|
|
356
|
+
);
|
|
357
|
+
t.strokes.template.set("strokeOpacity", 0), t.fills.template.set("visible", !1), t.data.setAll(
|
|
358
|
+
Array.from(u).sort((n, m) => n - m).map((n) => ({ [s]: n }))
|
|
336
359
|
);
|
|
337
|
-
|
|
360
|
+
}
|
|
361
|
+
!ne && Number.isFinite(y) && Number.isFinite(v) && (b.set("min", y), b.set("max", v + K), b.set("strictMinMax", !0)), ee || _.forEach((t) => {
|
|
362
|
+
const n = T(t.origin);
|
|
363
|
+
if (Number.isNaN(n)) return;
|
|
364
|
+
const m = b.createAxisRange(
|
|
365
|
+
b.makeDataItem({ value: n + K })
|
|
366
|
+
);
|
|
367
|
+
oe(m, 0.25);
|
|
368
|
+
});
|
|
369
|
+
const I = b.makeDataItem({ value: 0 }), j = b.createAxisRange(I);
|
|
370
|
+
oe(j, 0.8);
|
|
371
|
+
const X = /* @__PURE__ */ new Map(), U = (t, n) => t.setAll({
|
|
372
|
+
radius: n ? pt : Te,
|
|
373
|
+
fillOpacity: n ? 1 : 0.6
|
|
338
374
|
});
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
375
|
+
if (ee) {
|
|
376
|
+
const t = L.map((o) => ({ t: T(o[s]), v: o[f] })).filter(
|
|
377
|
+
(o) => Number.isFinite(o.t) && typeof o.v == "number" && Number.isFinite(o.v)
|
|
378
|
+
), n = (o) => {
|
|
379
|
+
let P;
|
|
380
|
+
for (const k of t) {
|
|
381
|
+
if (k.t > o) break;
|
|
382
|
+
P = k.v;
|
|
383
|
+
}
|
|
384
|
+
return P;
|
|
385
|
+
}, m = [];
|
|
386
|
+
_.forEach((o, P) => {
|
|
387
|
+
var $;
|
|
388
|
+
const k = T(o.origin);
|
|
389
|
+
if (!Number.isFinite(k)) return;
|
|
390
|
+
const S = c ? ($ = Q.orderBy(o.rows, [s]).find(
|
|
391
|
+
(Fe) => Fe[c] !== null && Fe[c] !== void 0
|
|
392
|
+
)) == null ? void 0 : $[c] : void 0, D = n(k) ?? S;
|
|
393
|
+
typeof D != "number" || !Number.isFinite(D) || m.push({
|
|
394
|
+
originDate: k,
|
|
395
|
+
originValue: D,
|
|
396
|
+
originIndex: P
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
const g = p.series.push(
|
|
400
|
+
G.new(e, {
|
|
401
|
+
name: "Forecast runs",
|
|
402
|
+
xAxis: b,
|
|
403
|
+
yAxis: E,
|
|
404
|
+
valueXField: "originDate",
|
|
405
|
+
valueYField: "originValue"
|
|
406
|
+
})
|
|
407
|
+
);
|
|
408
|
+
g.strokes.template.set("strokeOpacity", 0), g.fills.template.set("visible", !1), g.bullets.push((o, P, k) => {
|
|
409
|
+
const S = k.dataContext, D = it.new(o, {
|
|
410
|
+
radius: Te,
|
|
411
|
+
fill: B,
|
|
412
|
+
fillOpacity: 0.6,
|
|
413
|
+
stroke: O(r.palette.background.paper),
|
|
414
|
+
strokeWidth: 2,
|
|
415
|
+
interactive: !0,
|
|
416
|
+
cursorOverStyle: "pointer"
|
|
417
|
+
});
|
|
418
|
+
return U(D, S.originIndex === z.current), D.events.on(
|
|
419
|
+
"pointerover",
|
|
420
|
+
() => ie(S.originIndex)
|
|
421
|
+
), D.events.on(
|
|
422
|
+
"pointerout",
|
|
423
|
+
() => (
|
|
424
|
+
// Guard against a neighbouring bullet's `pointerover` landing first.
|
|
425
|
+
ie(
|
|
426
|
+
($) => $ === S.originIndex ? null : $
|
|
427
|
+
)
|
|
428
|
+
)
|
|
429
|
+
), D.events.on("click", () => {
|
|
430
|
+
be(S.originIndex), ie(null);
|
|
431
|
+
}), X.set(S.originIndex, D), rt.new(o, { sprite: D });
|
|
432
|
+
}), g.data.setAll(m);
|
|
433
|
+
}
|
|
434
|
+
const N = (t) => {
|
|
435
|
+
const n = _[t] ?? _[_.length - 1];
|
|
436
|
+
if (!n) return;
|
|
437
|
+
const m = Q.orderBy(n.rows, [s]).map((o) => ({
|
|
438
|
+
...o
|
|
346
439
|
}));
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
|
|
440
|
+
q.forEach((o) => o.data.setAll(m)), F == null || F.data.setAll(m);
|
|
441
|
+
const g = T(n.origin);
|
|
442
|
+
I.set("value", Number.isNaN(g) ? 0 : g + K), X.forEach(
|
|
443
|
+
(o, P) => U(o, P === t)
|
|
444
|
+
);
|
|
350
445
|
};
|
|
351
|
-
|
|
446
|
+
V.current = N, N(z.current);
|
|
352
447
|
} else {
|
|
353
|
-
const
|
|
354
|
-
(
|
|
355
|
-
),
|
|
356
|
-
(
|
|
357
|
-
),
|
|
358
|
-
if (!Number.isNaN(
|
|
359
|
-
const
|
|
360
|
-
|
|
448
|
+
const u = w.findIndex(
|
|
449
|
+
(y) => y[c] !== null && y[c] !== void 0
|
|
450
|
+
), d = [...w].reverse().find(
|
|
451
|
+
(y) => y[f] !== null && y[f] !== void 0
|
|
452
|
+
), l = u >= 0 ? w[u] : d, v = te !== void 0 ? T(te) : l ? T(l[s]) : NaN, A = Number.isNaN(v) ? NaN : v + K;
|
|
453
|
+
if (!Number.isNaN(A)) {
|
|
454
|
+
const y = b.createAxisRange(
|
|
455
|
+
b.makeDataItem({ value: A })
|
|
361
456
|
);
|
|
362
|
-
|
|
457
|
+
oe(y, 0.7);
|
|
363
458
|
}
|
|
364
459
|
}
|
|
365
|
-
const
|
|
366
|
-
return
|
|
460
|
+
const Ve = We(Z);
|
|
461
|
+
return ze({
|
|
367
462
|
root: e,
|
|
368
|
-
chart:
|
|
369
|
-
theme:
|
|
463
|
+
chart: p,
|
|
464
|
+
theme: r,
|
|
370
465
|
getText: () => {
|
|
371
|
-
var
|
|
372
|
-
const
|
|
373
|
-
C
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
466
|
+
var U;
|
|
467
|
+
const u = (N) => N == null ? "—" : e.numberFormatter.format(N), d = J.get("tooltipDataItem"), l = F == null ? void 0 : F.get("tooltipDataItem"), v = l ?? d ?? ((U = q[0]) == null ? void 0 : U.get("tooltipDataItem")), A = v == null ? void 0 : v.get("valueX"), y = typeof A == "number" ? e.dateFormatter.format(new Date(A), Ve) : "", I = [];
|
|
468
|
+
if (C && ge.current) {
|
|
469
|
+
const N = _[z.current];
|
|
470
|
+
N && I.push(`Forecast run: ${Ce(N)}`);
|
|
471
|
+
}
|
|
472
|
+
const j = d == null ? void 0 : d.get("valueY");
|
|
473
|
+
j != null && I.push(`History: ${u(j)}`);
|
|
474
|
+
const X = l == null ? void 0 : l.get("valueY");
|
|
475
|
+
return X != null && I.push(`Centre: ${u(X)}`), x.forEach((N, t) => {
|
|
476
|
+
var o;
|
|
477
|
+
const n = (o = q[t]) == null ? void 0 : o.get("tooltipDataItem"), m = n == null ? void 0 : n.get("valueY"), g = n == null ? void 0 : n.get("openValueY");
|
|
478
|
+
if (m != null && g !== void 0 && g !== null) {
|
|
479
|
+
const P = (m - g) / 2, k = N.label ?? `Band ${t + 1}`;
|
|
480
|
+
I.push(`[${B.toCSSHex()}]●[/] ${k}: ±${u(P)}`);
|
|
381
481
|
}
|
|
382
|
-
}),
|
|
383
|
-
${
|
|
384
|
-
`)}` :
|
|
482
|
+
}), I.length === 0 ? "" : y ? `[bold]${y}[/]
|
|
483
|
+
${I.join(`
|
|
484
|
+
`)}` : I.join(`
|
|
385
485
|
`);
|
|
386
486
|
}
|
|
387
|
-
}),
|
|
388
|
-
|
|
487
|
+
}), p.appear(1e3, 100), () => {
|
|
488
|
+
V.current = null, e.dispose(), ve.current = null, _e.current = null;
|
|
389
489
|
};
|
|
390
490
|
}, [
|
|
391
|
-
|
|
392
|
-
|
|
491
|
+
r.palette.mode,
|
|
492
|
+
h,
|
|
493
|
+
x,
|
|
393
494
|
_,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
]),
|
|
495
|
+
ee,
|
|
496
|
+
ce,
|
|
497
|
+
te,
|
|
498
|
+
R,
|
|
499
|
+
ue
|
|
500
|
+
]), He(() => {
|
|
400
501
|
var e;
|
|
401
|
-
(e =
|
|
402
|
-
}, [
|
|
403
|
-
const
|
|
502
|
+
(e = V.current) == null || e.call(V, Y);
|
|
503
|
+
}, [Y]);
|
|
504
|
+
const Me = C ? _.map(Ce) : [];
|
|
404
505
|
return {
|
|
405
|
-
chartDivRef:
|
|
406
|
-
data:
|
|
407
|
-
chartId:
|
|
408
|
-
loading:
|
|
409
|
-
emptyMessage:
|
|
410
|
-
isMulti:
|
|
411
|
-
origins:
|
|
412
|
-
selectedOriginIndex:
|
|
506
|
+
chartDivRef: re,
|
|
507
|
+
data: w,
|
|
508
|
+
chartId: me,
|
|
509
|
+
loading: de,
|
|
510
|
+
emptyMessage: he,
|
|
511
|
+
isMulti: C,
|
|
512
|
+
origins: Me,
|
|
513
|
+
selectedOriginIndex: fe,
|
|
514
|
+
shownOriginIndex: Y,
|
|
515
|
+
isPreviewing: W !== null,
|
|
413
516
|
onOriginChange: (e) => {
|
|
414
|
-
if (!
|
|
415
|
-
const
|
|
416
|
-
|
|
517
|
+
if (!C) return;
|
|
518
|
+
const p = Math.max(0, Math.min(_.length - 1, e));
|
|
519
|
+
be(p);
|
|
417
520
|
},
|
|
418
|
-
sx:
|
|
419
|
-
other:
|
|
420
|
-
ownerState:
|
|
521
|
+
sx: Le,
|
|
522
|
+
other: Se,
|
|
523
|
+
ownerState: Xe
|
|
421
524
|
};
|
|
422
525
|
};
|
|
423
526
|
export {
|
|
424
|
-
|
|
527
|
+
Et as useForecastConeChartLogic
|
|
425
528
|
};
|