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