@wick-charts/react 0.1.1 → 0.1.2
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/index.cjs +1 -1
- package/dist/index.d.ts +546 -121
- package/dist/index.js +513 -523
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
import { jsx as S, jsxs as F, Fragment as
|
|
3
|
-
var
|
|
1
|
+
import { createContext as ye, useContext as Nt, useRef as et, useLayoutEffect as it, useEffect as j, useState as Rt, Children as Ye, isValidElement as _e, useMemo as dt, useSyncExternalStore as Tt } from "react";
|
|
2
|
+
import { jsx as S, jsxs as F, Fragment as Dt } from "react/jsx-runtime";
|
|
3
|
+
var Ue = Object.defineProperty, xe = (r) => {
|
|
4
4
|
throw TypeError(r);
|
|
5
|
-
}, Ee = (r, t, i) => t in r ?
|
|
5
|
+
}, Ee = (r, t, i) => t in r ? Ue(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i, w = (r, t, i) => Ee(r, typeof t != "symbol" ? t + "" : t, i), jt = (r, t, i) => t.has(r) || xe("Cannot " + i), c = (r, t, i) => (jt(r, t, "read from private field"), i ? i.call(r) : t.get(r)), L = (r, t, i) => t.has(r) ? xe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, i), R = (r, t, i, e) => (jt(r, t, "write to private field"), t.set(r, i), i), Ft = (r, t, i) => (jt(r, t, "access private method"), i), le = (r, t, i, e) => ({
|
|
6
6
|
set _(a) {
|
|
7
7
|
R(r, t, a);
|
|
8
8
|
},
|
|
@@ -10,7 +10,7 @@ var Oe = Object.defineProperty, Ce = (r) => {
|
|
|
10
10
|
return c(r, t, e);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
class
|
|
13
|
+
class Bt {
|
|
14
14
|
constructor() {
|
|
15
15
|
w(this, "listeners", /* @__PURE__ */ new Map());
|
|
16
16
|
}
|
|
@@ -34,7 +34,7 @@ function ce(r, t, i) {
|
|
|
34
34
|
const e = document.createElement("canvas");
|
|
35
35
|
return e.style.position = "absolute", e.style.inset = "0", e.style.width = "100%", e.style.height = "100%", e.style.display = "block", e.style.zIndex = String(t), r.appendChild(e), e;
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class Oe extends Bt {
|
|
38
38
|
constructor(t) {
|
|
39
39
|
super(), w(this, "mainCanvas"), w(this, "mainCtx"), w(this, "overlayCanvas"), w(this, "overlayCtx"), w(this, "resizeObserver"), w(this, "_size"), w(this, "supportsDevicePixelContentBox", !1), this.mainCanvas = ce(t, 0), this.overlayCanvas = ce(t, 1), this.mainCtx = this.mainCanvas.getContext("2d", { alpha: !0 }), this.overlayCtx = this.overlayCanvas.getContext("2d", { alpha: !0 });
|
|
40
40
|
const i = window.devicePixelRatio || 1;
|
|
@@ -123,13 +123,13 @@ class $e extends zt {
|
|
|
123
123
|
this.resizeObserver.disconnect(), this.mainCanvas.remove(), this.overlayCanvas.remove(), this.removeAllListeners();
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function $e(r, t, i, e) {
|
|
127
127
|
const { context: a, bitmapSize: o, horizontalPixelRatio: s } = r;
|
|
128
128
|
a.strokeStyle = e.crosshair.color, a.lineWidth = 1, a.setLineDash([4 * s, 4 * s]);
|
|
129
129
|
const n = Math.round(t) + 0.5, l = Math.round(i) + 0.5;
|
|
130
130
|
a.beginPath(), a.moveTo(n, 0), a.lineTo(n, o.height), a.moveTo(0, l), a.lineTo(o.width, l), a.stroke(), a.setLineDash([]);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Xe(r, t, i, e, a) {
|
|
133
133
|
const { context: o, bitmapSize: s, horizontalPixelRatio: n, verticalPixelRatio: l } = r;
|
|
134
134
|
o.strokeStyle = e.grid.color, o.lineWidth = 1, e.grid.style === "dashed" ? o.setLineDash([4 * n, 4 * n]) : e.grid.style === "dotted" && o.setLineDash([1 * n, 3 * n]);
|
|
135
135
|
const h = i.niceTickValues();
|
|
@@ -150,7 +150,7 @@ function He(r, t, i, e, a) {
|
|
|
150
150
|
function he(r, t, i) {
|
|
151
151
|
return r + (t - r) * i;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Ot(r, t, i) {
|
|
154
154
|
let e = 0, a = r.length - 1;
|
|
155
155
|
for (; e <= a; ) {
|
|
156
156
|
const o = e + a >>> 1, s = i(r[o]);
|
|
@@ -160,7 +160,7 @@ function Et(r, t, i) {
|
|
|
160
160
|
}
|
|
161
161
|
return e;
|
|
162
162
|
}
|
|
163
|
-
class Jt extends
|
|
163
|
+
class Jt extends Bt {
|
|
164
164
|
constructor() {
|
|
165
165
|
super(...arguments), w(this, "data", []), w(this, "_visible", !0), w(this, "cachedRange", null), w(this, "cachedResult", []);
|
|
166
166
|
}
|
|
@@ -195,7 +195,7 @@ class Jt extends zt {
|
|
|
195
195
|
getVisibleData(t, i) {
|
|
196
196
|
if (this.data.length === 0) return [];
|
|
197
197
|
if (this.cachedRange && this.cachedRange.from === t && this.cachedRange.to === i) return this.cachedResult;
|
|
198
|
-
const e = Math.max(0,
|
|
198
|
+
const e = Math.max(0, Ot(this.data, t, (o) => o.time) - 1), a = Math.min(this.data.length, Ot(this.data, i, (o) => o.time) + 1);
|
|
199
199
|
return this.cachedResult = this.data.slice(e, a), this.cachedRange = { from: t, to: i }, this.cachedResult;
|
|
200
200
|
}
|
|
201
201
|
first() {
|
|
@@ -212,7 +212,7 @@ class Jt extends zt {
|
|
|
212
212
|
}
|
|
213
213
|
findNearest(t, i) {
|
|
214
214
|
if (this.data.length === 0) return null;
|
|
215
|
-
const e =
|
|
215
|
+
const e = Ot(this.data, t, (s) => s.time);
|
|
216
216
|
let a = null, o = i;
|
|
217
217
|
for (let s = Math.max(0, e - 1); s <= Math.min(this.data.length - 1, e + 1); s++) {
|
|
218
218
|
const n = Math.abs(this.data[s].time - t);
|
|
@@ -221,7 +221,7 @@ class Jt extends zt {
|
|
|
221
221
|
return a;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class He {
|
|
225
225
|
constructor(t, i, e) {
|
|
226
226
|
w(this, "dragging", !1), w(this, "lastX", 0), this.viewport = t, this.timeScale = i, this.canvas = e;
|
|
227
227
|
}
|
|
@@ -242,20 +242,20 @@ class Ge {
|
|
|
242
242
|
return this.dragging;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
class
|
|
245
|
+
class Ge {
|
|
246
246
|
constructor(t, i) {
|
|
247
247
|
this.viewport = t, this.timeScale = i;
|
|
248
248
|
}
|
|
249
249
|
handleWheel(t) {
|
|
250
250
|
t.preventDefault();
|
|
251
|
-
const i =
|
|
251
|
+
const i = Ne(t.deltaY, t.deltaMode), e = Math.exp(i * 5e-3), a = this.timeScale.getMediaWidth(), o = Math.min(t.offsetX, a), s = this.timeScale.xToTime(o);
|
|
252
252
|
this.viewport.zoomAt(s, e);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function Ne(r, t) {
|
|
256
256
|
return t === WheelEvent.DOM_DELTA_LINE ? r * 8 : t === WheelEvent.DOM_DELTA_PAGE ? r * 24 : r;
|
|
257
257
|
}
|
|
258
|
-
class
|
|
258
|
+
class je extends Bt {
|
|
259
259
|
constructor(t, i, e, a) {
|
|
260
260
|
super(), w(this, "zoom"), w(this, "pan"), w(this, "canvas"), w(this, "timeScale"), w(this, "yScale"), w(this, "viewport"), w(this, "onWheel", (o) => {
|
|
261
261
|
this.zoom.handleWheel(o);
|
|
@@ -290,7 +290,7 @@ class Je extends zt {
|
|
|
290
290
|
}
|
|
291
291
|
}), w(this, "onTouchEnd", (o) => {
|
|
292
292
|
o.touches.length === 0 && (this.pan.handleMouseUp(), this.touchCount = 0, this.lastTouchDist = 0);
|
|
293
|
-
}), this.canvas = t, this.viewport = i, this.timeScale = e, this.yScale = a, this.zoom = new
|
|
293
|
+
}), this.canvas = t, this.viewport = i, this.timeScale = e, this.yScale = a, this.zoom = new Ge(i, e), this.pan = new He(i, e, t), t.style.cursor = "crosshair", t.style.touchAction = "none", t.addEventListener("wheel", this.onWheel, { passive: !1 }), t.addEventListener("mousedown", this.onMouseDown), t.addEventListener("mousemove", this.onMouseMove), t.addEventListener("mouseup", this.onMouseUp), t.addEventListener("mouseleave", this.onMouseLeave), t.addEventListener("dblclick", this.onDblClick), t.addEventListener("touchstart", this.onTouchStart, { passive: !1 }), t.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), t.addEventListener("touchend", this.onTouchEnd);
|
|
294
294
|
}
|
|
295
295
|
emitCrosshair(t, i) {
|
|
296
296
|
const e = this.timeScale.xToTime(t), a = this.yScale.yToValue(i);
|
|
@@ -318,40 +318,40 @@ class de {
|
|
|
318
318
|
this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.dirty = !1;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
const
|
|
322
|
-
function
|
|
321
|
+
const ut = 6e4, ct = 36e5, st = 864e5;
|
|
322
|
+
function At(r) {
|
|
323
323
|
return r instanceof Date ? r.getTime() : r;
|
|
324
324
|
}
|
|
325
|
+
function Je(r) {
|
|
326
|
+
return r.length === 0 || !r.some((t) => t.time instanceof Date) ? r : r.map((t) => ({ ...t, time: At(t.time) }));
|
|
327
|
+
}
|
|
325
328
|
function Ke(r) {
|
|
326
|
-
return r.length === 0 ||
|
|
329
|
+
return r.length === 0 || !r.some((t) => t.time instanceof Date) ? r : r.map((t) => ({ ...t, time: At(t.time) }));
|
|
327
330
|
}
|
|
328
331
|
function qe(r) {
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
function Qe(r) {
|
|
332
|
-
if (r.length < 2) return nt;
|
|
332
|
+
if (r.length < 2) return st;
|
|
333
333
|
const t = [];
|
|
334
334
|
for (let i = 1; i < Math.min(r.length, 20); i++)
|
|
335
335
|
t.push(r[i] - r[i - 1]);
|
|
336
336
|
return t.sort((i, e) => i - e), t[Math.floor(t.length / 2)];
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function It(r, t) {
|
|
339
339
|
const i = new Date(r);
|
|
340
|
-
return t >=
|
|
340
|
+
return t >= st ? i.toLocaleDateString("en-US", { month: "short", day: "numeric" }) : t >= ct ? i.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit", hour12: !1 }) : i.toLocaleTimeString("en-US", {
|
|
341
341
|
hour: "2-digit",
|
|
342
342
|
minute: "2-digit",
|
|
343
343
|
second: "2-digit",
|
|
344
344
|
hour12: !1
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Qe(r) {
|
|
348
348
|
return new Date(r).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
const t = [1e3, 5e3, 1e4, 15e3, 3e4], i = [
|
|
352
|
-
return r <
|
|
350
|
+
function Ze(r) {
|
|
351
|
+
const t = [1e3, 5e3, 1e4, 15e3, 3e4], i = [ut, 5 * ut, 10 * ut, 15 * ut, 30 * ut], e = [ct, 2 * ct, 4 * ct, 6 * ct, 12 * ct], a = [st, 7 * st, 30 * st, 90 * st, 365 * st];
|
|
352
|
+
return r < ut ? [...t, ...i, ...e, ...a] : r < ct ? [...i, ...e, ...a] : r < st ? [...e, ...a] : a;
|
|
353
353
|
}
|
|
354
|
-
class
|
|
354
|
+
class ti {
|
|
355
355
|
constructor() {
|
|
356
356
|
w(this, "from", 0), w(this, "to", 0), w(this, "width", 1), w(this, "pixelRatio", 1);
|
|
357
357
|
}
|
|
@@ -378,7 +378,7 @@ class ei {
|
|
|
378
378
|
}
|
|
379
379
|
niceTickValues(t) {
|
|
380
380
|
if (this.to <= this.from) return { ticks: [], tickInterval: 0 };
|
|
381
|
-
const i =
|
|
381
|
+
const i = Ze(t), e = (this.to - this.from) / this.width * 80;
|
|
382
382
|
let a = i[i.length - 1];
|
|
383
383
|
for (const n of i)
|
|
384
384
|
if (n >= e) {
|
|
@@ -426,7 +426,7 @@ const $t = [
|
|
|
426
426
|
2e4,
|
|
427
427
|
5e4
|
|
428
428
|
];
|
|
429
|
-
class
|
|
429
|
+
class ei {
|
|
430
430
|
constructor() {
|
|
431
431
|
w(this, "min", 0), w(this, "max", 0), w(this, "height", 1), w(this, "pixelRatio", 1);
|
|
432
432
|
}
|
|
@@ -473,14 +473,14 @@ class ii {
|
|
|
473
473
|
return i < 0.01 ? t.toFixed(6) : i < 0.1 ? t.toFixed(4) : i < 10 ? t.toFixed(2) : i < 1e3 ? t.toFixed(1) : t.toFixed(0);
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
const
|
|
476
|
+
const ii = {
|
|
477
477
|
colors: ["#26a69a", "#ef5350"],
|
|
478
478
|
barWidthRatio: 0.6,
|
|
479
479
|
stacking: "off"
|
|
480
480
|
};
|
|
481
|
-
class
|
|
481
|
+
class Z {
|
|
482
482
|
constructor(t, i) {
|
|
483
|
-
w(this, "stores"), w(this, "options"), this.stores = Array.from({ length: t }, () => new Jt()), this.options = { ...
|
|
483
|
+
w(this, "stores"), w(this, "options"), this.stores = Array.from({ length: t }, () => new Jt()), this.options = { ...ii, ...i };
|
|
484
484
|
}
|
|
485
485
|
/** For chart compatibility — returns first store */
|
|
486
486
|
get store() {
|
|
@@ -604,11 +604,11 @@ class tt {
|
|
|
604
604
|
for (const z of v)
|
|
605
605
|
z > 0 ? k += z : D += z;
|
|
606
606
|
if (y > 0 && k > 0) {
|
|
607
|
-
const z = C / k * 100,
|
|
608
|
-
this.fillBar(n, x - g, P, d,
|
|
607
|
+
const z = C / k * 100, _ = (C + y) / k * 100, P = o.valueToBitmapY(_), X = o.valueToBitmapY(z), H = Math.max(1, X - P);
|
|
608
|
+
this.fillBar(n, x - g, P, d, H, b);
|
|
609
609
|
} else if (y < 0 && D < 0) {
|
|
610
|
-
const z = T / D * -100,
|
|
611
|
-
n.fillStyle = b, n.fillRect(x - g, P, d,
|
|
610
|
+
const z = T / D * -100, _ = (T + y) / D * -100, P = o.valueToBitmapY(z), X = o.valueToBitmapY(_), H = Math.max(1, X - P);
|
|
611
|
+
n.fillStyle = b, n.fillRect(x - g, P, d, H);
|
|
612
612
|
}
|
|
613
613
|
} else if (y > 0) {
|
|
614
614
|
const k = o.valueToBitmapY(C + y), D = o.valueToBitmapY(C), z = Math.max(1, D - k);
|
|
@@ -624,15 +624,15 @@ class tt {
|
|
|
624
624
|
t.fillStyle = s, t.fillRect(i, e, a, o);
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
return r.length <= t ? r :
|
|
627
|
+
function ue(r, t) {
|
|
628
|
+
return r.length <= t ? r : ri(
|
|
629
629
|
r,
|
|
630
630
|
t,
|
|
631
631
|
(i) => i.time,
|
|
632
632
|
(i) => i.value
|
|
633
633
|
);
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function oi(r, t) {
|
|
636
636
|
if (r.length <= t) return r;
|
|
637
637
|
const i = Math.ceil(r.length / t), e = [];
|
|
638
638
|
for (let a = 0; a < r.length; a += i) {
|
|
@@ -651,7 +651,7 @@ function ri(r, t) {
|
|
|
651
651
|
}
|
|
652
652
|
return e;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function ri(r, t, i, e) {
|
|
655
655
|
if (t >= r.length || t < 3) return r;
|
|
656
656
|
const a = [r[0]], o = (r.length - 2) / (t - 2);
|
|
657
657
|
let s = 0;
|
|
@@ -674,45 +674,45 @@ function ai(r, t, i, e) {
|
|
|
674
674
|
}
|
|
675
675
|
return a.push(r[r.length - 1]), a;
|
|
676
676
|
}
|
|
677
|
-
const
|
|
677
|
+
const fe = /* @__PURE__ */ new Map(), ge = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map();
|
|
678
678
|
function Kt(r) {
|
|
679
679
|
return [parseInt(r.slice(1, 3), 16), parseInt(r.slice(3, 5), 16), parseInt(r.slice(5, 7), 16)];
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function Ce(r, t, i) {
|
|
682
682
|
return `#${r.toString(16).padStart(2, "0")}${t.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`;
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function bt(r, t) {
|
|
685
685
|
if (r.startsWith("rgba")) return r.replace(/[\d.]+\)\s*$/, `${t})`);
|
|
686
686
|
if (r.startsWith("rgb(")) return r.replace(/^rgb\((.*)\)$/i, `rgba($1, ${t})`);
|
|
687
687
|
const i = r + t;
|
|
688
|
-
let e =
|
|
688
|
+
let e = fe.get(i);
|
|
689
689
|
if (e) return e;
|
|
690
690
|
const [a, o, s] = Kt(r);
|
|
691
|
-
return e = `rgba(${a}, ${o}, ${s}, ${t})`,
|
|
691
|
+
return e = `rgba(${a}, ${o}, ${s}, ${t})`, fe.set(i, e), e;
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function ai(r, t) {
|
|
694
694
|
const i = r + t;
|
|
695
|
-
let e =
|
|
695
|
+
let e = ge.get(i);
|
|
696
696
|
if (e) return e;
|
|
697
697
|
const [a, o, s] = Kt(r);
|
|
698
|
-
return e =
|
|
698
|
+
return e = Ce(
|
|
699
699
|
Math.min(255, Math.round(a + (255 - a) * t)),
|
|
700
700
|
Math.min(255, Math.round(o + (255 - o) * t)),
|
|
701
701
|
Math.min(255, Math.round(s + (255 - s) * t))
|
|
702
|
-
),
|
|
702
|
+
), ge.set(i, e), e;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function si(r, t) {
|
|
705
705
|
const i = r + t;
|
|
706
|
-
let e =
|
|
706
|
+
let e = pe.get(i);
|
|
707
707
|
if (e) return e;
|
|
708
708
|
const [a, o, s] = Kt(r);
|
|
709
|
-
return e =
|
|
709
|
+
return e = Ce(
|
|
710
710
|
Math.max(0, Math.round(a * (1 - t))),
|
|
711
711
|
Math.max(0, Math.round(o * (1 - t))),
|
|
712
712
|
Math.max(0, Math.round(s * (1 - t)))
|
|
713
|
-
),
|
|
713
|
+
), pe.set(i, e), e;
|
|
714
714
|
}
|
|
715
|
-
const
|
|
715
|
+
const ni = {
|
|
716
716
|
upColor: "#26a69a",
|
|
717
717
|
downColor: "#ef5350",
|
|
718
718
|
wickUpColor: "#26a69a",
|
|
@@ -721,7 +721,7 @@ const li = {
|
|
|
721
721
|
};
|
|
722
722
|
class Xt {
|
|
723
723
|
constructor(t, i) {
|
|
724
|
-
w(this, "store"), w(this, "options"), this.store = t, this.options = { ...
|
|
724
|
+
w(this, "store"), w(this, "options"), this.store = t, this.options = { ...ni, ...i };
|
|
725
725
|
}
|
|
726
726
|
updateOptions(t) {
|
|
727
727
|
this.options = { ...this.options, ...t };
|
|
@@ -733,7 +733,7 @@ class Xt {
|
|
|
733
733
|
const { scope: i, timeScale: e, yScale: a, dataInterval: o } = t, { context: s, horizontalPixelRatio: n } = i, l = e.getRange();
|
|
734
734
|
let h = this.store.getVisibleData(l.from, l.to);
|
|
735
735
|
const d = i.mediaSize.width;
|
|
736
|
-
if (h.length > d * 2 && (h =
|
|
736
|
+
if (h.length > d * 2 && (h = oi(h, Math.round(d * 1.5))), h.length === 0) return;
|
|
737
737
|
const g = e.barWidthBitmap(o), f = Math.max(1, Math.round(g * this.options.bodyWidthRatio) - 2), p = Math.floor(f / 2), m = Math.max(1, Math.round(n)), b = Math.round(a.getMediaHeight() * i.verticalPixelRatio);
|
|
738
738
|
this.drawVolume(s, h, e, b, g, o);
|
|
739
739
|
const u = [], v = [];
|
|
@@ -766,7 +766,7 @@ class Xt {
|
|
|
766
766
|
for (const p of i)
|
|
767
767
|
p.volume !== void 0 && p.volume > n && (n = p.volume);
|
|
768
768
|
if (n === 0) return;
|
|
769
|
-
const l = a * 0.2, h = Math.max(1, o - 2), d = Math.floor(h / 2), g =
|
|
769
|
+
const l = a * 0.2, h = Math.max(1, o - 2), d = Math.floor(h / 2), g = bt(this.options.upColor, 0.2), f = bt(this.options.downColor, 0.2);
|
|
770
770
|
for (const p of i) {
|
|
771
771
|
if (p.volume === void 0 || p.volume === 0) continue;
|
|
772
772
|
const m = e.timeToBitmapX(p.time), b = Math.max(1, p.volume / n * l), u = p.close >= p.open;
|
|
@@ -780,7 +780,7 @@ class Xt {
|
|
|
780
780
|
const m = e.timeToBitmapX(p.time), b = a.valueToBitmapY(p.high), u = a.valueToBitmapY(p.low), v = m - Math.floor(n / 2);
|
|
781
781
|
t.fillRect(v, b, n, u - b);
|
|
782
782
|
}
|
|
783
|
-
const d = this.options.candleGradient !== !1, g = d ?
|
|
783
|
+
const d = this.options.candleGradient !== !1, g = d ? ai(l, 0.2) : l, f = d ? si(l, 0.15) : l;
|
|
784
784
|
d || (t.fillStyle = l);
|
|
785
785
|
for (const p of i) {
|
|
786
786
|
const m = e.timeToBitmapX(p.time), b = a.valueToBitmapY(p.open), u = a.valueToBitmapY(p.close), v = Math.min(b, u), y = Math.max(1, Math.abs(u - b));
|
|
@@ -792,16 +792,16 @@ class Xt {
|
|
|
792
792
|
}
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
|
-
const
|
|
795
|
+
const li = {
|
|
796
796
|
colors: ["#2962FF"],
|
|
797
797
|
lineWidth: 1,
|
|
798
798
|
areaFill: !0,
|
|
799
799
|
pulse: !0,
|
|
800
800
|
stacking: "off"
|
|
801
801
|
};
|
|
802
|
-
class
|
|
802
|
+
class G {
|
|
803
803
|
constructor(t, i) {
|
|
804
|
-
w(this, "stores"), w(this, "options"), w(this, "areaGradientCache", /* @__PURE__ */ new Map()), this.stores = Array.from({ length: t }, () => new Jt()), this.options = { ...
|
|
804
|
+
w(this, "stores"), w(this, "options"), w(this, "areaGradientCache", /* @__PURE__ */ new Map()), this.stores = Array.from({ length: t }, () => new Jt()), this.options = { ...li, ...i };
|
|
805
805
|
}
|
|
806
806
|
get store() {
|
|
807
807
|
return this.stores[0];
|
|
@@ -860,7 +860,7 @@ class H {
|
|
|
860
860
|
if (!this.stores[d].isVisible()) continue;
|
|
861
861
|
let g = this.stores[d].getVisibleData(s.from, s.to);
|
|
862
862
|
const f = i.mediaSize.width;
|
|
863
|
-
if (g.length > f * 2 && (g =
|
|
863
|
+
if (g.length > f * 2 && (g = ue(g, Math.round(f * 1.5))), g.length < 2) continue;
|
|
864
864
|
const p = this.options.colors[d % this.options.colors.length];
|
|
865
865
|
o.beginPath(), o.moveTo(e.timeToBitmapX(g[0].time), a.valueToBitmapY(g[0].value));
|
|
866
866
|
for (let m = 1; m < g.length; m++)
|
|
@@ -870,7 +870,7 @@ class H {
|
|
|
870
870
|
o.lineTo(b, u), o.lineTo(m, u), o.closePath();
|
|
871
871
|
const v = String(d), y = this.areaGradientCache.get(v);
|
|
872
872
|
let x;
|
|
873
|
-
y && y.bottomY === u && y.color === p ? x = y.gradient : (x = o.createLinearGradient(0, 0, 0, u), x.addColorStop(0,
|
|
873
|
+
y && y.bottomY === u && y.color === p ? x = y.gradient : (x = o.createLinearGradient(0, 0, 0, u), x.addColorStop(0, bt(p, 0.12)), x.addColorStop(1, bt(p, 0.01)), this.areaGradientCache.set(v, { gradient: x, bottomY: u, color: p })), o.fillStyle = x, o.fill();
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
876
|
}
|
|
@@ -878,7 +878,7 @@ class H {
|
|
|
878
878
|
renderStacked(t, i) {
|
|
879
879
|
const { scope: e, timeScale: a, yScale: o } = t, { context: s } = e, n = a.getRange(), { verticalPixelRatio: l } = e, h = Math.max(1, Math.round(this.options.lineWidth * l)), d = e.mediaSize.width, g = this.stores.map((u) => {
|
|
880
880
|
let v = u.getVisibleData(n.from, n.to);
|
|
881
|
-
return v.length > d * 2 && (v =
|
|
881
|
+
return v.length > d * 2 && (v = ue(v, Math.round(d * 1.5))), v;
|
|
882
882
|
}), f = /* @__PURE__ */ new Set();
|
|
883
883
|
for (const u of g)
|
|
884
884
|
for (const v of u) f.add(v.time);
|
|
@@ -917,7 +917,7 @@ class H {
|
|
|
917
917
|
s.lineTo(y[C][0], y[C][1]);
|
|
918
918
|
for (let C = x.length - 1; C >= 0; C--)
|
|
919
919
|
s.lineTo(x[C][0], x[C][1]);
|
|
920
|
-
s.closePath(), s.fillStyle =
|
|
920
|
+
s.closePath(), s.fillStyle = bt(v, 0.25), s.fill();
|
|
921
921
|
}
|
|
922
922
|
s.beginPath(), s.moveTo(y[0][0], y[0][1]);
|
|
923
923
|
for (let C = 1; C < y.length; C++)
|
|
@@ -932,42 +932,36 @@ class H {
|
|
|
932
932
|
const s = this.stores[o].last();
|
|
933
933
|
if (!s) continue;
|
|
934
934
|
const n = this.options.colors[o % this.options.colors.length];
|
|
935
|
-
this.drawPulse(
|
|
936
|
-
t,
|
|
937
|
-
i.timeToBitmapX(s.time),
|
|
938
|
-
e.valueToBitmapY(s.value),
|
|
939
|
-
n,
|
|
940
|
-
a
|
|
941
|
-
);
|
|
935
|
+
this.drawPulse(t, i.timeToBitmapX(s.time), e.valueToBitmapY(s.value), n, a);
|
|
942
936
|
}
|
|
943
937
|
}
|
|
944
938
|
drawPulse(t, i, e, a, o) {
|
|
945
939
|
const s = 3 * o, n = 0.4 + 0.6 * Math.abs(Math.sin(performance.now() / 600)), l = s + 4 * o * n;
|
|
946
|
-
t.beginPath(), t.arc(i, e, l, 0, Math.PI * 2), t.fillStyle =
|
|
940
|
+
t.beginPath(), t.arc(i, e, l, 0, Math.PI * 2), t.fillStyle = bt(a, n * 0.3), t.fill(), t.beginPath(), t.arc(i, e, s, 0, Math.PI * 2), t.fillStyle = a, t.fill();
|
|
947
941
|
}
|
|
948
942
|
}
|
|
949
|
-
const
|
|
943
|
+
const ci = {
|
|
950
944
|
innerRadiusRatio: 0,
|
|
951
945
|
padAngle: 0.02,
|
|
952
946
|
strokeColor: "transparent",
|
|
953
947
|
strokeWidth: 0
|
|
954
|
-
},
|
|
955
|
-
function
|
|
948
|
+
}, Pt = Math.PI * 2;
|
|
949
|
+
function hi(r) {
|
|
956
950
|
if (!r.startsWith("#")) return !1;
|
|
957
951
|
const t = parseInt(r.slice(1, 3), 16), i = parseInt(r.slice(3, 5), 16), e = parseInt(r.slice(5, 7), 16);
|
|
958
952
|
return t * 0.299 + i * 0.587 + e * 0.114 > 150;
|
|
959
953
|
}
|
|
960
|
-
function
|
|
954
|
+
function di(r, t) {
|
|
961
955
|
if (!r.startsWith("#")) return r;
|
|
962
956
|
const i = Math.min(255, parseInt(r.slice(1, 3), 16) + Math.round(255 * t)), e = Math.min(255, parseInt(r.slice(3, 5), 16) + Math.round(255 * t)), a = Math.min(255, parseInt(r.slice(5, 7), 16) + Math.round(255 * t));
|
|
963
957
|
return `#${i.toString(16).padStart(2, "0")}${e.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}`;
|
|
964
958
|
}
|
|
965
|
-
function
|
|
959
|
+
function ui(r, t, i) {
|
|
966
960
|
return r + (t - r) * Math.min(1, i);
|
|
967
961
|
}
|
|
968
|
-
class
|
|
962
|
+
class lt {
|
|
969
963
|
constructor(t) {
|
|
970
|
-
w(this, "data", []), w(this, "options"), w(this, "hoverIndex", -1), w(this, "sliceOffsets", []), w(this, "lastRenderTime", 0), this.options = { ...
|
|
964
|
+
w(this, "data", []), w(this, "options"), w(this, "hoverIndex", -1), w(this, "sliceOffsets", []), w(this, "lastRenderTime", 0), this.options = { ...ci, ...t };
|
|
971
965
|
}
|
|
972
966
|
getData() {
|
|
973
967
|
return this.data;
|
|
@@ -990,10 +984,10 @@ class ct {
|
|
|
990
984
|
const s = e / 2, n = a / 2, l = Math.min(e, a) / 2 * 0.85, h = l * this.options.innerRadiusRatio, d = t - s, g = i - n, f = Math.sqrt(d * d + g * g);
|
|
991
985
|
if (f > l || f < h) return -1;
|
|
992
986
|
let p = Math.atan2(g, d) + Math.PI / 2;
|
|
993
|
-
p < 0 && (p +=
|
|
987
|
+
p < 0 && (p += Pt);
|
|
994
988
|
let m = 0;
|
|
995
989
|
for (let b = 0; b < this.data.length; b++) {
|
|
996
|
-
const u = this.data[b].value / o *
|
|
990
|
+
const u = this.data[b].value / o * Pt;
|
|
997
991
|
if (p >= m && p < m + u) return b;
|
|
998
992
|
m += u;
|
|
999
993
|
}
|
|
@@ -1017,30 +1011,30 @@ class ct {
|
|
|
1017
1011
|
for (; this.sliceOffsets.length < this.data.length; ) this.sliceOffsets.push(0);
|
|
1018
1012
|
for (let k = 0; k < this.data.length; k++) {
|
|
1019
1013
|
const D = k === this.hoverIndex ? 1 : 0;
|
|
1020
|
-
this.sliceOffsets[k] =
|
|
1014
|
+
this.sliceOffsets[k] = ui(this.sliceOffsets[k], D, d * l);
|
|
1021
1015
|
}
|
|
1022
1016
|
const g = this.options.colors ?? e.seriesColors, f = o.width / 2, p = o.height / 2, m = Math.min(o.width, o.height) / 2 * 0.85, b = m * this.options.innerRadiusRatio, u = this.options.padAngle, { strokeColor: v, strokeWidth: y } = this.options, x = 8 * s;
|
|
1023
1017
|
let C = -Math.PI / 2;
|
|
1024
1018
|
for (let k = 0; k < this.data.length; k++) {
|
|
1025
|
-
const D = this.data[k], z = D.value / h *
|
|
1026
|
-
a.beginPath(), a.arc(
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1019
|
+
const D = this.data[k], z = D.value / h * Pt, _ = C + u / 2, P = C + z - u / 2, X = C + z / 2, H = D.color ?? g[k % g.length], Q = this.sliceOffsets[k] * x, U = Math.cos(X) * Q, nt = Math.sin(X) * Q, E = f + U, O = p + nt;
|
|
1020
|
+
a.beginPath(), a.arc(E, O, m, _, P), b > 0 ? a.arc(E, O, b, P, _, !0) : a.lineTo(E, O), a.closePath();
|
|
1021
|
+
const A = a.createRadialGradient(E, O, b || 0, E, O, m);
|
|
1022
|
+
A.addColorStop(0, di(H, 0.15)), A.addColorStop(1, H), a.fillStyle = A, this.sliceOffsets[k] > 0.01 && (a.shadowColor = "rgba(0,0,0,0.25)", a.shadowBlur = 12 * s * this.sliceOffsets[k], a.shadowOffsetX = U * 0.3, a.shadowOffsetY = nt * 0.3), a.fill(), a.shadowColor = "transparent", a.shadowBlur = 0, a.shadowOffsetX = 0, a.shadowOffsetY = 0, y > 0 && v !== "transparent" && (a.strokeStyle = v, a.lineWidth = y, a.stroke()), C += z;
|
|
1029
1023
|
}
|
|
1030
1024
|
C = -Math.PI / 2;
|
|
1031
1025
|
const T = b > 0 ? (m + b) / 2 : m * 0.65;
|
|
1032
1026
|
a.textAlign = "center", a.textBaseline = "middle", a.font = `${11 * s}px ${e.typography.fontFamily}`;
|
|
1033
1027
|
for (let k = 0; k < this.data.length; k++) {
|
|
1034
|
-
const D = this.data[k], z = D.value / h *
|
|
1028
|
+
const D = this.data[k], z = D.value / h * Pt;
|
|
1035
1029
|
if (z > 0.3) {
|
|
1036
|
-
const
|
|
1037
|
-
a.fillStyle =
|
|
1030
|
+
const _ = C + z / 2, P = this.sliceOffsets[k] * x, X = f + Math.cos(_) * (T + P), H = p + Math.sin(_) * (T + P), Q = D.color ?? g[k % g.length];
|
|
1031
|
+
a.fillStyle = hi(Q) ? "#000000" : "#ffffff", a.fillText(D.label, X, H);
|
|
1038
1032
|
}
|
|
1039
1033
|
C += z;
|
|
1040
1034
|
}
|
|
1041
1035
|
}
|
|
1042
1036
|
}
|
|
1043
|
-
const
|
|
1037
|
+
const fi = {
|
|
1044
1038
|
background: "#131722",
|
|
1045
1039
|
chartGradient: ["#1a1f2e", "#101318"],
|
|
1046
1040
|
typography: {
|
|
@@ -1099,19 +1093,19 @@ const gi = {
|
|
|
1099
1093
|
textColor: "#d1d4dc",
|
|
1100
1094
|
borderColor: "rgba(42, 46, 57, 0.8)"
|
|
1101
1095
|
}
|
|
1102
|
-
},
|
|
1096
|
+
}, rt = {
|
|
1103
1097
|
top: 20,
|
|
1104
1098
|
bottom: 20,
|
|
1105
1099
|
right: { intervals: 3 },
|
|
1106
1100
|
left: { intervals: 0 }
|
|
1107
1101
|
};
|
|
1108
|
-
class
|
|
1102
|
+
class gi extends Bt {
|
|
1109
1103
|
constructor({ padding: t } = {}) {
|
|
1110
1104
|
super(), w(this, "_visibleRange", { from: 0, to: 0 }), w(this, "_yRange", { min: 0, max: 0 }), w(this, "_autoScroll", !0), w(this, "padding"), w(this, "dataInterval", 6e4), w(this, "_dataStart", null), w(this, "_dataEnd", null), w(this, "_animating", !1), w(this, "animStartTime", 0), w(this, "animDuration", 0), w(this, "animFrom", { from: 0, to: 0 }), w(this, "animTo", { from: 0, to: 0 }), this.padding = {
|
|
1111
|
-
top: (t == null ? void 0 : t.top) ??
|
|
1112
|
-
bottom: (t == null ? void 0 : t.bottom) ??
|
|
1113
|
-
right: (t == null ? void 0 : t.right) ??
|
|
1114
|
-
left: (t == null ? void 0 : t.left) ??
|
|
1105
|
+
top: (t == null ? void 0 : t.top) ?? rt.top,
|
|
1106
|
+
bottom: (t == null ? void 0 : t.bottom) ?? rt.bottom,
|
|
1107
|
+
right: (t == null ? void 0 : t.right) ?? rt.right,
|
|
1108
|
+
left: (t == null ? void 0 : t.left) ?? rt.left
|
|
1115
1109
|
};
|
|
1116
1110
|
}
|
|
1117
1111
|
/**
|
|
@@ -1140,10 +1134,10 @@ class pi extends zt {
|
|
|
1140
1134
|
/** Replace padding configuration. Only updates fields that are provided; others keep defaults. */
|
|
1141
1135
|
setPadding(t) {
|
|
1142
1136
|
this.padding = {
|
|
1143
|
-
top: (t == null ? void 0 : t.top) ??
|
|
1144
|
-
bottom: (t == null ? void 0 : t.bottom) ??
|
|
1145
|
-
right: (t == null ? void 0 : t.right) ??
|
|
1146
|
-
left: (t == null ? void 0 : t.left) ??
|
|
1137
|
+
top: (t == null ? void 0 : t.top) ?? rt.top,
|
|
1138
|
+
bottom: (t == null ? void 0 : t.bottom) ?? rt.bottom,
|
|
1139
|
+
right: (t == null ? void 0 : t.right) ?? rt.right,
|
|
1140
|
+
left: (t == null ? void 0 : t.left) ?? rt.left
|
|
1147
1141
|
};
|
|
1148
1142
|
}
|
|
1149
1143
|
setDataStart(t) {
|
|
@@ -1223,27 +1217,27 @@ class pi extends zt {
|
|
|
1223
1217
|
this.cancelAnimation(), this.removeAllListeners();
|
|
1224
1218
|
}
|
|
1225
1219
|
}
|
|
1226
|
-
let
|
|
1227
|
-
var
|
|
1228
|
-
class
|
|
1220
|
+
let pi = 0;
|
|
1221
|
+
var Y, B, V, ft, wt, M, W, St, N, ot, $, tt, Ht, gt, at, kt, ht, pt, Mt, Wt, K, q, mt;
|
|
1222
|
+
class mi extends Bt {
|
|
1229
1223
|
constructor(t, i) {
|
|
1230
1224
|
var e, a, o;
|
|
1231
|
-
super(), L(this,
|
|
1225
|
+
super(), L(this, pt), L(this, Y), L(this, B), L(this, V), L(this, ft), w(this, "timeScale"), w(this, "yScale"), L(this, wt), L(this, M, []), L(this, W), L(this, St), L(this, N, 6e4), L(this, ot, null), L(this, $, {}), L(this, tt, null), L(this, Ht, !1), L(this, gt, {}), L(this, at, 0), L(this, kt, !1), L(this, ht, !1), L(this, Wt, 0), L(this, K, 0), L(this, q, 0), L(this, mt, !1), i != null && i.axis && (R(this, gt, i.axis), R(this, $, { min: (e = i.axis.y) == null ? void 0 : e.min, max: (a = i.axis.y) == null ? void 0 : a.max })), R(this, W, (i == null ? void 0 : i.theme) ?? fi), R(this, St, (i == null ? void 0 : i.grid) !== !1), R(this, Y, new Oe(t)), R(this, B, new gi({ padding: i == null ? void 0 : i.padding })), this.timeScale = new ti(), this.yScale = new ei(), R(this, V, new de(() => this.renderMain())), R(this, ft, new de(() => this.renderOverlay()));
|
|
1232
1226
|
const s = (i == null ? void 0 : i.interactive) !== !1;
|
|
1233
|
-
R(this,
|
|
1234
|
-
this.syncScales(), c(this,
|
|
1235
|
-
}), c(this,
|
|
1227
|
+
R(this, wt, s ? new je(c(this, Y).canvas, c(this, B), this.timeScale, this.yScale) : null), c(this, B).on("change", () => {
|
|
1228
|
+
this.syncScales(), c(this, V).markDirty(), this.emit("viewportChange");
|
|
1229
|
+
}), c(this, Y).on("resize", () => {
|
|
1236
1230
|
this.updateScales(!0), this.renderMain(), this.emit("viewportChange");
|
|
1237
|
-
}), (o = c(this,
|
|
1238
|
-
R(this,
|
|
1231
|
+
}), (o = c(this, wt)) == null || o.on("crosshairMove", (n) => {
|
|
1232
|
+
R(this, ot, n), c(this, ft).markDirty(), this.emit("crosshairMove", n), this.updatePieHover(n);
|
|
1239
1233
|
});
|
|
1240
1234
|
}
|
|
1241
1235
|
get yAxisWidth() {
|
|
1242
|
-
const t = c(this,
|
|
1236
|
+
const t = c(this, gt).y;
|
|
1243
1237
|
return (t == null ? void 0 : t.visible) === !1 ? 0 : (t == null ? void 0 : t.width) ?? 55;
|
|
1244
1238
|
}
|
|
1245
1239
|
get xAxisHeight() {
|
|
1246
|
-
const t = c(this,
|
|
1240
|
+
const t = c(this, gt).x;
|
|
1247
1241
|
return (t == null ? void 0 : t.visible) === !1 ? 0 : (t == null ? void 0 : t.height) ?? 30;
|
|
1248
1242
|
}
|
|
1249
1243
|
/** Add a candlestick (OHLC) series and return its unique ID. */
|
|
@@ -1255,10 +1249,10 @@ class bi extends zt {
|
|
|
1255
1249
|
wickDownColor: c(this, W).candlestick.wickDownColor,
|
|
1256
1250
|
bodyWidthRatio: 0.6,
|
|
1257
1251
|
...t
|
|
1258
|
-
}), a =
|
|
1252
|
+
}), a = Ft(this, pt, Mt).call(this, t == null ? void 0 : t.id);
|
|
1259
1253
|
return i.on("update", () => {
|
|
1260
1254
|
this.onDataChanged();
|
|
1261
|
-
}), c(this, M).push({ id: a, renderer: e, store: i, visible: !0 }), R(this,
|
|
1255
|
+
}), c(this, M).push({ id: a, renderer: e, store: i, visible: !0 }), R(this, tt, null), this.updateViewportPadding(), this.emit("seriesChange"), a;
|
|
1262
1256
|
}
|
|
1263
1257
|
addLineSeries(t, i) {
|
|
1264
1258
|
let e, a;
|
|
@@ -1268,20 +1262,20 @@ class bi extends zt {
|
|
|
1268
1262
|
const { layers: n, ...l } = t ?? {};
|
|
1269
1263
|
e = n ?? 1, a = l;
|
|
1270
1264
|
}
|
|
1271
|
-
const o = new
|
|
1265
|
+
const o = new G(e, {
|
|
1272
1266
|
colors: e === 1 ? [c(this, W).line.color] : c(this, W).seriesColors.slice(0, e),
|
|
1273
1267
|
lineWidth: c(this, W).line.width,
|
|
1274
1268
|
areaFill: !0,
|
|
1275
1269
|
...a
|
|
1276
|
-
}), s =
|
|
1270
|
+
}), s = Ft(this, pt, Mt).call(this, a == null ? void 0 : a.id);
|
|
1277
1271
|
for (const n of o.stores)
|
|
1278
1272
|
n.on("update", () => this.onDataChanged());
|
|
1279
|
-
return c(this, M).push({ id: s, label: a == null ? void 0 : a.label, renderer: o, store: o.stores[0], visible: !0 }), R(this,
|
|
1273
|
+
return c(this, M).push({ id: s, label: a == null ? void 0 : a.label, renderer: o, store: o.stores[0], visible: !0 }), R(this, tt, null), this.updateViewportPadding(), this.emit("seriesChange"), s;
|
|
1280
1274
|
}
|
|
1281
1275
|
/** Set data for a specific layer within a line series. */
|
|
1282
1276
|
setLineLayerData(t, i, e) {
|
|
1283
1277
|
const a = c(this, M).find((s) => s.id === t);
|
|
1284
|
-
if (!a || !(a.renderer instanceof
|
|
1278
|
+
if (!a || !(a.renderer instanceof G)) return;
|
|
1285
1279
|
const o = a.renderer.stores[i];
|
|
1286
1280
|
o && o.setData(e);
|
|
1287
1281
|
}
|
|
@@ -1293,69 +1287,69 @@ class bi extends zt {
|
|
|
1293
1287
|
const { layers: n, ...l } = t ?? {};
|
|
1294
1288
|
e = n ?? 1, a = l;
|
|
1295
1289
|
}
|
|
1296
|
-
const o = new
|
|
1290
|
+
const o = new Z(e, {
|
|
1297
1291
|
colors: c(this, W).seriesColors.slice(0, e),
|
|
1298
1292
|
barWidthRatio: 0.6,
|
|
1299
1293
|
...a
|
|
1300
|
-
}), s =
|
|
1294
|
+
}), s = Ft(this, pt, Mt).call(this, a == null ? void 0 : a.id);
|
|
1301
1295
|
for (const n of o.stores)
|
|
1302
1296
|
n.on("update", () => this.onDataChanged());
|
|
1303
|
-
return c(this, M).push({ id: s, label: a == null ? void 0 : a.label, renderer: o, store: o.stores[0], visible: !0 }), R(this,
|
|
1297
|
+
return c(this, M).push({ id: s, label: a == null ? void 0 : a.label, renderer: o, store: o.stores[0], visible: !0 }), R(this, tt, null), this.updateViewportPadding(), this.emit("seriesChange"), s;
|
|
1304
1298
|
}
|
|
1305
1299
|
/** Set data for a specific layer within a bar series. */
|
|
1306
1300
|
setBarLayerData(t, i, e) {
|
|
1307
1301
|
const a = c(this, M).find((s) => s.id === t);
|
|
1308
|
-
if (!a || !(a.renderer instanceof
|
|
1302
|
+
if (!a || !(a.renderer instanceof Z)) return;
|
|
1309
1303
|
const o = a.renderer.stores[i];
|
|
1310
1304
|
o && o.setData(e);
|
|
1311
1305
|
}
|
|
1312
1306
|
/** Add a pie/donut series. Set `innerRadiusRatio > 0` for donut. */
|
|
1313
1307
|
addPieSeries(t) {
|
|
1314
|
-
const i = new
|
|
1315
|
-
return c(this, M).push({ id: e, label: t == null ? void 0 : t.label, renderer: i, store: null, visible: !0 }), R(this,
|
|
1308
|
+
const i = new lt(t), e = Ft(this, pt, Mt).call(this, t == null ? void 0 : t.id);
|
|
1309
|
+
return c(this, M).push({ id: e, label: t == null ? void 0 : t.label, renderer: i, store: null, visible: !0 }), R(this, tt, null), this.updateViewportPadding(), this.emit("seriesChange"), e;
|
|
1316
1310
|
}
|
|
1317
1311
|
/** Set data for a pie/donut series. */
|
|
1318
1312
|
setPieData(t, i) {
|
|
1319
1313
|
const e = c(this, M).find((a) => a.id === t);
|
|
1320
|
-
!e || !(e.renderer instanceof
|
|
1314
|
+
!e || !(e.renderer instanceof lt) || (e.renderer.setData(i), c(this, V).markDirty(), this.emit("dataUpdate"));
|
|
1321
1315
|
}
|
|
1322
1316
|
/** Remove a series by ID and clean up its resources. */
|
|
1323
1317
|
removeSeries(t) {
|
|
1324
1318
|
const i = c(this, M).findIndex((e) => e.id === t);
|
|
1325
1319
|
if (i >= 0) {
|
|
1326
1320
|
const { renderer: e, store: a } = c(this, M)[i];
|
|
1327
|
-
if (e instanceof
|
|
1321
|
+
if (e instanceof G || e instanceof Z)
|
|
1328
1322
|
for (const o of e.stores) o.removeAllListeners();
|
|
1329
1323
|
else
|
|
1330
1324
|
a == null || a.removeAllListeners();
|
|
1331
|
-
c(this, M).splice(i, 1), R(this,
|
|
1325
|
+
c(this, M).splice(i, 1), R(this, tt, null), this.updateViewportPadding(), c(this, V).markDirty(), this.emit("seriesChange");
|
|
1332
1326
|
}
|
|
1333
1327
|
}
|
|
1334
1328
|
/** Replace all data for a series (batch load). Accepts `Date` objects for time fields. */
|
|
1335
1329
|
setSeriesData(t, i) {
|
|
1336
1330
|
const e = c(this, M).find((o) => o.id === t);
|
|
1337
1331
|
if (!(e != null && e.store)) return;
|
|
1338
|
-
const a = i.length > 0 && "open" in i[0] ?
|
|
1332
|
+
const a = i.length > 0 && "open" in i[0] ? Je(i) : Ke(i);
|
|
1339
1333
|
e.store.setData(a);
|
|
1340
1334
|
}
|
|
1341
1335
|
/** Append a new data point to the end of a series (real-time tick). */
|
|
1342
1336
|
appendData(t, i) {
|
|
1343
1337
|
const e = c(this, M).find((o) => o.id === t);
|
|
1344
1338
|
if (!(e != null && e.store)) return;
|
|
1345
|
-
const a = { ...i, time:
|
|
1339
|
+
const a = { ...i, time: At(i.time) };
|
|
1346
1340
|
e.store.append(a);
|
|
1347
1341
|
}
|
|
1348
1342
|
/** Update the last data point of a series in place (e.g. live candle update). */
|
|
1349
1343
|
updateData(t, i) {
|
|
1350
1344
|
const e = c(this, M).find((o) => o.id === t);
|
|
1351
1345
|
if (!(e != null && e.store)) return;
|
|
1352
|
-
const a = { ...i, time:
|
|
1346
|
+
const a = { ...i, time: At(i.time) };
|
|
1353
1347
|
e.store.updateLast(a);
|
|
1354
1348
|
}
|
|
1355
1349
|
/** Update visual options (color, width, etc.) for an existing series. */
|
|
1356
1350
|
updateSeriesOptions(t, i) {
|
|
1357
1351
|
const e = c(this, M).find((a) => a.id === t);
|
|
1358
|
-
e && ((e.renderer instanceof Xt || e.renderer instanceof
|
|
1352
|
+
e && ((e.renderer instanceof Xt || e.renderer instanceof G || e.renderer instanceof Z || e.renderer instanceof lt) && e.renderer.updateOptions(i), "label" in i && typeof i.label == "string" && (e.label = i.label), c(this, V).markDirty());
|
|
1359
1353
|
}
|
|
1360
1354
|
/**
|
|
1361
1355
|
* Batch multiple updates: suppress recomputes until `fn` returns.
|
|
@@ -1371,21 +1365,21 @@ class bi extends zt {
|
|
|
1371
1365
|
}
|
|
1372
1366
|
/** @deprecated Use {@link batch} instead. */
|
|
1373
1367
|
beginUpdate() {
|
|
1374
|
-
le(this,
|
|
1368
|
+
le(this, at)._++;
|
|
1375
1369
|
}
|
|
1376
1370
|
/** @deprecated Use {@link batch} instead. */
|
|
1377
1371
|
endUpdate() {
|
|
1378
|
-
--le(this,
|
|
1372
|
+
--le(this, at)._ <= 0 && (R(this, at, 0), c(this, kt) ? (R(this, kt, !1), R(this, ht, !1), this.onDataChanged()) : c(this, ht) && (R(this, ht, !1), this.updateYRange(!0), c(this, V).markDirty()));
|
|
1379
1373
|
}
|
|
1380
1374
|
/** Show or hide a series. Hidden series are not rendered and excluded from Y-range. */
|
|
1381
1375
|
setSeriesVisible(t, i) {
|
|
1382
1376
|
const e = c(this, M).find((a) => a.id === t);
|
|
1383
1377
|
if (!(!e || e.visible === i)) {
|
|
1384
|
-
if (e.visible = i, c(this,
|
|
1385
|
-
R(this,
|
|
1378
|
+
if (e.visible = i, c(this, at) > 0) {
|
|
1379
|
+
R(this, ht, !0);
|
|
1386
1380
|
return;
|
|
1387
1381
|
}
|
|
1388
|
-
this.updateYRange(!0), c(this,
|
|
1382
|
+
this.updateYRange(!0), c(this, V).markDirty();
|
|
1389
1383
|
}
|
|
1390
1384
|
}
|
|
1391
1385
|
isSeriesVisible(t) {
|
|
@@ -1397,15 +1391,15 @@ class bi extends zt {
|
|
|
1397
1391
|
const a = c(this, M).find((s) => s.id === t);
|
|
1398
1392
|
if (!a) return;
|
|
1399
1393
|
const o = a.renderer;
|
|
1400
|
-
if (o instanceof
|
|
1394
|
+
if (o instanceof Z || o instanceof G) {
|
|
1401
1395
|
const s = o.stores[i];
|
|
1402
1396
|
if (s) {
|
|
1403
1397
|
if (s.isVisible() === e) return;
|
|
1404
|
-
if (s.setVisible(e), c(this,
|
|
1405
|
-
R(this,
|
|
1398
|
+
if (s.setVisible(e), c(this, at) > 0) {
|
|
1399
|
+
R(this, ht, !0);
|
|
1406
1400
|
return;
|
|
1407
1401
|
}
|
|
1408
|
-
this.updateYRange(!0), c(this,
|
|
1402
|
+
this.updateYRange(!0), c(this, V).markDirty();
|
|
1409
1403
|
}
|
|
1410
1404
|
}
|
|
1411
1405
|
}
|
|
@@ -1414,13 +1408,13 @@ class bi extends zt {
|
|
|
1414
1408
|
const a = c(this, M).find((s) => s.id === t);
|
|
1415
1409
|
if (!a) return !0;
|
|
1416
1410
|
const o = a.renderer;
|
|
1417
|
-
return o instanceof
|
|
1411
|
+
return o instanceof Z || o instanceof G ? ((e = o.stores[i]) == null ? void 0 : e.isVisible()) ?? !0 : !0;
|
|
1418
1412
|
}
|
|
1419
1413
|
/** Auto-fit the viewport to show all data across every series. */
|
|
1420
1414
|
fitContent() {
|
|
1421
1415
|
const { first: t, last: i } = this.getDataBounds();
|
|
1422
1416
|
if (t === void 0 || i === void 0) return;
|
|
1423
|
-
const e = c(this,
|
|
1417
|
+
const e = c(this, Y).size.media.width - this.yAxisWidth;
|
|
1424
1418
|
c(this, B).fitToData(t, i, e, !0);
|
|
1425
1419
|
}
|
|
1426
1420
|
getVisibleRange() {
|
|
@@ -1430,7 +1424,7 @@ class bi extends zt {
|
|
|
1430
1424
|
return c(this, B).yRange;
|
|
1431
1425
|
}
|
|
1432
1426
|
getCrosshairPosition() {
|
|
1433
|
-
return c(this,
|
|
1427
|
+
return c(this, ot);
|
|
1434
1428
|
}
|
|
1435
1429
|
/** Get the last visible value and whether the absolute last point is on screen. */
|
|
1436
1430
|
getLastValue(t) {
|
|
@@ -1475,7 +1469,7 @@ class bi extends zt {
|
|
|
1475
1469
|
const e = c(this, M).find((n) => n.id === t);
|
|
1476
1470
|
if (!e || !e.visible) return null;
|
|
1477
1471
|
const a = e.renderer;
|
|
1478
|
-
if (!(a instanceof
|
|
1472
|
+
if (!(a instanceof Z) && !(a instanceof G) || a.stores.length <= 1) return null;
|
|
1479
1473
|
const o = a.getColors(), s = [];
|
|
1480
1474
|
for (let n = 0; n < a.stores.length; n++) {
|
|
1481
1475
|
if (!a.stores[n].isVisible()) continue;
|
|
@@ -1494,7 +1488,7 @@ class bi extends zt {
|
|
|
1494
1488
|
return s.length > 0 ? s : null;
|
|
1495
1489
|
}
|
|
1496
1490
|
getSeriesIds() {
|
|
1497
|
-
return c(this,
|
|
1491
|
+
return c(this, tt) || R(this, tt, c(this, M).map((t) => t.id)), c(this, tt).slice();
|
|
1498
1492
|
}
|
|
1499
1493
|
/** Get the primary display color for a series. */
|
|
1500
1494
|
getSeriesColor(t) {
|
|
@@ -1510,7 +1504,7 @@ class bi extends zt {
|
|
|
1510
1504
|
const i = c(this, M).find((o) => o.id === t);
|
|
1511
1505
|
if (!i) return null;
|
|
1512
1506
|
const e = i.renderer;
|
|
1513
|
-
if (!(e instanceof
|
|
1507
|
+
if (!(e instanceof Z) && !(e instanceof G)) return null;
|
|
1514
1508
|
const a = e.getColors();
|
|
1515
1509
|
return e.stores.map((o, s) => ({
|
|
1516
1510
|
color: a[s % a.length]
|
|
@@ -1519,7 +1513,7 @@ class bi extends zt {
|
|
|
1519
1513
|
/** Get all pie slices with computed colors and percentages. Returns null for non-pie series. */
|
|
1520
1514
|
getPieSlices(t) {
|
|
1521
1515
|
const i = c(this, M).find((s) => s.id === t);
|
|
1522
|
-
if (!i || !(i.renderer instanceof
|
|
1516
|
+
if (!i || !(i.renderer instanceof lt)) return null;
|
|
1523
1517
|
const e = i.renderer.getData();
|
|
1524
1518
|
if (e.length === 0) return null;
|
|
1525
1519
|
const a = e.reduce((s, n) => s + n.value, 0), o = c(this, W).seriesColors;
|
|
@@ -1533,7 +1527,7 @@ class bi extends zt {
|
|
|
1533
1527
|
/** Get the hovered pie slice info (label, value, percentage, color). Returns null if no hover. */
|
|
1534
1528
|
getPieHoverInfo(t) {
|
|
1535
1529
|
const i = c(this, M).find((l) => l.id === t);
|
|
1536
|
-
if (!i || !(i.renderer instanceof
|
|
1530
|
+
if (!i || !(i.renderer instanceof lt)) return null;
|
|
1537
1531
|
const e = i.renderer;
|
|
1538
1532
|
if (e.hoverIndex < 0) return null;
|
|
1539
1533
|
const a = e.getData(), o = a[e.hoverIndex];
|
|
@@ -1556,12 +1550,12 @@ class bi extends zt {
|
|
|
1556
1550
|
downColor: t.candlestick.downColor,
|
|
1557
1551
|
wickUpColor: t.candlestick.wickUpColor,
|
|
1558
1552
|
wickDownColor: t.candlestick.wickDownColor
|
|
1559
|
-
}) : e.renderer instanceof
|
|
1553
|
+
}) : e.renderer instanceof Z ? e.renderer.updateOptions({
|
|
1560
1554
|
colors: t.seriesColors.slice(0, e.renderer.stores.length)
|
|
1561
|
-
}) : e.renderer instanceof
|
|
1555
|
+
}) : e.renderer instanceof G && (e.renderer.stores.length === 1 ? e.renderer.getColor() === i && e.renderer.updateOptions({ colors: [t.line.color] }) : e.renderer.updateOptions({
|
|
1562
1556
|
colors: t.seriesColors.slice(0, e.renderer.stores.length)
|
|
1563
1557
|
}));
|
|
1564
|
-
c(this,
|
|
1558
|
+
c(this, V).markDirty();
|
|
1565
1559
|
}
|
|
1566
1560
|
getTheme() {
|
|
1567
1561
|
return c(this, W);
|
|
@@ -1570,16 +1564,16 @@ class bi extends zt {
|
|
|
1570
1564
|
setAxis(t) {
|
|
1571
1565
|
var i, e;
|
|
1572
1566
|
const a = this.yAxisWidth, o = this.xAxisHeight;
|
|
1573
|
-
R(this,
|
|
1567
|
+
R(this, gt, t);
|
|
1574
1568
|
const s = { min: (i = t.y) == null ? void 0 : i.min, max: (e = t.y) == null ? void 0 : e.max };
|
|
1575
|
-
R(this,
|
|
1569
|
+
R(this, $, s), R(this, mt, !1), this.updateYRange(!0), (this.yAxisWidth !== a || this.xAxisHeight !== o) && this.updateScales(!0), c(this, V).markDirty();
|
|
1576
1570
|
}
|
|
1577
1571
|
getMediaSize() {
|
|
1578
|
-
return c(this,
|
|
1572
|
+
return c(this, Y).size.media;
|
|
1579
1573
|
}
|
|
1580
1574
|
/** Returns layout metrics for the chart area, Y axis, and time axis. */
|
|
1581
1575
|
getLayout() {
|
|
1582
|
-
const t = c(this,
|
|
1576
|
+
const t = c(this, Y).size.media, i = this.yAxisWidth, e = this.xAxisHeight;
|
|
1583
1577
|
return {
|
|
1584
1578
|
chartArea: { x: 0, y: 0, width: t.width - i, height: t.height - e },
|
|
1585
1579
|
yAxisWidth: i,
|
|
@@ -1594,30 +1588,30 @@ class bi extends zt {
|
|
|
1594
1588
|
c(this, B).setPadding(t);
|
|
1595
1589
|
const { first: i, last: e } = this.getDataBounds();
|
|
1596
1590
|
if (i !== void 0 && e !== void 0) {
|
|
1597
|
-
const a = c(this,
|
|
1591
|
+
const a = c(this, Y).size.media.width - this.yAxisWidth;
|
|
1598
1592
|
c(this, B).fitToData(i, e, a, !1);
|
|
1599
1593
|
}
|
|
1600
|
-
this.syncScales(), c(this,
|
|
1594
|
+
this.syncScales(), c(this, V).markDirty();
|
|
1601
1595
|
}
|
|
1602
1596
|
/** Show or hide the background grid. Takes effect on the next render frame. */
|
|
1603
1597
|
setGrid(t) {
|
|
1604
|
-
R(this,
|
|
1598
|
+
R(this, St, t), c(this, V).markDirty();
|
|
1605
1599
|
}
|
|
1606
1600
|
/** Notify chart that a YLabel is present (affects right padding). */
|
|
1607
1601
|
setYLabel(t) {
|
|
1608
1602
|
R(this, Ht, t), this.updateViewportPadding();
|
|
1609
1603
|
}
|
|
1610
1604
|
updatePieHover(t) {
|
|
1611
|
-
const i = c(this,
|
|
1605
|
+
const i = c(this, Y).size;
|
|
1612
1606
|
for (const e of c(this, M))
|
|
1613
|
-
if (e.renderer instanceof
|
|
1607
|
+
if (e.renderer instanceof lt) {
|
|
1614
1608
|
const a = e.renderer.hoverIndex;
|
|
1615
1609
|
if (t) {
|
|
1616
1610
|
const o = t.mediaX * i.horizontalPixelRatio, s = t.mediaY * i.verticalPixelRatio;
|
|
1617
1611
|
e.renderer.hoverIndex = e.renderer.hitTest(o, s, i.bitmap.width, i.bitmap.height);
|
|
1618
1612
|
} else
|
|
1619
1613
|
e.renderer.hoverIndex = -1;
|
|
1620
|
-
e.renderer.hoverIndex !== a && c(this,
|
|
1614
|
+
e.renderer.hoverIndex !== a && c(this, V).markDirty();
|
|
1621
1615
|
}
|
|
1622
1616
|
}
|
|
1623
1617
|
updateViewportPadding() {
|
|
@@ -1625,7 +1619,7 @@ class bi extends zt {
|
|
|
1625
1619
|
/** Tear down the chart: cancel animations, remove listeners, and detach the canvas. */
|
|
1626
1620
|
destroy() {
|
|
1627
1621
|
var t;
|
|
1628
|
-
c(this, B).destroy(), c(this,
|
|
1622
|
+
c(this, B).destroy(), c(this, V).destroy(), c(this, ft).destroy(), (t = c(this, wt)) == null || t.destroy(), c(this, Y).destroy(), this.removeAllListeners();
|
|
1629
1623
|
}
|
|
1630
1624
|
/** Compute the earliest and latest timestamps across all series. */
|
|
1631
1625
|
getDataBounds() {
|
|
@@ -1638,8 +1632,8 @@ class bi extends zt {
|
|
|
1638
1632
|
return { first: t, last: i };
|
|
1639
1633
|
}
|
|
1640
1634
|
onDataChanged() {
|
|
1641
|
-
if (c(this,
|
|
1642
|
-
R(this,
|
|
1635
|
+
if (c(this, at) > 0) {
|
|
1636
|
+
R(this, kt, !0);
|
|
1643
1637
|
return;
|
|
1644
1638
|
}
|
|
1645
1639
|
this.updateDataInterval();
|
|
@@ -1647,15 +1641,15 @@ class bi extends zt {
|
|
|
1647
1641
|
t !== void 0 && c(this, B).setDataStart(t), i !== void 0 && c(this, B).setDataEnd(i);
|
|
1648
1642
|
let e = 0;
|
|
1649
1643
|
for (const o of c(this, M))
|
|
1650
|
-
if (o.renderer instanceof
|
|
1644
|
+
if (o.renderer instanceof G || o.renderer instanceof Z)
|
|
1651
1645
|
for (const s of o.renderer.stores) e += s.length;
|
|
1652
1646
|
else o.store && (e += o.store.length);
|
|
1653
|
-
const a = e - c(this,
|
|
1654
|
-
if (R(this,
|
|
1655
|
-
const { from: o, to: s } = c(this, B).visibleRange, n = o === 0 && s === 0, l = c(this,
|
|
1647
|
+
const a = e - c(this, Wt) > 5;
|
|
1648
|
+
if (R(this, Wt, e), t !== void 0 && i !== void 0) {
|
|
1649
|
+
const { from: o, to: s } = c(this, B).visibleRange, n = o === 0 && s === 0, l = c(this, Y).size.media.width - this.yAxisWidth;
|
|
1656
1650
|
n ? c(this, B).fitToData(t, i, l, !1) : a && c(this, B).autoScroll ? c(this, B).fitToData(t, i, l, !0) : !a && this.isLastPointVisible() && c(this, B).scrollToEnd(i, l);
|
|
1657
1651
|
}
|
|
1658
|
-
this.updateYRange(a), this.syncScales(), c(this,
|
|
1652
|
+
this.updateYRange(a), this.syncScales(), c(this, V).markDirty(), this.emit("dataUpdate");
|
|
1659
1653
|
}
|
|
1660
1654
|
/** Check whether the last data point of any series falls within the visible time range. */
|
|
1661
1655
|
isLastPointVisible() {
|
|
@@ -1673,7 +1667,7 @@ class bi extends zt {
|
|
|
1673
1667
|
const i = t.store.getAll();
|
|
1674
1668
|
if (i.length >= 2) {
|
|
1675
1669
|
const e = i.slice(0, 20).map((a) => a.time);
|
|
1676
|
-
R(this, N,
|
|
1670
|
+
R(this, N, qe(e)), c(this, B).setDataInterval(c(this, N));
|
|
1677
1671
|
break;
|
|
1678
1672
|
}
|
|
1679
1673
|
}
|
|
@@ -1681,7 +1675,7 @@ class bi extends zt {
|
|
|
1681
1675
|
updateYRange(t = !1) {
|
|
1682
1676
|
let i = 1 / 0, e = -1 / 0;
|
|
1683
1677
|
const a = c(this, B).visibleRange;
|
|
1684
|
-
let o = c(this,
|
|
1678
|
+
let o = c(this, $).min !== void 0 && c(this, $).min !== "auto" && typeof c(this, $).min != "number" || c(this, $).max !== void 0 && c(this, $).max !== "auto" && typeof c(this, $).max != "number" ? [] : null;
|
|
1685
1679
|
for (const h of c(this, M)) {
|
|
1686
1680
|
if (!h.visible) continue;
|
|
1687
1681
|
if (h.renderer.getValueRange) {
|
|
@@ -1703,17 +1697,17 @@ class bi extends zt {
|
|
|
1703
1697
|
}
|
|
1704
1698
|
}
|
|
1705
1699
|
if (i === 1 / 0 || e === -1 / 0) {
|
|
1706
|
-
R(this,
|
|
1700
|
+
R(this, mt, !1);
|
|
1707
1701
|
return;
|
|
1708
1702
|
}
|
|
1709
|
-
if (i = this.resolveBound(c(this,
|
|
1710
|
-
R(this, K, i), R(this, q, e), R(this,
|
|
1703
|
+
if (i = this.resolveBound(c(this, $).min, i, e, o ?? [], "min"), e = this.resolveBound(c(this, $).max, e, i, o ?? [], "max"), !c(this, mt) || t)
|
|
1704
|
+
R(this, K, i), R(this, q, e), R(this, mt, !0);
|
|
1711
1705
|
else {
|
|
1712
1706
|
R(this, K, c(this, K) + (i - c(this, K)) * 0.2), R(this, q, c(this, q) + (e - c(this, q)) * 0.2), i < c(this, K) && R(this, K, i), e > c(this, q) && R(this, q, e);
|
|
1713
1707
|
const h = Math.max(Math.abs(c(this, q) - c(this, K)) * 1e-4, 1e-3);
|
|
1714
|
-
(Math.abs(c(this, K) - i) > h || Math.abs(c(this, q) - e) > h) && c(this,
|
|
1708
|
+
(Math.abs(c(this, K) - i) > h || Math.abs(c(this, q) - e) > h) && c(this, V).markDirty();
|
|
1715
1709
|
}
|
|
1716
|
-
const s = c(this,
|
|
1710
|
+
const s = c(this, $).min !== void 0 && c(this, $).min !== "auto", n = c(this, $).max !== void 0 && c(this, $).max !== "auto", l = c(this, Y).size.media.height - this.xAxisHeight;
|
|
1717
1711
|
c(this, B).setYRange(c(this, K), c(this, q), l, s, n);
|
|
1718
1712
|
}
|
|
1719
1713
|
/** Resolve an {@link AxisBound} to a concrete numeric value. */
|
|
@@ -1734,24 +1728,24 @@ class bi extends zt {
|
|
|
1734
1728
|
* handler so DOM axis components always read fresh coordinates on re-render.
|
|
1735
1729
|
*/
|
|
1736
1730
|
syncScales() {
|
|
1737
|
-
const t = c(this,
|
|
1731
|
+
const t = c(this, Y).size;
|
|
1738
1732
|
if (t.media.width === 0 || t.media.height === 0) return;
|
|
1739
1733
|
const i = t.media.width - this.yAxisWidth, e = t.media.height - this.xAxisHeight;
|
|
1740
1734
|
this.timeScale.update(c(this, B).visibleRange, i, t.horizontalPixelRatio), this.yScale.update(c(this, B).yRange, e, t.verticalPixelRatio);
|
|
1741
1735
|
}
|
|
1742
1736
|
updateScales(t = !1) {
|
|
1743
|
-
const i = c(this,
|
|
1737
|
+
const i = c(this, Y).size;
|
|
1744
1738
|
if (i.media.width === 0 || i.media.height === 0) return;
|
|
1745
1739
|
const e = i.media.width - this.yAxisWidth, a = i.media.height - this.xAxisHeight;
|
|
1746
1740
|
this.timeScale.update(c(this, B).visibleRange, e, i.horizontalPixelRatio), this.yScale.update(c(this, B).yRange, a, i.verticalPixelRatio), this.updateYRange(t), this.yScale.update(c(this, B).yRange, a, i.verticalPixelRatio);
|
|
1747
1741
|
}
|
|
1748
1742
|
/** Expensive: background, grid, all series. Only on data/viewport/resize change. */
|
|
1749
1743
|
renderMain() {
|
|
1750
|
-
const t = c(this,
|
|
1744
|
+
const t = c(this, Y).size;
|
|
1751
1745
|
if (!(t.media.width === 0 || t.media.height === 0)) {
|
|
1752
|
-
c(this, B).tick(performance.now()) && c(this,
|
|
1746
|
+
c(this, B).tick(performance.now()) && c(this, V).markDirty(), this.updateScales(), c(this, Y).useMainLayer((i) => {
|
|
1753
1747
|
const { context: e, bitmapSize: a } = i, o = (t.media.width - this.yAxisWidth) * t.horizontalPixelRatio, s = (t.media.height - this.xAxisHeight) * t.verticalPixelRatio;
|
|
1754
|
-
e.clearRect(0, 0, a.width, a.height), e.save(), e.beginPath(), e.rect(0, 0, o, s), e.clip(), c(this,
|
|
1748
|
+
e.clearRect(0, 0, a.width, a.height), e.save(), e.beginPath(), e.rect(0, 0, o, s), e.clip(), c(this, St) && Xe(i, this.timeScale, this.yScale, c(this, W), c(this, N));
|
|
1755
1749
|
for (const n of c(this, M))
|
|
1756
1750
|
n.visible && n.renderer.render({
|
|
1757
1751
|
scope: i,
|
|
@@ -1763,8 +1757,8 @@ class bi extends zt {
|
|
|
1763
1757
|
e.restore();
|
|
1764
1758
|
});
|
|
1765
1759
|
for (const i of c(this, M))
|
|
1766
|
-
if (i.renderer instanceof
|
|
1767
|
-
c(this,
|
|
1760
|
+
if (i.renderer instanceof lt && i.renderer.needsAnimation) {
|
|
1761
|
+
c(this, V).markDirty();
|
|
1768
1762
|
break;
|
|
1769
1763
|
}
|
|
1770
1764
|
this.renderOverlay();
|
|
@@ -1772,25 +1766,25 @@ class bi extends zt {
|
|
|
1772
1766
|
}
|
|
1773
1767
|
/** Cheap overlay: crosshair, nearest-point dots, pulse animation. */
|
|
1774
1768
|
renderOverlay() {
|
|
1775
|
-
const t = c(this,
|
|
1769
|
+
const t = c(this, Y).size;
|
|
1776
1770
|
if (t.media.width === 0 || t.media.height === 0) return;
|
|
1777
1771
|
let i = !1;
|
|
1778
1772
|
for (const e of c(this, M))
|
|
1779
|
-
if (e.visible && e.renderer instanceof
|
|
1773
|
+
if (e.visible && e.renderer instanceof G && e.renderer.hasPulse) {
|
|
1780
1774
|
i = !0;
|
|
1781
1775
|
break;
|
|
1782
1776
|
}
|
|
1783
|
-
if (c(this,
|
|
1784
|
-
if (!c(this,
|
|
1777
|
+
if (c(this, Y).useOverlayLayer((e) => {
|
|
1778
|
+
if (!c(this, ot) && !i) return;
|
|
1785
1779
|
const a = (t.media.width - this.yAxisWidth) * t.horizontalPixelRatio, o = (t.media.height - this.xAxisHeight) * t.verticalPixelRatio;
|
|
1786
|
-
if (e.context.save(), e.context.beginPath(), e.context.rect(0, 0, a, o), e.context.clip(), c(this,
|
|
1787
|
-
const s = c(this,
|
|
1788
|
-
|
|
1780
|
+
if (e.context.save(), e.context.beginPath(), e.context.rect(0, 0, a, o), e.context.clip(), c(this, ot)) {
|
|
1781
|
+
const s = c(this, ot).mediaX * t.horizontalPixelRatio, n = c(this, ot).mediaY * t.verticalPixelRatio;
|
|
1782
|
+
$e(e, s, n, c(this, W));
|
|
1789
1783
|
for (const l of c(this, M))
|
|
1790
|
-
if (l.visible && l.renderer instanceof
|
|
1784
|
+
if (l.visible && l.renderer instanceof G) {
|
|
1791
1785
|
const h = l.renderer, d = h.getColors(), g = h.getStacking(), f = 4 * t.horizontalPixelRatio, p = [], m = [];
|
|
1792
1786
|
for (let u = 0; u < h.stores.length; u++) {
|
|
1793
|
-
const v = h.stores[u].findNearest(c(this,
|
|
1787
|
+
const v = h.stores[u].findNearest(c(this, ot).time, c(this, N));
|
|
1794
1788
|
v ? (p.push(v.value), m.push(v.time)) : (p.push(0), m.push(0));
|
|
1795
1789
|
}
|
|
1796
1790
|
const b = [];
|
|
@@ -1814,7 +1808,7 @@ class bi extends zt {
|
|
|
1814
1808
|
}
|
|
1815
1809
|
}
|
|
1816
1810
|
for (const s of c(this, M))
|
|
1817
|
-
s.visible && s.renderer instanceof
|
|
1811
|
+
s.visible && s.renderer instanceof G && s.renderer.hasPulse && s.renderer.drawPulseOverlay(
|
|
1818
1812
|
e.context,
|
|
1819
1813
|
this.timeScale,
|
|
1820
1814
|
this.yScale,
|
|
@@ -1825,7 +1819,7 @@ class bi extends zt {
|
|
|
1825
1819
|
const { from: e, to: a } = this.timeScale.getRange();
|
|
1826
1820
|
let o = !1;
|
|
1827
1821
|
for (const s of c(this, M))
|
|
1828
|
-
if (!(!s.visible || !(s.renderer instanceof
|
|
1822
|
+
if (!(!s.visible || !(s.renderer instanceof G) || !s.renderer.hasPulse)) {
|
|
1829
1823
|
for (const n of s.renderer.stores) {
|
|
1830
1824
|
const l = n.last();
|
|
1831
1825
|
if (l && l.time >= e && l.time <= a) {
|
|
@@ -1835,25 +1829,25 @@ class bi extends zt {
|
|
|
1835
1829
|
}
|
|
1836
1830
|
if (o) break;
|
|
1837
1831
|
}
|
|
1838
|
-
o && c(this,
|
|
1832
|
+
o && c(this, ft).markDirty();
|
|
1839
1833
|
}
|
|
1840
1834
|
}
|
|
1841
1835
|
}
|
|
1842
|
-
|
|
1836
|
+
Y = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakSet(), /**
|
|
1843
1837
|
* Return a series ID: use the provided hint if it's non-empty and not already taken,
|
|
1844
1838
|
* otherwise generate a new auto ID. Auto-generated IDs never collide with each other
|
|
1845
1839
|
* or with user-provided IDs because they use a monotonically increasing counter.
|
|
1846
1840
|
*/
|
|
1847
|
-
|
|
1841
|
+
Mt = function(r) {
|
|
1848
1842
|
if (r && !c(this, M).some((i) => i.id === r))
|
|
1849
1843
|
return r;
|
|
1850
1844
|
let t;
|
|
1851
1845
|
do
|
|
1852
|
-
t = `series_${++
|
|
1846
|
+
t = `series_${++pi}`;
|
|
1853
1847
|
while (c(this, M).some((i) => i.id === t));
|
|
1854
1848
|
return t;
|
|
1855
|
-
},
|
|
1856
|
-
const
|
|
1849
|
+
}, Wt = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap();
|
|
1850
|
+
const yo = {
|
|
1857
1851
|
background: "#ffffff",
|
|
1858
1852
|
chartGradient: ["#ffffff", "#f5f6f8"],
|
|
1859
1853
|
typography: {
|
|
@@ -1910,83 +1904,77 @@ const xo = {
|
|
|
1910
1904
|
borderColor: "rgba(0, 0, 0, 0.1)"
|
|
1911
1905
|
}
|
|
1912
1906
|
};
|
|
1913
|
-
function
|
|
1907
|
+
function bi(r) {
|
|
1914
1908
|
return parseInt(r.slice(1, 3), 16) * 0.299 + parseInt(r.slice(3, 5), 16) * 0.587 + parseInt(r.slice(5, 7), 16) * 0.114 < 128;
|
|
1915
1909
|
}
|
|
1916
1910
|
function I(r) {
|
|
1917
|
-
var t, i, e, a, o, s, n, l, h, d, g, f, p, m, b, u, v, y, x, C, T, k, D, z,
|
|
1918
|
-
const { background:
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
description: U,
|
|
1922
|
-
dark: G,
|
|
1923
|
-
fontUrl: O,
|
|
1924
|
-
backgroundImage: Z,
|
|
1925
|
-
backgroundSize: De,
|
|
1926
|
-
background: _,
|
|
1927
|
-
chartGradient: r.chartGradient ?? (G ? [Wt(_, 0.04), be(_, 0.06)] : [Wt(_, 0.06), _]),
|
|
1911
|
+
var t, i, e, a, o, s, n, l, h, d, g, f, p, m, b, u, v, y, x, C, T, k, D, z, _, P, X, H, Q;
|
|
1912
|
+
const { background: U, name: nt = "Custom", description: E, fontUrl: O = null } = r, A = bi(U), Te = A ? "#d1d4dc" : "#24292f", De = A ? "#787b86" : "#8b949e", re = A ? "#26a69a" : "#2da44e", ae = A ? "#ef5350" : "#cf222e", Be = A ? "#2962ff" : "#0969da", ze = A ? "rgba(42,46,57,0.6)" : "rgba(200,200,200,0.5)", Fe = A ? "rgba(150,150,150,0.5)" : "rgba(170,170,170,0.3)", se = A ? Lt(U, 0.1) : me(U, 0.05), Pe = A ? yt(U, 0.92) : yt(U, 0.95), Le = A ? yt(Lt(U, 0.15), 0.6) : "rgba(200,200,200,0.5)", We = _t, Et = ((t = r.candlestick) == null ? void 0 : t.upColor) ?? re, zt = ((i = r.candlestick) == null ? void 0 : i.downColor) ?? ae, vt = ((e = r.line) == null ? void 0 : e.color) ?? Be, ne = ((a = r.tooltip) == null ? void 0 : a.textColor) ?? Te, Ae = ((o = r.axis) == null ? void 0 : o.textColor) ?? De, Ie = ((s = r.typography) == null ? void 0 : s.fontFamily) ?? We, Ve = {
|
|
1913
|
+
background: U,
|
|
1914
|
+
chartGradient: r.chartGradient ?? (A ? [Lt(U, 0.04), me(U, 0.06)] : [Lt(U, 0.06), U]),
|
|
1928
1915
|
typography: {
|
|
1929
|
-
fontFamily:
|
|
1916
|
+
fontFamily: Ie,
|
|
1930
1917
|
fontSize: ((n = r.typography) == null ? void 0 : n.fontSize) ?? 12,
|
|
1931
1918
|
axisFontSize: ((l = r.typography) == null ? void 0 : l.axisFontSize) ?? 10,
|
|
1932
1919
|
yFontSize: ((h = r.typography) == null ? void 0 : h.yFontSize) ?? 11,
|
|
1933
1920
|
tooltipFontSize: ((d = r.typography) == null ? void 0 : d.tooltipFontSize) ?? ((g = r.typography) == null ? void 0 : g.fontSize) ?? 12
|
|
1934
1921
|
},
|
|
1935
1922
|
grid: {
|
|
1936
|
-
color: ((f = r.grid) == null ? void 0 : f.color) ??
|
|
1923
|
+
color: ((f = r.grid) == null ? void 0 : f.color) ?? ze,
|
|
1937
1924
|
style: ((p = r.grid) == null ? void 0 : p.style) ?? "dashed"
|
|
1938
1925
|
},
|
|
1939
1926
|
candlestick: {
|
|
1940
|
-
upColor:
|
|
1941
|
-
downColor:
|
|
1942
|
-
wickUpColor: ((m = r.candlestick) == null ? void 0 : m.wickUpColor) ??
|
|
1943
|
-
wickDownColor: ((b = r.candlestick) == null ? void 0 : b.wickDownColor) ??
|
|
1927
|
+
upColor: Et,
|
|
1928
|
+
downColor: zt,
|
|
1929
|
+
wickUpColor: ((m = r.candlestick) == null ? void 0 : m.wickUpColor) ?? Et,
|
|
1930
|
+
wickDownColor: ((b = r.candlestick) == null ? void 0 : b.wickDownColor) ?? zt
|
|
1944
1931
|
},
|
|
1945
1932
|
line: {
|
|
1946
|
-
color:
|
|
1933
|
+
color: vt,
|
|
1947
1934
|
width: ((u = r.line) == null ? void 0 : u.width) ?? 1,
|
|
1948
|
-
areaTopColor: ((v = r.line) == null ? void 0 : v.areaTopColor) ??
|
|
1949
|
-
areaBottomColor: ((y = r.line) == null ? void 0 : y.areaBottomColor) ??
|
|
1935
|
+
areaTopColor: ((v = r.line) == null ? void 0 : v.areaTopColor) ?? yt(vt, 0.08),
|
|
1936
|
+
areaBottomColor: ((y = r.line) == null ? void 0 : y.areaBottomColor) ?? yt(vt, 0.01)
|
|
1950
1937
|
},
|
|
1951
|
-
seriesColors: r.seriesColors ?? [
|
|
1938
|
+
seriesColors: r.seriesColors ?? [vt, re, ae],
|
|
1952
1939
|
bands: {
|
|
1953
|
-
upper: ((x = r.bands) == null ? void 0 : x.upper) ??
|
|
1954
|
-
lower: ((C = r.bands) == null ? void 0 : C.lower) ??
|
|
1940
|
+
upper: ((x = r.bands) == null ? void 0 : x.upper) ?? vt,
|
|
1941
|
+
lower: ((C = r.bands) == null ? void 0 : C.lower) ?? zt
|
|
1955
1942
|
},
|
|
1956
1943
|
crosshair: {
|
|
1957
|
-
color: ((T = r.crosshair) == null ? void 0 : T.color) ??
|
|
1944
|
+
color: ((T = r.crosshair) == null ? void 0 : T.color) ?? Fe,
|
|
1958
1945
|
labelBackground: ((k = r.crosshair) == null ? void 0 : k.labelBackground) ?? se,
|
|
1959
1946
|
labelTextColor: ((D = r.crosshair) == null ? void 0 : D.labelTextColor) ?? ne
|
|
1960
1947
|
},
|
|
1961
|
-
axis: { textColor:
|
|
1948
|
+
axis: { textColor: Ae },
|
|
1962
1949
|
yLabel: {
|
|
1963
|
-
upBackground: ((z = r.yLabel) == null ? void 0 : z.upBackground) ??
|
|
1964
|
-
downBackground: ((
|
|
1950
|
+
upBackground: ((z = r.yLabel) == null ? void 0 : z.upBackground) ?? Et,
|
|
1951
|
+
downBackground: ((_ = r.yLabel) == null ? void 0 : _.downBackground) ?? zt,
|
|
1965
1952
|
neutralBackground: ((P = r.yLabel) == null ? void 0 : P.neutralBackground) ?? se,
|
|
1966
|
-
textColor: ((
|
|
1953
|
+
textColor: ((X = r.yLabel) == null ? void 0 : X.textColor) ?? "#ffffff"
|
|
1967
1954
|
},
|
|
1968
1955
|
tooltip: {
|
|
1969
|
-
background: ((
|
|
1956
|
+
background: ((H = r.tooltip) == null ? void 0 : H.background) ?? Pe,
|
|
1970
1957
|
textColor: ne,
|
|
1971
|
-
borderColor: ((Q = r.tooltip) == null ? void 0 : Q.borderColor) ??
|
|
1958
|
+
borderColor: ((Q = r.tooltip) == null ? void 0 : Q.borderColor) ?? Le
|
|
1972
1959
|
}
|
|
1973
1960
|
};
|
|
1961
|
+
return { name: nt, description: E, fontUrl: O, dark: A, theme: Ve };
|
|
1974
1962
|
}
|
|
1975
|
-
function
|
|
1963
|
+
function yt(r, t) {
|
|
1976
1964
|
const i = parseInt(r.slice(1, 3), 16), e = parseInt(r.slice(3, 5), 16), a = parseInt(r.slice(5, 7), 16);
|
|
1977
1965
|
return `rgba(${i}, ${e}, ${a}, ${t})`;
|
|
1978
1966
|
}
|
|
1979
|
-
function
|
|
1967
|
+
function Lt(r, t) {
|
|
1980
1968
|
if (!r.startsWith("#")) return r;
|
|
1981
1969
|
const i = Math.min(255, Math.round(parseInt(r.slice(1, 3), 16) + 255 * t)), e = Math.min(255, Math.round(parseInt(r.slice(3, 5), 16) + 255 * t)), a = Math.min(255, Math.round(parseInt(r.slice(5, 7), 16) + 255 * t));
|
|
1982
1970
|
return `#${i.toString(16).padStart(2, "0")}${e.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}`;
|
|
1983
1971
|
}
|
|
1984
|
-
function
|
|
1972
|
+
function me(r, t) {
|
|
1985
1973
|
if (!r.startsWith("#")) return r;
|
|
1986
1974
|
const i = Math.max(0, Math.round(parseInt(r.slice(1, 3), 16) * (1 - t))), e = Math.max(0, Math.round(parseInt(r.slice(3, 5), 16) * (1 - t))), a = Math.max(0, Math.round(parseInt(r.slice(5, 7), 16) * (1 - t)));
|
|
1987
1975
|
return `#${i.toString(16).padStart(2, "0")}${e.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}`;
|
|
1988
1976
|
}
|
|
1989
|
-
const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap", _t = "'Outfit', -apple-system, BlinkMacSystemFont, sans-serif", qt = "https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600&display=swap",
|
|
1977
|
+
const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap", _t = "'Outfit', -apple-system, BlinkMacSystemFont, sans-serif", qt = "https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600&display=swap", we = "'Roboto Mono', monospace", Se = "https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;600&display=swap", vi = "'IBM Plex Mono', monospace", yi = "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap", Qt = "'Fira Code', monospace", Zt = "https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap", ke = "'Source Code Pro', monospace", Me = "https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600&display=swap", xi = "'Space Mono', monospace", Ci = "https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap", te = "'Plus Jakarta Sans', sans-serif", ee = "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap", wi = "'Caveat', 'Comic Sans MS', cursive", Si = "https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap", ki = I({
|
|
1990
1978
|
name: "Andromeda",
|
|
1991
1979
|
description: "Deep space purples and cosmic blues",
|
|
1992
1980
|
background: "#23262e",
|
|
@@ -2009,9 +1997,9 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2009
1997
|
crosshair: { color: "rgba(102,94,110,0.4)", labelBackground: "#2e3038" },
|
|
2010
1998
|
axis: { textColor: "#665e6e" },
|
|
2011
1999
|
tooltip: { background: "rgba(35,38,46,0.92)", textColor: "#d5ced9", borderColor: "rgba(50,48,56,0.6)" },
|
|
2012
|
-
typography: { fontFamily:
|
|
2013
|
-
fontUrl:
|
|
2014
|
-
}),
|
|
2000
|
+
typography: { fontFamily: we },
|
|
2001
|
+
fontUrl: Se
|
|
2002
|
+
}), Mi = I({
|
|
2015
2003
|
name: "Ayu Mirage",
|
|
2016
2004
|
description: "Warm dark with amber accents",
|
|
2017
2005
|
background: "#1f2430",
|
|
@@ -2036,7 +2024,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2036
2024
|
tooltip: { background: "rgba(31,36,48,0.92)", textColor: "#cbccc6", borderColor: "rgba(42,48,60,0.6)" },
|
|
2037
2025
|
typography: { fontFamily: _t },
|
|
2038
2026
|
fontUrl: qt
|
|
2039
|
-
}),
|
|
2027
|
+
}), Ri = I({
|
|
2040
2028
|
name: "Catppuccin",
|
|
2041
2029
|
description: "Pastel tones on a mocha base",
|
|
2042
2030
|
background: "#1e1e2e",
|
|
@@ -2061,7 +2049,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2061
2049
|
tooltip: { background: "rgba(30,30,46,0.92)", textColor: "#cdd6f4", borderColor: "rgba(49,50,68,0.6)" },
|
|
2062
2050
|
typography: { fontFamily: _t },
|
|
2063
2051
|
fontUrl: qt
|
|
2064
|
-
}),
|
|
2052
|
+
}), Ti = I({
|
|
2065
2053
|
name: "Dracula",
|
|
2066
2054
|
description: "Classic dark with vibrant highlights",
|
|
2067
2055
|
background: "#282a36",
|
|
@@ -2086,7 +2074,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2086
2074
|
tooltip: { background: "rgba(40,42,54,0.92)", textColor: "#f8f8f2", borderColor: "rgba(68,71,90,0.6)" },
|
|
2087
2075
|
typography: { fontFamily: Qt },
|
|
2088
2076
|
fontUrl: Zt
|
|
2089
|
-
}),
|
|
2077
|
+
}), Di = I({
|
|
2090
2078
|
name: "GitHub Light",
|
|
2091
2079
|
description: "Clean and familiar, GitHub-inspired",
|
|
2092
2080
|
background: "#fafbfc",
|
|
@@ -2110,9 +2098,9 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2110
2098
|
crosshair: { color: "rgba(208,215,222,0.3)", labelBackground: "#f0f3f6" },
|
|
2111
2099
|
axis: { textColor: "#8b949e" },
|
|
2112
2100
|
tooltip: { background: "rgba(250,251,252,0.95)", textColor: "#24292f", borderColor: "rgba(216,222,228,0.5)" },
|
|
2113
|
-
typography: { fontFamily:
|
|
2114
|
-
fontUrl:
|
|
2115
|
-
}),
|
|
2101
|
+
typography: { fontFamily: vi },
|
|
2102
|
+
fontUrl: yi
|
|
2103
|
+
}), Bi = I({
|
|
2116
2104
|
name: "Gruvbox",
|
|
2117
2105
|
description: "Retro warm with earthy tones",
|
|
2118
2106
|
background: "#282828",
|
|
@@ -2137,70 +2125,72 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2137
2125
|
tooltip: { background: "rgba(40,40,40,0.92)", textColor: "#ebdbb2", borderColor: "rgba(60,56,54,0.6)" },
|
|
2138
2126
|
typography: { fontFamily: Vt },
|
|
2139
2127
|
fontUrl: Yt
|
|
2140
|
-
}),
|
|
2128
|
+
}), zi = {
|
|
2141
2129
|
name: "Handwritten",
|
|
2142
2130
|
description: "Sketch-style with a personal touch",
|
|
2143
|
-
fontUrl:
|
|
2131
|
+
fontUrl: Si,
|
|
2144
2132
|
dark: !1,
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2133
|
+
theme: {
|
|
2134
|
+
background: "#fdf5e6",
|
|
2135
|
+
chartGradient: ["#fef6e3", "#fdf5e6"],
|
|
2136
|
+
typography: {
|
|
2137
|
+
fontFamily: wi,
|
|
2138
|
+
fontSize: 18,
|
|
2139
|
+
axisFontSize: 13,
|
|
2140
|
+
yFontSize: 15,
|
|
2141
|
+
tooltipFontSize: 14
|
|
2142
|
+
},
|
|
2143
|
+
grid: {
|
|
2144
|
+
color: "rgba(180,170,150,0.3)",
|
|
2145
|
+
style: "dashed"
|
|
2146
|
+
},
|
|
2147
|
+
candlestick: {
|
|
2148
|
+
upColor: "#7a9a5e",
|
|
2149
|
+
downColor: "#b07060",
|
|
2150
|
+
wickUpColor: "#7a9a5e",
|
|
2151
|
+
wickDownColor: "#b07060"
|
|
2152
|
+
},
|
|
2153
|
+
line: {
|
|
2154
|
+
color: "#6a8fa0",
|
|
2155
|
+
width: 1,
|
|
2156
|
+
areaTopColor: "rgba(106,143,160,0.08)",
|
|
2157
|
+
areaBottomColor: "rgba(106,143,160,0.01)"
|
|
2158
|
+
},
|
|
2159
|
+
seriesColors: [
|
|
2160
|
+
"#6a8fa0",
|
|
2161
|
+
"#c09050",
|
|
2162
|
+
"#7a9a5e",
|
|
2163
|
+
"#8a7098",
|
|
2164
|
+
"#b07060",
|
|
2165
|
+
"#a09030",
|
|
2166
|
+
"#508878",
|
|
2167
|
+
"#a06878",
|
|
2168
|
+
"#6888a0",
|
|
2169
|
+
"#8870a0"
|
|
2170
|
+
],
|
|
2171
|
+
bands: {
|
|
2172
|
+
upper: "#6888a0",
|
|
2173
|
+
lower: "#a06878"
|
|
2174
|
+
},
|
|
2175
|
+
crosshair: {
|
|
2176
|
+
color: "rgba(160,152,128,0.3)",
|
|
2177
|
+
labelBackground: "#f5edd8",
|
|
2178
|
+
labelTextColor: "#5c5040"
|
|
2179
|
+
},
|
|
2180
|
+
axis: { textColor: "#a09880" },
|
|
2181
|
+
yLabel: {
|
|
2182
|
+
upBackground: "#7a9a5e",
|
|
2183
|
+
downBackground: "#b07060",
|
|
2184
|
+
neutralBackground: "#e8dcc8",
|
|
2185
|
+
textColor: "#fdf5e6"
|
|
2186
|
+
},
|
|
2187
|
+
tooltip: {
|
|
2188
|
+
background: "rgba(253,245,230,0.95)",
|
|
2189
|
+
textColor: "#5c5040",
|
|
2190
|
+
borderColor: "rgba(180,170,150,0.4)"
|
|
2191
|
+
}
|
|
2202
2192
|
}
|
|
2203
|
-
},
|
|
2193
|
+
}, Fi = "'Silkscreen', cursive", Pi = "https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap", Li = I({
|
|
2204
2194
|
name: "Matrix",
|
|
2205
2195
|
background: "#000000",
|
|
2206
2196
|
candlestick: { upColor: "#00ff41", downColor: "#00802a" },
|
|
@@ -2222,10 +2212,10 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2222
2212
|
axis: { textColor: "#00cc33" },
|
|
2223
2213
|
crosshair: { color: "rgba(0,255,65,0.3)", labelBackground: "#0a1a0a" },
|
|
2224
2214
|
tooltip: { background: "rgba(0,10,0,0.95)", textColor: "#00ff41", borderColor: "rgba(0,255,65,0.2)" },
|
|
2225
|
-
typography: { fontFamily:
|
|
2226
|
-
fontUrl:
|
|
2215
|
+
typography: { fontFamily: Fi },
|
|
2216
|
+
fontUrl: Pi,
|
|
2227
2217
|
chartGradient: ["#010a01", "#000000"]
|
|
2228
|
-
}),
|
|
2218
|
+
}), Wi = I({
|
|
2229
2219
|
name: "Lavender Mist",
|
|
2230
2220
|
background: "#f5f0f4",
|
|
2231
2221
|
candlestick: { upColor: "#6b8e5e", downColor: "#b85468" },
|
|
@@ -2276,7 +2266,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2276
2266
|
tooltip: { background: "rgba(253,242,244,0.95)", textColor: "#4a3040", borderColor: "rgba(200,160,175,0.35)" },
|
|
2277
2267
|
typography: { fontFamily: _t },
|
|
2278
2268
|
fontUrl: qt
|
|
2279
|
-
}),
|
|
2269
|
+
}), Ii = I({
|
|
2280
2270
|
name: "Material Palenight",
|
|
2281
2271
|
description: "Material Design in moonlit hues",
|
|
2282
2272
|
background: "#292d3e",
|
|
@@ -2299,9 +2289,9 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2299
2289
|
crosshair: { color: "rgba(103,110,149,0.4)", labelBackground: "#34324a" },
|
|
2300
2290
|
axis: { textColor: "#676e95" },
|
|
2301
2291
|
tooltip: { background: "rgba(41,45,62,0.92)", textColor: "#a6accd", borderColor: "rgba(55,59,75,0.6)" },
|
|
2302
|
-
typography: { fontFamily:
|
|
2303
|
-
fontUrl:
|
|
2304
|
-
}),
|
|
2292
|
+
typography: { fontFamily: we },
|
|
2293
|
+
fontUrl: Se
|
|
2294
|
+
}), Vi = "'Silkscreen', cursive", Yi = "https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap", _i = I({
|
|
2305
2295
|
name: "Monochrome",
|
|
2306
2296
|
description: "Pure black and white, pixel font",
|
|
2307
2297
|
background: "#ffffff",
|
|
@@ -2325,9 +2315,9 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2325
2315
|
crosshair: { color: "rgba(0,0,0,0.08)", labelBackground: "#f0f0f0" },
|
|
2326
2316
|
axis: { textColor: "#b0b0b0" },
|
|
2327
2317
|
tooltip: { background: "rgba(255,255,255,0.97)", textColor: "#222222", borderColor: "rgba(0,0,0,0.08)" },
|
|
2328
|
-
typography: { fontFamily:
|
|
2329
|
-
fontUrl:
|
|
2330
|
-
}),
|
|
2318
|
+
typography: { fontFamily: Vi, tooltipFontSize: 9 },
|
|
2319
|
+
fontUrl: Yi
|
|
2320
|
+
}), Ui = I({
|
|
2331
2321
|
name: "Mint Breeze",
|
|
2332
2322
|
background: "#f6f5ee",
|
|
2333
2323
|
candlestick: { upColor: "#2e9070", downColor: "#d04848" },
|
|
@@ -2349,8 +2339,8 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2349
2339
|
axis: { textColor: "#80a098" },
|
|
2350
2340
|
crosshair: { color: "rgba(120,140,120,0.18)", labelBackground: "#ece8de" },
|
|
2351
2341
|
tooltip: { background: "rgba(246,245,238,0.95)", textColor: "#2a3530", borderColor: "rgba(130,140,115,0.2)" },
|
|
2352
|
-
typography: { fontFamily:
|
|
2353
|
-
fontUrl:
|
|
2342
|
+
typography: { fontFamily: xi },
|
|
2343
|
+
fontUrl: Ci,
|
|
2354
2344
|
chartGradient: ["#f8f7f0", "#f6f5ee"]
|
|
2355
2345
|
}), Ei = I({
|
|
2356
2346
|
name: "Monokai Pro",
|
|
@@ -2377,7 +2367,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2377
2367
|
tooltip: { background: "rgba(45,42,46,0.92)", textColor: "#fcfcfa", borderColor: "rgba(64,60,62,0.6)" },
|
|
2378
2368
|
typography: { fontFamily: Qt },
|
|
2379
2369
|
fontUrl: Zt
|
|
2380
|
-
}),
|
|
2370
|
+
}), Oi = I({
|
|
2381
2371
|
name: "Night Owl",
|
|
2382
2372
|
description: "Crafted for late-night coding",
|
|
2383
2373
|
background: "#011627",
|
|
@@ -2402,7 +2392,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2402
2392
|
tooltip: { background: "rgba(1,22,39,0.92)", textColor: "#d6deeb", borderColor: "rgba(31,52,72,0.6)" },
|
|
2403
2393
|
typography: { fontFamily: Vt },
|
|
2404
2394
|
fontUrl: Yt
|
|
2405
|
-
}),
|
|
2395
|
+
}), $i = I({
|
|
2406
2396
|
name: "One Dark Pro",
|
|
2407
2397
|
description: "Atom editor's iconic dark palette",
|
|
2408
2398
|
background: "#282c34",
|
|
@@ -2427,7 +2417,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2427
2417
|
tooltip: { background: "rgba(40,44,52,0.92)", textColor: "#abb2bf", borderColor: "rgba(59,64,72,0.6)" },
|
|
2428
2418
|
typography: { fontFamily: Vt },
|
|
2429
2419
|
fontUrl: Yt
|
|
2430
|
-
}),
|
|
2420
|
+
}), Xi = I({
|
|
2431
2421
|
name: "Panda",
|
|
2432
2422
|
description: "Playful neons on charcoal",
|
|
2433
2423
|
background: "#292a2b",
|
|
@@ -2452,7 +2442,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2452
2442
|
tooltip: { background: "rgba(41,42,43,0.92)", textColor: "#e6e6e6", borderColor: "rgba(58,58,60,0.6)" },
|
|
2453
2443
|
typography: { fontFamily: Qt },
|
|
2454
2444
|
fontUrl: Zt
|
|
2455
|
-
}),
|
|
2445
|
+
}), Hi = I({
|
|
2456
2446
|
name: "Peach Cream",
|
|
2457
2447
|
background: "#fef6f0",
|
|
2458
2448
|
candlestick: { upColor: "#5a9a68", downColor: "#d06848" },
|
|
@@ -2477,7 +2467,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2477
2467
|
typography: { fontFamily: te },
|
|
2478
2468
|
fontUrl: ee,
|
|
2479
2469
|
chartGradient: ["#fff8f2", "#fef6f0"]
|
|
2480
|
-
}),
|
|
2470
|
+
}), Gi = I({
|
|
2481
2471
|
name: "Quiet Light",
|
|
2482
2472
|
description: "Subdued and easy on the eyes",
|
|
2483
2473
|
background: "#f5f5f5",
|
|
@@ -2502,7 +2492,7 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2502
2492
|
tooltip: { background: "rgba(245,245,245,0.95)", textColor: "#333333", borderColor: "rgba(200,200,200,0.5)" },
|
|
2503
2493
|
typography: { fontFamily: te },
|
|
2504
2494
|
fontUrl: ee
|
|
2505
|
-
}),
|
|
2495
|
+
}), Ni = I({
|
|
2506
2496
|
name: "Rosé Pine Dawn",
|
|
2507
2497
|
description: "Dawn-inspired warm neutrals",
|
|
2508
2498
|
background: "#faf4ed",
|
|
@@ -2525,9 +2515,9 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2525
2515
|
crosshair: { color: "rgba(152,147,165,0.3)", labelBackground: "#f2e9e1" },
|
|
2526
2516
|
axis: { textColor: "#9893a5" },
|
|
2527
2517
|
tooltip: { background: "rgba(250,244,237,0.95)", textColor: "#575279", borderColor: "rgba(152,147,165,0.3)" },
|
|
2528
|
-
typography: { fontFamily:
|
|
2529
|
-
fontUrl:
|
|
2530
|
-
}),
|
|
2518
|
+
typography: { fontFamily: ke },
|
|
2519
|
+
fontUrl: Me
|
|
2520
|
+
}), ji = I({
|
|
2531
2521
|
name: "Sand Dune",
|
|
2532
2522
|
background: "#f4f0e8",
|
|
2533
2523
|
candlestick: { upColor: "#5a8a50", downColor: "#b85040" },
|
|
@@ -2549,10 +2539,10 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2549
2539
|
axis: { textColor: "#9a8a70" },
|
|
2550
2540
|
crosshair: { color: "rgba(150,130,100,0.2)", labelBackground: "#e8e0d0" },
|
|
2551
2541
|
tooltip: { background: "rgba(244,240,232,0.95)", textColor: "#3a3020", borderColor: "rgba(150,130,100,0.3)" },
|
|
2552
|
-
typography: { fontFamily:
|
|
2553
|
-
fontUrl:
|
|
2542
|
+
typography: { fontFamily: ke },
|
|
2543
|
+
fontUrl: Me,
|
|
2554
2544
|
chartGradient: ["#f8f4ec", "#f4f0e8"]
|
|
2555
|
-
}),
|
|
2545
|
+
}), Ji = I({
|
|
2556
2546
|
name: "Solarized Light",
|
|
2557
2547
|
description: "Ethan Schoonover's precision palette",
|
|
2558
2548
|
background: "#fdf6e3",
|
|
@@ -2578,49 +2568,49 @@ const Vt = "'JetBrains Mono', 'Fira Code', monospace", Yt = "https://fonts.googl
|
|
|
2578
2568
|
tooltip: { background: "rgba(253,246,227,0.95)", textColor: "#586e75", borderColor: "rgba(238,232,213,0.6)" },
|
|
2579
2569
|
typography: { fontFamily: Vt },
|
|
2580
2570
|
fontUrl: Yt
|
|
2581
|
-
}),
|
|
2582
|
-
Dracula:
|
|
2583
|
-
"One Dark Pro":
|
|
2571
|
+
}), be = {
|
|
2572
|
+
Dracula: Ti,
|
|
2573
|
+
"One Dark Pro": $i,
|
|
2584
2574
|
"Monokai Pro": Ei,
|
|
2585
|
-
"Night Owl":
|
|
2586
|
-
"Material Palenight":
|
|
2587
|
-
Gruvbox:
|
|
2588
|
-
Catppuccin:
|
|
2589
|
-
"Ayu Mirage":
|
|
2590
|
-
Panda:
|
|
2591
|
-
Andromeda:
|
|
2592
|
-
Matrix:
|
|
2593
|
-
Handwritten:
|
|
2594
|
-
"GitHub Light":
|
|
2595
|
-
"Solarized Light":
|
|
2596
|
-
"Rosé Pine Dawn":
|
|
2597
|
-
"Quiet Light":
|
|
2598
|
-
"Lavender Mist":
|
|
2599
|
-
"Mint Breeze":
|
|
2600
|
-
"Sand Dune":
|
|
2601
|
-
"Peach Cream":
|
|
2602
|
-
Monochrome:
|
|
2575
|
+
"Night Owl": Oi,
|
|
2576
|
+
"Material Palenight": Ii,
|
|
2577
|
+
Gruvbox: Bi,
|
|
2578
|
+
Catppuccin: Ri,
|
|
2579
|
+
"Ayu Mirage": Mi,
|
|
2580
|
+
Panda: Xi,
|
|
2581
|
+
Andromeda: ki,
|
|
2582
|
+
Matrix: Li,
|
|
2583
|
+
Handwritten: zi,
|
|
2584
|
+
"GitHub Light": Di,
|
|
2585
|
+
"Solarized Light": Ji,
|
|
2586
|
+
"Rosé Pine Dawn": Ni,
|
|
2587
|
+
"Quiet Light": Gi,
|
|
2588
|
+
"Lavender Mist": Wi,
|
|
2589
|
+
"Mint Breeze": Ui,
|
|
2590
|
+
"Sand Dune": ji,
|
|
2591
|
+
"Peach Cream": Hi,
|
|
2592
|
+
Monochrome: _i,
|
|
2603
2593
|
Love: Ai
|
|
2604
2594
|
};
|
|
2605
|
-
function
|
|
2606
|
-
return
|
|
2595
|
+
function xo(r) {
|
|
2596
|
+
return (be[r] ?? be["One Dark Pro"]).theme;
|
|
2607
2597
|
}
|
|
2608
|
-
const Gt =
|
|
2598
|
+
const Gt = ye(null);
|
|
2609
2599
|
function J() {
|
|
2610
2600
|
const r = Nt(Gt);
|
|
2611
2601
|
if (!r)
|
|
2612
2602
|
throw new Error("useChartInstance must be used within <ChartContainer>");
|
|
2613
2603
|
return r;
|
|
2614
2604
|
}
|
|
2615
|
-
function
|
|
2605
|
+
function Ki({ data: r, options: t, label: i, id: e, onSeriesId: a }) {
|
|
2616
2606
|
var n;
|
|
2617
|
-
const o = J(), s =
|
|
2618
|
-
return
|
|
2607
|
+
const o = J(), s = et(null);
|
|
2608
|
+
return it(() => {
|
|
2619
2609
|
const l = o.addBarSeries({ ...t, label: i ?? (t == null ? void 0 : t.label), layers: r.length, id: e });
|
|
2620
2610
|
return s.current = l, a == null || a(l), () => {
|
|
2621
2611
|
o.removeSeries(l), s.current = null;
|
|
2622
2612
|
};
|
|
2623
|
-
}, [o, r.length, e]),
|
|
2613
|
+
}, [o, r.length, e]), it(() => {
|
|
2624
2614
|
const l = s.current;
|
|
2625
2615
|
l && o.batch(() => {
|
|
2626
2616
|
for (let h = 0; h < r.length; h++)
|
|
@@ -2630,14 +2620,14 @@ function qi({ data: r, options: t, label: i, id: e, onSeriesId: a }) {
|
|
|
2630
2620
|
s.current && t && o.updateSeriesOptions(s.current, t);
|
|
2631
2621
|
}, [o, (n = t == null ? void 0 : t.colors) == null ? void 0 : n.join(","), t == null ? void 0 : t.barWidthRatio, t == null ? void 0 : t.stacking]), null;
|
|
2632
2622
|
}
|
|
2633
|
-
function
|
|
2634
|
-
const a = J(), o =
|
|
2635
|
-
return
|
|
2623
|
+
function Co({ data: r, options: t, id: i, onSeriesId: e }) {
|
|
2624
|
+
const a = J(), o = et(null), s = et(0);
|
|
2625
|
+
return it(() => {
|
|
2636
2626
|
const n = a.addCandlestickSeries({ ...t, id: i });
|
|
2637
2627
|
return o.current = n, e == null || e(n), () => {
|
|
2638
2628
|
a.removeSeries(n), o.current = null, s.current = 0;
|
|
2639
2629
|
};
|
|
2640
|
-
}, [a, i]),
|
|
2630
|
+
}, [a, i]), it(() => {
|
|
2641
2631
|
const n = o.current;
|
|
2642
2632
|
if (!n) return;
|
|
2643
2633
|
if (r.length === 0) {
|
|
@@ -2665,19 +2655,19 @@ function wo({ data: r, options: t, id: i, onSeriesId: e }) {
|
|
|
2665
2655
|
t == null ? void 0 : t.candleGradient
|
|
2666
2656
|
]), null;
|
|
2667
2657
|
}
|
|
2668
|
-
const ie =
|
|
2669
|
-
function
|
|
2658
|
+
const ie = ye(null), ve = ie.Provider;
|
|
2659
|
+
function qi() {
|
|
2670
2660
|
const r = Nt(ie);
|
|
2671
2661
|
if (!r)
|
|
2672
2662
|
throw new Error("useTheme must be used within <ThemeProvider>");
|
|
2673
2663
|
return r;
|
|
2674
2664
|
}
|
|
2675
|
-
function
|
|
2665
|
+
function Qi() {
|
|
2676
2666
|
return Nt(ie);
|
|
2677
2667
|
}
|
|
2678
|
-
function
|
|
2679
|
-
const e = J(), a =
|
|
2680
|
-
|
|
2668
|
+
function Zi({ items: r, position: t = "bottom", mode: i = "toggle" }) {
|
|
2669
|
+
const e = J(), a = qi(), [o, s] = Rt(/* @__PURE__ */ new Set()), [, n] = Rt(0);
|
|
2670
|
+
it(() => {
|
|
2681
2671
|
const f = () => {
|
|
2682
2672
|
n((m) => m + 1), s(/* @__PURE__ */ new Set());
|
|
2683
2673
|
}, p = () => n((m) => m + 1);
|
|
@@ -2782,13 +2772,13 @@ function to({ items: r, position: t = "bottom", mode: i = "toggle" }) {
|
|
|
2782
2772
|
}
|
|
2783
2773
|
);
|
|
2784
2774
|
}
|
|
2785
|
-
function
|
|
2786
|
-
var
|
|
2787
|
-
const h =
|
|
2788
|
-
|
|
2775
|
+
function to({ children: r, theme: t, axis: i, padding: e, gradient: a = !0, interactive: o, grid: s, style: n, className: l }) {
|
|
2776
|
+
var _, P, X, H, Q, U, nt;
|
|
2777
|
+
const h = Qi(), d = t ?? h ?? void 0, g = et(null), f = et(null), [p, m] = Rt(0);
|
|
2778
|
+
it(() => {
|
|
2789
2779
|
if (!g.current || f.current) return;
|
|
2790
|
-
const
|
|
2791
|
-
return i && (
|
|
2780
|
+
const E = {};
|
|
2781
|
+
return i && (E.axis = i), d && (E.theme = d), e && (E.padding = e), o !== void 0 && (E.interactive = o), s !== void 0 && (E.grid = s), f.current = new mi(g.current, E), m((O) => O + 1), () => {
|
|
2792
2782
|
const O = f.current;
|
|
2793
2783
|
f.current = null, setTimeout(() => {
|
|
2794
2784
|
f.current || O == null || O.destroy();
|
|
@@ -2798,7 +2788,7 @@ function eo({ children: r, theme: t, axis: i, padding: e, gradient: a = !0, inte
|
|
|
2798
2788
|
f.current && d && f.current.setTheme(d);
|
|
2799
2789
|
}, [d]), j(() => {
|
|
2800
2790
|
f.current && i && f.current.setAxis(i);
|
|
2801
|
-
}, [(
|
|
2791
|
+
}, [(_ = i == null ? void 0 : i.y) == null ? void 0 : _.width, (P = i == null ? void 0 : i.y) == null ? void 0 : P.min, (X = i == null ? void 0 : i.y) == null ? void 0 : X.max, (H = i == null ? void 0 : i.y) == null ? void 0 : H.visible, (Q = i == null ? void 0 : i.x) == null ? void 0 : Q.height, (U = i == null ? void 0 : i.x) == null ? void 0 : U.visible]), j(() => {
|
|
2802
2792
|
f.current && e && f.current.setPadding(e);
|
|
2803
2793
|
}, [
|
|
2804
2794
|
e == null ? void 0 : e.top,
|
|
@@ -2809,12 +2799,12 @@ function eo({ children: r, theme: t, axis: i, padding: e, gradient: a = !0, inte
|
|
|
2809
2799
|
f.current && s !== void 0 && f.current.setGrid(s);
|
|
2810
2800
|
}, [s]);
|
|
2811
2801
|
const b = f.current, { legendEl: u, overlay: v } = (() => {
|
|
2812
|
-
let
|
|
2802
|
+
let E = null;
|
|
2813
2803
|
const O = [];
|
|
2814
|
-
return
|
|
2815
|
-
|
|
2816
|
-
}), { legendEl:
|
|
2817
|
-
})(), x = (((
|
|
2804
|
+
return Ye.forEach(r, (A) => {
|
|
2805
|
+
_e(A) && A.type === Zi ? E = A : O.push(A);
|
|
2806
|
+
}), { legendEl: E, overlay: O };
|
|
2807
|
+
})(), x = (((nt = u == null ? void 0 : u.props) == null ? void 0 : nt.position) ?? "bottom") === "right", C = d ?? (b == null ? void 0 : b.getTheme()), [T, k] = (C == null ? void 0 : C.chartGradient) ?? ["transparent", "transparent"], D = (C == null ? void 0 : C.background) ?? "transparent", z = a ? `linear-gradient(to bottom, ${T} 0%, ${D} 70%, ${k} 100%)` : D;
|
|
2818
2808
|
return /* @__PURE__ */ F(
|
|
2819
2809
|
"div",
|
|
2820
2810
|
{
|
|
@@ -2840,7 +2830,7 @@ function eo({ children: r, theme: t, axis: i, padding: e, gradient: a = !0, inte
|
|
|
2840
2830
|
minHeight: 0,
|
|
2841
2831
|
overflow: "hidden"
|
|
2842
2832
|
},
|
|
2843
|
-
children: b && /* @__PURE__ */ S(Gt.Provider, { value: b, children: /* @__PURE__ */ S(
|
|
2833
|
+
children: b && /* @__PURE__ */ S(Gt.Provider, { value: b, children: /* @__PURE__ */ S(ve, { value: d ?? b.getTheme(), children: /* @__PURE__ */ S(
|
|
2844
2834
|
"div",
|
|
2845
2835
|
{
|
|
2846
2836
|
style: {
|
|
@@ -2854,20 +2844,20 @@ function eo({ children: r, theme: t, axis: i, padding: e, gradient: a = !0, inte
|
|
|
2854
2844
|
) }) })
|
|
2855
2845
|
}
|
|
2856
2846
|
),
|
|
2857
|
-
b && u && /* @__PURE__ */ S(Gt.Provider, { value: b, children: /* @__PURE__ */ S(
|
|
2847
|
+
b && u && /* @__PURE__ */ S(Gt.Provider, { value: b, children: /* @__PURE__ */ S(ve, { value: d ?? b.getTheme(), children: u }) })
|
|
2858
2848
|
]
|
|
2859
2849
|
}
|
|
2860
2850
|
);
|
|
2861
2851
|
}
|
|
2862
|
-
function
|
|
2852
|
+
function eo({ data: r, options: t, label: i, id: e, onSeriesId: a }) {
|
|
2863
2853
|
var n;
|
|
2864
|
-
const o = J(), s =
|
|
2865
|
-
return
|
|
2854
|
+
const o = J(), s = et(null);
|
|
2855
|
+
return it(() => {
|
|
2866
2856
|
const l = o.addLineSeries({ ...t, label: i ?? (t == null ? void 0 : t.label), layers: r.length, id: e });
|
|
2867
2857
|
return s.current = l, a == null || a(l), () => {
|
|
2868
2858
|
o.removeSeries(l), s.current = null;
|
|
2869
2859
|
};
|
|
2870
|
-
}, [o, r.length, e]),
|
|
2860
|
+
}, [o, r.length, e]), it(() => {
|
|
2871
2861
|
const l = s.current;
|
|
2872
2862
|
l && o.batch(() => {
|
|
2873
2863
|
for (let h = 0; h < r.length; h++)
|
|
@@ -2877,9 +2867,9 @@ function io({ data: r, options: t, label: i, id: e, onSeriesId: a }) {
|
|
|
2877
2867
|
s.current && t && o.updateSeriesOptions(s.current, t);
|
|
2878
2868
|
}, [o, (n = t == null ? void 0 : t.colors) == null ? void 0 : n.join(","), t == null ? void 0 : t.lineWidth, t == null ? void 0 : t.areaFill, t == null ? void 0 : t.pulse, t == null ? void 0 : t.stacking]), null;
|
|
2879
2869
|
}
|
|
2880
|
-
function
|
|
2881
|
-
const a = J(), o =
|
|
2882
|
-
return
|
|
2870
|
+
function wo({ data: r, options: t, id: i, onSeriesId: e }) {
|
|
2871
|
+
const a = J(), o = et(null);
|
|
2872
|
+
return it(() => {
|
|
2883
2873
|
const s = a.addPieSeries({ ...t, id: i });
|
|
2884
2874
|
return o.current = s, e == null || e(s), () => {
|
|
2885
2875
|
a.removeSeries(s), o.current = null;
|
|
@@ -2893,7 +2883,7 @@ function So({ data: r, options: t, id: i, onSeriesId: e }) {
|
|
|
2893
2883
|
t == null ? void 0 : t.strokeColor,
|
|
2894
2884
|
t == null ? void 0 : t.strokeWidth,
|
|
2895
2885
|
t == null ? void 0 : t.colors
|
|
2896
|
-
]),
|
|
2886
|
+
]), it(() => {
|
|
2897
2887
|
o.current && a.setPieData(o.current, r);
|
|
2898
2888
|
}, [a, r]), null;
|
|
2899
2889
|
}
|
|
@@ -2909,16 +2899,16 @@ function Ut(r, t, i) {
|
|
|
2909
2899
|
getSnapshot: i
|
|
2910
2900
|
};
|
|
2911
2901
|
}
|
|
2912
|
-
function
|
|
2913
|
-
const t =
|
|
2914
|
-
return
|
|
2902
|
+
function io(r) {
|
|
2903
|
+
const t = dt(() => Ut(r, ["viewportChange", "dataUpdate", "seriesChange"], () => r.getVisibleRange()), [r]);
|
|
2904
|
+
return Tt(t.subscribe, t.getSnapshot);
|
|
2915
2905
|
}
|
|
2916
|
-
function
|
|
2917
|
-
const t =
|
|
2918
|
-
return
|
|
2906
|
+
function oo(r) {
|
|
2907
|
+
const t = dt(() => Ut(r, ["viewportChange", "dataUpdate", "seriesChange"], () => r.getYRange()), [r]);
|
|
2908
|
+
return Tt(t.subscribe, t.getSnapshot);
|
|
2919
2909
|
}
|
|
2920
|
-
function
|
|
2921
|
-
const i =
|
|
2910
|
+
function ro(r, t) {
|
|
2911
|
+
const i = dt(() => {
|
|
2922
2912
|
let e = r.getLastValue(t);
|
|
2923
2913
|
return {
|
|
2924
2914
|
subscribe: (o) => {
|
|
@@ -2936,20 +2926,20 @@ function ao(r, t) {
|
|
|
2936
2926
|
getSnapshot: () => e
|
|
2937
2927
|
};
|
|
2938
2928
|
}, [r, t]);
|
|
2939
|
-
return
|
|
2929
|
+
return Tt(i.subscribe, i.getSnapshot);
|
|
2940
2930
|
}
|
|
2941
|
-
function
|
|
2942
|
-
const i =
|
|
2931
|
+
function ao(r, t) {
|
|
2932
|
+
const i = dt(
|
|
2943
2933
|
() => Ut(r, "dataUpdate", () => r.getPreviousClose(t)),
|
|
2944
2934
|
[r, t]
|
|
2945
2935
|
);
|
|
2946
|
-
return
|
|
2936
|
+
return Tt(i.subscribe, i.getSnapshot);
|
|
2947
2937
|
}
|
|
2948
2938
|
function oe(r) {
|
|
2949
|
-
const t =
|
|
2950
|
-
return
|
|
2939
|
+
const t = dt(() => Ut(r, "crosshairMove", () => r.getCrosshairPosition()), [r]);
|
|
2940
|
+
return Tt(t.subscribe, t.getSnapshot);
|
|
2951
2941
|
}
|
|
2952
|
-
function
|
|
2942
|
+
function So() {
|
|
2953
2943
|
const r = J(), t = oe(r);
|
|
2954
2944
|
if (!t) return null;
|
|
2955
2945
|
const i = r.getTheme(), e = r.getDataInterval(), a = {
|
|
@@ -2962,7 +2952,7 @@ function ko() {
|
|
|
2962
2952
|
whiteSpace: "nowrap",
|
|
2963
2953
|
pointerEvents: "none"
|
|
2964
2954
|
};
|
|
2965
|
-
return /* @__PURE__ */ F(
|
|
2955
|
+
return /* @__PURE__ */ F(Dt, { children: [
|
|
2966
2956
|
/* @__PURE__ */ S(
|
|
2967
2957
|
"div",
|
|
2968
2958
|
{
|
|
@@ -2986,20 +2976,20 @@ function ko() {
|
|
|
2986
2976
|
transform: "translateX(-50%)",
|
|
2987
2977
|
...a
|
|
2988
2978
|
},
|
|
2989
|
-
children:
|
|
2979
|
+
children: It(t.time, e)
|
|
2990
2980
|
}
|
|
2991
2981
|
)
|
|
2992
2982
|
] });
|
|
2993
2983
|
}
|
|
2994
|
-
const
|
|
2995
|
-
function
|
|
2984
|
+
const so = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
2985
|
+
function no(r) {
|
|
2996
2986
|
const t = [];
|
|
2997
2987
|
for (const i of r)
|
|
2998
2988
|
i >= "0" && i <= "9" ? t.push({ type: "digit", value: i }) : t.push({ type: "symbol", value: i });
|
|
2999
2989
|
return t;
|
|
3000
2990
|
}
|
|
3001
|
-
function
|
|
3002
|
-
const n =
|
|
2991
|
+
function lo({ value: r, format: t, locale: i = "en-US", spinDuration: e = 350, className: a, style: o }) {
|
|
2992
|
+
const n = dt(() => new Intl.NumberFormat(i, t), [i, t]).format(r), l = no(n);
|
|
3003
2993
|
return /* @__PURE__ */ S(
|
|
3004
2994
|
"span",
|
|
3005
2995
|
{
|
|
@@ -3011,13 +3001,13 @@ function co({ value: r, format: t, locale: i = "en-US", spinDuration: e = 350, c
|
|
|
3011
3001
|
...o
|
|
3012
3002
|
},
|
|
3013
3003
|
children: l.map(
|
|
3014
|
-
(h, d) => h.type === "digit" ? /* @__PURE__ */ S(
|
|
3004
|
+
(h, d) => h.type === "digit" ? /* @__PURE__ */ S(co, { digit: parseInt(h.value), duration: e }, `d${d}`) : /* @__PURE__ */ S("span", { style: { display: "inline-block" }, children: h.value }, `s${d}`)
|
|
3015
3005
|
)
|
|
3016
3006
|
}
|
|
3017
3007
|
);
|
|
3018
3008
|
}
|
|
3019
|
-
function
|
|
3020
|
-
const i =
|
|
3009
|
+
function co({ digit: r, duration: t }) {
|
|
3010
|
+
const i = et(!1);
|
|
3021
3011
|
return j(() => {
|
|
3022
3012
|
i.current = !0;
|
|
3023
3013
|
}, []), /* @__PURE__ */ S(
|
|
@@ -3038,7 +3028,7 @@ function ho({ digit: r, duration: t }) {
|
|
|
3038
3028
|
transform: `translateY(${-r * 1.2}em)`,
|
|
3039
3029
|
transition: i.current ? `transform ${t}ms cubic-bezier(0.16, 1, 0.3, 1)` : "none"
|
|
3040
3030
|
},
|
|
3041
|
-
children:
|
|
3031
|
+
children: so.map((e) => /* @__PURE__ */ S(
|
|
3042
3032
|
"span",
|
|
3043
3033
|
{
|
|
3044
3034
|
style: {
|
|
@@ -3056,11 +3046,11 @@ function ho({ digit: r, duration: t }) {
|
|
|
3056
3046
|
}
|
|
3057
3047
|
);
|
|
3058
3048
|
}
|
|
3059
|
-
function
|
|
3049
|
+
function ho(r) {
|
|
3060
3050
|
return r >= 1e9 ? (r / 1e9).toFixed(1) + "B" : r >= 1e6 ? (r / 1e6).toFixed(1) + "M" : r >= 1e3 ? (r / 1e3).toFixed(1) + "K" : r.toLocaleString();
|
|
3061
3051
|
}
|
|
3062
|
-
function
|
|
3063
|
-
const i = J(), e = i.getTheme(), [, a] =
|
|
3052
|
+
function ko({ seriesId: r, format: t = "value" }) {
|
|
3053
|
+
const i = J(), e = i.getTheme(), [, a] = Rt(0);
|
|
3064
3054
|
j(() => {
|
|
3065
3055
|
const s = () => a((n) => n + 1);
|
|
3066
3056
|
return i.on("dataUpdate", s), () => {
|
|
@@ -3103,7 +3093,7 @@ function Mo({ seriesId: r, format: t = "value" }) {
|
|
|
3103
3093
|
}
|
|
3104
3094
|
),
|
|
3105
3095
|
/* @__PURE__ */ S("span", { style: { flex: 1, opacity: 0.8 }, children: s.label }),
|
|
3106
|
-
t === "value" && /* @__PURE__ */ S("span", { style: { fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children:
|
|
3096
|
+
t === "value" && /* @__PURE__ */ S("span", { style: { fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: ho(s.value) }),
|
|
3107
3097
|
/* @__PURE__ */ F(
|
|
3108
3098
|
"span",
|
|
3109
3099
|
{
|
|
@@ -3128,7 +3118,7 @@ function Mo({ seriesId: r, format: t = "value" }) {
|
|
|
3128
3118
|
}
|
|
3129
3119
|
);
|
|
3130
3120
|
}
|
|
3131
|
-
function
|
|
3121
|
+
function Mo({ seriesId: r }) {
|
|
3132
3122
|
const t = J(), i = oe(t), e = t.getPieHoverInfo(r);
|
|
3133
3123
|
if (!e || !i) return null;
|
|
3134
3124
|
const a = t.getTheme(), o = t.getMediaSize(), s = 160, n = 70, l = 16, h = 16, d = i.mediaX + l + s > o.width ? i.mediaX - l - s : i.mediaX + l, g = i.mediaY + h + n > o.height ? i.mediaY - h - n : i.mediaY + h;
|
|
@@ -3182,25 +3172,25 @@ function Ro({ seriesId: r }) {
|
|
|
3182
3172
|
}
|
|
3183
3173
|
);
|
|
3184
3174
|
}
|
|
3185
|
-
function
|
|
3175
|
+
function uo(r, t) {
|
|
3186
3176
|
if (r.startsWith("rgba") || !r.startsWith("#")) return r;
|
|
3187
3177
|
const i = parseInt(r.slice(1, 3), 16), e = parseInt(r.slice(3, 5), 16), a = parseInt(r.slice(5, 7), 16);
|
|
3188
3178
|
return `rgba(${i}, ${e}, ${a}, ${t})`;
|
|
3189
3179
|
}
|
|
3190
|
-
function
|
|
3180
|
+
function fo(r) {
|
|
3191
3181
|
return Math.abs(r) >= 1e6 ? `${(r / 1e6).toFixed(1)}M` : Math.abs(r) >= 1e4 ? `${(r / 1e3).toFixed(1)}K` : Math.abs(r) >= 1e3 ? `${(r / 1e3).toFixed(2)}K` : Math.abs(r) < 1 ? r.toFixed(4) : Math.abs(r) < 10 ? r.toFixed(2) : r.toFixed(1);
|
|
3192
3182
|
}
|
|
3193
|
-
function
|
|
3183
|
+
function go(r) {
|
|
3194
3184
|
if (r.length < 2) return { value: 0, pct: 0, positive: !0 };
|
|
3195
3185
|
const t = r[0].value, e = r[r.length - 1].value - t, a = t !== 0 ? e / t * 100 : 0;
|
|
3196
3186
|
return { value: e, pct: a, positive: e >= 0 };
|
|
3197
3187
|
}
|
|
3198
|
-
function
|
|
3188
|
+
function Ro({
|
|
3199
3189
|
data: r,
|
|
3200
3190
|
theme: t,
|
|
3201
3191
|
variant: i = "line",
|
|
3202
3192
|
valuePosition: e = "right",
|
|
3203
|
-
formatValue: a =
|
|
3193
|
+
formatValue: a = fo,
|
|
3204
3194
|
label: o,
|
|
3205
3195
|
sublabel: s,
|
|
3206
3196
|
color: n,
|
|
@@ -3212,7 +3202,7 @@ function To({
|
|
|
3212
3202
|
gradient: p = !0,
|
|
3213
3203
|
style: m
|
|
3214
3204
|
}) {
|
|
3215
|
-
const b = r.length > 0 ? r[r.length - 1].value : 0, u =
|
|
3205
|
+
const b = r.length > 0 ? r[r.length - 1].value : 0, u = dt(() => go(r), [r]), v = n ?? t.seriesColors[0], y = l ?? t.candlestick.downColor, x = u.positive ? t.candlestick.upColor : t.candlestick.downColor, C = e !== "none" && /* @__PURE__ */ F(
|
|
3216
3206
|
"div",
|
|
3217
3207
|
{
|
|
3218
3208
|
style: {
|
|
@@ -3284,7 +3274,7 @@ function To({
|
|
|
3284
3274
|
]
|
|
3285
3275
|
}
|
|
3286
3276
|
), T = /* @__PURE__ */ S("div", { style: { width: d, height: g, flexShrink: 0, borderRadius: 4, overflow: "hidden" }, children: /* @__PURE__ */ S(
|
|
3287
|
-
|
|
3277
|
+
to,
|
|
3288
3278
|
{
|
|
3289
3279
|
theme: t,
|
|
3290
3280
|
axis: {
|
|
@@ -3296,7 +3286,7 @@ function To({
|
|
|
3296
3286
|
interactive: !1,
|
|
3297
3287
|
grid: !1,
|
|
3298
3288
|
children: i === "line" ? /* @__PURE__ */ S(
|
|
3299
|
-
|
|
3289
|
+
eo,
|
|
3300
3290
|
{
|
|
3301
3291
|
data: [r],
|
|
3302
3292
|
options: {
|
|
@@ -3308,7 +3298,7 @@ function To({
|
|
|
3308
3298
|
}
|
|
3309
3299
|
}
|
|
3310
3300
|
) : /* @__PURE__ */ S(
|
|
3311
|
-
|
|
3301
|
+
Ki,
|
|
3312
3302
|
{
|
|
3313
3303
|
data: [r],
|
|
3314
3304
|
options: {
|
|
@@ -3329,7 +3319,7 @@ function To({
|
|
|
3329
3319
|
gap: 12,
|
|
3330
3320
|
padding: "8px 12px",
|
|
3331
3321
|
borderRadius: 8,
|
|
3332
|
-
background:
|
|
3322
|
+
background: uo(t.tooltip.background, 0.7),
|
|
3333
3323
|
border: `1px solid ${t.tooltip.borderColor}`,
|
|
3334
3324
|
fontFamily: t.typography.fontFamily,
|
|
3335
3325
|
...m
|
|
@@ -3342,10 +3332,10 @@ function To({
|
|
|
3342
3332
|
}
|
|
3343
3333
|
);
|
|
3344
3334
|
}
|
|
3345
|
-
function
|
|
3335
|
+
function To() {
|
|
3346
3336
|
const r = J();
|
|
3347
|
-
|
|
3348
|
-
const t = r.getTheme(), i = r.getDataInterval(), { ticks: e, tickInterval: a } = r.timeScale.niceTickValues(i), o = new Set(e), n =
|
|
3337
|
+
io(r);
|
|
3338
|
+
const t = r.getTheme(), i = r.getDataInterval(), { ticks: e, tickInterval: a } = r.timeScale.niceTickValues(i), o = new Set(e), n = et(/* @__PURE__ */ new Map()).current, l = performance.now();
|
|
3349
3339
|
for (const d of e)
|
|
3350
3340
|
n.has(d) ? n.get(d).opacity = 1 : n.set(d, { opacity: 1, addedAt: l });
|
|
3351
3341
|
for (const [d, g] of n)
|
|
@@ -3384,7 +3374,7 @@ function Do() {
|
|
|
3384
3374
|
transition: "opacity 0.3s ease",
|
|
3385
3375
|
willChange: "opacity"
|
|
3386
3376
|
},
|
|
3387
|
-
children:
|
|
3377
|
+
children: It(d, a)
|
|
3388
3378
|
},
|
|
3389
3379
|
d
|
|
3390
3380
|
);
|
|
@@ -3392,14 +3382,14 @@ function Do() {
|
|
|
3392
3382
|
}
|
|
3393
3383
|
);
|
|
3394
3384
|
}
|
|
3395
|
-
function
|
|
3385
|
+
function po(r, t) {
|
|
3396
3386
|
return t === "none" || r.length <= 1 ? r : [...r].sort((i, e) => {
|
|
3397
3387
|
const a = "value" in i.data ? i.data.value : i.data.close, o = "value" in e.data ? e.data.value : e.data.close;
|
|
3398
3388
|
return t === "asc" ? a - o : o - a;
|
|
3399
3389
|
});
|
|
3400
3390
|
}
|
|
3401
|
-
function
|
|
3402
|
-
const a = i ?? e ?? !0, o = J(), s = oe(o), n = r ? [r] : o.getSeriesIds(), [, l] =
|
|
3391
|
+
function Do({ seriesId: r, sort: t = "none", showLegend: i, legend: e }) {
|
|
3392
|
+
const a = i ?? e ?? !0, o = J(), s = oe(o), n = r ? [r] : o.getSeriesIds(), [, l] = Rt(0);
|
|
3403
3393
|
j(() => {
|
|
3404
3394
|
const u = () => l((v) => v + 1);
|
|
3405
3395
|
return o.on("dataUpdate", u), () => o.off("dataUpdate", u);
|
|
@@ -3448,10 +3438,10 @@ function Bo({ seriesId: r, sort: t = "none", showLegend: i, legend: e }) {
|
|
|
3448
3438
|
}
|
|
3449
3439
|
d = u;
|
|
3450
3440
|
}
|
|
3451
|
-
const g =
|
|
3441
|
+
const g = po(d, t), f = o.getTheme();
|
|
3452
3442
|
if (g.length === 0) return null;
|
|
3453
3443
|
const p = o.getDataInterval(), m = o.getMediaSize(), b = g[0].data.time;
|
|
3454
|
-
return /* @__PURE__ */ F(
|
|
3444
|
+
return /* @__PURE__ */ F(Dt, { children: [
|
|
3455
3445
|
a && /* @__PURE__ */ F(
|
|
3456
3446
|
"div",
|
|
3457
3447
|
{
|
|
@@ -3472,17 +3462,17 @@ function Bo({ seriesId: r, sort: t = "none", showLegend: i, legend: e }) {
|
|
|
3472
3462
|
transition: "opacity 0.2s ease"
|
|
3473
3463
|
},
|
|
3474
3464
|
children: [
|
|
3475
|
-
/* @__PURE__ */ S("span", { style: { color: f.axis.textColor, marginRight: 2 }, children:
|
|
3465
|
+
/* @__PURE__ */ S("span", { style: { color: f.axis.textColor, marginRight: 2 }, children: It(b, p) }),
|
|
3476
3466
|
g.map((u) => {
|
|
3477
3467
|
if ("open" in u.data) {
|
|
3478
3468
|
const x = u.data, T = x.close >= x.open ? f.candlestick.upColor : f.candlestick.downColor;
|
|
3479
3469
|
return /* @__PURE__ */ F("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
3480
|
-
/* @__PURE__ */ S(
|
|
3481
|
-
/* @__PURE__ */ S(
|
|
3482
|
-
/* @__PURE__ */ S(
|
|
3483
|
-
/* @__PURE__ */ S(
|
|
3470
|
+
/* @__PURE__ */ S(xt, { label: "O", value: x.open, color: T, dim: f.axis.textColor }),
|
|
3471
|
+
/* @__PURE__ */ S(xt, { label: "H", value: x.high, color: T, dim: f.axis.textColor }),
|
|
3472
|
+
/* @__PURE__ */ S(xt, { label: "L", value: x.low, color: T, dim: f.axis.textColor }),
|
|
3473
|
+
/* @__PURE__ */ S(xt, { label: "C", value: x.close, color: T, dim: f.axis.textColor }),
|
|
3484
3474
|
x.volume != null && /* @__PURE__ */ S(
|
|
3485
|
-
|
|
3475
|
+
xt,
|
|
3486
3476
|
{
|
|
3487
3477
|
label: "V",
|
|
3488
3478
|
value: x.volume,
|
|
@@ -3514,7 +3504,7 @@ function Bo({ seriesId: r, sort: t = "none", showLegend: i, legend: e }) {
|
|
|
3514
3504
|
}
|
|
3515
3505
|
),
|
|
3516
3506
|
s && h.length > 0 && /* @__PURE__ */ S(
|
|
3517
|
-
|
|
3507
|
+
mo,
|
|
3518
3508
|
{
|
|
3519
3509
|
snapshots: g,
|
|
3520
3510
|
x: s.mediaX,
|
|
@@ -3527,19 +3517,19 @@ function Bo({ seriesId: r, sort: t = "none", showLegend: i, legend: e }) {
|
|
|
3527
3517
|
)
|
|
3528
3518
|
] });
|
|
3529
3519
|
}
|
|
3530
|
-
function
|
|
3520
|
+
function xt({
|
|
3531
3521
|
label: r,
|
|
3532
3522
|
value: t,
|
|
3533
3523
|
color: i,
|
|
3534
3524
|
dim: e,
|
|
3535
3525
|
volume: a
|
|
3536
3526
|
}) {
|
|
3537
|
-
return /* @__PURE__ */ F(
|
|
3527
|
+
return /* @__PURE__ */ F(Dt, { children: [
|
|
3538
3528
|
/* @__PURE__ */ S("span", { style: { color: e, opacity: 0.5, marginLeft: 5 }, children: r }),
|
|
3539
|
-
/* @__PURE__ */ S("span", { style: { color: i, fontWeight: 500, marginLeft: 2 }, children: a ?
|
|
3529
|
+
/* @__PURE__ */ S("span", { style: { color: i, fontWeight: 500, marginLeft: 2 }, children: a ? Re(t) : t.toFixed(2) })
|
|
3540
3530
|
] });
|
|
3541
3531
|
}
|
|
3542
|
-
function
|
|
3532
|
+
function mo({
|
|
3543
3533
|
snapshots: r,
|
|
3544
3534
|
x: t,
|
|
3545
3535
|
y: i,
|
|
@@ -3585,21 +3575,21 @@ function bo({
|
|
|
3585
3575
|
letterSpacing: "0.02em"
|
|
3586
3576
|
},
|
|
3587
3577
|
children: [
|
|
3588
|
-
|
|
3578
|
+
Qe(y),
|
|
3589
3579
|
" ",
|
|
3590
|
-
|
|
3580
|
+
It(y, s)
|
|
3591
3581
|
]
|
|
3592
3582
|
}
|
|
3593
3583
|
),
|
|
3594
3584
|
r.map((x) => {
|
|
3595
3585
|
if ("open" in x.data) {
|
|
3596
|
-
const k = x.data, D = k.close >= k.open, z = o.candlestick.upColor,
|
|
3586
|
+
const k = x.data, D = k.close >= k.open, z = o.candlestick.upColor, _ = o.candlestick.downColor, P = D ? z : _;
|
|
3597
3587
|
return /* @__PURE__ */ F("div", { style: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "4px 12px" }, children: [
|
|
3598
|
-
/* @__PURE__ */ S(
|
|
3599
|
-
/* @__PURE__ */ S(
|
|
3600
|
-
/* @__PURE__ */ S(
|
|
3601
|
-
/* @__PURE__ */ S(
|
|
3602
|
-
k.volume != null && /* @__PURE__ */ S(
|
|
3588
|
+
/* @__PURE__ */ S(Ct, { label: "Open", value: k.open, color: P }),
|
|
3589
|
+
/* @__PURE__ */ S(Ct, { label: "High", value: k.high, color: P }),
|
|
3590
|
+
/* @__PURE__ */ S(Ct, { label: "Low", value: k.low, color: P }),
|
|
3591
|
+
/* @__PURE__ */ S(Ct, { label: "Close", value: k.close, color: P }),
|
|
3592
|
+
k.volume != null && /* @__PURE__ */ S(Ct, { label: "Volume", value: k.volume, color: o.tooltip.textColor, volume: !0 })
|
|
3603
3593
|
] }, x.id);
|
|
3604
3594
|
}
|
|
3605
3595
|
const T = x.data;
|
|
@@ -3624,24 +3614,24 @@ function bo({
|
|
|
3624
3614
|
}
|
|
3625
3615
|
);
|
|
3626
3616
|
}
|
|
3627
|
-
function
|
|
3617
|
+
function Ct({
|
|
3628
3618
|
label: r,
|
|
3629
3619
|
value: t,
|
|
3630
3620
|
color: i,
|
|
3631
3621
|
volume: e
|
|
3632
3622
|
}) {
|
|
3633
|
-
return /* @__PURE__ */ F(
|
|
3623
|
+
return /* @__PURE__ */ F(Dt, { children: [
|
|
3634
3624
|
/* @__PURE__ */ S("span", { style: { opacity: 0.5 }, children: r }),
|
|
3635
|
-
/* @__PURE__ */ S("span", { style: { fontWeight: 600, color: i, textAlign: "right" }, children: e ?
|
|
3625
|
+
/* @__PURE__ */ S("span", { style: { fontWeight: 600, color: i, textAlign: "right" }, children: e ? Re(t) : t.toFixed(2) })
|
|
3636
3626
|
] });
|
|
3637
3627
|
}
|
|
3638
|
-
function
|
|
3628
|
+
function Re(r) {
|
|
3639
3629
|
return r >= 1e9 ? (r / 1e9).toFixed(2) + "B" : r >= 1e6 ? (r / 1e6).toFixed(2) + "M" : r >= 1e3 ? (r / 1e3).toFixed(1) + "K" : r.toFixed(0);
|
|
3640
3630
|
}
|
|
3641
|
-
function
|
|
3631
|
+
function Bo() {
|
|
3642
3632
|
const r = J();
|
|
3643
|
-
|
|
3644
|
-
const t = r.getTheme(), i = r.yScale.niceTickValues(), e = new Set(i), o =
|
|
3633
|
+
oo(r);
|
|
3634
|
+
const t = r.getTheme(), i = r.yScale.niceTickValues(), e = new Set(i), o = et(/* @__PURE__ */ new Map()).current, s = performance.now();
|
|
3645
3635
|
for (const l of i)
|
|
3646
3636
|
o.has(l) ? o.get(l).opacity = 1 : o.set(l, { opacity: 1, addedAt: s });
|
|
3647
3637
|
for (const [l, h] of o)
|
|
@@ -3687,10 +3677,10 @@ function zo() {
|
|
|
3687
3677
|
}
|
|
3688
3678
|
);
|
|
3689
3679
|
}
|
|
3690
|
-
function
|
|
3680
|
+
function zo({ seriesId: r, color: t }) {
|
|
3691
3681
|
const i = J();
|
|
3692
3682
|
j(() => (i.setYLabel(!0), () => i.setYLabel(!1)), [i]);
|
|
3693
|
-
const e =
|
|
3683
|
+
const e = ro(i, r), a = ao(i, r);
|
|
3694
3684
|
if (!e) return null;
|
|
3695
3685
|
const { value: o, isLive: s } = e, n = i.getTheme(), l = i.yScale.valueToY(o);
|
|
3696
3686
|
let h;
|
|
@@ -3703,7 +3693,7 @@ function Fo({ seriesId: r, color: t }) {
|
|
|
3703
3693
|
h = p === "up" ? n.yLabel.upBackground : p === "down" ? n.yLabel.downBackground : n.yLabel.neutralBackground;
|
|
3704
3694
|
}
|
|
3705
3695
|
const d = i.yScale.getRange(), g = d.max - d.min, f = g < 0.1 ? 6 : g < 10 ? 4 : g < 1e3 ? 2 : 0;
|
|
3706
|
-
return /* @__PURE__ */ F(
|
|
3696
|
+
return /* @__PURE__ */ F(Dt, { children: [
|
|
3707
3697
|
/* @__PURE__ */ S(
|
|
3708
3698
|
"div",
|
|
3709
3699
|
{
|
|
@@ -3740,7 +3730,7 @@ function Fo({ seriesId: r, color: t }) {
|
|
|
3740
3730
|
transition: "background-color 0.3s ease"
|
|
3741
3731
|
},
|
|
3742
3732
|
children: /* @__PURE__ */ S(
|
|
3743
|
-
|
|
3733
|
+
lo,
|
|
3744
3734
|
{
|
|
3745
3735
|
value: o,
|
|
3746
3736
|
format: { minimumFractionDigits: f, maximumFractionDigits: f, useGrouping: !1 },
|
|
@@ -3752,60 +3742,60 @@ function Fo({ seriesId: r, color: t }) {
|
|
|
3752
3742
|
] });
|
|
3753
3743
|
}
|
|
3754
3744
|
export {
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3745
|
+
Ki as BarSeries,
|
|
3746
|
+
Co as CandlestickSeries,
|
|
3747
|
+
to as ChartContainer,
|
|
3748
|
+
mi as ChartInstance,
|
|
3749
|
+
So as Crosshair,
|
|
3750
|
+
Zi as Legend,
|
|
3751
|
+
eo as LineSeries,
|
|
3752
|
+
lo as NumberFlow,
|
|
3753
|
+
ko as PieLegend,
|
|
3754
|
+
wo as PieSeries,
|
|
3755
|
+
Mo as PieTooltip,
|
|
3756
|
+
Ro as Sparkline,
|
|
3757
|
+
ve as ThemeProvider,
|
|
3758
|
+
To as TimeAxis,
|
|
3759
|
+
Do as Tooltip,
|
|
3760
|
+
To as XAxis,
|
|
3761
|
+
Bo as YAxis,
|
|
3762
|
+
zo as YLabel,
|
|
3763
|
+
ki as andromeda,
|
|
3764
|
+
Mi as ayuMirage,
|
|
3765
|
+
xo as buildTheme,
|
|
3766
|
+
Ri as catppuccin,
|
|
3777
3767
|
I as createTheme,
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3768
|
+
fi as darkTheme,
|
|
3769
|
+
qe as detectInterval,
|
|
3770
|
+
Ti as dracula,
|
|
3771
|
+
Qe as formatDate,
|
|
3772
|
+
It as formatTime,
|
|
3773
|
+
Di as githubLight,
|
|
3774
|
+
Bi as gruvbox,
|
|
3775
|
+
zi as handwritten,
|
|
3776
|
+
Li as highContrast,
|
|
3777
|
+
Wi as lavenderMist,
|
|
3788
3778
|
Ai as lightPink,
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3779
|
+
yo as lightTheme,
|
|
3780
|
+
Ii as materialPalenight,
|
|
3781
|
+
_i as minimalLight,
|
|
3782
|
+
Ui as mintBreeze,
|
|
3793
3783
|
Ei as monokaiPro,
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3784
|
+
Oi as nightOwl,
|
|
3785
|
+
At as normalizeTime,
|
|
3786
|
+
$i as oneDarkPro,
|
|
3787
|
+
Xi as panda,
|
|
3788
|
+
Hi as peachCream,
|
|
3789
|
+
Gi as quietLight,
|
|
3790
|
+
Ni as rosePineDawn,
|
|
3791
|
+
ji as sandDune,
|
|
3792
|
+
Ji as solarizedLight,
|
|
3793
|
+
be as themes,
|
|
3804
3794
|
J as useChartInstance,
|
|
3805
3795
|
oe as useCrosshairPosition,
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3796
|
+
ro as useLastYValue,
|
|
3797
|
+
ao as usePreviousClose,
|
|
3798
|
+
qi as useTheme,
|
|
3799
|
+
io as useVisibleRange,
|
|
3800
|
+
oo as useYRange
|
|
3811
3801
|
};
|