p1-charts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +100 -2
- package/dist/CategoryBarChart-1Kn3Vozc.js +580 -0
- package/dist/CategoryBarChart-1Kn3Vozc.js.map +1 -0
- package/dist/ChartFrame-B1bVFM2E.js +403 -0
- package/dist/ChartFrame-B1bVFM2E.js.map +1 -0
- package/dist/{Heatmap-C1XcTUg1.js → Heatmap-CFC753mV.js} +278 -272
- package/dist/Heatmap-CFC753mV.js.map +1 -0
- package/dist/{PieLegend-BZsv9IbF.js → PieLegend-CbpjaOJH.js} +94 -111
- package/dist/PieLegend-CbpjaOJH.js.map +1 -0
- package/dist/PolarChart-hcNTWKfJ.js +450 -0
- package/dist/PolarChart-hcNTWKfJ.js.map +1 -0
- package/dist/Sparkline-BApLVWfg.js +110 -0
- package/dist/Sparkline-BApLVWfg.js.map +1 -0
- package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BzeHEtQl.js} +120 -119
- package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BzeHEtQl.js.map} +1 -1
- package/dist/category.d.ts +1 -1
- package/dist/category.d.ts.map +1 -1
- package/dist/category.js +1 -1
- package/dist/charts/CategoryBarChart/index.d.ts +1 -1
- package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
- package/dist/charts/Heatmap/index.d.ts.map +1 -1
- package/dist/charts/PolarChart/index.d.ts.map +1 -1
- package/dist/charts/ScatterChart/index.d.ts +1 -1
- package/dist/charts/ScatterChart/index.d.ts.map +1 -1
- package/dist/charts/Sparkline/index.d.ts +5 -2
- package/dist/charts/Sparkline/index.d.ts.map +1 -1
- package/dist/components/ChartFrame/index.d.ts +7 -0
- package/dist/components/ChartFrame/index.d.ts.map +1 -0
- package/dist/components/ChartStory/index.d.ts +7 -0
- package/dist/components/ChartStory/index.d.ts.map +1 -0
- package/dist/components/HeatmapCells/index.d.ts +1 -1
- package/dist/components/HeatmapCells/index.d.ts.map +1 -1
- package/dist/{css-C-rsk7-l.js → css-BtFQ2bM4.js} +2 -2
- package/dist/{css-C-rsk7-l.js.map → css-BtFQ2bM4.js.map} +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/hooks/useMarkMemory.d.ts +9 -0
- package/dist/hooks/useMarkMemory.d.ts.map +1 -0
- package/dist/hooks/usePieTween.d.ts.map +1 -1
- package/dist/hooks/useSteps.d.ts +4 -0
- package/dist/hooks/useSteps.d.ts.map +1 -0
- package/dist/hooks/useTween.d.ts +12 -0
- package/dist/hooks/useTween.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -118
- package/dist/index.js.map +1 -1
- package/dist/motion.utils-DFoqptDi.js +55 -0
- package/dist/motion.utils-DFoqptDi.js.map +1 -0
- package/dist/pie.js +1 -1
- package/dist/scatter.js +1 -1
- package/dist/series.js +1 -1
- package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
- package/dist/shared-C1pGJV4T.js.map +1 -0
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.d.ts.map +1 -1
- package/dist/sparkline.js +2 -2
- package/dist/story.d.ts +11 -0
- package/dist/story.d.ts.map +1 -0
- package/dist/story.js +7 -0
- package/dist/theme.js +3 -3
- package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DgmWROoe.js} +40 -20
- package/dist/theme.utils-DgmWROoe.js.map +1 -0
- package/dist/tooltip.utils-CXD_NapA.js +9 -0
- package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
- package/dist/types/category.d.ts +10 -0
- package/dist/types/category.d.ts.map +1 -1
- package/dist/types/heatmap.d.ts +3 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmapParts.d.ts +2 -0
- package/dist/types/heatmapParts.d.ts.map +1 -1
- package/dist/types/motion.d.ts +31 -0
- package/dist/types/motion.d.ts.map +1 -0
- package/dist/types/pie.d.ts +3 -4
- package/dist/types/pie.d.ts.map +1 -1
- package/dist/types/polar.d.ts +3 -0
- package/dist/types/polar.d.ts.map +1 -1
- package/dist/types/scatter.d.ts +3 -0
- package/dist/types/scatter.d.ts.map +1 -1
- package/dist/types/sparkline.d.ts +3 -0
- package/dist/types/sparkline.d.ts.map +1 -1
- package/dist/types/story.d.ts +73 -0
- package/dist/types/story.d.ts.map +1 -0
- package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-KKtc1C4K.js} +2 -2
- package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-KKtc1C4K.js.map} +1 -1
- package/dist/useControllable-Crsr0byh.js +11 -0
- package/dist/useControllable-Crsr0byh.js.map +1 -0
- package/dist/useMarkMemory-CLNY6TtT.js +15 -0
- package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
- package/dist/useTween-B0G0CcvM.js +46 -0
- package/dist/useTween-B0G0CcvM.js.map +1 -0
- package/dist/utils/category.utils.d.ts +2 -0
- package/dist/utils/category.utils.d.ts.map +1 -1
- package/dist/utils/color.utils.d.ts +9 -0
- package/dist/utils/color.utils.d.ts.map +1 -1
- package/dist/utils/csv.utils.d.ts +6 -0
- package/dist/utils/csv.utils.d.ts.map +1 -0
- package/dist/utils/motion.utils.d.ts +25 -0
- package/dist/utils/motion.utils.d.ts.map +1 -1
- package/dist/utils/pieTween.utils.d.ts +1 -1
- package/dist/utils/pieTween.utils.d.ts.map +1 -1
- package/dist/utils/sparkline.utils.d.ts +15 -0
- package/dist/utils/sparkline.utils.d.ts.map +1 -1
- package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
- package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
- package/package.json +10 -3
- package/src/category.ts +1 -0
- package/src/charts/CategoryBarChart/index.tsx +203 -44
- package/src/charts/Heatmap/index.tsx +4 -0
- package/src/charts/PolarChart/index.tsx +98 -5
- package/src/charts/ScatterChart/index.tsx +96 -13
- package/src/charts/Sparkline/index.tsx +54 -7
- package/src/components/ChartFrame/index.tsx +180 -0
- package/src/components/ChartStory/index.tsx +184 -0
- package/src/components/HeatmapCells/index.tsx +5 -2
- package/src/hooks/useMarkMemory.ts +29 -0
- package/src/hooks/usePieTween.ts +9 -44
- package/src/hooks/useSteps.ts +77 -0
- package/src/hooks/useTween.ts +112 -0
- package/src/index.ts +19 -0
- package/src/sparkline.ts +1 -1
- package/src/story.ts +19 -0
- package/src/types/category.ts +11 -0
- package/src/types/heatmap.ts +3 -0
- package/src/types/heatmapParts.ts +2 -0
- package/src/types/motion.ts +35 -0
- package/src/types/pie.ts +3 -3
- package/src/types/polar.ts +3 -0
- package/src/types/scatter.ts +3 -0
- package/src/types/sparkline.ts +3 -0
- package/src/types/story.ts +103 -0
- package/src/utils/category.utils.ts +22 -0
- package/src/utils/color.utils.ts +48 -0
- package/src/utils/csv.utils.ts +28 -0
- package/src/utils/motion.utils.ts +124 -0
- package/src/utils/pieTween.utils.ts +1 -2
- package/src/utils/sparkline.utils.ts +69 -0
- package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
- package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
- package/dist/Heatmap-C1XcTUg1.js.map +0 -1
- package/dist/PieLegend-BZsv9IbF.js.map +0 -1
- package/dist/PolarChart-BUEhn3CI.js +0 -334
- package/dist/PolarChart-BUEhn3CI.js.map +0 -1
- package/dist/Sparkline-DtNhxGVo.js +0 -67
- package/dist/Sparkline-DtNhxGVo.js.map +0 -1
- package/dist/motion.utils-C1eaZJdQ.js +0 -9
- package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
- package/dist/theme.utils-CP1XtGIe.js.map +0 -1
- package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
- package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { _ as e, a as t, c as n, d as r, f as i,
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
2
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, p as d, r as f, s as p, u as m, y as h } from "./theme.utils-DgmWROoe.js";
|
|
3
|
+
import { a as g, c as _, i as v, n as y, o as b, r as x, s as S } from "./visibility.utils-wuc3ZS8D.js";
|
|
4
|
+
import { a as ee, c as C, d as w, f as T, i as E, l as te, m as D, n as O, o as k, p as ne, r as re, s as A, t as j, u as M } from "./Heatmap-CFC753mV.js";
|
|
5
|
+
import { i as N, n as P, r as F } from "./motion.utils-DFoqptDi.js";
|
|
6
|
+
import { n as I, t as L } from "./useChartTheme-KKtc1C4K.js";
|
|
7
|
+
import { C as ie, S as R, _ as ae, a as z, b as B, c as V, d as oe, f as se, g as ce, h as le, i as ue, l as de, m as H, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as U, w as W, x as G, y as ye } from "./TimeSeriesChart-BzeHEtQl.js";
|
|
8
|
+
import { a as be, i as xe, n as Se, o as Ce, r as we, t as Te } from "./PieLegend-CbpjaOJH.js";
|
|
9
|
+
import { t as Ee } from "./useTween-B0G0CcvM.js";
|
|
10
|
+
import { t as De } from "./CategoryBarChart-1Kn3Vozc.js";
|
|
11
|
+
import { t as Oe } from "./useMarkMemory-CLNY6TtT.js";
|
|
12
|
+
import { r as ke, t as Ae } from "./PolarChart-hcNTWKfJ.js";
|
|
13
|
+
import { t as je } from "./Sparkline-BApLVWfg.js";
|
|
14
|
+
import { t as Me } from "./bin.utils-Ch1y7YDn.js";
|
|
15
|
+
import { i as Ne, n as Pe, r as Fe, t as Ie } from "./css-BtFQ2bM4.js";
|
|
16
|
+
import { a as Le, i as Re, n as ze, r as Be, t as Ve } from "./ChartFrame-B1bVFM2E.js";
|
|
17
|
+
import { HistogramSeries as K } from "lightweight-charts";
|
|
18
|
+
import { Children as He, forwardRef as q, isValidElement as Ue, useEffect as J, useImperativeHandle as We, useMemo as Y, useRef as X, useState as Ge } from "react";
|
|
15
19
|
import { jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
16
20
|
//#region src/utils/squarify.utils.ts
|
|
17
|
-
function
|
|
18
|
-
let n = b(e), [r, i] =
|
|
21
|
+
function Ke(e, t) {
|
|
22
|
+
let n = b(e), [r, i] = x(e), a = t * t, o = n * n;
|
|
19
23
|
return Math.max(a * i / o, o / (a * r));
|
|
20
24
|
}
|
|
21
|
-
function
|
|
25
|
+
function qe(e, t, n, r) {
|
|
22
26
|
let i = b(e.map((e) => t[e])), a = n.width >= n.height, o = i / (a ? n.height : n.width), s = 0;
|
|
23
27
|
for (let i of e) {
|
|
24
28
|
let e = t[i] / o;
|
|
@@ -44,7 +48,7 @@ function Fe(e, t, n, r) {
|
|
|
44
48
|
height: Math.max(0, n.height - o)
|
|
45
49
|
};
|
|
46
50
|
}
|
|
47
|
-
function
|
|
51
|
+
function Je(e, t) {
|
|
48
52
|
y("squarify", e);
|
|
49
53
|
let n = e.map(() => ({
|
|
50
54
|
x: t.x,
|
|
@@ -56,18 +60,18 @@ function Ie(e, t) {
|
|
|
56
60
|
let a = e.map((e) => e * i / r), o = a.map((e, t) => t).filter((e) => a[e] > 0).sort((e, t) => a[t] - a[e] || e - t), s = { ...t }, c = [], l = (e) => e.map((e) => a[e]);
|
|
57
61
|
for (let e of o) {
|
|
58
62
|
let t = Math.min(s.width, s.height), r = [...c, e];
|
|
59
|
-
c.length === 0 ||
|
|
63
|
+
c.length === 0 || Ke(l(r), t) <= Ke(l(c), t) ? c = r : (s = qe(c, a, s, n), c = [e]);
|
|
60
64
|
}
|
|
61
|
-
return c.length > 0 &&
|
|
65
|
+
return c.length > 0 && qe(c, a, s, n), n;
|
|
62
66
|
}
|
|
63
67
|
//#endregion
|
|
64
68
|
//#region src/hooks/useNowLine.ts
|
|
65
|
-
function
|
|
69
|
+
function Ye(e, t, n) {
|
|
66
70
|
J(() => {
|
|
67
71
|
let r = t.current;
|
|
68
72
|
if (!e || !r) return;
|
|
69
73
|
let { chart: i } = e, a = i.timeScale(), o = () => {
|
|
70
|
-
let e = n === null ? null :
|
|
74
|
+
let e = n === null ? null : W(a, n), t = e !== null && e >= 0 && e <= a.width();
|
|
71
75
|
r.style.display = t ? "block" : "none", t && (r.style.transform = `translateX(${e + i.priceScale("left").width()}px)`);
|
|
72
76
|
};
|
|
73
77
|
return o(), a.subscribeVisibleLogicalRangeChange(o), a.subscribeSizeChange(o), () => {
|
|
@@ -86,14 +90,14 @@ function $(e) {
|
|
|
86
90
|
}
|
|
87
91
|
//#endregion
|
|
88
92
|
//#region src/charts/HistogramPane/index.tsx
|
|
89
|
-
function
|
|
93
|
+
function Xe(e) {
|
|
90
94
|
return null;
|
|
91
95
|
}
|
|
92
96
|
//#endregion
|
|
93
97
|
//#region src/utils/timeline.utils.ts
|
|
94
|
-
var
|
|
95
|
-
function
|
|
96
|
-
let { palette: n, typography: r, timeline: i } = e, a = i.barHeight ??
|
|
98
|
+
var Ze = 18, Qe = 5e3;
|
|
99
|
+
function $e(e, t) {
|
|
100
|
+
let { palette: n, typography: r, timeline: i } = e, a = i.barHeight ?? Ze, o = (e) => ({
|
|
97
101
|
...r.label,
|
|
98
102
|
color: e
|
|
99
103
|
}), s = [...t].reduce((e, t) => e + t.charCodeAt(0), 0);
|
|
@@ -133,10 +137,10 @@ function Ve(e, t) {
|
|
|
133
137
|
text: o(n.background)
|
|
134
138
|
};
|
|
135
139
|
}
|
|
136
|
-
function
|
|
137
|
-
return (n) =>
|
|
140
|
+
function et(e, t = {}) {
|
|
141
|
+
return (n) => o(e && $e(e, n), e?.timeline.styles?.[n], t[n]);
|
|
138
142
|
}
|
|
139
|
-
function
|
|
143
|
+
function tt(e) {
|
|
140
144
|
return e.flatMap(({ start: e, end: t, eta: n, state: r, label: i, color: a }) => {
|
|
141
145
|
let o = {
|
|
142
146
|
from: e,
|
|
@@ -144,7 +148,7 @@ function Ue(e) {
|
|
|
144
148
|
key: r,
|
|
145
149
|
label: i,
|
|
146
150
|
color: a
|
|
147
|
-
}, s = n === void 0 ? null :
|
|
151
|
+
}, s = n === void 0 ? null : R(n), c = R(e);
|
|
148
152
|
return s !== null && c !== null && s < c ? [{
|
|
149
153
|
from: n,
|
|
150
154
|
to: e,
|
|
@@ -152,62 +156,62 @@ function Ue(e) {
|
|
|
152
156
|
}, o] : [o];
|
|
153
157
|
});
|
|
154
158
|
}
|
|
155
|
-
function
|
|
156
|
-
let t = e.map(
|
|
159
|
+
function nt(e) {
|
|
160
|
+
let t = e.map(R).filter((e) => e !== null);
|
|
157
161
|
return [...new Set(t)].sort((e, t) => e - t);
|
|
158
162
|
}
|
|
159
|
-
function
|
|
160
|
-
let n =
|
|
163
|
+
function rt(e, t = 3600) {
|
|
164
|
+
let n = nt(e), r = n[0], i = n[n.length - 1];
|
|
161
165
|
if (r === void 0 || i === void 0 || !(t > 0)) return [];
|
|
162
|
-
let a = Math.max(t, Math.ceil((i - r) /
|
|
166
|
+
let a = Math.max(t, Math.ceil((i - r) / Qe)), o = Math.floor(r / a) * a, s = Math.ceil(i / a) * a;
|
|
163
167
|
return Array.from({ length: Math.max(1, (s - o) / a + 1) }, (e, t) => o + t * a);
|
|
164
168
|
}
|
|
165
169
|
//#endregion
|
|
166
170
|
//#region src/hooks/usePaneRanges.ts
|
|
167
|
-
function
|
|
168
|
-
let
|
|
171
|
+
function it(e, t, n) {
|
|
172
|
+
let r = X([]);
|
|
169
173
|
J(() => {
|
|
170
|
-
|
|
171
|
-
}, [
|
|
172
|
-
if (!
|
|
173
|
-
let
|
|
174
|
-
|
|
175
|
-
let
|
|
176
|
-
if (
|
|
177
|
-
let
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
r.current = [];
|
|
175
|
+
}, [e]), J(() => {
|
|
176
|
+
if (!e) return;
|
|
177
|
+
let i = r.current, a = e.chart.panes(), o = (e) => e?.pane.detachPrimitive(e.primitive);
|
|
178
|
+
t.forEach((e, t) => {
|
|
179
|
+
let r = a[t], s = i[t];
|
|
180
|
+
if (s && (!e || s.pane !== r) && (o(s), s = i[t] = void 0), !e || !r) return;
|
|
181
|
+
let c = [
|
|
182
|
+
e.items,
|
|
183
|
+
e.styles,
|
|
184
|
+
n
|
|
181
185
|
];
|
|
182
|
-
if (
|
|
183
|
-
let
|
|
184
|
-
items:
|
|
185
|
-
style:
|
|
186
|
+
if (s && h(s.inputs, c)) return;
|
|
187
|
+
let l = {
|
|
188
|
+
items: tt(e.items),
|
|
189
|
+
style: et(n, e.styles)
|
|
186
190
|
};
|
|
187
|
-
if (
|
|
188
|
-
|
|
191
|
+
if (s) {
|
|
192
|
+
s.primitive.applyOptions(l), s.inputs = c;
|
|
189
193
|
return;
|
|
190
194
|
}
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
pane:
|
|
194
|
-
primitive:
|
|
195
|
-
inputs:
|
|
195
|
+
let u = new U(l);
|
|
196
|
+
r.attachPrimitive(u), i[t] = {
|
|
197
|
+
pane: r,
|
|
198
|
+
primitive: u,
|
|
199
|
+
inputs: c
|
|
196
200
|
};
|
|
197
|
-
}),
|
|
201
|
+
}), i.splice(t.length).forEach(o);
|
|
198
202
|
});
|
|
199
203
|
}
|
|
200
204
|
//#endregion
|
|
201
205
|
//#region src/hooks/usePaneSeries.ts
|
|
202
|
-
function
|
|
203
|
-
let
|
|
206
|
+
function at(n, r, i) {
|
|
207
|
+
let s = X([]);
|
|
204
208
|
return J(() => {
|
|
205
|
-
|
|
209
|
+
s.current = [];
|
|
206
210
|
}, [n]), J(() => {
|
|
207
211
|
if (!n) return;
|
|
208
|
-
let { chart:
|
|
209
|
-
let i = e === 0 ? n.series :
|
|
210
|
-
return e > 0 && (i.applyOptions(t),
|
|
212
|
+
let { chart: c } = n, l = s.current, u = (e, t, r) => {
|
|
213
|
+
let i = e === 0 ? n.series : c.addSeries(K, {}, e), a = o(i.options());
|
|
214
|
+
return e > 0 && (i.applyOptions(t), c.panes()[e]?.setPreserveEmptyPane(!0)), {
|
|
211
215
|
series: i,
|
|
212
216
|
defaults: a,
|
|
213
217
|
options: t,
|
|
@@ -215,108 +219,108 @@ function qe(n, r, i) {
|
|
|
215
219
|
dataInputs: [],
|
|
216
220
|
lineInputs: [],
|
|
217
221
|
lines: [],
|
|
218
|
-
normalized:
|
|
222
|
+
normalized: G([])
|
|
219
223
|
};
|
|
220
224
|
};
|
|
221
225
|
r.forEach((n, r) => {
|
|
222
|
-
let
|
|
223
|
-
g && r > 0 && !
|
|
224
|
-
let { bar: _, over: v, positive: y, negative: b } =
|
|
226
|
+
let s = n.mode ?? "plain", d = [s, n.seriesOptions], f = H(s, n.seriesOptions), g = l[r];
|
|
227
|
+
g && r > 0 && !h(g.optionInputs, d) && (e(g.defaults, g.options, f) ? (c.removeSeries(g.series), g = void 0) : (g.series.applyOptions(o(a(g.defaults, g.options), f)), g.options = f, g.optionInputs = d)), g || (l[r] = g = u(r, f, d));
|
|
228
|
+
let { bar: _, over: v, positive: y, negative: b } = o(t(i), n.colors), x = [
|
|
225
229
|
n.data,
|
|
226
230
|
n.whitespace,
|
|
227
|
-
|
|
231
|
+
s,
|
|
228
232
|
n.threshold,
|
|
229
233
|
_,
|
|
230
234
|
v,
|
|
231
235
|
y,
|
|
232
236
|
b
|
|
233
237
|
];
|
|
234
|
-
|
|
238
|
+
h(g.dataInputs, x) || (g.normalized = G(n.data), g.series.setData(n.whitespace ? nt(n.whitespace).map((e) => ({ time: e })) : me(g.normalized.data, s, n.threshold, {
|
|
235
239
|
bar: _,
|
|
236
240
|
over: v,
|
|
237
241
|
positive: y,
|
|
238
242
|
negative: b
|
|
239
243
|
})), g.dataInputs = x);
|
|
240
244
|
let S = [
|
|
241
|
-
|
|
245
|
+
s,
|
|
242
246
|
n.threshold,
|
|
243
247
|
n.thresholdLine,
|
|
244
248
|
n.zeroLine,
|
|
245
249
|
i
|
|
246
250
|
];
|
|
247
|
-
if (!
|
|
251
|
+
if (!h(g.lineInputs, S)) {
|
|
248
252
|
let { series: e } = g;
|
|
249
|
-
g.lines.forEach((t) => e.removePriceLine(t)), g.lines =
|
|
253
|
+
g.lines.forEach((t) => e.removePriceLine(t)), g.lines = le(s, n.threshold, m(p(i, i?.histogram.threshold, "dashed"), n.thresholdLine), m(p(i, i?.histogram.zero, "solid"), n.zeroLine)).map((t) => e.createPriceLine(t)), g.lineInputs = S;
|
|
250
254
|
}
|
|
251
|
-
|
|
255
|
+
c.panes()[r]?.setStretchFactor(n.height);
|
|
252
256
|
}), l.splice(r.length).forEach((e) => {
|
|
253
257
|
if (e.series !== n.series) {
|
|
254
|
-
|
|
258
|
+
c.removeSeries(e.series);
|
|
255
259
|
return;
|
|
256
260
|
}
|
|
257
261
|
e.lines.forEach((t) => e.series.removePriceLine(t)), e.series.setData([]);
|
|
258
262
|
});
|
|
259
|
-
for (let e =
|
|
260
|
-
}),
|
|
263
|
+
for (let e = c.panes().length - 1; e >= Math.max(r.length, 1); e--) c.removePane(e);
|
|
264
|
+
}), s;
|
|
261
265
|
}
|
|
262
266
|
//#endregion
|
|
263
267
|
//#region src/charts/ChartPanes/index.tsx
|
|
264
|
-
var
|
|
268
|
+
var ot = { display: "flex" }, st = { flex: "none" }, ct = {
|
|
265
269
|
boxSizing: "border-box",
|
|
266
270
|
overflow: "hidden"
|
|
267
|
-
},
|
|
271
|
+
}, lt = {
|
|
268
272
|
position: "relative",
|
|
269
273
|
flex: 1,
|
|
270
274
|
minWidth: 0
|
|
271
|
-
},
|
|
275
|
+
}, ut = {
|
|
272
276
|
position: "absolute",
|
|
273
277
|
inset: 0
|
|
274
|
-
},
|
|
278
|
+
}, dt = {
|
|
275
279
|
position: "absolute",
|
|
276
280
|
top: 0,
|
|
277
281
|
left: 0,
|
|
278
282
|
width: 1,
|
|
279
283
|
display: "none",
|
|
280
284
|
pointerEvents: "none"
|
|
281
|
-
},
|
|
285
|
+
}, ft = { layout: { panes: { enableResize: !1 } } }, pt = [], mt = (e) => e.value.toLocaleString(), ht = q(function({ children: e, now: t = null, axisLabel: r, chartOptions: i, ctrlWheelZoom: a = !0, ariaLabel: c = "Chart panes", className: l, classNames: d = {}, styles: f = {}, onPaneClick: p, onPaneHover: m, onPaneLeave: h, theme: g, unstyled: _ }, v) {
|
|
282
286
|
let y = X(null), b = X(null), x = X({
|
|
283
287
|
onPaneClick: p,
|
|
284
288
|
onPaneHover: m,
|
|
285
289
|
onPaneLeave: h
|
|
286
|
-
}), [S, ee] =
|
|
290
|
+
}), [S, ee] = Ge(0), [C, w] = Ge(null);
|
|
287
291
|
x.current = {
|
|
288
292
|
onPaneClick: p,
|
|
289
293
|
onPaneHover: m,
|
|
290
294
|
onPaneLeave: h
|
|
291
295
|
};
|
|
292
|
-
let T =
|
|
296
|
+
let T = L({
|
|
293
297
|
theme: g,
|
|
294
298
|
unstyled: _
|
|
295
|
-
}), E = T?.sizes.paneHeight ??
|
|
296
|
-
|
|
297
|
-
if (
|
|
299
|
+
}), E = T?.sizes.paneHeight ?? s.sizes.paneHeight, te = T?.sizes.laneHeight ?? E, D = [], O = [];
|
|
300
|
+
He.forEach(e, (e) => {
|
|
301
|
+
if (Ue(e) && e.type === Xe && (D.push(null), O.push({
|
|
298
302
|
...e.props,
|
|
299
303
|
height: e.props.height ?? E
|
|
300
|
-
})),
|
|
304
|
+
})), Ue(e) && e.type === $) {
|
|
301
305
|
let { label: t, meta: n, height: r = te, times: i } = e.props;
|
|
302
306
|
D.push(e.props), O.push({
|
|
303
307
|
label: t,
|
|
304
308
|
meta: n,
|
|
305
309
|
height: r,
|
|
306
|
-
data:
|
|
310
|
+
data: pt,
|
|
307
311
|
whitespace: i
|
|
308
312
|
});
|
|
309
313
|
}
|
|
310
314
|
});
|
|
311
|
-
let k = O[0], ne = Y(() =>
|
|
315
|
+
let k = O[0], ne = Y(() => H(k?.mode ?? "plain", k?.seriesOptions), [k?.mode, k?.seriesOptions]), re = Y(() => o(u(T), ft, a && {
|
|
312
316
|
handleScale: { mouseWheel: !1 },
|
|
313
317
|
handleScroll: { mouseWheel: !1 }
|
|
314
318
|
}, i), [
|
|
315
319
|
T,
|
|
316
320
|
a,
|
|
317
321
|
i
|
|
318
|
-
]), A =
|
|
319
|
-
|
|
322
|
+
]), A = ie(y, K, re, ne), j = at(A, O, T);
|
|
323
|
+
it(A, D, T), ae(A, y, a), J(() => {
|
|
320
324
|
if (!A) return;
|
|
321
325
|
let e = A.chart.timeScale(), t = () => ee(e.height());
|
|
322
326
|
return t(), e.subscribeSizeChange(t), () => e.unsubscribeSizeChange(t);
|
|
@@ -347,25 +351,25 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
|
|
|
347
351
|
return e.subscribeCrosshairMove(r), e.subscribeClick(i), () => {
|
|
348
352
|
e.unsubscribeCrosshairMove(r), e.unsubscribeClick(i);
|
|
349
353
|
};
|
|
350
|
-
}, [A, j]),
|
|
354
|
+
}, [A, j]), Ye(A, b, t === null ? null : R(t)), We(v, () => A ? {
|
|
351
355
|
chart: A.chart,
|
|
352
356
|
get series() {
|
|
353
357
|
return j.current.map((e) => e.series);
|
|
354
358
|
}
|
|
355
359
|
} : null, [A, j]);
|
|
356
|
-
let
|
|
360
|
+
let M = O.map((e) => e.height), N = T && o({ color: T.palette.now }, T.panes.now), P = N ? {
|
|
357
361
|
width: 0,
|
|
358
|
-
borderLeft: `${
|
|
359
|
-
} : {},
|
|
362
|
+
borderLeft: `${N.width ?? 1}px ${N.style ?? "solid"} ${N.color}`
|
|
363
|
+
} : {}, F = { width: T?.sizes.paneLabel }, I = { padding: T?.spacing.paneLabel }, z = n(T ? o(T.typography.title, T.panes.title) : void 0), B = n(T ? o(T.typography.value, T.panes.meta) : void 0), V = M.reduce((e, t) => e + t, 0) + Math.max(0, O.length - 1) + S;
|
|
360
364
|
return /* @__PURE__ */ Q("div", {
|
|
361
|
-
className:
|
|
362
|
-
style:
|
|
365
|
+
className: l,
|
|
366
|
+
style: ot,
|
|
363
367
|
children: [/* @__PURE__ */ Q("div", {
|
|
364
368
|
"data-part": "labels",
|
|
365
369
|
className: d.labels,
|
|
366
370
|
style: {
|
|
367
|
-
...
|
|
368
|
-
...
|
|
371
|
+
...st,
|
|
372
|
+
...F,
|
|
369
373
|
...f.labels
|
|
370
374
|
},
|
|
371
375
|
children: [O.map((e, t) => {
|
|
@@ -374,16 +378,16 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
|
|
|
374
378
|
"data-part": "label",
|
|
375
379
|
className: d.label,
|
|
376
380
|
style: {
|
|
377
|
-
...
|
|
378
|
-
...
|
|
379
|
-
height:
|
|
381
|
+
...ct,
|
|
382
|
+
...I,
|
|
383
|
+
height: M[t] + +(t > 0),
|
|
380
384
|
...f.label
|
|
381
385
|
},
|
|
382
386
|
children: [/* @__PURE__ */ Z("div", {
|
|
383
387
|
"data-part": "title",
|
|
384
388
|
className: d.title,
|
|
385
389
|
style: {
|
|
386
|
-
...
|
|
390
|
+
...z,
|
|
387
391
|
...f.title
|
|
388
392
|
},
|
|
389
393
|
children: e.label
|
|
@@ -391,17 +395,17 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
|
|
|
391
395
|
"data-part": "meta",
|
|
392
396
|
className: d.meta,
|
|
393
397
|
style: {
|
|
394
|
-
...
|
|
398
|
+
...B,
|
|
395
399
|
...f.meta
|
|
396
400
|
},
|
|
397
|
-
children: n ? (e.format ??
|
|
401
|
+
children: n ? (e.format ?? mt)(n) : e.meta
|
|
398
402
|
})]
|
|
399
403
|
}, t);
|
|
400
404
|
}), /* @__PURE__ */ Z("div", {
|
|
401
405
|
"data-part": "axis",
|
|
402
406
|
className: d.axis,
|
|
403
407
|
style: {
|
|
404
|
-
...
|
|
408
|
+
...ct,
|
|
405
409
|
height: S,
|
|
406
410
|
...f.axis
|
|
407
411
|
},
|
|
@@ -411,22 +415,22 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
|
|
|
411
415
|
"data-part": "plot",
|
|
412
416
|
className: d.plot,
|
|
413
417
|
style: {
|
|
414
|
-
...
|
|
415
|
-
height:
|
|
418
|
+
...lt,
|
|
419
|
+
height: V,
|
|
416
420
|
...f.plot
|
|
417
421
|
},
|
|
418
422
|
children: [/* @__PURE__ */ Z("div", {
|
|
419
423
|
ref: y,
|
|
420
|
-
style:
|
|
424
|
+
style: ut,
|
|
421
425
|
role: "img",
|
|
422
|
-
"aria-label":
|
|
426
|
+
"aria-label": c
|
|
423
427
|
}), /* @__PURE__ */ Z("div", {
|
|
424
428
|
ref: b,
|
|
425
429
|
"data-part": "now",
|
|
426
430
|
className: d.now,
|
|
427
431
|
style: {
|
|
428
|
-
|
|
429
|
-
...
|
|
432
|
+
...dt,
|
|
433
|
+
...P,
|
|
430
434
|
bottom: S,
|
|
431
435
|
...f.now
|
|
432
436
|
},
|
|
@@ -434,13 +438,13 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
|
|
|
434
438
|
})]
|
|
435
439
|
})]
|
|
436
440
|
});
|
|
437
|
-
}),
|
|
438
|
-
let i = Y(() =>
|
|
441
|
+
}), gt = q(function({ lanes: e, step: t, ...n }, r) {
|
|
442
|
+
let i = Y(() => rt(e.flatMap((e) => e.items.flatMap(({ start: e, end: t, eta: n }) => n === void 0 ? [e, t] : [
|
|
439
443
|
n,
|
|
440
444
|
e,
|
|
441
445
|
t
|
|
442
446
|
])), t), [e, t]);
|
|
443
|
-
return /* @__PURE__ */ Z(
|
|
447
|
+
return /* @__PURE__ */ Z(ht, {
|
|
444
448
|
ref: r,
|
|
445
449
|
...n,
|
|
446
450
|
children: e.map(({ id: e, ...t }, n) => /* @__PURE__ */ Z($, {
|
|
@@ -450,6 +454,6 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
|
|
|
450
454
|
});
|
|
451
455
|
});
|
|
452
456
|
//#endregion
|
|
453
|
-
export {
|
|
457
|
+
export { ve as BarChart, z as CandlestickChart, De as CategoryBarChart, Ve as ChartFrame, ht as ChartPanes, Re as ChartStory, I as ChartThemeProvider, j as Heatmap, E as HeatmapLegend, pe as HistogramChart, Xe as HistogramPane, de as LineChart, Se as PieChart, Te as PieLegend, Ae as PolarChart, ue as RibbonPrimitive, ke as ScatterChart, ce as SeriesChart, je as Sparkline, U as TimeRangePrimitive, _e as TimeSeriesChart, gt as TimelineChart, $ as TimelinePane, ge as aggregate, oe as aggregatePoints, xe as arcPath, ye as bandAt, Me as bin, k as cellAt, r as contrastRatio, f as createTheme, s as defaultTheme, ze as downloadCsv, P as easeInOutCubic, F as easeOutCubic, fe as editorialChartOptions, A as extremes, C as heatmapGrid, te as heatmapLayout, M as inRange, V as isUp, N as linear, w as normaliseRange, Fe as p1Accents, Ie as p1CssVariables, Ne as p1Theme, Pe as p1ThemeFromCss, he as patchSquareCanvasLabels, v as pieArcs, be as pieSlices, Ce as placeLabels, T as pointerCell, g as quantize, ne as rangeStats, i as readableInk, B as resolveBandStyles, Je as squarify, D as stepColor, S as symmetricExtent, c as themeFromCssVariables, _ as tidyTree, W as timeToX, Be as toCsv, se as toLinePoints, d as toSrgb, L as useChartTheme, O as useHeatmapSelection, re as useHeatmapState, ee as useHeatmapSteps, Oe as useMarkMemory, we as usePieState, Le as useSteps, Ee as useTween, l as withAlpha };
|
|
454
458
|
|
|
455
459
|
//# sourceMappingURL=index.js.map
|