@hybridcore/ui 1.5.79 → 1.5.82
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/{AxisRendererY-CFo972D5.js → AxisRendererY-kADUad00.js} +2464 -3363
- package/dist/ColumnSeries-BTcqshjB.js +399 -0
- package/dist/DateAxis-CMum47iz.js +924 -0
- package/dist/LineSeries-CfcpoYla.js +549 -0
- package/dist/components/charts/candlestick/index.js +30 -613
- package/dist/components/charts/candlestick/logic.js +249 -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 +293 -0
- package/dist/components/charts/highlighting-line-data/styled.js +12 -0
- package/dist/components/metric-card/MetricChart.js +525 -0
- package/dist/components/metric-card/index.js +95 -182
- package/dist/components/metric-card/logic.js +91 -0
- package/dist/components/metric-card/styled.js +155 -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 +187 -42
- package/package.json +1 -1
|
@@ -0,0 +1,924 @@
|
|
|
1
|
+
import { C as it, G as Z, n as rt, m as st, o as K, s as q, q as lt, i as y, r as J, t as ht, u as Q, v as ut, j as b, V as at, w as C, x as $, y as ct, z as f, D as G, B as S, E as gt, F as dt, H as z, I as tt, J as et, K as vt, M as N, k as ft } from "./AxisRendererY-kADUad00.js";
|
|
2
|
+
class H extends it {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments), Object.defineProperty(this, "_alwaysShow", {
|
|
5
|
+
enumerable: !0,
|
|
6
|
+
configurable: !0,
|
|
7
|
+
writable: !0,
|
|
8
|
+
value: !1
|
|
9
|
+
}), Object.defineProperty(this, "lineX", {
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
configurable: !0,
|
|
12
|
+
writable: !0,
|
|
13
|
+
value: this.children.push(Z.new(this._root, {
|
|
14
|
+
themeTags: ["x"]
|
|
15
|
+
}))
|
|
16
|
+
}), Object.defineProperty(this, "lineY", {
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
configurable: !0,
|
|
19
|
+
writable: !0,
|
|
20
|
+
value: this.children.push(Z.new(this._root, {
|
|
21
|
+
themeTags: ["y"]
|
|
22
|
+
}))
|
|
23
|
+
}), Object.defineProperty(this, "selection", {
|
|
24
|
+
enumerable: !0,
|
|
25
|
+
configurable: !0,
|
|
26
|
+
writable: !0,
|
|
27
|
+
value: this.children.push(rt.new(this._root, {
|
|
28
|
+
themeTags: ["selection", "cursor"],
|
|
29
|
+
layer: 30
|
|
30
|
+
}))
|
|
31
|
+
}), Object.defineProperty(this, "_movePoint", {
|
|
32
|
+
enumerable: !0,
|
|
33
|
+
configurable: !0,
|
|
34
|
+
writable: !0,
|
|
35
|
+
value: void 0
|
|
36
|
+
}), Object.defineProperty(this, "_lastPoint", {
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
configurable: !0,
|
|
39
|
+
writable: !0,
|
|
40
|
+
value: { x: 0, y: 0 }
|
|
41
|
+
}), Object.defineProperty(this, "_lastPoint2", {
|
|
42
|
+
enumerable: !0,
|
|
43
|
+
configurable: !0,
|
|
44
|
+
writable: !0,
|
|
45
|
+
value: { x: 0, y: 0 }
|
|
46
|
+
}), Object.defineProperty(this, "_tooltipX", {
|
|
47
|
+
enumerable: !0,
|
|
48
|
+
configurable: !0,
|
|
49
|
+
writable: !0,
|
|
50
|
+
value: !1
|
|
51
|
+
}), Object.defineProperty(this, "_tooltipY", {
|
|
52
|
+
enumerable: !0,
|
|
53
|
+
configurable: !0,
|
|
54
|
+
writable: !0,
|
|
55
|
+
value: !1
|
|
56
|
+
}), Object.defineProperty(this, "chart", {
|
|
57
|
+
enumerable: !0,
|
|
58
|
+
configurable: !0,
|
|
59
|
+
writable: !0,
|
|
60
|
+
value: void 0
|
|
61
|
+
}), Object.defineProperty(this, "_toX", {
|
|
62
|
+
enumerable: !0,
|
|
63
|
+
configurable: !0,
|
|
64
|
+
writable: !0,
|
|
65
|
+
value: void 0
|
|
66
|
+
}), Object.defineProperty(this, "_toY", {
|
|
67
|
+
enumerable: !0,
|
|
68
|
+
configurable: !0,
|
|
69
|
+
writable: !0,
|
|
70
|
+
value: void 0
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
_afterNew() {
|
|
74
|
+
this._settings.themeTags = st(this._settings.themeTags, ["xy", "cursor"]), super._afterNew(), this.setAll({ width: K, height: K, isMeasured: !0, position: "absolute" }), this.states.create("hidden", { visible: !0, opacity: 0 }), this._drawLines(), this.setPrivateRaw("visible", !1), this._disposers.push(this.setTimeout(() => {
|
|
75
|
+
this.setPrivate("visible", !0);
|
|
76
|
+
}, 500)), this._disposers.push(this.lineX.events.on("positionchanged", () => {
|
|
77
|
+
this._handleXLine();
|
|
78
|
+
})), this._disposers.push(this.lineY.events.on("positionchanged", () => {
|
|
79
|
+
this._handleYLine();
|
|
80
|
+
})), this._disposers.push(this.lineX.events.on("focus", () => this._handleLineFocus())), this._disposers.push(this.lineX.events.on("blur", () => this._handleLineBlur())), this._disposers.push(this.lineY.events.on("focus", () => this._handleLineFocus())), this._disposers.push(this.lineY.events.on("blur", () => this._handleLineBlur())), q("keyboardevents") && this._disposers.push(lt(document, "keydown", (t) => {
|
|
81
|
+
this._handleLineMove(ut(t), t.ctrlKey);
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
_setUpTouch() {
|
|
85
|
+
const t = this.chart;
|
|
86
|
+
t && (t.plotContainer._display.cancelTouch = this.get("behavior") != "none");
|
|
87
|
+
}
|
|
88
|
+
_handleXLine() {
|
|
89
|
+
let t = this.lineX.x(), e = !0;
|
|
90
|
+
(t < 0 || t > this.width()) && (e = !1), this.lineX.setPrivate("visible", e);
|
|
91
|
+
}
|
|
92
|
+
_handleYLine() {
|
|
93
|
+
let t = this.lineY.y(), e = !0;
|
|
94
|
+
(t < 0 || t > this.height()) && (e = !1), this.lineY.setPrivate("visible", e);
|
|
95
|
+
}
|
|
96
|
+
_handleLineMove(t, e) {
|
|
97
|
+
let i = "";
|
|
98
|
+
const s = this.chart;
|
|
99
|
+
let n;
|
|
100
|
+
if (s && s.xAxes.length) {
|
|
101
|
+
this._root.focused(this.lineX) ? (i = "positionX", n = s.xAxes.getIndex(0)) : this._root.focused(this.lineY) && (n = s.yAxes.getIndex(0), i = "positionY");
|
|
102
|
+
let a = 1;
|
|
103
|
+
if (e && (a = 5), n) {
|
|
104
|
+
let r = n.get("renderer").get("inversed", !1), o;
|
|
105
|
+
t == "ArrowRight" || t == "ArrowDown" ? o = 1 : t == "ArrowLeft" || t == "ArrowUp" ? o = -1 : t == "Tab" && (o = 0), o != null && (r && (o *= -1), this.set(i, n.nextPosition(o * a)));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
_handleLineFocus() {
|
|
110
|
+
this._alwaysShow = this.get("alwaysShow", !1), this.setAll({
|
|
111
|
+
positionX: this.getPrivate("positionX", 0),
|
|
112
|
+
positionY: this.getPrivate("positionY", 0),
|
|
113
|
+
alwaysShow: !0
|
|
114
|
+
}), this._handleLineMove("Tab");
|
|
115
|
+
}
|
|
116
|
+
_handleLineBlur() {
|
|
117
|
+
(this.lineX.isFocus() || this.lineY.isFocus()) && this.setAll({
|
|
118
|
+
positionX: void 0,
|
|
119
|
+
positionY: void 0,
|
|
120
|
+
alwaysShow: this._alwaysShow
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
_prepareChildren() {
|
|
124
|
+
if (super._prepareChildren(), this.isDirty("xAxis")) {
|
|
125
|
+
this._tooltipX = !1;
|
|
126
|
+
const t = this.get("xAxis");
|
|
127
|
+
if (t) {
|
|
128
|
+
const e = t.get("tooltip");
|
|
129
|
+
e && (this._tooltipX = !0, this._disposers.push(e.on("pointTo", () => {
|
|
130
|
+
this._updateXLine(e);
|
|
131
|
+
})));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (this.isDirty("yAxis")) {
|
|
135
|
+
this._tooltipY = !1;
|
|
136
|
+
const t = this.get("yAxis");
|
|
137
|
+
if (t) {
|
|
138
|
+
const e = t.get("tooltip");
|
|
139
|
+
e && (this._tooltipY = !0, this._disposers.push(e.on("pointTo", () => {
|
|
140
|
+
this._updateYLine(e);
|
|
141
|
+
})));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
_handleSyncWith() {
|
|
146
|
+
const t = this.chart;
|
|
147
|
+
if (t) {
|
|
148
|
+
const e = this.get("syncWith"), i = [];
|
|
149
|
+
e && y(e, (s) => {
|
|
150
|
+
const n = s.chart;
|
|
151
|
+
n && i.push(n);
|
|
152
|
+
}), t._otherCharts = i;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_updateChildren() {
|
|
156
|
+
if (super._updateChildren(), this._handleSyncWith(), this.isDirty("positionX") || this.isDirty("positionY")) {
|
|
157
|
+
const t = this.get("positionX"), e = this.get("positionY");
|
|
158
|
+
t == null && e == null ? this.hide(0) : (this._movePoint = this.toGlobal(this._getPoint(this.get("positionX", 0), this.get("positionY", 0))), this.handleMove());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
_updateXLine(t) {
|
|
162
|
+
let e = J(this._display.toLocal(t.get("pointTo", { x: 0, y: 0 })).x, 3);
|
|
163
|
+
this._toX != e && (this.lineX.animate({ key: "x", to: e, duration: t.get("animationDuration", 0), easing: t.get("animationEasing") }), this._toX = e);
|
|
164
|
+
}
|
|
165
|
+
_updateYLine(t) {
|
|
166
|
+
let e = J(this._display.toLocal(t.get("pointTo", { x: 0, y: 0 })).y, 3);
|
|
167
|
+
this._toY != e && (this.lineY.animate({ key: "y", to: e, duration: t.get("animationDuration", 0), easing: t.get("animationEasing") }), this._toY = e);
|
|
168
|
+
}
|
|
169
|
+
_drawLines() {
|
|
170
|
+
this.lineX.set("draw", (t) => {
|
|
171
|
+
t.moveTo(0, 0), t.lineTo(0, this.height());
|
|
172
|
+
}), this.lineY.set("draw", (t) => {
|
|
173
|
+
t.moveTo(0, 0), t.lineTo(this.width(), 0);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
updateCursor() {
|
|
177
|
+
this.get("alwaysShow") && (this._movePoint = this.toGlobal(this._getPoint(this.get("positionX", 0), this.get("positionY", 0)))), this.handleMove();
|
|
178
|
+
}
|
|
179
|
+
_setChart(t) {
|
|
180
|
+
this.chart = t, this._handleSyncWith();
|
|
181
|
+
const e = t.plotContainer;
|
|
182
|
+
this.events.on("boundschanged", () => {
|
|
183
|
+
this._disposers.push(this.setTimeout(() => {
|
|
184
|
+
this.updateCursor();
|
|
185
|
+
}, 50));
|
|
186
|
+
}), q("touchevents") && (this._disposers.push(e.events.on("click", (s) => {
|
|
187
|
+
ht(s.originalEvent) && this._handleMove(s);
|
|
188
|
+
})), this._setUpTouch()), this._disposers.push(e.events.on("pointerdown", (s) => {
|
|
189
|
+
this._handleCursorDown(s);
|
|
190
|
+
})), this._disposers.push(e.events.on("globalpointerup", (s) => {
|
|
191
|
+
this._handleCursorUp(s), !s.native && !this.isHidden() && this._handleMove(s);
|
|
192
|
+
})), this._disposers.push(e.events.on("globalpointermove", (s) => {
|
|
193
|
+
!this.get("syncWith") && Q(e._downPoints).length == 0 && !s.native && this.isHidden() || (this._handleMove(s), Math.hypot(this._lastPoint2.x - s.point.x, this._lastPoint2.y - s.point.y) > 1 && (this._handleLineBlur(), this._lastPoint2 = s.point));
|
|
194
|
+
}));
|
|
195
|
+
const i = this.parent;
|
|
196
|
+
i && i.children.moveValue(this.selection);
|
|
197
|
+
}
|
|
198
|
+
_inPlot(t) {
|
|
199
|
+
const e = this.chart;
|
|
200
|
+
return e ? e.inPlot(t) : !1;
|
|
201
|
+
}
|
|
202
|
+
_handleCursorDown(t) {
|
|
203
|
+
if (t.originalEvent.button == 2)
|
|
204
|
+
return;
|
|
205
|
+
const e = t.point;
|
|
206
|
+
let i = this._display.toLocal(e);
|
|
207
|
+
const s = this.chart;
|
|
208
|
+
if (this.selection.set("draw", () => {
|
|
209
|
+
}), s && this._inPlot(i)) {
|
|
210
|
+
if (this._downPoint = i, this.get("behavior") != "none") {
|
|
211
|
+
this.selection.show();
|
|
212
|
+
const r = "selectstarted";
|
|
213
|
+
this.events.isEnabled(r) && this.events.dispatch(r, { type: r, target: this, originalEvent: t.originalEvent });
|
|
214
|
+
}
|
|
215
|
+
let n = this._getPosition(i).x, a = this._getPosition(i).y;
|
|
216
|
+
this.setPrivate("downPositionX", n), this.setPrivate("downPositionY", a);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
_handleCursorUp(t) {
|
|
220
|
+
if (this._downPoint) {
|
|
221
|
+
const e = this.get("behavior", "none");
|
|
222
|
+
if (e != "none") {
|
|
223
|
+
e.charAt(0) === "z" && this.selection.hide();
|
|
224
|
+
const i = t.point;
|
|
225
|
+
let s = this._display.toLocal(i);
|
|
226
|
+
const n = this._downPoint, a = this.get("moveThreshold", 1);
|
|
227
|
+
if (s && n) {
|
|
228
|
+
let r = !1;
|
|
229
|
+
if ((e === "zoomX" || e === "zoomXY" || e === "selectX" || e === "selectXY") && Math.abs(s.x - n.x) > a && (r = !0), (e === "zoomY" || e === "zoomXY" || e === "selectY" || e === "selectXY") && Math.abs(s.y - n.y) > a && (r = !0), r) {
|
|
230
|
+
const o = "selectended";
|
|
231
|
+
this.events.isEnabled(o) && this.events.dispatch(o, { type: o, target: this, originalEvent: t.originalEvent });
|
|
232
|
+
} else {
|
|
233
|
+
const o = "selectcancelled";
|
|
234
|
+
this.events.isEnabled(o) && this.events.dispatch(o, { type: o, target: this, originalEvent: t.originalEvent });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
this._downPoint = void 0;
|
|
240
|
+
}
|
|
241
|
+
_handleMove(t) {
|
|
242
|
+
if (this.getPrivate("visible")) {
|
|
243
|
+
const e = this.chart;
|
|
244
|
+
if (e && Q(e.plotContainer._downPoints).length > 1) {
|
|
245
|
+
this.set("forceHidden", !0);
|
|
246
|
+
return;
|
|
247
|
+
} else
|
|
248
|
+
this.set("forceHidden", !1);
|
|
249
|
+
const i = t.point, s = this._lastPoint;
|
|
250
|
+
if (Math.round(s.x) === Math.round(i.x) && Math.round(s.y) === Math.round(i.y))
|
|
251
|
+
return;
|
|
252
|
+
this._lastPoint = i, this.setPrivate("lastPoint", i), this.handleMove({ x: i.x, y: i.y }, !1, t.originalEvent);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
_getPosition(t) {
|
|
256
|
+
return { x: t.x / this.width(), y: t.y / this.height() };
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Moves the cursor to X/Y coordinates within chart container (`point`).
|
|
260
|
+
*
|
|
261
|
+
* If `skipEvent` parameter is set to `true`, the move will not invoke
|
|
262
|
+
* the `"cursormoved"` event.
|
|
263
|
+
*
|
|
264
|
+
* @param point X/Y to move cursor to
|
|
265
|
+
* @param skipEvent Do not fire "cursormoved" event
|
|
266
|
+
*/
|
|
267
|
+
handleMove(t, e, i) {
|
|
268
|
+
t || (t = this._movePoint);
|
|
269
|
+
const s = this.get("alwaysShow");
|
|
270
|
+
if (!t) {
|
|
271
|
+
this.hide(0);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
this._movePoint = t;
|
|
275
|
+
let n = this._display.toLocal(t), a = this.chart;
|
|
276
|
+
if (a && (this._inPlot(n) || this._downPoint)) {
|
|
277
|
+
a._movePoint = t, this.isHidden() && (this.show(), this.get("behavior", "").charAt(0) == "z" && this.selection.set("draw", () => {
|
|
278
|
+
}));
|
|
279
|
+
let r = n.x, o = n.y, l = this._getPosition(n);
|
|
280
|
+
this.setPrivate("point", n);
|
|
281
|
+
let d = this.get("snapToSeries");
|
|
282
|
+
this._downPoint && (d = void 0);
|
|
283
|
+
let u = this.get("positionX"), m = l.x;
|
|
284
|
+
b(u) && (m = u);
|
|
285
|
+
let v = this.get("positionY"), P = l.y;
|
|
286
|
+
b(v) && (P = v), this.setPrivate("positionX", m), this.setPrivate("positionY", P);
|
|
287
|
+
const T = this._getPoint(m, P);
|
|
288
|
+
if (r = T.x, o = T.y, a.xAxes.each((h) => {
|
|
289
|
+
h._handleCursorPosition(m, d), s && h.handleCursorShow();
|
|
290
|
+
}), a.yAxes.each((h) => {
|
|
291
|
+
h._handleCursorPosition(P, d), s && h.handleCursorShow();
|
|
292
|
+
}), !e) {
|
|
293
|
+
a._handleCursorPosition();
|
|
294
|
+
const h = "cursormoved";
|
|
295
|
+
this.events.isEnabled(h) && this.events.dispatch(h, { type: h, target: this, point: t, originalEvent: i });
|
|
296
|
+
}
|
|
297
|
+
this._updateLines(r, o), a.arrangeTooltips();
|
|
298
|
+
} else if (!this._downPoint && !s) {
|
|
299
|
+
this.hide(0);
|
|
300
|
+
const r = "cursorhidden";
|
|
301
|
+
this.events.isEnabled(r) && this.events.dispatch(r, { type: r, target: this });
|
|
302
|
+
}
|
|
303
|
+
this._downPoint && this.get("behavior") != "none" && this._updateSelection(n);
|
|
304
|
+
}
|
|
305
|
+
_getPoint(t, e) {
|
|
306
|
+
return { x: this.width() * t, y: this.height() * e };
|
|
307
|
+
}
|
|
308
|
+
_updateLines(t, e) {
|
|
309
|
+
this._tooltipX || this.lineX.set("x", t), this._tooltipY || this.lineY.set("y", e), this._drawLines();
|
|
310
|
+
}
|
|
311
|
+
_updateSelection(t) {
|
|
312
|
+
const e = this.selection, i = this.get("behavior"), s = this.width(), n = this.height();
|
|
313
|
+
t.x < 0 && (t.x = 0), t.x > s && (t.x = s), t.y < 0 && (t.y = 0), t.y > n && (t.y = n), e.set("draw", (a) => {
|
|
314
|
+
const r = this._downPoint;
|
|
315
|
+
r && (i === "zoomXY" || i === "selectXY" ? (a.moveTo(r.x, r.y), a.lineTo(r.x, t.y), a.lineTo(t.x, t.y), a.lineTo(t.x, r.y), a.lineTo(r.x, r.y)) : i === "zoomX" || i === "selectX" ? (a.moveTo(r.x, 0), a.lineTo(r.x, n), a.lineTo(t.x, n), a.lineTo(t.x, 0), a.lineTo(r.x, 0)) : (i === "zoomY" || i === "selectY") && (a.moveTo(0, r.y), a.lineTo(s, r.y), a.lineTo(s, t.y), a.lineTo(0, t.y), a.lineTo(0, r.y)));
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
_onHide() {
|
|
319
|
+
if (this.isHidden()) {
|
|
320
|
+
let t = this.chart;
|
|
321
|
+
t && (t.xAxes.each((e) => {
|
|
322
|
+
e.handleCursorHide();
|
|
323
|
+
}), t.yAxes.each((e) => {
|
|
324
|
+
e.handleCursorHide();
|
|
325
|
+
}), t.series.each((e) => {
|
|
326
|
+
e.handleCursorHide();
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
super._onHide();
|
|
330
|
+
}
|
|
331
|
+
_onShow() {
|
|
332
|
+
if (!this.isHidden()) {
|
|
333
|
+
let t = this.chart;
|
|
334
|
+
t && (t.xAxes.each((e) => {
|
|
335
|
+
e.handleCursorShow();
|
|
336
|
+
}), t.yAxes.each((e) => {
|
|
337
|
+
e.handleCursorShow();
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
340
|
+
super._onShow();
|
|
341
|
+
}
|
|
342
|
+
_dispose() {
|
|
343
|
+
super._dispose(), this.selection.dispose();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
Object.defineProperty(H, "className", {
|
|
347
|
+
enumerable: !0,
|
|
348
|
+
configurable: !0,
|
|
349
|
+
writable: !0,
|
|
350
|
+
value: "XYCursor"
|
|
351
|
+
});
|
|
352
|
+
Object.defineProperty(H, "classNames", {
|
|
353
|
+
enumerable: !0,
|
|
354
|
+
configurable: !0,
|
|
355
|
+
writable: !0,
|
|
356
|
+
value: it.classNames.concat([H.className])
|
|
357
|
+
});
|
|
358
|
+
class B extends at {
|
|
359
|
+
constructor() {
|
|
360
|
+
super(...arguments), Object.defineProperty(this, "_dataGrouped", {
|
|
361
|
+
enumerable: !0,
|
|
362
|
+
configurable: !0,
|
|
363
|
+
writable: !0,
|
|
364
|
+
value: !1
|
|
365
|
+
}), Object.defineProperty(this, "_seriesDataGrouped", {
|
|
366
|
+
enumerable: !0,
|
|
367
|
+
configurable: !0,
|
|
368
|
+
writable: !0,
|
|
369
|
+
value: !1
|
|
370
|
+
}), Object.defineProperty(this, "_groupingCalculated", {
|
|
371
|
+
enumerable: !0,
|
|
372
|
+
configurable: !0,
|
|
373
|
+
writable: !0,
|
|
374
|
+
value: !1
|
|
375
|
+
}), Object.defineProperty(this, "_intervalDuration", {
|
|
376
|
+
enumerable: !0,
|
|
377
|
+
configurable: !0,
|
|
378
|
+
writable: !0,
|
|
379
|
+
value: 1
|
|
380
|
+
}), Object.defineProperty(this, "_baseDuration", {
|
|
381
|
+
enumerable: !0,
|
|
382
|
+
configurable: !0,
|
|
383
|
+
writable: !0,
|
|
384
|
+
value: 1
|
|
385
|
+
}), Object.defineProperty(this, "_intervalMax", {
|
|
386
|
+
enumerable: !0,
|
|
387
|
+
configurable: !0,
|
|
388
|
+
writable: !0,
|
|
389
|
+
value: {}
|
|
390
|
+
}), Object.defineProperty(this, "_intervalMin", {
|
|
391
|
+
enumerable: !0,
|
|
392
|
+
configurable: !0,
|
|
393
|
+
writable: !0,
|
|
394
|
+
value: {}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
_afterNew() {
|
|
398
|
+
this._settings.themeTags = st(this._settings.themeTags, ["axis"]), super._afterNew(), this.addTag("date"), this._setBaseInterval(this.get("baseInterval")), this.on("baseInterval", () => {
|
|
399
|
+
this._setBaseInterval(this.get("baseInterval"));
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
_setBaseInterval(t) {
|
|
403
|
+
this.setPrivateRaw("baseInterval", t), this._baseDuration = C(t);
|
|
404
|
+
}
|
|
405
|
+
_fixZoomFactor() {
|
|
406
|
+
const t = this.get("maxZoomFactor");
|
|
407
|
+
t != null && t != 1 / 0 ? this.setPrivateRaw("maxZoomFactor", t) : this.setPrivateRaw("maxZoomFactor", Math.round((this.getPrivate("max", 0) - this.getPrivate("min", 0)) / this.baseMainDuration()));
|
|
408
|
+
}
|
|
409
|
+
_groupData() {
|
|
410
|
+
const t = this.getPrivate("min"), e = this.getPrivate("max");
|
|
411
|
+
if (b(t) && b(e)) {
|
|
412
|
+
this._fixZoomFactor();
|
|
413
|
+
const i = this.getPrivate("groupInterval");
|
|
414
|
+
if (i ? this._setBaseInterval(i) : this._setBaseInterval(this.get("baseInterval")), this.isDirty("groupInterval")) {
|
|
415
|
+
let s = this.get("groupInterval");
|
|
416
|
+
s && (this.setRaw("groupIntervals", [s]), this._handleRangeChange());
|
|
417
|
+
}
|
|
418
|
+
if (this.isDirty("groupData") && !this._dataGrouped) {
|
|
419
|
+
if (this.get("groupData"))
|
|
420
|
+
y(this.series, (s) => {
|
|
421
|
+
this._groupSeriesData(s);
|
|
422
|
+
}), this._handleRangeChange();
|
|
423
|
+
else {
|
|
424
|
+
let s = this.get("baseInterval"), n = s.timeUnit + s.count;
|
|
425
|
+
y(this.series, (a) => {
|
|
426
|
+
a.setDataSet(n), a.resetGrouping();
|
|
427
|
+
}), this._setBaseInterval(s), this.setPrivateRaw("groupInterval", void 0), this.markDirtyExtremes();
|
|
428
|
+
}
|
|
429
|
+
this._dataGrouped = !0;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
_groupSeriesData(t) {
|
|
434
|
+
if (this.get("groupData") && !t.get("groupDataDisabled")) {
|
|
435
|
+
this._dataGrouped = !0, this._seriesDataGrouped = !0;
|
|
436
|
+
let e = [], i = this.baseMainDuration(), s = this.get("groupIntervals");
|
|
437
|
+
y(s, (v) => {
|
|
438
|
+
C(v) > i && e.push(v);
|
|
439
|
+
}), t._dataSets = {};
|
|
440
|
+
const n = this.getPrivate("name") + this.get("renderer").getPrivate("letter");
|
|
441
|
+
let a;
|
|
442
|
+
const r = t.get("baseAxis");
|
|
443
|
+
t.get("xAxis") === r ? a = t._valueYFields : t.get("yAxis") === r && (a = t._valueXFields);
|
|
444
|
+
let o = t._mainDataItems, l = this.get("baseInterval"), d = l.timeUnit + l.count;
|
|
445
|
+
t._dataSets[d] = o;
|
|
446
|
+
const u = t.get("groupDataCallback");
|
|
447
|
+
let m = t.get("groupDataWithOriginals", !1);
|
|
448
|
+
u && (m = !0), y(e, (v) => {
|
|
449
|
+
let P = -1 / 0, T = v.timeUnit + v.count;
|
|
450
|
+
t._dataSets[T] = [];
|
|
451
|
+
let h, M = {}, U = {}, R = {}, L = {};
|
|
452
|
+
y(a, (p) => {
|
|
453
|
+
M[p] = 0, U[p] = 0, R[p] = t.get(p + "Grouped"), L[p] = p + "Working";
|
|
454
|
+
});
|
|
455
|
+
let X = S(v.timeUnit), A = o[0], Y;
|
|
456
|
+
A && (Y = o[0].get(n));
|
|
457
|
+
let g;
|
|
458
|
+
y(o, (p) => {
|
|
459
|
+
let V = p.get(n), x = f(V, v.timeUnit, v.count, this._root, Y), k;
|
|
460
|
+
P < x - X / 24 ? (k = et(p.dataContext), h = new G(t, k, t._makeDataItem(k)), h.setRaw(n, x), t._dataSets[T].push(h), y(a, (c) => {
|
|
461
|
+
let w = p.get(c);
|
|
462
|
+
b(w) ? (h.setRaw(c, w), h.setRaw(L[c], w), U[c] = 1, M[c] = w) : (M[c] = 0, U[c] = 0);
|
|
463
|
+
}), m && h.set("originals", [p]), u && g && u(g, v), g = h) : (y(a, (c) => {
|
|
464
|
+
let w = R[c], _ = p.get(c);
|
|
465
|
+
if (_ != null) {
|
|
466
|
+
let D = h.get(c);
|
|
467
|
+
switch (w) {
|
|
468
|
+
case "close":
|
|
469
|
+
h.setRaw(c, _);
|
|
470
|
+
break;
|
|
471
|
+
case "sum":
|
|
472
|
+
h.setRaw(c, D + _);
|
|
473
|
+
break;
|
|
474
|
+
case "open":
|
|
475
|
+
break;
|
|
476
|
+
case "low":
|
|
477
|
+
_ < D && h.setRaw(c, _);
|
|
478
|
+
break;
|
|
479
|
+
case "high":
|
|
480
|
+
_ > D && h.setRaw(c, _);
|
|
481
|
+
break;
|
|
482
|
+
case "average":
|
|
483
|
+
U[c]++, M[c] += _;
|
|
484
|
+
let E = M[c] / U[c];
|
|
485
|
+
h.setRaw(c, E);
|
|
486
|
+
break;
|
|
487
|
+
case "extreme":
|
|
488
|
+
Math.abs(_) > Math.abs(D) && h.setRaw(c, _);
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
h.setRaw(L[c], h.get(c));
|
|
492
|
+
let F = et(p.dataContext);
|
|
493
|
+
F[n] = x, h.dataContext = F;
|
|
494
|
+
}
|
|
495
|
+
}), m && h.get("originals").push(p)), P = x;
|
|
496
|
+
}), u && g && u(g, v);
|
|
497
|
+
}), t._dataSetId && t.setDataSet(t._dataSetId), this.markDirtySize(), this._seriesAdded && this._root.events.once("frameended", () => {
|
|
498
|
+
this.markDirtySize();
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
_clearDirty() {
|
|
503
|
+
super._clearDirty(), this._groupingCalculated = !1, this._dataGrouped = !1;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Returns a time interval axis would group data to for a specified duration.
|
|
507
|
+
*
|
|
508
|
+
* @since 5.2.1
|
|
509
|
+
*/
|
|
510
|
+
getGroupInterval(t) {
|
|
511
|
+
let e = this.get("baseInterval"), i = $(0, t, this.get("groupCount", 1 / 0), this.get("groupIntervals"));
|
|
512
|
+
return C(i) < C(e) && (i = Object.assign({}, e)), i;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Return `max` of a specified time interval.
|
|
516
|
+
*
|
|
517
|
+
* Will work only if the axis was grouped to this interval at least once.
|
|
518
|
+
*
|
|
519
|
+
* @since 5.2.1
|
|
520
|
+
* @param interval Interval
|
|
521
|
+
* @return Max
|
|
522
|
+
*/
|
|
523
|
+
getIntervalMax(t) {
|
|
524
|
+
return this._intervalMax[t.timeUnit + t.count];
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Return `min` of a specified time interval.
|
|
528
|
+
*
|
|
529
|
+
* Will work only if the axis was grouped to this interval at least once.
|
|
530
|
+
*
|
|
531
|
+
* @since 5.2.1
|
|
532
|
+
* @param interval Interval
|
|
533
|
+
* @return Min
|
|
534
|
+
*/
|
|
535
|
+
getIntervalMin(t) {
|
|
536
|
+
return this._intervalMin[t.timeUnit + t.count];
|
|
537
|
+
}
|
|
538
|
+
_handleRangeChange() {
|
|
539
|
+
super._handleRangeChange();
|
|
540
|
+
let t = Math.round(this.getPrivate("selectionMin")), e = Math.round(this.getPrivate("selectionMax"));
|
|
541
|
+
if (b(t) && b(e)) {
|
|
542
|
+
if (this.get("endLocation") == 0 && (e += 1), this.get("groupData") && !this._groupingCalculated) {
|
|
543
|
+
this._groupingCalculated = !0;
|
|
544
|
+
let i = this.get("groupInterval"), s = this.getPrivate("groupInterval"), n = e - t + (this.get("startLocation", 0) + (1 - this.get("endLocation", 1)) * this.baseDuration());
|
|
545
|
+
if (s) {
|
|
546
|
+
let a = C(s);
|
|
547
|
+
n = Math.ceil(n / a) * a;
|
|
548
|
+
}
|
|
549
|
+
if (i || (i = this.getGroupInterval(n)), i && (!s || s.timeUnit !== i.timeUnit || s.count !== i.count || this._seriesDataGrouped)) {
|
|
550
|
+
this._seriesDataGrouped = !1, this.setPrivateRaw("groupInterval", i), this._setBaseInterval(i);
|
|
551
|
+
let a = i.timeUnit + i.count;
|
|
552
|
+
y(this.series, (r) => {
|
|
553
|
+
r.get("baseAxis") === this && r.setDataSet(a);
|
|
554
|
+
}), this.markDirtyExtremes(), this._root.events.once("frameended", () => {
|
|
555
|
+
this._root.events.once("frameended", () => {
|
|
556
|
+
const r = "groupintervalchanged";
|
|
557
|
+
this.events.isEnabled(r) && this.events.dispatch(r, { type: r, target: this });
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
y(this.series, (i) => {
|
|
563
|
+
if (i.get("baseAxis") === this) {
|
|
564
|
+
let s = this.getPrivate("name") + this.get("renderer").getPrivate("letter"), a = vt(i.dataItems, (h) => N(h.get(s), t)).index;
|
|
565
|
+
a > 0 && (a -= 1), e += this.baseDuration() * (1 - this.get("endLocation", 1));
|
|
566
|
+
let o = tt(i.dataItems, (h) => N(h.get(s), e)).index, l = o;
|
|
567
|
+
l > 1 && l--;
|
|
568
|
+
const d = i.dataItems[a], u = i.dataItems[l];
|
|
569
|
+
let m, v;
|
|
570
|
+
d && (v = d.get(s)), u && (m = u.get(s));
|
|
571
|
+
let P = !1;
|
|
572
|
+
m != null && v != null && (m < t || v > e) && (P = !0), i.setPrivate("outOfSelection", P), i.setPrivate("startIndex", a);
|
|
573
|
+
let T = i._adjustStartIndex(a);
|
|
574
|
+
i.getPrivate("adjustedStartIndex") !== T && (i.setPrivate("adjustedStartIndex", T), this.root.events.once("frameended", () => {
|
|
575
|
+
i._markDirtyPrivateKey("adjustedStartIndex");
|
|
576
|
+
})), i.setPrivate("endIndex", o);
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
_adjustMinMax(t, e, i, s) {
|
|
582
|
+
return { min: t, max: e, step: (e - t) / i };
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* @ignore
|
|
586
|
+
*/
|
|
587
|
+
intervalDuration() {
|
|
588
|
+
return this._intervalDuration;
|
|
589
|
+
}
|
|
590
|
+
_saveMinMax(t, e) {
|
|
591
|
+
let i = this.getPrivate("groupInterval");
|
|
592
|
+
i || (i = this.get("baseInterval"));
|
|
593
|
+
let s = i.timeUnit + i.count;
|
|
594
|
+
this._intervalMin[s] = t, this._intervalMax[s] = e;
|
|
595
|
+
}
|
|
596
|
+
_getM(t) {
|
|
597
|
+
return t == "day" || t == "month" || t == "year" ? 1.05 : 1.01;
|
|
598
|
+
}
|
|
599
|
+
_getMinorInterval(t) {
|
|
600
|
+
var e;
|
|
601
|
+
let i, s = t.count, n = t.timeUnit;
|
|
602
|
+
return s > 1 && (s == 10 || s == 15 ? s = 5 : s == 12 ? s = 2 : s == 6 ? s = 1 : s == 30 ? s = 10 : s < 10 && (s = 1), i = { timeUnit: n, count: s }), n == "week" && (((e = this.getPrivate("baseInterval")) === null || e === void 0 ? void 0 : e.timeUnit) != "week" ? i = { timeUnit: "day", count: 1 } : i = { timeUnit: "week", count: 1 }), n == "year" && s == 1 && this.getPrivate("selectionMax", 0) - this.getPrivate("selectionMin", 0) < 4 * 366 * 24 * 60 * 60 * 1e3 && (i = { timeUnit: "month", count: 1 }), i;
|
|
603
|
+
}
|
|
604
|
+
_prepareAxisItems() {
|
|
605
|
+
const t = this.getPrivate("min"), e = this.getPrivate("max");
|
|
606
|
+
if (b(t) && b(e)) {
|
|
607
|
+
const i = this._root, s = Math.round(this.getPrivate("selectionMin")), n = Math.round(this.getPrivate("selectionMax")), a = this.get("renderer"), r = this.getPrivate("baseInterval");
|
|
608
|
+
let o = s, l = 0;
|
|
609
|
+
const d = this.get("gridIntervals");
|
|
610
|
+
let u = $(0, n - s, a.gridCount(), d);
|
|
611
|
+
C(u) < this.baseDuration() && (u = Object.assign({}, r));
|
|
612
|
+
const m = C(u);
|
|
613
|
+
this._intervalDuration = m;
|
|
614
|
+
const v = ct(u.timeUnit), P = i.utc, T = i.timezone;
|
|
615
|
+
o = f(s - m, u.timeUnit, u.count, i, t);
|
|
616
|
+
let h = o - m, M;
|
|
617
|
+
const U = this.get("dateFormats");
|
|
618
|
+
this.setPrivateRaw("gridInterval", u);
|
|
619
|
+
const R = a.get("minorLabelsEnabled"), L = a.get("minorGridEnabled", R);
|
|
620
|
+
let X, A = 0;
|
|
621
|
+
L && (X = this._getMinorInterval(u), A = C(X));
|
|
622
|
+
let Y = 0;
|
|
623
|
+
for (; o < n + m; ) {
|
|
624
|
+
let g;
|
|
625
|
+
this.dataItems.length < l + 1 ? (g = new G(this, void 0, {}), this._dataItems.push(g), this.processDataItem(g)) : g = this.dataItems[l], this._createAssets(g, []), this._toggleDataItem(g, !0), g.setRaw("value", o), g.setRaw("labelEndValue", void 0);
|
|
626
|
+
let p = o + S(u.timeUnit, u.count * this._getM(u.timeUnit));
|
|
627
|
+
p = f(p, u.timeUnit, 1, i), g.setRaw("endValue", p);
|
|
628
|
+
let V = new Date(o);
|
|
629
|
+
M = U[u.timeUnit], v && this.get("markUnitChange") && b(h) && u.timeUnit != "year" && gt(o, h, v, P, T) && (M = this.get("periodChangeDateFormats")[u.timeUnit]);
|
|
630
|
+
const x = g.get("label");
|
|
631
|
+
x && x.set("text", i.dateFormatter.format(V, M));
|
|
632
|
+
let k = u.count;
|
|
633
|
+
if (u.timeUnit == "week" ? x == null || x.set("location", this.get("weekLabelLocation", 0)) : x == null || x.set("location", a.labels.template.get("location")), L) {
|
|
634
|
+
k = 1;
|
|
635
|
+
let c = u.timeUnit;
|
|
636
|
+
c == "week" && this.get("skipFirstMinor") && (c = "day");
|
|
637
|
+
let w = o + S(c, this._getM(c));
|
|
638
|
+
w = f(w, c, 1, i), g.setRaw("labelEndValue", w);
|
|
639
|
+
}
|
|
640
|
+
if (this._prepareDataItem(g, k), h = o, o = p, X) {
|
|
641
|
+
const c = X.timeUnit, w = X.count, _ = this._getM(c);
|
|
642
|
+
this.get("skipFirstMinor") || (h -= A * _);
|
|
643
|
+
let D = f(h + A * _, c, w, i, h), F, E = this.get("minorDateFormats", this.get("dateFormats"));
|
|
644
|
+
for (; D < o - 0.01 * A; ) {
|
|
645
|
+
let I;
|
|
646
|
+
this.minorDataItems.length < Y + 1 ? (I = new G(this, void 0, {}), this.minorDataItems.push(I), this.processDataItem(I)) : I = this.minorDataItems[Y], this._createAssets(I, ["minor"], !0), this._toggleDataItem(I, !0), I.setRaw("value", D);
|
|
647
|
+
let j = D + S(c, w * _);
|
|
648
|
+
j = f(j, c, 1, i), I.setRaw("endValue", j);
|
|
649
|
+
let ot = new Date(D);
|
|
650
|
+
M = E[c];
|
|
651
|
+
const O = I.get("label");
|
|
652
|
+
if (O && (R ? O.set("text", i.dateFormatter.format(ot, M)) : O.setPrivate("visible", !1)), this._prepareDataItem(I, 1), D == F)
|
|
653
|
+
break;
|
|
654
|
+
if (!I.get("isRange")) {
|
|
655
|
+
const W = this.get("fillRule");
|
|
656
|
+
W && W(I);
|
|
657
|
+
}
|
|
658
|
+
F = D, D = j, Y++;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (o == h)
|
|
662
|
+
break;
|
|
663
|
+
l++;
|
|
664
|
+
}
|
|
665
|
+
for (let g = l; g < this.dataItems.length; g++)
|
|
666
|
+
this._toggleDataItem(this.dataItems[g], !1);
|
|
667
|
+
for (let g = Y; g < this.minorDataItems.length; g++)
|
|
668
|
+
this._toggleDataItem(this.minorDataItems[g], !1);
|
|
669
|
+
y(this.series, (g) => {
|
|
670
|
+
g.inited && g._markDirtyAxes();
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
this._updateGhost();
|
|
674
|
+
}
|
|
675
|
+
_updateFinals(t, e) {
|
|
676
|
+
this.setPrivateRaw("selectionMinFinal", this.positionToValue(t)), this.setPrivateRaw("selectionMaxFinal", this.positionToValue(e));
|
|
677
|
+
}
|
|
678
|
+
_getDelta() {
|
|
679
|
+
this._deltaMinMax = this.baseDuration() / 2;
|
|
680
|
+
}
|
|
681
|
+
_fixMin(t) {
|
|
682
|
+
const e = this.getPrivate("baseInterval"), i = e.timeUnit;
|
|
683
|
+
let s = f(t, i, e.count, this._root), n = s + S(i, e.count * this._getM(i));
|
|
684
|
+
return n = f(n, i, 1, this._root), s + (n - s) * this.get("startLocation", 0);
|
|
685
|
+
}
|
|
686
|
+
_fixMax(t) {
|
|
687
|
+
const e = this.getPrivate("baseInterval"), i = e.timeUnit;
|
|
688
|
+
let s = f(t, i, e.count, this._root), n = s + S(i, e.count * this._getM(i));
|
|
689
|
+
return n = f(n, i, 1, this._root), s + (n - s) * this.get("endLocation", 1);
|
|
690
|
+
}
|
|
691
|
+
_updateDates(t, e) {
|
|
692
|
+
}
|
|
693
|
+
_handleSeriesRemoved() {
|
|
694
|
+
this.setPrivate("baseInterval", this.get("baseInterval")), this.setPrivate("min", void 0), this.setPrivate("minFinal", void 0);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Returns a duration of currently active `baseInterval` in milliseconds.
|
|
698
|
+
*
|
|
699
|
+
* @return Duration
|
|
700
|
+
*/
|
|
701
|
+
baseDuration() {
|
|
702
|
+
return this._baseDuration;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Returns a duration of user-defined `baseInterval` in milliseconds.
|
|
706
|
+
*
|
|
707
|
+
* @return Duration
|
|
708
|
+
*/
|
|
709
|
+
baseMainDuration() {
|
|
710
|
+
return C(this.get("baseInterval"));
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* @ignore
|
|
714
|
+
*/
|
|
715
|
+
processSeriesDataItem(t, e) {
|
|
716
|
+
const i = this.getPrivate("baseInterval");
|
|
717
|
+
t.open || (t.open = {}), t.close || (t.close = {}), y(e, (s) => {
|
|
718
|
+
let n = t.get(s);
|
|
719
|
+
if (b(n)) {
|
|
720
|
+
let a = t.open[s], r = t.close[s];
|
|
721
|
+
if (!(n >= a && n <= r)) {
|
|
722
|
+
const o = i.timeUnit, l = i.count;
|
|
723
|
+
a = f(n, o, l, this._root), r = a + S(o, l * this._getM(o)), r = f(r, o, 1, this._root), t.open[s] = a, t.close[s] = r;
|
|
724
|
+
}
|
|
725
|
+
this._updateDates(a, t.component);
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
_handleSizeDirty() {
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* @ignore
|
|
733
|
+
*/
|
|
734
|
+
getDataItemPositionX(t, e, i, s, n) {
|
|
735
|
+
let a, r, o;
|
|
736
|
+
return n ? o = t.get(e) : (t.open && t.close ? (a = t.open[e], r = t.close[e]) : (a = t.get(e), r = a), o = a + (r - a) * i, o = this._baseValue + (o - this._baseValue) * s), this.valueToPosition(o);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* @ignore
|
|
740
|
+
*/
|
|
741
|
+
getDataItemCoordinateX(t, e, i, s) {
|
|
742
|
+
return this._settings.renderer.positionToCoordinate(this.getDataItemPositionX(t, e, i, s));
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* @ignore
|
|
746
|
+
*/
|
|
747
|
+
getDataItemPositionY(t, e, i, s, n) {
|
|
748
|
+
let a, r, o;
|
|
749
|
+
return n ? o = t.get(e) : (t.open && t.close ? (a = t.open[e], r = t.close[e]) : (a = t.get(e), r = a), o = a + (r - a) * i, o = this._baseValue + (o - this._baseValue) * s), this.valueToPosition(o);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* @ignore
|
|
753
|
+
*/
|
|
754
|
+
getDataItemCoordinateY(t, e, i, s) {
|
|
755
|
+
return this._settings.renderer.positionToCoordinate(this.getDataItemPositionY(t, e, i, s));
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* @ignore
|
|
759
|
+
*/
|
|
760
|
+
roundAxisPosition(t, e) {
|
|
761
|
+
let i = this.positionToValue(t);
|
|
762
|
+
i = i - (e - 0.5) * this.baseDuration();
|
|
763
|
+
let s = this.getPrivate("baseInterval");
|
|
764
|
+
if (!dt(i)) {
|
|
765
|
+
const n = this._root.locale.firstDayOfWeek, a = s.timeUnit, r = this._root.utc, o = this._root.timezone, l = s.count;
|
|
766
|
+
i = f(i, a, l, this._root, this.getPrivate("min", 0));
|
|
767
|
+
let d = z(s, new Date(i), n, r, o);
|
|
768
|
+
return o && (i = f(i + this.baseDuration() * 0.05, a, l, this._root, this.getPrivate("min", 0)), d = z(s, new Date(i + d * e), n, r, o)), this.valueToPosition(i + d * e);
|
|
769
|
+
}
|
|
770
|
+
return NaN;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Returns text to be used in an axis tooltip for specific relative position.
|
|
774
|
+
*
|
|
775
|
+
* NOTE: Unless `adjustPosition` (2nd parameter) is set to `false`, the method
|
|
776
|
+
* will adjust position by `tooltipIntervalOffset`.
|
|
777
|
+
*
|
|
778
|
+
* @param position Position
|
|
779
|
+
* @param adjustPosition Adjust position
|
|
780
|
+
* @return Tooltip text
|
|
781
|
+
*/
|
|
782
|
+
getTooltipText(t, e) {
|
|
783
|
+
if (this.getPrivate("min") != null) {
|
|
784
|
+
let i = this.get("tooltipDateFormats")[this.getPrivate("baseInterval").timeUnit], s = this.positionToValue(t);
|
|
785
|
+
if (b(s)) {
|
|
786
|
+
let n = new Date(s), a = this.getPrivate("baseInterval"), r = z(a, n, this._root.locale.firstDayOfWeek, this._root.utc, this._root.timezone);
|
|
787
|
+
return e !== !1 && (n = new Date(s + this.get("tooltipIntervalOffset", -this.get("tooltipLocation", 0.5)) * r)), this._root.dateFormatter.format(n, this.get("tooltipDateFormat", i));
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return "";
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Returns a data item from series that is closest to the `position`.
|
|
794
|
+
*
|
|
795
|
+
* @param series Series
|
|
796
|
+
* @param position Relative position
|
|
797
|
+
* @return Data item
|
|
798
|
+
*/
|
|
799
|
+
getSeriesItem(t, e, i, s) {
|
|
800
|
+
let n = this.getPrivate("name") + this.get("renderer").getPrivate("letter"), a = this.positionToValue(e);
|
|
801
|
+
i == null && (i = 0.5), a = a - (i - 0.5) * this.baseDuration();
|
|
802
|
+
const r = tt(t.dataItems, (o) => {
|
|
803
|
+
let l = 0;
|
|
804
|
+
return o.open && (l = o.open[n]), N(l, a);
|
|
805
|
+
});
|
|
806
|
+
if (s || t.get("snapTooltip")) {
|
|
807
|
+
let o = t.dataItems[r.index - 1], l = t.dataItems[r.index];
|
|
808
|
+
if (o && l && o.open && l.close) {
|
|
809
|
+
let d = o.open[n], u = l.close[n];
|
|
810
|
+
if (Math.abs(a - d) > Math.abs(a - u))
|
|
811
|
+
return l;
|
|
812
|
+
}
|
|
813
|
+
if (o)
|
|
814
|
+
return o;
|
|
815
|
+
if (l)
|
|
816
|
+
return l;
|
|
817
|
+
} else {
|
|
818
|
+
const o = t.dataItems[r.index - 1];
|
|
819
|
+
if (o && o.open && o.close) {
|
|
820
|
+
let l = o.open[n], d = o.close[n];
|
|
821
|
+
if (a >= l && a <= d)
|
|
822
|
+
return o;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* @ignore
|
|
828
|
+
*/
|
|
829
|
+
shouldGap(t, e, i, s) {
|
|
830
|
+
const n = t.get(s);
|
|
831
|
+
return e.get(s) - n > this.baseDuration() * i;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Zooms the axis to specific `start` and `end` dates.
|
|
835
|
+
*
|
|
836
|
+
* Optional `duration` specifies duration of zoom animation in milliseconds.
|
|
837
|
+
*
|
|
838
|
+
* @param start Start Date
|
|
839
|
+
* @param end End Date
|
|
840
|
+
* @param duration Duration in milliseconds
|
|
841
|
+
*/
|
|
842
|
+
zoomToDates(t, e, i) {
|
|
843
|
+
this.zoomToValues(t.getTime(), e.getTime(), i);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Zooms the axis to specific `start` and `end` values.
|
|
847
|
+
*
|
|
848
|
+
* Optional `duration` specifies duration of zoom animation in milliseconds.
|
|
849
|
+
*
|
|
850
|
+
* @param start Start value
|
|
851
|
+
* @param end End value
|
|
852
|
+
* @param duration Duration in milliseconds
|
|
853
|
+
*/
|
|
854
|
+
zoomToValues(t, e, i) {
|
|
855
|
+
const s = this.getPrivate("minFinal", this.getPrivate("min", 0)), n = this.getPrivate("maxFinal", this.getPrivate("max", 0));
|
|
856
|
+
if (this.getPrivate("min") != null && this.getPrivate("max") != null)
|
|
857
|
+
if (this.get("groupData")) {
|
|
858
|
+
const a = this.getGroupInterval(e - t), r = this.get("baseInterval");
|
|
859
|
+
let o = this.getIntervalMin(r), l = this.getIntervalMax(r) - 1;
|
|
860
|
+
l = f(l, a.timeUnit, a.count, this.root), l += this._getM(a.timeUnit) * C(a), l = f(l, a.timeUnit, a.count, this.root);
|
|
861
|
+
let d = f(o, a.timeUnit, a.count, this.root), u = f(l, a.timeUnit, a.count, this.root), m = (t - d) / (u - d), v = (e - d) / (u - d);
|
|
862
|
+
this.zoom(m, v, i);
|
|
863
|
+
} else
|
|
864
|
+
this.zoom((t - s) / (n - s), (e - s) / (n - s), i);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Returns a `Date` object corresponding to specific position within plot
|
|
868
|
+
* area.
|
|
869
|
+
*
|
|
870
|
+
* @param position Pposition
|
|
871
|
+
* @return Date
|
|
872
|
+
*/
|
|
873
|
+
positionToDate(t) {
|
|
874
|
+
return new Date(this.positionToValue(t));
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Returns a relative position within plot area that corresponds to specific
|
|
878
|
+
* date.
|
|
879
|
+
*
|
|
880
|
+
* @param date Date
|
|
881
|
+
* @return Position
|
|
882
|
+
*/
|
|
883
|
+
dateToPosition(t) {
|
|
884
|
+
return this.valueToPosition(t.getTime());
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Returns relative position between two grid lines of the axis.
|
|
888
|
+
*
|
|
889
|
+
* @since 5.2.30
|
|
890
|
+
* @return Position
|
|
891
|
+
*/
|
|
892
|
+
getCellWidthPosition() {
|
|
893
|
+
let t = this.getPrivate("selectionMax", this.getPrivate("max")), e = this.getPrivate("selectionMin", this.getPrivate("min"));
|
|
894
|
+
return b(t) && b(e) ? this._intervalDuration / (t - e) : 0.05;
|
|
895
|
+
}
|
|
896
|
+
nextPosition(t) {
|
|
897
|
+
t == null && (t = 1);
|
|
898
|
+
let e = this.get("tooltipLocation", 0.5) * this.baseDuration();
|
|
899
|
+
this.get("renderer").getPrivate("letter") == "Y" && (t *= -1);
|
|
900
|
+
let i = this.positionToValue(this.getPrivate("tooltipPosition", 0));
|
|
901
|
+
const s = this.getPrivate("baseInterval");
|
|
902
|
+
let n = this._nextTime(i, t, s), a = this.getPrivate("selectionMin", 0), r = this.getPrivate("selectionMax", 0), o = f(a, s.timeUnit, s.count, this._root), l = f(r, s.timeUnit, s.count, this._root);
|
|
903
|
+
return n += e, n = ft(n, o + e, l - e), this.toGlobalPosition(this.valueToPosition(n));
|
|
904
|
+
}
|
|
905
|
+
_nextTime(t, e, i) {
|
|
906
|
+
return f(t + e * this.baseDuration(), i.timeUnit, i.count, this._root);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
Object.defineProperty(B, "className", {
|
|
910
|
+
enumerable: !0,
|
|
911
|
+
configurable: !0,
|
|
912
|
+
writable: !0,
|
|
913
|
+
value: "DateAxis"
|
|
914
|
+
});
|
|
915
|
+
Object.defineProperty(B, "classNames", {
|
|
916
|
+
enumerable: !0,
|
|
917
|
+
configurable: !0,
|
|
918
|
+
writable: !0,
|
|
919
|
+
value: at.classNames.concat([B.className])
|
|
920
|
+
});
|
|
921
|
+
export {
|
|
922
|
+
B as D,
|
|
923
|
+
H as X
|
|
924
|
+
};
|