@hybridcore/ui 1.5.78 → 1.5.80
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/components/charts/candlestick/index.js +30 -613
- package/dist/components/charts/candlestick/logic.js +642 -0
- package/dist/components/charts/candlestick/styled.js +12 -0
- package/dist/components/charts/highlighting-line-data/index.js +31 -813
- package/dist/components/charts/highlighting-line-data/logic.js +836 -0
- package/dist/components/charts/highlighting-line-data/styled.js +12 -0
- package/dist/components/metric-card/index.js +56 -170
- package/dist/components/metric-card/logic.js +46 -0
- package/dist/components/metric-card/styled.js +136 -0
- package/dist/components/paginated-list/index.js +68 -95
- package/dist/components/paginated-list/logic.js +45 -0
- package/dist/components/paginated-list/styled.js +49 -0
- package/dist/components/profile-card/index.js +80 -0
- package/dist/components/profile-card/logic.js +33 -0
- package/dist/components/profile-card/styled.js +43 -0
- package/dist/main.d.ts +165 -33
- package/package.json +1 -1
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
import { X as se, e as k, v as K, P as V, i as Q, a as O, _ as $, R as W, G as ie, L as E, T as H, m as U, b as oe, A as ne, c as le, d as ae, D as re, f as he, g as I, V as ee, h as te, j as M, p as ce } from "../../../AxisRendererY-CFo972D5.js";
|
|
2
|
+
import { useThemeProps as ge } from "@mui/material";
|
|
3
|
+
import { useRef as q, useLayoutEffect as ue, useEffect as pe } from "react";
|
|
4
|
+
class T extends se {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments), Object.defineProperty(this, "_ph", {
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0,
|
|
10
|
+
value: 0
|
|
11
|
+
}), Object.defineProperty(this, "_pw", {
|
|
12
|
+
enumerable: !0,
|
|
13
|
+
configurable: !0,
|
|
14
|
+
writable: !0,
|
|
15
|
+
value: 0
|
|
16
|
+
}), Object.defineProperty(this, "_columnsUpdated", {
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
configurable: !0,
|
|
19
|
+
writable: !0,
|
|
20
|
+
value: !1
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_makeGraphics(e, t) {
|
|
24
|
+
return this.makeColumn(t, e);
|
|
25
|
+
}
|
|
26
|
+
_makeFieldNames() {
|
|
27
|
+
super._makeFieldNames();
|
|
28
|
+
const e = this.get("xAxis"), t = this.get("yAxis"), s = "CategoryAxis", o = "ValueAxis";
|
|
29
|
+
e.isType(s) && (this.get("openCategoryXField") || (this._xOpenField = this._xField)), e.isType(o) && (this.get("openValueXField") || (this._xOpenField = this._xField)), t.isType(s) && (this.get("openCategoryYField") || (this._yOpenField = this._yField)), t.isType(o) && (this.get("openValueYField") || (this._yOpenField = this._yField));
|
|
30
|
+
}
|
|
31
|
+
_prepareChildren() {
|
|
32
|
+
super._prepareChildren();
|
|
33
|
+
const e = this.get("xAxis"), t = this.get("yAxis"), s = this.dataItems.length, o = Math.max(0, this.startIndex() - 2), i = Math.min(this.endIndex() + 2, s - 1);
|
|
34
|
+
if (e.inited && t.inited)
|
|
35
|
+
for (let n = o; n <= i; n++) {
|
|
36
|
+
let l = this.dataItems[n];
|
|
37
|
+
this._createGraphics(l);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
_updateChildren() {
|
|
41
|
+
const e = this.chart;
|
|
42
|
+
e && (this._ph = e.plotContainer.height(), this._pw = e.plotContainer.width());
|
|
43
|
+
const t = this.get("xAxis"), s = this.get("yAxis"), o = this.get("baseAxis"), i = this.columns.template;
|
|
44
|
+
this.isDirty("fill") && i.get("fill") == null && i.set("fill", this.get("fill")), this.isDirty("fillPattern") && i.get("fillPattern") == null && i.set("fillPattern", this.get("fillPattern")), this.isDirty("stroke") && i.get("stroke") == null && i.set("stroke", this.get("stroke"));
|
|
45
|
+
let n = 0, l = 0, d = 0;
|
|
46
|
+
k(o.series, (f) => {
|
|
47
|
+
if (f instanceof T) {
|
|
48
|
+
const c = f.get("stacked");
|
|
49
|
+
c && d == 0 && l++, !c && f.get("clustered") && l++;
|
|
50
|
+
}
|
|
51
|
+
f === this && (n = l - 1), d++;
|
|
52
|
+
}), this.get("clustered") || (n = 0, l = 1), l === 0 && (l = 1, n = 0);
|
|
53
|
+
const m = t.get("renderer"), x = s.get("renderer"), h = "cellStartLocation", u = "cellEndLocation", p = m.get(h, 0), _ = m.get(u, 1), g = x.get(h, 0), a = x.get(u, 1);
|
|
54
|
+
if (this._aLocationX0 = p + n / l * (_ - p), this._aLocationX1 = p + (n + 1) / l * (_ - p), this._aLocationY0 = g + n / l * (a - g), this._aLocationY1 = g + (n + 1) / l * (a - g), t.inited && s.inited) {
|
|
55
|
+
if (this._axesDirty || this._valuesDirty || this._stackDirty || this.isDirty("vcx") || this.isDirty("vcy") || this._sizeDirty) {
|
|
56
|
+
const f = this.dataItems.length;
|
|
57
|
+
let c = Math.max(0, this.startIndex() - 2), r = Math.min(this.endIndex() + 2, f - 1);
|
|
58
|
+
for (let y = 0; y < c; y++)
|
|
59
|
+
this._toggleColumn(this.dataItems[y], !1);
|
|
60
|
+
let w = this.dataItems[c];
|
|
61
|
+
for (let y = c; y <= r; y++) {
|
|
62
|
+
let b = this.dataItems[y];
|
|
63
|
+
if (b.get("valueX") != null && b.get("valueY") != null) {
|
|
64
|
+
if (w = b, y > 0 && c > 0)
|
|
65
|
+
for (let C = y - 1; C >= 0; C--) {
|
|
66
|
+
let Y = this.dataItems[C];
|
|
67
|
+
if (Y.get("valueX") != null && Y.get("valueY") != null) {
|
|
68
|
+
w = Y;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
} else
|
|
74
|
+
this._toggleColumn(b, !1);
|
|
75
|
+
}
|
|
76
|
+
this._beforeColumnsDraw();
|
|
77
|
+
let X = 0;
|
|
78
|
+
s.isType("CategoryAxis") && t.isType("CategoryAxis") ? X = 2 : t === o ? X = 0 : s === o && (X = 1);
|
|
79
|
+
for (let y = c; y <= r; y++) {
|
|
80
|
+
let b = this.dataItems[y];
|
|
81
|
+
this._updateGraphics(b, w, X), b.get("valueX") != null && b.get("valueY") != null && (w = b);
|
|
82
|
+
}
|
|
83
|
+
this._afterColumnsDraw();
|
|
84
|
+
for (let y = r + 1; y < f; y++)
|
|
85
|
+
this._toggleColumn(this.dataItems[y], !1);
|
|
86
|
+
this._columnsUpdated = !0;
|
|
87
|
+
}
|
|
88
|
+
} else
|
|
89
|
+
this._skipped = !0;
|
|
90
|
+
this.getPrivate("doNotUpdateLegend") || this.updateLegendMarker(this.get("tooltipDataItem")), super._updateChildren();
|
|
91
|
+
}
|
|
92
|
+
_afterChanged() {
|
|
93
|
+
super._afterChanged(), this._columnsUpdated = !1;
|
|
94
|
+
}
|
|
95
|
+
_beforeColumnsDraw() {
|
|
96
|
+
}
|
|
97
|
+
_afterColumnsDraw() {
|
|
98
|
+
}
|
|
99
|
+
_createGraphics(e) {
|
|
100
|
+
let t = e.get("graphics");
|
|
101
|
+
if (!t) {
|
|
102
|
+
t = this._makeGraphics(this.columns, e), e.set("graphics", t), t._setDataItem(e);
|
|
103
|
+
const s = e.get("legendDataItem");
|
|
104
|
+
if (s) {
|
|
105
|
+
const i = s.get("markerRectangle");
|
|
106
|
+
if (i) {
|
|
107
|
+
const n = i.states.lookup("default");
|
|
108
|
+
k(K, (l) => {
|
|
109
|
+
const d = t.get(l, this.get(l));
|
|
110
|
+
i.set(l, d), n.set(l, d);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
let o = e.get("rangeGraphics");
|
|
115
|
+
o && k(o, (i) => {
|
|
116
|
+
i.dispose();
|
|
117
|
+
}), o = [], e.setRaw("rangeGraphics", o), this.axisRanges.each((i) => {
|
|
118
|
+
const n = i.container, l = this._makeGraphics(i.columns, e);
|
|
119
|
+
o && o.push(l), l.setPrivate("list", i.columns), n.children.push(l);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
createAxisRange(e) {
|
|
124
|
+
return k(this.dataItems, (t) => {
|
|
125
|
+
const s = t.get("graphics");
|
|
126
|
+
s && (s.dispose(), t.set("graphics", void 0));
|
|
127
|
+
}), super.createAxisRange(e);
|
|
128
|
+
}
|
|
129
|
+
_updateGraphics(e, t, s) {
|
|
130
|
+
let o = e.get("graphics");
|
|
131
|
+
const i = this._xField, n = this._yField, l = e.get(i), d = e.get(n), m = this.get("exactLocationX", !1);
|
|
132
|
+
if (l != null && d != null) {
|
|
133
|
+
const x = this._xOpenField, h = this._yOpenField, u = this.get("locationX", e.get("locationX", 0.5)), p = this.get("locationY", e.get("locationY", 0.5)), _ = this.get("openLocationX", e.get("openLocationX", u)), g = this.get("openLocationY", e.get("openLocationY", p)), a = o.get("width"), f = o.get("height"), c = this.get("stacked"), r = this.get("xAxis"), w = this.get("yAxis"), X = r.get("start"), y = r.get("end"), b = w.get("start"), C = w.get("end");
|
|
134
|
+
let Y, L, F, A, G = this.get("vcy", 1), R = this.get("vcx", 1), B = !1, Z = !1;
|
|
135
|
+
if (s == 0) {
|
|
136
|
+
let P = this._aLocationX0 + _ - 0.5, D = this._aLocationX1 + u - 0.5;
|
|
137
|
+
if (a instanceof V) {
|
|
138
|
+
let v = (D - P) * (1 - a.value) / 2;
|
|
139
|
+
P += v, D -= v;
|
|
140
|
+
}
|
|
141
|
+
if (Y = r.getDataItemPositionX(e, x, P, R, m), L = r.getDataItemPositionX(e, i, D, R, m), F = w.getDataItemPositionY(e, n, p, G), this._yOpenField !== this._yField)
|
|
142
|
+
A = w.getDataItemPositionY(e, h, g, G);
|
|
143
|
+
else if (c) {
|
|
144
|
+
let v = e.get("stackToItemY");
|
|
145
|
+
v ? A = w.getDataItemPositionY(v, n, g, v.component.get("vcy")) : A = w.basePosition();
|
|
146
|
+
} else
|
|
147
|
+
A = w.basePosition();
|
|
148
|
+
e.setRaw("point", { x: Y + (L - Y) / 2, y: F }), Z = !0;
|
|
149
|
+
} else if (s == 1) {
|
|
150
|
+
let P = this._aLocationY0 + g - 0.5, D = this._aLocationY1 + p - 0.5;
|
|
151
|
+
if (f instanceof V) {
|
|
152
|
+
let v = (D - P) * (1 - f.value) / 2;
|
|
153
|
+
P += v, D -= v;
|
|
154
|
+
}
|
|
155
|
+
if (F = w.getDataItemPositionY(e, h, P, G), A = w.getDataItemPositionY(e, n, D, G), L = r.getDataItemPositionX(e, i, u, R, m), this._xOpenField !== this._xField)
|
|
156
|
+
Y = r.getDataItemPositionX(e, x, _, R, m);
|
|
157
|
+
else if (c) {
|
|
158
|
+
let v = e.get("stackToItemX");
|
|
159
|
+
v ? Y = r.getDataItemPositionX(v, i, _, v.component.get("vcx"), m) : Y = r.basePosition();
|
|
160
|
+
} else
|
|
161
|
+
Y = r.basePosition();
|
|
162
|
+
B = !0, e.setRaw("point", { x: L, y: F + (A - F) / 2 });
|
|
163
|
+
} else if (s == 2) {
|
|
164
|
+
let P = this._aLocationX0 + _ - 0.5, D = this._aLocationX1 + u - 0.5;
|
|
165
|
+
if (a instanceof V) {
|
|
166
|
+
let v = (D - P) * (1 - a.value) / 2;
|
|
167
|
+
P += v, D -= v;
|
|
168
|
+
}
|
|
169
|
+
if (Y = r.getDataItemPositionX(e, x, P, R), L = r.getDataItemPositionX(e, i, D, R), P = this._aLocationY0 + g - 0.5, D = this._aLocationY1 + p - 0.5, f instanceof V) {
|
|
170
|
+
let v = (D - P) * (1 - f.value) / 2;
|
|
171
|
+
P += v, D -= v;
|
|
172
|
+
}
|
|
173
|
+
F = w.getDataItemPositionY(e, h, P, G), A = w.getDataItemPositionY(e, n, D, G), e.setRaw("point", { x: Y + (L - Y) / 2, y: F + (A - F) / 2 });
|
|
174
|
+
}
|
|
175
|
+
this._applyGraphicsStates(e, t), this._updateSeriesGraphics(e, o, Y, L, F, A, B, Z), Y < X && L < X || Y > y && L > y || F < b && A <= b || F >= C && A > C || Q(Y) || Q(F) ? this._toggleColumn(e, !1) : this._toggleColumn(e, !0);
|
|
176
|
+
let J = e.get("rangeGraphics");
|
|
177
|
+
J && k(J, (P) => {
|
|
178
|
+
this._updateSeriesGraphics(e, P, Y, L, F, A, B, Z);
|
|
179
|
+
});
|
|
180
|
+
} else
|
|
181
|
+
this._toggleColumn(e, !1);
|
|
182
|
+
}
|
|
183
|
+
_updateSeriesGraphics(e, t, s, o, i, n, l, d) {
|
|
184
|
+
const m = t.get("width"), x = t.get("height"), h = t.get("maxWidth"), u = t.get("maxHeight"), p = this.getPoint(s, i), _ = this.getPoint(o, n), g = e.get("point");
|
|
185
|
+
if (g) {
|
|
186
|
+
const a = this.getPoint(g.x, g.y);
|
|
187
|
+
g.x = a.x + this._x, g.y = a.y + this._y;
|
|
188
|
+
}
|
|
189
|
+
if (s = p.x, o = _.x, i = p.y, n = _.y, O(m)) {
|
|
190
|
+
const a = (o - s - m) / 2;
|
|
191
|
+
s += a, o -= a;
|
|
192
|
+
}
|
|
193
|
+
if (O(h) && h < Math.abs(o - s)) {
|
|
194
|
+
const a = (o - s - h) / 2;
|
|
195
|
+
s += a, o -= a;
|
|
196
|
+
}
|
|
197
|
+
if (O(x)) {
|
|
198
|
+
const a = (n - i - x) / 2;
|
|
199
|
+
i += a, n -= a;
|
|
200
|
+
}
|
|
201
|
+
if (O(u) && u < Math.abs(n - i)) {
|
|
202
|
+
const a = (n - i - u) / 2;
|
|
203
|
+
i += a, n -= a;
|
|
204
|
+
}
|
|
205
|
+
this.get("adjustBulletPosition") && (l && (o = Math.min(Math.max(0, o), this._pw), s = Math.min(Math.max(0, s), this._pw)), d && (i = Math.min(Math.max(0, i), this._ph), n = Math.min(Math.max(0, n), this._ph))), e.setRaw("left", s), e.setRaw("right", o), e.setRaw("top", i), e.setRaw("bottom", n), t.setPrivate("width", o - s), t.setPrivate("height", n - i), t.set("x", s), t.set("y", n - (n - i));
|
|
206
|
+
}
|
|
207
|
+
_handleDataSetChange() {
|
|
208
|
+
super._handleDataSetChange(), k(this._dataItems, (e) => {
|
|
209
|
+
this._toggleColumn(e, !1);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
_applyGraphicsStates(e, t) {
|
|
213
|
+
const s = e.get("graphics"), o = s.states.lookup("dropFromOpen"), i = s.states.lookup("riseFromOpen"), n = s.states.lookup("dropFromPrevious"), l = s.states.lookup("riseFromPrevious");
|
|
214
|
+
if (o || n || i || l) {
|
|
215
|
+
const d = this.get("xAxis"), m = this.get("yAxis"), x = this.get("baseAxis");
|
|
216
|
+
let h, u, p;
|
|
217
|
+
x === d && m.isType("ValueAxis") ? (h = e.get(this._yOpenField), u = e.get(this._yField), p = t.get(this._yField)) : x === m && d.isType("ValueAxis") && (h = e.get(this._xOpenField), u = e.get(this._xField), p = t.get(this._xField)), O(h) && O(u) && (u < h ? o && o.apply() : i && i.apply(), O(p) && (u < p ? n && n.apply() : l && l.apply()));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @ignore
|
|
222
|
+
*/
|
|
223
|
+
disposeDataItem(e) {
|
|
224
|
+
super.disposeDataItem(e);
|
|
225
|
+
const t = e.get("graphics");
|
|
226
|
+
t && (this.columns.removeValue(t), t.dispose());
|
|
227
|
+
const s = e.get("rangeGraphics");
|
|
228
|
+
s && k(s, (o) => {
|
|
229
|
+
const i = o.getPrivate("list");
|
|
230
|
+
i && i.removeValue(o), o.dispose();
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Hides series's data item.
|
|
235
|
+
*
|
|
236
|
+
* @param dataItem Data item
|
|
237
|
+
* @param duration Animation duration in milliseconds
|
|
238
|
+
* @return Promise
|
|
239
|
+
*/
|
|
240
|
+
hideDataItem(e, t) {
|
|
241
|
+
const s = Object.create(null, {
|
|
242
|
+
hideDataItem: { get: () => super.hideDataItem }
|
|
243
|
+
});
|
|
244
|
+
return $(this, void 0, void 0, function* () {
|
|
245
|
+
const o = [s.hideDataItem.call(this, e, t)], i = e.get("graphics");
|
|
246
|
+
i && o.push(i.hide(t));
|
|
247
|
+
const n = e.get("rangeGraphics");
|
|
248
|
+
n && k(n, (l) => {
|
|
249
|
+
o.push(l.hide(t));
|
|
250
|
+
}), yield Promise.all(o);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
_toggleColumn(e, t) {
|
|
254
|
+
const s = e.get("graphics");
|
|
255
|
+
s && s.setPrivate("visible", t);
|
|
256
|
+
const o = e.get("rangeGraphics");
|
|
257
|
+
o && k(o, (n) => {
|
|
258
|
+
n.setPrivate("visible", t);
|
|
259
|
+
});
|
|
260
|
+
const i = e.bullets;
|
|
261
|
+
i && k(i, (n) => {
|
|
262
|
+
n.setPrivate("hidden", !t);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Shows series's data item.
|
|
267
|
+
*
|
|
268
|
+
* @param dataItem Data item
|
|
269
|
+
* @param duration Animation duration in milliseconds
|
|
270
|
+
* @return Promise
|
|
271
|
+
*/
|
|
272
|
+
showDataItem(e, t) {
|
|
273
|
+
const s = Object.create(null, {
|
|
274
|
+
showDataItem: { get: () => super.showDataItem }
|
|
275
|
+
});
|
|
276
|
+
return $(this, void 0, void 0, function* () {
|
|
277
|
+
const o = [s.showDataItem.call(this, e, t)], i = e.get("graphics");
|
|
278
|
+
i && o.push(i.show(t));
|
|
279
|
+
const n = e.get("rangeGraphics");
|
|
280
|
+
n && k(n, (l) => {
|
|
281
|
+
o.push(l.show(t));
|
|
282
|
+
}), yield Promise.all(o);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* @ignore
|
|
287
|
+
*/
|
|
288
|
+
updateLegendMarker(e) {
|
|
289
|
+
let t = this.get("legendDataItem");
|
|
290
|
+
if (this.get("useLastColorForLegendMarker") && !e) {
|
|
291
|
+
const s = this.dataItems[this.endIndex() - 1];
|
|
292
|
+
s && (e = s);
|
|
293
|
+
}
|
|
294
|
+
if (t) {
|
|
295
|
+
let s = this.columns.template;
|
|
296
|
+
if (e) {
|
|
297
|
+
let i = e.get("graphics");
|
|
298
|
+
i && (s = i);
|
|
299
|
+
}
|
|
300
|
+
const o = t.get("markerRectangle");
|
|
301
|
+
if (o && !t.get("itemContainer").get("disabled")) {
|
|
302
|
+
const i = o.states.lookup("default");
|
|
303
|
+
k(K, (n) => {
|
|
304
|
+
const l = s.get(n, this.get(n));
|
|
305
|
+
o.set(n, l), i.set(n, l);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
_getTooltipTarget(e) {
|
|
311
|
+
if (this.get("seriesTooltipTarget") == "bullet")
|
|
312
|
+
return super._getTooltipTarget(e);
|
|
313
|
+
let t = e.get("graphics");
|
|
314
|
+
return t || this;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
Object.defineProperty(T, "className", {
|
|
318
|
+
enumerable: !0,
|
|
319
|
+
configurable: !0,
|
|
320
|
+
writable: !0,
|
|
321
|
+
value: "BaseColumnSeries"
|
|
322
|
+
});
|
|
323
|
+
Object.defineProperty(T, "classNames", {
|
|
324
|
+
enumerable: !0,
|
|
325
|
+
configurable: !0,
|
|
326
|
+
writable: !0,
|
|
327
|
+
value: se.classNames.concat([T.className])
|
|
328
|
+
});
|
|
329
|
+
class N extends W {
|
|
330
|
+
_beforeChanged() {
|
|
331
|
+
super._beforeChanged(), (this.isDirty("lowX0") || this.isDirty("lowY0") || this.isDirty("lowX1") || this.isDirty("lowY1") || this.isDirty("highX0") || this.isDirty("highX1") || this.isDirty("highY0") || this.isDirty("highY1")) && (this._clear = !0);
|
|
332
|
+
}
|
|
333
|
+
_draw() {
|
|
334
|
+
super._draw();
|
|
335
|
+
const e = this._display;
|
|
336
|
+
e.moveTo(this.get("lowX0", 0), this.get("lowY0", 0)), e.lineTo(this.get("lowX1", 0), this.get("lowY1", 0)), e.moveTo(this.get("highX0", 0), this.get("highY0", 0)), e.lineTo(this.get("highX1", 0), this.get("highY1", 0));
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
Object.defineProperty(N, "className", {
|
|
340
|
+
enumerable: !0,
|
|
341
|
+
configurable: !0,
|
|
342
|
+
writable: !0,
|
|
343
|
+
value: "Candlestick"
|
|
344
|
+
});
|
|
345
|
+
Object.defineProperty(N, "classNames", {
|
|
346
|
+
enumerable: !0,
|
|
347
|
+
configurable: !0,
|
|
348
|
+
writable: !0,
|
|
349
|
+
value: W.classNames.concat([N.className])
|
|
350
|
+
});
|
|
351
|
+
class S extends T {
|
|
352
|
+
constructor() {
|
|
353
|
+
super(...arguments), Object.defineProperty(this, "allColumns", {
|
|
354
|
+
enumerable: !0,
|
|
355
|
+
configurable: !0,
|
|
356
|
+
writable: !0,
|
|
357
|
+
value: this.children.push(ie.new(this._root, {}))
|
|
358
|
+
}), Object.defineProperty(this, "allColumnsData", {
|
|
359
|
+
enumerable: !0,
|
|
360
|
+
configurable: !0,
|
|
361
|
+
writable: !0,
|
|
362
|
+
value: []
|
|
363
|
+
}), Object.defineProperty(this, "columns", {
|
|
364
|
+
enumerable: !0,
|
|
365
|
+
configurable: !0,
|
|
366
|
+
writable: !0,
|
|
367
|
+
value: this.addDisposer(new E(H.new({}), () => W._new(this._root, {
|
|
368
|
+
position: "absolute",
|
|
369
|
+
themeTags: U(this.columns.template.get("themeTags", []), ["series", "column"])
|
|
370
|
+
}, [this.columns.template])))
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @ignore
|
|
375
|
+
*/
|
|
376
|
+
makeColumn(e, t) {
|
|
377
|
+
const s = t.make();
|
|
378
|
+
return this.get("turboMode") ? s.virtualParent = this.chart : this.mainContainer.children.push(s), s._setDataItem(e), t.push(s), s;
|
|
379
|
+
}
|
|
380
|
+
_processAxisRange(e) {
|
|
381
|
+
super._processAxisRange(e), e.columns = new E(H.new({}), () => W._new(this._root, {
|
|
382
|
+
position: "absolute",
|
|
383
|
+
themeTags: U(e.columns.template.get("themeTags", []), ["series", "column"])
|
|
384
|
+
}, [this.columns.template, e.columns.template]));
|
|
385
|
+
}
|
|
386
|
+
_beforeColumnsDraw() {
|
|
387
|
+
this.allColumnsData = [];
|
|
388
|
+
}
|
|
389
|
+
_afterColumnsDraw() {
|
|
390
|
+
this.get("turboMode") && this.allColumns.set("draw", (e) => {
|
|
391
|
+
e.clear(), k(this.allColumnsData, (t) => {
|
|
392
|
+
const s = t.width, o = t.height, i = t.x, n = t.y, l = t.stroke, d = t.fill, m = t.strokeWidth, x = t.strokeOpacity, h = t.fillOpacity;
|
|
393
|
+
e.beginFill(d, h), e.beginPath(), e.lineStyle(m, l, x), e.drawRect(i, n, s, o), e.endStroke(), e.endFill();
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
_updateSeriesGraphics(e, t, s, o, i, n, l, d) {
|
|
398
|
+
if (this.get("turboMode")) {
|
|
399
|
+
const m = t.get("stroke"), x = t.get("fillOpacity", 1), h = t.get("strokeOpacity", 1), u = t.get("strokeWidth", 1), p = t.get("fill"), _ = this.getPoint(s, i), g = this.getPoint(o, n), a = e.get("point");
|
|
400
|
+
if (a) {
|
|
401
|
+
const f = this.getPoint(a.x, a.y);
|
|
402
|
+
a.x = f.x + this._x, a.y = f.y + this._y;
|
|
403
|
+
}
|
|
404
|
+
s = _.x, o = g.x, i = _.y, n = g.y, e.setRaw("left", s), e.setRaw("right", o), e.setRaw("top", i), e.setRaw("bottom", n), this.allColumnsData.push({ width: o - s, height: n - i, x: s, y: i, stroke: m, fill: p, strokeWidth: u, strokeOpacity: h, fillOpacity: x });
|
|
405
|
+
} else
|
|
406
|
+
super._updateSeriesGraphics(e, t, s, o, i, n, l, d);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
Object.defineProperty(S, "className", {
|
|
410
|
+
enumerable: !0,
|
|
411
|
+
configurable: !0,
|
|
412
|
+
writable: !0,
|
|
413
|
+
value: "ColumnSeries"
|
|
414
|
+
});
|
|
415
|
+
Object.defineProperty(S, "classNames", {
|
|
416
|
+
enumerable: !0,
|
|
417
|
+
configurable: !0,
|
|
418
|
+
writable: !0,
|
|
419
|
+
value: T.classNames.concat([S.className])
|
|
420
|
+
});
|
|
421
|
+
class z extends S {
|
|
422
|
+
constructor() {
|
|
423
|
+
super(...arguments), Object.defineProperty(this, "columns", {
|
|
424
|
+
enumerable: !0,
|
|
425
|
+
configurable: !0,
|
|
426
|
+
writable: !0,
|
|
427
|
+
value: this.addDisposer(new E(H.new({
|
|
428
|
+
themeTags: ["autocolor"]
|
|
429
|
+
}), () => N._new(this._root, {
|
|
430
|
+
themeTags: U(this.columns.template.get("themeTags", []), ["candlestick", "series", "column"])
|
|
431
|
+
}, [this.columns.template])))
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* @ignore
|
|
436
|
+
*/
|
|
437
|
+
makeColumn(e, t) {
|
|
438
|
+
const s = t.make();
|
|
439
|
+
return this.get("turboMode") ? s.virtualParent = this.chart : this.mainContainer.children.push(s), s._setDataItem(e), t.push(s), s;
|
|
440
|
+
}
|
|
441
|
+
_updateGraphics(e, t, s) {
|
|
442
|
+
super._updateGraphics(e, t, s);
|
|
443
|
+
const o = this.getRaw("xAxis"), i = this.getRaw("yAxis");
|
|
444
|
+
let n = this.get("vcy", 1), l = this.get("vcx", 1), d, m, x, h, u, p, _, g, a = this.get("locationX", e.get("locationX", 0.5)), f = this.get("locationY", e.get("locationY", 0.5)), c = this.get("openLocationX", e.get("openLocationX", a)), r = this.get("openLocationY", e.get("openLocationY", f)), w;
|
|
445
|
+
if (s == 0) {
|
|
446
|
+
let X = i.getDataItemPositionY(e, this._yOpenField, 1, n), y = i.getDataItemPositionY(e, this._yField, 1, n);
|
|
447
|
+
h = i.getDataItemPositionY(e, this._yLowField, 1, n), g = i.getDataItemPositionY(e, this._yHighField, 1, n), _ = Math.max(X, y), x = Math.min(X, y);
|
|
448
|
+
let b = this._aLocationX0 + c - 0.5, C = this._aLocationX1 + a - 0.5;
|
|
449
|
+
d = o.getDataItemPositionX(e, this._xField, b + (C - b) / 2, l), m = d, u = d, p = d, w = "vertical";
|
|
450
|
+
} else {
|
|
451
|
+
let X = o.getDataItemPositionX(e, this._xOpenField, 1, l), y = o.getDataItemPositionX(e, this._xField, 1, l);
|
|
452
|
+
m = o.getDataItemPositionX(e, this._xLowField, 1, l), p = o.getDataItemPositionX(e, this._xHighField, 1, l), u = Math.max(X, y), d = Math.min(X, y);
|
|
453
|
+
let b = this._aLocationY0 + r - 0.5, C = this._aLocationY1 + f - 0.5;
|
|
454
|
+
x = i.getDataItemPositionY(e, this._yField, b + (C - b) / 2, n), h = x, _ = x, g = x, w = "horizontal";
|
|
455
|
+
}
|
|
456
|
+
this._updateCandleGraphics(e, d, m, x, h, u, p, _, g, w);
|
|
457
|
+
}
|
|
458
|
+
_updateCandleGraphics(e, t, s, o, i, n, l, d, m, x) {
|
|
459
|
+
let h = e.get("graphics");
|
|
460
|
+
if (h) {
|
|
461
|
+
let u = this.getPoint(t, o), p = this.getPoint(s, i), _ = this.getPoint(n, d), g = this.getPoint(l, m);
|
|
462
|
+
if (this.get("turboMode")) {
|
|
463
|
+
const a = this.allColumnsData[this.allColumnsData.length - 1];
|
|
464
|
+
a.lowX0 = u.x, a.lowY0 = u.y, a.lowX1 = p.x, a.lowY1 = p.y, a.highX0 = _.x, a.highY0 = _.y, a.highX1 = g.x, a.highY1 = g.y;
|
|
465
|
+
} else {
|
|
466
|
+
let a = h.x(), f = h.y();
|
|
467
|
+
h.set("lowX0", u.x - a), h.set("lowY0", u.y - f), h.set("lowX1", p.x - a), h.set("lowY1", p.y - f), h.set("highX0", _.x - a), h.set("highY0", _.y - f), h.set("highX1", g.x - a), h.set("highY1", g.y - f), h.set("orientation", x);
|
|
468
|
+
let c = e.get("rangeGraphics");
|
|
469
|
+
c && k(c, (r) => {
|
|
470
|
+
r.set("lowX0", u.x - a), r.set("lowY0", u.y - f), r.set("lowX1", p.x - a), r.set("lowY1", p.y - f), r.set("highX0", _.x - a), r.set("highY0", _.y - f), r.set("highX1", g.x - a), r.set("highY1", g.y - f), r.set("orientation", x);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
_afterColumnsDraw() {
|
|
476
|
+
this.get("turboMode") && this.allColumns.set("draw", (e) => {
|
|
477
|
+
e.clear(), k(this.allColumnsData, (t) => {
|
|
478
|
+
e.beginPath();
|
|
479
|
+
const s = t.width, o = t.height, i = t.x, n = t.y, l = t.stroke, d = t.fill, m = t.strokeWidth, x = t.strokeOpacity, h = t.fillOpacity, u = t.lowX0, p = t.lowY0, _ = t.lowX1, g = t.lowY1, a = t.highX0, f = t.highY0, c = t.highX1, r = t.highY1;
|
|
480
|
+
e.beginFill(d, h), e.beginPath(), e.lineStyle(m, l, x), e.drawRect(i, n, s, o), e.moveTo(u, p), e.lineTo(_, g), e.moveTo(a, f), e.lineTo(c, r), e.endStroke(), e.endFill();
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
_processAxisRange(e) {
|
|
485
|
+
super._processAxisRange(e), e.columns = new E(H.new({}), () => N._new(this._root, {
|
|
486
|
+
themeTags: U(e.columns.template.get("themeTags", []), ["candlestick", "series", "column"])
|
|
487
|
+
}, [this.columns.template, e.columns.template]));
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
Object.defineProperty(z, "className", {
|
|
491
|
+
enumerable: !0,
|
|
492
|
+
configurable: !0,
|
|
493
|
+
writable: !0,
|
|
494
|
+
value: "CandlestickSeries"
|
|
495
|
+
});
|
|
496
|
+
Object.defineProperty(z, "classNames", {
|
|
497
|
+
enumerable: !0,
|
|
498
|
+
configurable: !0,
|
|
499
|
+
writable: !0,
|
|
500
|
+
value: S.classNames.concat([z.className])
|
|
501
|
+
});
|
|
502
|
+
const xe = (j) => {
|
|
503
|
+
const e = ge({
|
|
504
|
+
props: j,
|
|
505
|
+
name: "MuiCandlestickChart"
|
|
506
|
+
}), {
|
|
507
|
+
data: t,
|
|
508
|
+
seriesName: s,
|
|
509
|
+
height: o = "500px",
|
|
510
|
+
width: i = "100%",
|
|
511
|
+
chartId: n = "candlestick-chart",
|
|
512
|
+
showVolume: l = !1,
|
|
513
|
+
risingColor: d = "#00b050",
|
|
514
|
+
fallingColor: m = "#ff3b30",
|
|
515
|
+
loading: x = !1,
|
|
516
|
+
emptyMessage: h = "No data available",
|
|
517
|
+
sx: u,
|
|
518
|
+
...p
|
|
519
|
+
} = e, _ = {
|
|
520
|
+
...e,
|
|
521
|
+
height: o,
|
|
522
|
+
width: i,
|
|
523
|
+
chartId: n,
|
|
524
|
+
showVolume: l,
|
|
525
|
+
risingColor: d,
|
|
526
|
+
fallingColor: m,
|
|
527
|
+
loading: x,
|
|
528
|
+
emptyMessage: h
|
|
529
|
+
}, g = q(null), a = q(null), f = q(null);
|
|
530
|
+
return ue(() => {
|
|
531
|
+
if (!f.current) return;
|
|
532
|
+
const c = oe.new(f.current);
|
|
533
|
+
a.current = c, c.setThemes([ne.new(c)]);
|
|
534
|
+
const r = c.container.children.push(
|
|
535
|
+
le.new(c, {
|
|
536
|
+
panX: !0,
|
|
537
|
+
panY: !0,
|
|
538
|
+
wheelX: "panX",
|
|
539
|
+
wheelY: "zoomX",
|
|
540
|
+
pinchZoomX: !0,
|
|
541
|
+
layout: c.verticalLayout
|
|
542
|
+
})
|
|
543
|
+
);
|
|
544
|
+
g.current = r, r.set(
|
|
545
|
+
"cursor",
|
|
546
|
+
ae.new(c, {
|
|
547
|
+
behavior: "zoomX"
|
|
548
|
+
})
|
|
549
|
+
).lineY.set("visible", !1);
|
|
550
|
+
const w = r.xAxes.push(
|
|
551
|
+
re.new(c, {
|
|
552
|
+
maxDeviation: 0.3,
|
|
553
|
+
groupData: !0,
|
|
554
|
+
baseInterval: { timeUnit: "day", count: 1 },
|
|
555
|
+
renderer: he.new(c, {
|
|
556
|
+
minorGridEnabled: !0
|
|
557
|
+
}),
|
|
558
|
+
tooltip: I.new(c, {})
|
|
559
|
+
})
|
|
560
|
+
), X = r.yAxes.push(
|
|
561
|
+
ee.new(c, {
|
|
562
|
+
renderer: te.new(c, {})
|
|
563
|
+
})
|
|
564
|
+
), y = r.series.push(
|
|
565
|
+
z.new(c, {
|
|
566
|
+
name: s || "Price",
|
|
567
|
+
xAxis: w,
|
|
568
|
+
yAxis: X,
|
|
569
|
+
valueXField: "date",
|
|
570
|
+
openValueYField: "open",
|
|
571
|
+
highValueYField: "high",
|
|
572
|
+
lowValueYField: "low",
|
|
573
|
+
valueYField: "close",
|
|
574
|
+
tooltip: I.new(c, {
|
|
575
|
+
labelText: `
|
|
576
|
+
Open: {openValueY}
|
|
577
|
+
High: {highValueY}
|
|
578
|
+
Low: {lowValueY}
|
|
579
|
+
Close: {valueY}
|
|
580
|
+
Change: {valueY - openValueY > 0 ? "+" : ""}{((valueY - openValueY)/openValueY*100).toFixed(2)}%
|
|
581
|
+
`
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
);
|
|
585
|
+
y.columns.template.states.create("riseFromPrevious", {
|
|
586
|
+
fill: M(d),
|
|
587
|
+
stroke: M(d)
|
|
588
|
+
}), y.columns.template.states.create("dropFromPrevious", {
|
|
589
|
+
fill: M(m),
|
|
590
|
+
stroke: M(m)
|
|
591
|
+
});
|
|
592
|
+
let b = null, C = null;
|
|
593
|
+
return l && (C = r.yAxes.push(
|
|
594
|
+
ee.new(c, {
|
|
595
|
+
renderer: te.new(c, {
|
|
596
|
+
opposite: !0
|
|
597
|
+
}),
|
|
598
|
+
numberFormat: "#a"
|
|
599
|
+
})
|
|
600
|
+
), b = r.series.push(
|
|
601
|
+
S.new(c, {
|
|
602
|
+
name: "Volume",
|
|
603
|
+
xAxis: w,
|
|
604
|
+
yAxis: C,
|
|
605
|
+
valueYField: "volume",
|
|
606
|
+
valueXField: "date",
|
|
607
|
+
fill: M("#2962ff"),
|
|
608
|
+
stroke: M("#2962ff"),
|
|
609
|
+
opacity: 0.6
|
|
610
|
+
})
|
|
611
|
+
), b.columns.template.setAll({
|
|
612
|
+
width: ce(80)
|
|
613
|
+
})), y.data.setAll(t), l && b && b.data.setAll(t), r.appear(1e3), y.appear(1e3), () => {
|
|
614
|
+
c.dispose();
|
|
615
|
+
};
|
|
616
|
+
}, []), pe(() => {
|
|
617
|
+
if (g.current && a.current) {
|
|
618
|
+
const c = g.current.series.getIndex(
|
|
619
|
+
0
|
|
620
|
+
), r = l ? g.current.series.getIndex(1) : null;
|
|
621
|
+
c == null || c.data.setAll(t), r == null || r.data.setAll(t);
|
|
622
|
+
}
|
|
623
|
+
}, [t, l]), {
|
|
624
|
+
chartDivRef: f,
|
|
625
|
+
data: t,
|
|
626
|
+
seriesName: s,
|
|
627
|
+
height: o,
|
|
628
|
+
width: i,
|
|
629
|
+
chartId: n,
|
|
630
|
+
showVolume: l,
|
|
631
|
+
risingColor: d,
|
|
632
|
+
fallingColor: m,
|
|
633
|
+
loading: x,
|
|
634
|
+
emptyMessage: h,
|
|
635
|
+
sx: u,
|
|
636
|
+
other: p,
|
|
637
|
+
ownerState: _
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
export {
|
|
641
|
+
xe as useCandlestickChartLogic
|
|
642
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { styled as i } from "@mui/material";
|
|
2
|
+
const h = i("div", {
|
|
3
|
+
name: "MuiCandlestickChart",
|
|
4
|
+
slot: "Root"
|
|
5
|
+
})(({ ownerState: t }) => ({
|
|
6
|
+
position: "relative",
|
|
7
|
+
width: t.width,
|
|
8
|
+
height: t.height
|
|
9
|
+
}));
|
|
10
|
+
export {
|
|
11
|
+
h as CandlestickChartRoot
|
|
12
|
+
};
|