@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
|
@@ -1,612 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 r = this.dataItems[n];
|
|
37
|
-
this._createGraphics(r);
|
|
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, r = 0, f = 0;
|
|
46
|
-
D(o.series, (g) => {
|
|
47
|
-
if (g instanceof G) {
|
|
48
|
-
const _ = g.get("stacked");
|
|
49
|
-
_ && f == 0 && r++, !_ && g.get("clustered") && r++;
|
|
50
|
-
}
|
|
51
|
-
g === this && (n = r - 1), f++;
|
|
52
|
-
}), this.get("clustered") || (n = 0, r = 1), r === 0 && (r = 1, n = 0);
|
|
53
|
-
const x = t.get("renderer"), u = s.get("renderer"), c = "cellStartLocation", a = "cellEndLocation", h = x.get(c, 0), d = x.get(a, 1), p = u.get(c, 0), l = u.get(a, 1);
|
|
54
|
-
if (this._aLocationX0 = h + n / r * (d - h), this._aLocationX1 = h + (n + 1) / r * (d - h), this._aLocationY0 = p + n / r * (l - p), this._aLocationY1 = p + (n + 1) / r * (l - p), t.inited && s.inited) {
|
|
55
|
-
if (this._axesDirty || this._valuesDirty || this._stackDirty || this.isDirty("vcx") || this.isDirty("vcy") || this._sizeDirty) {
|
|
56
|
-
const g = this.dataItems.length;
|
|
57
|
-
let _ = Math.max(0, this.startIndex() - 2), m = Math.min(this.endIndex() + 2, g - 1);
|
|
58
|
-
for (let y = 0; y < _; y++)
|
|
59
|
-
this._toggleColumn(this.dataItems[y], !1);
|
|
60
|
-
let w = this.dataItems[_];
|
|
61
|
-
for (let y = _; y <= m; y++) {
|
|
62
|
-
let Y = this.dataItems[y];
|
|
63
|
-
if (Y.get("valueX") != null && Y.get("valueY") != null) {
|
|
64
|
-
if (w = Y, y > 0 && _ > 0)
|
|
65
|
-
for (let A = y - 1; A >= 0; A--) {
|
|
66
|
-
let b = this.dataItems[A];
|
|
67
|
-
if (b.get("valueX") != null && b.get("valueY") != null) {
|
|
68
|
-
w = b;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
break;
|
|
73
|
-
} else
|
|
74
|
-
this._toggleColumn(Y, !1);
|
|
75
|
-
}
|
|
76
|
-
this._beforeColumnsDraw();
|
|
77
|
-
let k = 0;
|
|
78
|
-
s.isType("CategoryAxis") && t.isType("CategoryAxis") ? k = 2 : t === o ? k = 0 : s === o && (k = 1);
|
|
79
|
-
for (let y = _; y <= m; y++) {
|
|
80
|
-
let Y = this.dataItems[y];
|
|
81
|
-
this._updateGraphics(Y, w, k), Y.get("valueX") != null && Y.get("valueY") != null && (w = Y);
|
|
82
|
-
}
|
|
83
|
-
this._afterColumnsDraw();
|
|
84
|
-
for (let y = m + 1; y < g; 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
|
-
D(K, (r) => {
|
|
109
|
-
const f = t.get(r, this.get(r));
|
|
110
|
-
i.set(r, f), n.set(r, f);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
let o = e.get("rangeGraphics");
|
|
115
|
-
o && D(o, (i) => {
|
|
116
|
-
i.dispose();
|
|
117
|
-
}), o = [], e.setRaw("rangeGraphics", o), this.axisRanges.each((i) => {
|
|
118
|
-
const n = i.container, r = this._makeGraphics(i.columns, e);
|
|
119
|
-
o && o.push(r), r.setPrivate("list", i.columns), n.children.push(r);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
createAxisRange(e) {
|
|
124
|
-
return D(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, r = e.get(i), f = e.get(n), x = this.get("exactLocationX", !1);
|
|
132
|
-
if (r != null && f != null) {
|
|
133
|
-
const u = this._xOpenField, c = this._yOpenField, a = this.get("locationX", e.get("locationX", 0.5)), h = this.get("locationY", e.get("locationY", 0.5)), d = this.get("openLocationX", e.get("openLocationX", a)), p = this.get("openLocationY", e.get("openLocationY", h)), l = o.get("width"), g = o.get("height"), _ = this.get("stacked"), m = this.get("xAxis"), w = this.get("yAxis"), k = m.get("start"), y = m.get("end"), Y = w.get("start"), A = w.get("end");
|
|
134
|
-
let b, L, F, C, R = this.get("vcy", 1), M = this.get("vcx", 1), B = !1, Z = !1;
|
|
135
|
-
if (s == 0) {
|
|
136
|
-
let X = this._aLocationX0 + d - 0.5, P = this._aLocationX1 + a - 0.5;
|
|
137
|
-
if (l instanceof V) {
|
|
138
|
-
let v = (P - X) * (1 - l.value) / 2;
|
|
139
|
-
X += v, P -= v;
|
|
140
|
-
}
|
|
141
|
-
if (b = m.getDataItemPositionX(e, u, X, M, x), L = m.getDataItemPositionX(e, i, P, M, x), F = w.getDataItemPositionY(e, n, h, R), this._yOpenField !== this._yField)
|
|
142
|
-
C = w.getDataItemPositionY(e, c, p, R);
|
|
143
|
-
else if (_) {
|
|
144
|
-
let v = e.get("stackToItemY");
|
|
145
|
-
v ? C = w.getDataItemPositionY(v, n, p, v.component.get("vcy")) : C = w.basePosition();
|
|
146
|
-
} else
|
|
147
|
-
C = w.basePosition();
|
|
148
|
-
e.setRaw("point", { x: b + (L - b) / 2, y: F }), Z = !0;
|
|
149
|
-
} else if (s == 1) {
|
|
150
|
-
let X = this._aLocationY0 + p - 0.5, P = this._aLocationY1 + h - 0.5;
|
|
151
|
-
if (g instanceof V) {
|
|
152
|
-
let v = (P - X) * (1 - g.value) / 2;
|
|
153
|
-
X += v, P -= v;
|
|
154
|
-
}
|
|
155
|
-
if (F = w.getDataItemPositionY(e, c, X, R), C = w.getDataItemPositionY(e, n, P, R), L = m.getDataItemPositionX(e, i, a, M, x), this._xOpenField !== this._xField)
|
|
156
|
-
b = m.getDataItemPositionX(e, u, d, M, x);
|
|
157
|
-
else if (_) {
|
|
158
|
-
let v = e.get("stackToItemX");
|
|
159
|
-
v ? b = m.getDataItemPositionX(v, i, d, v.component.get("vcx"), x) : b = m.basePosition();
|
|
160
|
-
} else
|
|
161
|
-
b = m.basePosition();
|
|
162
|
-
B = !0, e.setRaw("point", { x: L, y: F + (C - F) / 2 });
|
|
163
|
-
} else if (s == 2) {
|
|
164
|
-
let X = this._aLocationX0 + d - 0.5, P = this._aLocationX1 + a - 0.5;
|
|
165
|
-
if (l instanceof V) {
|
|
166
|
-
let v = (P - X) * (1 - l.value) / 2;
|
|
167
|
-
X += v, P -= v;
|
|
168
|
-
}
|
|
169
|
-
if (b = m.getDataItemPositionX(e, u, X, M), L = m.getDataItemPositionX(e, i, P, M), X = this._aLocationY0 + p - 0.5, P = this._aLocationY1 + h - 0.5, g instanceof V) {
|
|
170
|
-
let v = (P - X) * (1 - g.value) / 2;
|
|
171
|
-
X += v, P -= v;
|
|
172
|
-
}
|
|
173
|
-
F = w.getDataItemPositionY(e, c, X, R), C = w.getDataItemPositionY(e, n, P, R), e.setRaw("point", { x: b + (L - b) / 2, y: F + (C - F) / 2 });
|
|
174
|
-
}
|
|
175
|
-
this._applyGraphicsStates(e, t), this._updateSeriesGraphics(e, o, b, L, F, C, B, Z), b < k && L < k || b > y && L > y || F < Y && C <= Y || F >= A && C > A || Q(b) || Q(F) ? this._toggleColumn(e, !1) : this._toggleColumn(e, !0);
|
|
176
|
-
let J = e.get("rangeGraphics");
|
|
177
|
-
J && D(J, (X) => {
|
|
178
|
-
this._updateSeriesGraphics(e, X, b, L, F, C, B, Z);
|
|
179
|
-
});
|
|
180
|
-
} else
|
|
181
|
-
this._toggleColumn(e, !1);
|
|
182
|
-
}
|
|
183
|
-
_updateSeriesGraphics(e, t, s, o, i, n, r, f) {
|
|
184
|
-
const x = t.get("width"), u = t.get("height"), c = t.get("maxWidth"), a = t.get("maxHeight"), h = this.getPoint(s, i), d = this.getPoint(o, n), p = e.get("point");
|
|
185
|
-
if (p) {
|
|
186
|
-
const l = this.getPoint(p.x, p.y);
|
|
187
|
-
p.x = l.x + this._x, p.y = l.y + this._y;
|
|
188
|
-
}
|
|
189
|
-
if (s = h.x, o = d.x, i = h.y, n = d.y, T(x)) {
|
|
190
|
-
const l = (o - s - x) / 2;
|
|
191
|
-
s += l, o -= l;
|
|
192
|
-
}
|
|
193
|
-
if (T(c) && c < Math.abs(o - s)) {
|
|
194
|
-
const l = (o - s - c) / 2;
|
|
195
|
-
s += l, o -= l;
|
|
196
|
-
}
|
|
197
|
-
if (T(u)) {
|
|
198
|
-
const l = (n - i - u) / 2;
|
|
199
|
-
i += l, n -= l;
|
|
200
|
-
}
|
|
201
|
-
if (T(a) && a < Math.abs(n - i)) {
|
|
202
|
-
const l = (n - i - a) / 2;
|
|
203
|
-
i += l, n -= l;
|
|
204
|
-
}
|
|
205
|
-
this.get("adjustBulletPosition") && (r && (o = Math.min(Math.max(0, o), this._pw), s = Math.min(Math.max(0, s), this._pw)), f && (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(), D(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"), r = s.states.lookup("riseFromPrevious");
|
|
214
|
-
if (o || n || i || r) {
|
|
215
|
-
const f = this.get("xAxis"), x = this.get("yAxis"), u = this.get("baseAxis");
|
|
216
|
-
let c, a, h;
|
|
217
|
-
u === f && x.isType("ValueAxis") ? (c = e.get(this._yOpenField), a = e.get(this._yField), h = t.get(this._yField)) : u === x && f.isType("ValueAxis") && (c = e.get(this._xOpenField), a = e.get(this._xField), h = t.get(this._xField)), T(c) && T(a) && (a < c ? o && o.apply() : i && i.apply(), T(h) && (a < h ? n && n.apply() : r && r.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 && D(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 && D(n, (r) => {
|
|
249
|
-
o.push(r.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 && D(o, (n) => {
|
|
258
|
-
n.setPrivate("visible", t);
|
|
259
|
-
});
|
|
260
|
-
const i = e.bullets;
|
|
261
|
-
i && D(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 && D(n, (r) => {
|
|
281
|
-
o.push(r.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
|
-
D(K, (n) => {
|
|
304
|
-
const r = s.get(n, this.get(n));
|
|
305
|
-
o.set(n, r), i.set(n, r);
|
|
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(G, "className", {
|
|
318
|
-
enumerable: !0,
|
|
319
|
-
configurable: !0,
|
|
320
|
-
writable: !0,
|
|
321
|
-
value: "BaseColumnSeries"
|
|
322
|
-
});
|
|
323
|
-
Object.defineProperty(G, "classNames", {
|
|
324
|
-
enumerable: !0,
|
|
325
|
-
configurable: !0,
|
|
326
|
-
writable: !0,
|
|
327
|
-
value: ie.classNames.concat([G.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 j extends G {
|
|
352
|
-
constructor() {
|
|
353
|
-
super(...arguments), Object.defineProperty(this, "allColumns", {
|
|
354
|
-
enumerable: !0,
|
|
355
|
-
configurable: !0,
|
|
356
|
-
writable: !0,
|
|
357
|
-
value: this.children.push(ne.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(z.new({}), () => W._new(this._root, {
|
|
368
|
-
position: "absolute",
|
|
369
|
-
themeTags: H(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(z.new({}), () => W._new(this._root, {
|
|
382
|
-
position: "absolute",
|
|
383
|
-
themeTags: H(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(), D(this.allColumnsData, (t) => {
|
|
392
|
-
const s = t.width, o = t.height, i = t.x, n = t.y, r = t.stroke, f = t.fill, x = t.strokeWidth, u = t.strokeOpacity, c = t.fillOpacity;
|
|
393
|
-
e.beginFill(f, c), e.beginPath(), e.lineStyle(x, r, u), e.drawRect(i, n, s, o), e.endStroke(), e.endFill();
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
_updateSeriesGraphics(e, t, s, o, i, n, r, f) {
|
|
398
|
-
if (this.get("turboMode")) {
|
|
399
|
-
const x = t.get("stroke"), u = t.get("fillOpacity", 1), c = t.get("strokeOpacity", 1), a = t.get("strokeWidth", 1), h = t.get("fill"), d = this.getPoint(s, i), p = this.getPoint(o, n), l = e.get("point");
|
|
400
|
-
if (l) {
|
|
401
|
-
const g = this.getPoint(l.x, l.y);
|
|
402
|
-
l.x = g.x + this._x, l.y = g.y + this._y;
|
|
403
|
-
}
|
|
404
|
-
s = d.x, o = p.x, i = d.y, n = p.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: x, fill: h, strokeWidth: a, strokeOpacity: c, fillOpacity: u });
|
|
405
|
-
} else
|
|
406
|
-
super._updateSeriesGraphics(e, t, s, o, i, n, r, f);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
Object.defineProperty(j, "className", {
|
|
410
|
-
enumerable: !0,
|
|
411
|
-
configurable: !0,
|
|
412
|
-
writable: !0,
|
|
413
|
-
value: "ColumnSeries"
|
|
414
|
-
});
|
|
415
|
-
Object.defineProperty(j, "classNames", {
|
|
416
|
-
enumerable: !0,
|
|
417
|
-
configurable: !0,
|
|
418
|
-
writable: !0,
|
|
419
|
-
value: G.classNames.concat([j.className])
|
|
420
|
-
});
|
|
421
|
-
class U extends j {
|
|
422
|
-
constructor() {
|
|
423
|
-
super(...arguments), Object.defineProperty(this, "columns", {
|
|
424
|
-
enumerable: !0,
|
|
425
|
-
configurable: !0,
|
|
426
|
-
writable: !0,
|
|
427
|
-
value: this.addDisposer(new E(z.new({
|
|
428
|
-
themeTags: ["autocolor"]
|
|
429
|
-
}), () => N._new(this._root, {
|
|
430
|
-
themeTags: H(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), r = this.get("vcx", 1), f, x, u, c, a, h, d, p, l = this.get("locationX", e.get("locationX", 0.5)), g = this.get("locationY", e.get("locationY", 0.5)), _ = this.get("openLocationX", e.get("openLocationX", l)), m = this.get("openLocationY", e.get("openLocationY", g)), w;
|
|
445
|
-
if (s == 0) {
|
|
446
|
-
let k = i.getDataItemPositionY(e, this._yOpenField, 1, n), y = i.getDataItemPositionY(e, this._yField, 1, n);
|
|
447
|
-
c = i.getDataItemPositionY(e, this._yLowField, 1, n), p = i.getDataItemPositionY(e, this._yHighField, 1, n), d = Math.max(k, y), u = Math.min(k, y);
|
|
448
|
-
let Y = this._aLocationX0 + _ - 0.5, A = this._aLocationX1 + l - 0.5;
|
|
449
|
-
f = o.getDataItemPositionX(e, this._xField, Y + (A - Y) / 2, r), x = f, a = f, h = f, w = "vertical";
|
|
450
|
-
} else {
|
|
451
|
-
let k = o.getDataItemPositionX(e, this._xOpenField, 1, r), y = o.getDataItemPositionX(e, this._xField, 1, r);
|
|
452
|
-
x = o.getDataItemPositionX(e, this._xLowField, 1, r), h = o.getDataItemPositionX(e, this._xHighField, 1, r), a = Math.max(k, y), f = Math.min(k, y);
|
|
453
|
-
let Y = this._aLocationY0 + m - 0.5, A = this._aLocationY1 + g - 0.5;
|
|
454
|
-
u = i.getDataItemPositionY(e, this._yField, Y + (A - Y) / 2, n), c = u, d = u, p = u, w = "horizontal";
|
|
455
|
-
}
|
|
456
|
-
this._updateCandleGraphics(e, f, x, u, c, a, h, d, p, w);
|
|
457
|
-
}
|
|
458
|
-
_updateCandleGraphics(e, t, s, o, i, n, r, f, x, u) {
|
|
459
|
-
let c = e.get("graphics");
|
|
460
|
-
if (c) {
|
|
461
|
-
let a = this.getPoint(t, o), h = this.getPoint(s, i), d = this.getPoint(n, f), p = this.getPoint(r, x);
|
|
462
|
-
if (this.get("turboMode")) {
|
|
463
|
-
const l = this.allColumnsData[this.allColumnsData.length - 1];
|
|
464
|
-
l.lowX0 = a.x, l.lowY0 = a.y, l.lowX1 = h.x, l.lowY1 = h.y, l.highX0 = d.x, l.highY0 = d.y, l.highX1 = p.x, l.highY1 = p.y;
|
|
465
|
-
} else {
|
|
466
|
-
let l = c.x(), g = c.y();
|
|
467
|
-
c.set("lowX0", a.x - l), c.set("lowY0", a.y - g), c.set("lowX1", h.x - l), c.set("lowY1", h.y - g), c.set("highX0", d.x - l), c.set("highY0", d.y - g), c.set("highX1", p.x - l), c.set("highY1", p.y - g), c.set("orientation", u);
|
|
468
|
-
let _ = e.get("rangeGraphics");
|
|
469
|
-
_ && D(_, (m) => {
|
|
470
|
-
m.set("lowX0", a.x - l), m.set("lowY0", a.y - g), m.set("lowX1", h.x - l), m.set("lowY1", h.y - g), m.set("highX0", d.x - l), m.set("highY0", d.y - g), m.set("highX1", p.x - l), m.set("highY1", p.y - g), m.set("orientation", u);
|
|
471
|
-
});
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useCandlestickChartLogic as h } from "./logic.js";
|
|
3
|
+
import { CandlestickChartRoot as f } from "./styled.js";
|
|
4
|
+
function u(i) {
|
|
5
|
+
const {
|
|
6
|
+
chartDivRef: n,
|
|
7
|
+
data: o,
|
|
8
|
+
chartId: r,
|
|
9
|
+
loading: e,
|
|
10
|
+
emptyMessage: s,
|
|
11
|
+
sx: a,
|
|
12
|
+
other: l,
|
|
13
|
+
ownerState: d
|
|
14
|
+
} = h(i);
|
|
15
|
+
return /* @__PURE__ */ c(f, { ownerState: d, sx: a, ...l, children: [
|
|
16
|
+
/* @__PURE__ */ t(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
ref: n,
|
|
20
|
+
id: r,
|
|
21
|
+
style: { width: "100%", height: "100%" }
|
|
472
22
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
_afterColumnsDraw() {
|
|
476
|
-
this.get("turboMode") && this.allColumns.set("draw", (e) => {
|
|
477
|
-
e.clear(), D(this.allColumnsData, (t) => {
|
|
478
|
-
e.beginPath();
|
|
479
|
-
const s = t.width, o = t.height, i = t.x, n = t.y, r = t.stroke, f = t.fill, x = t.strokeWidth, u = t.strokeOpacity, c = t.fillOpacity, a = t.lowX0, h = t.lowY0, d = t.lowX1, p = t.lowY1, l = t.highX0, g = t.highY0, _ = t.highX1, m = t.highY1;
|
|
480
|
-
e.beginFill(f, c), e.beginPath(), e.lineStyle(x, r, u), e.drawRect(i, n, s, o), e.moveTo(a, h), e.lineTo(d, p), e.moveTo(l, g), e.lineTo(_, m), e.endStroke(), e.endFill();
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
_processAxisRange(e) {
|
|
485
|
-
super._processAxisRange(e), e.columns = new E(z.new({}), () => N._new(this._root, {
|
|
486
|
-
themeTags: H(e.columns.template.get("themeTags", []), ["candlestick", "series", "column"])
|
|
487
|
-
}, [this.columns.template, e.columns.template]));
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
Object.defineProperty(U, "className", {
|
|
491
|
-
enumerable: !0,
|
|
492
|
-
configurable: !0,
|
|
493
|
-
writable: !0,
|
|
494
|
-
value: "CandlestickSeries"
|
|
495
|
-
});
|
|
496
|
-
Object.defineProperty(U, "classNames", {
|
|
497
|
-
enumerable: !0,
|
|
498
|
-
configurable: !0,
|
|
499
|
-
writable: !0,
|
|
500
|
-
value: j.classNames.concat([U.className])
|
|
501
|
-
});
|
|
502
|
-
function ye({
|
|
503
|
-
data: O,
|
|
504
|
-
seriesName: e,
|
|
505
|
-
height: t = "500px",
|
|
506
|
-
width: s = "100%",
|
|
507
|
-
chartId: o = "candlestick-chart",
|
|
508
|
-
showVolume: i = !1,
|
|
509
|
-
risingColor: n = "#00b050",
|
|
510
|
-
fallingColor: r = "#ff3b30",
|
|
511
|
-
loading: f = !1,
|
|
512
|
-
emptyMessage: x = "No data available"
|
|
513
|
-
}) {
|
|
514
|
-
const u = se(null), c = se(null);
|
|
515
|
-
return pe(() => {
|
|
516
|
-
const a = le.new(o);
|
|
517
|
-
c.current = a, a.setThemes([ae.new(a)]);
|
|
518
|
-
const h = a.container.children.push(
|
|
519
|
-
re.new(a, {
|
|
520
|
-
panX: !0,
|
|
521
|
-
panY: !0,
|
|
522
|
-
wheelX: "panX",
|
|
523
|
-
wheelY: "zoomX",
|
|
524
|
-
pinchZoomX: !0,
|
|
525
|
-
layout: a.verticalLayout
|
|
526
|
-
})
|
|
527
|
-
);
|
|
528
|
-
u.current = h, h.set(
|
|
529
|
-
"cursor",
|
|
530
|
-
he.new(a, {
|
|
531
|
-
behavior: "zoomX"
|
|
532
|
-
})
|
|
533
|
-
).lineY.set("visible", !1);
|
|
534
|
-
const d = h.xAxes.push(
|
|
535
|
-
ce.new(a, {
|
|
536
|
-
maxDeviation: 0.3,
|
|
537
|
-
groupData: !0,
|
|
538
|
-
baseInterval: { timeUnit: "day", count: 1 },
|
|
539
|
-
renderer: ge.new(a, {
|
|
540
|
-
minorGridEnabled: !0
|
|
541
|
-
}),
|
|
542
|
-
tooltip: I.new(a, {})
|
|
543
|
-
})
|
|
544
|
-
), p = h.yAxes.push(
|
|
545
|
-
ee.new(a, {
|
|
546
|
-
renderer: te.new(a, {})
|
|
547
|
-
})
|
|
548
|
-
), l = h.series.push(
|
|
549
|
-
U.new(a, {
|
|
550
|
-
name: e || "Price",
|
|
551
|
-
xAxis: d,
|
|
552
|
-
yAxis: p,
|
|
553
|
-
valueXField: "date",
|
|
554
|
-
openValueYField: "open",
|
|
555
|
-
highValueYField: "high",
|
|
556
|
-
lowValueYField: "low",
|
|
557
|
-
valueYField: "close",
|
|
558
|
-
tooltip: I.new(a, {
|
|
559
|
-
labelText: `
|
|
560
|
-
Open: {openValueY}
|
|
561
|
-
High: {highValueY}
|
|
562
|
-
Low: {lowValueY}
|
|
563
|
-
Close: {valueY}
|
|
564
|
-
Change: {valueY - openValueY > 0 ? "+" : ""}{((valueY - openValueY)/openValueY*100).toFixed(2)}%
|
|
565
|
-
`
|
|
566
|
-
})
|
|
567
|
-
})
|
|
568
|
-
);
|
|
569
|
-
l.columns.template.states.create("riseFromPrevious", {
|
|
570
|
-
fill: S(n),
|
|
571
|
-
stroke: S(n)
|
|
572
|
-
}), l.columns.template.states.create("dropFromPrevious", {
|
|
573
|
-
fill: S(r),
|
|
574
|
-
stroke: S(r)
|
|
575
|
-
});
|
|
576
|
-
let g = null, _ = null;
|
|
577
|
-
return i && (_ = h.yAxes.push(
|
|
578
|
-
ee.new(a, {
|
|
579
|
-
renderer: te.new(a, {
|
|
580
|
-
opposite: !0
|
|
581
|
-
}),
|
|
582
|
-
numberFormat: "#a"
|
|
583
|
-
})
|
|
584
|
-
), g = h.series.push(
|
|
585
|
-
j.new(a, {
|
|
586
|
-
name: "Volume",
|
|
587
|
-
xAxis: d,
|
|
588
|
-
yAxis: _,
|
|
589
|
-
valueYField: "volume",
|
|
590
|
-
valueXField: "date",
|
|
591
|
-
fill: S("#2962ff"),
|
|
592
|
-
stroke: S("#2962ff"),
|
|
593
|
-
opacity: 0.6
|
|
594
|
-
})
|
|
595
|
-
), g.columns.template.setAll({
|
|
596
|
-
width: ue(80)
|
|
597
|
-
})), l.data.setAll(O), i && g && g.data.setAll(O), h.appear(1e3), l.appear(1e3), () => {
|
|
598
|
-
a.dispose();
|
|
599
|
-
};
|
|
600
|
-
}, []), fe(() => {
|
|
601
|
-
if (u.current && c.current) {
|
|
602
|
-
const a = u.current.series.getIndex(
|
|
603
|
-
0
|
|
604
|
-
), h = i ? u.current.series.getIndex(1) : null;
|
|
605
|
-
a == null || a.data.setAll(O), h == null || h.data.setAll(O);
|
|
606
|
-
}
|
|
607
|
-
}, [O, i]), /* @__PURE__ */ oe("div", { style: { position: "relative", width: s, height: t }, children: [
|
|
608
|
-
/* @__PURE__ */ q("div", { id: o, style: { width: "100%", height: "100%" } }),
|
|
609
|
-
f && /* @__PURE__ */ q(
|
|
23
|
+
),
|
|
24
|
+
e && /* @__PURE__ */ t(
|
|
610
25
|
"div",
|
|
611
26
|
{
|
|
612
27
|
style: {
|
|
@@ -617,12 +32,13 @@ function ye({
|
|
|
617
32
|
alignItems: "center",
|
|
618
33
|
justifyContent: "center",
|
|
619
34
|
fontSize: "1.2rem",
|
|
620
|
-
color: "#555"
|
|
35
|
+
color: "#555",
|
|
36
|
+
zIndex: 10
|
|
621
37
|
},
|
|
622
38
|
children: "Loading..."
|
|
623
39
|
}
|
|
624
40
|
),
|
|
625
|
-
!
|
|
41
|
+
!e && o.length === 0 && /* @__PURE__ */ t(
|
|
626
42
|
"div",
|
|
627
43
|
{
|
|
628
44
|
style: {
|
|
@@ -632,13 +48,14 @@ function ye({
|
|
|
632
48
|
alignItems: "center",
|
|
633
49
|
justifyContent: "center",
|
|
634
50
|
color: "#999",
|
|
635
|
-
fontSize: "1.1rem"
|
|
51
|
+
fontSize: "1.1rem",
|
|
52
|
+
zIndex: 10
|
|
636
53
|
},
|
|
637
|
-
children:
|
|
54
|
+
children: s
|
|
638
55
|
}
|
|
639
56
|
)
|
|
640
57
|
] });
|
|
641
58
|
}
|
|
642
59
|
export {
|
|
643
|
-
|
|
60
|
+
u as CandlestickChart
|
|
644
61
|
};
|