@carbon/charts 1.13.12 → 1.13.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/{_baseEach-_pb8o-nX.mjs → _baseEach-fTLS5z67.mjs} +2 -2
- package/dist/{_baseEach-_pb8o-nX.mjs.map → _baseEach-fTLS5z67.mjs.map} +1 -1
- package/dist/{angle-utils-lGS6958-.mjs → angle-utils-DHfDhGau.mjs} +2 -2
- package/dist/{angle-utils-lGS6958-.mjs.map → angle-utils-DHfDhGau.mjs.map} +1 -1
- package/dist/{choropleth-OVZrVx-E.mjs → choropleth-S04OahB3.mjs} +4 -4
- package/dist/choropleth-S04OahB3.mjs.map +1 -0
- package/dist/color-scale-utils-7ngqnWVI.mjs +3330 -0
- package/dist/color-scale-utils-7ngqnWVI.mjs.map +1 -0
- package/dist/components/index.mjs +4 -4
- package/dist/demo/index.mjs +17 -17
- package/dist/index.mjs +54 -54
- package/dist/interfaces/axis-scales.d.ts +1 -1
- package/dist/model/index.mjs +3 -3
- package/dist/services/index.mjs +3 -3
- package/dist/umd/bundle.umd.js +17 -17
- package/dist/umd/bundle.umd.js.map +1 -1
- package/dist/{wordcloud-vuA-nZYy.mjs → wordcloud-eTGg6ZP6.mjs} +3 -3
- package/dist/wordcloud-eTGg6ZP6.mjs.map +1 -0
- package/dist/{zoom-WD9MTgCJ.mjs → zoom-i_u9NbAF.mjs} +278 -324
- package/dist/zoom-i_u9NbAF.mjs.map +1 -0
- package/package.json +5 -5
- package/dist/choropleth-OVZrVx-E.mjs.map +0 -1
- package/dist/color-scale-utils-xGxEq2HZ.mjs +0 -3397
- package/dist/color-scale-utils-xGxEq2HZ.mjs.map +0 -1
- package/dist/wordcloud-vuA-nZYy.mjs.map +0 -1
- package/dist/zoom-WD9MTgCJ.mjs.map +0 -1
|
@@ -1,183 +1,12 @@
|
|
|
1
|
-
import { select as
|
|
2
|
-
import { S as
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
g(2, arguments);
|
|
7
|
-
var t = f(i), n = D(e);
|
|
8
|
-
return isNaN(n) ? /* @__PURE__ */ new Date(NaN) : (n && t.setDate(t.getDate() + n), t);
|
|
9
|
-
}
|
|
10
|
-
function C(i, e) {
|
|
11
|
-
g(2, arguments);
|
|
12
|
-
var t = f(i), n = D(e);
|
|
13
|
-
if (isNaN(n))
|
|
14
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
15
|
-
if (!n)
|
|
16
|
-
return t;
|
|
17
|
-
var s = t.getDate(), o = new Date(t.getTime());
|
|
18
|
-
o.setMonth(t.getMonth() + n + 1, 0);
|
|
19
|
-
var a = o.getDate();
|
|
20
|
-
return s >= a ? o : (t.setFullYear(o.getFullYear(), o.getMonth(), s), t);
|
|
21
|
-
}
|
|
22
|
-
var Ie = 36e5;
|
|
23
|
-
function Q(i, e) {
|
|
24
|
-
g(2, arguments);
|
|
25
|
-
var t = D(e);
|
|
26
|
-
return b(i, t * Ie);
|
|
27
|
-
}
|
|
28
|
-
function G(i) {
|
|
29
|
-
g(1, arguments);
|
|
30
|
-
var e = f(i);
|
|
31
|
-
return e.setHours(0, 0, 0, 0), e;
|
|
32
|
-
}
|
|
33
|
-
var be = 864e5;
|
|
34
|
-
function Ce(i, e) {
|
|
35
|
-
g(2, arguments);
|
|
36
|
-
var t = G(i), n = G(e), s = t.getTime() - Y(t), o = n.getTime() - Y(n);
|
|
37
|
-
return Math.round((s - o) / be);
|
|
38
|
-
}
|
|
39
|
-
var we = 6e4;
|
|
40
|
-
function E(i, e) {
|
|
41
|
-
g(2, arguments);
|
|
42
|
-
var t = D(e);
|
|
43
|
-
return b(i, t * we);
|
|
44
|
-
}
|
|
45
|
-
function I(i, e) {
|
|
46
|
-
g(2, arguments);
|
|
47
|
-
var t = D(e);
|
|
48
|
-
return b(i, t * 1e3);
|
|
49
|
-
}
|
|
50
|
-
function ee(i, e) {
|
|
51
|
-
g(2, arguments);
|
|
52
|
-
var t = D(e);
|
|
53
|
-
return C(i, t * 12);
|
|
54
|
-
}
|
|
55
|
-
function M(i, e) {
|
|
56
|
-
g(2, arguments);
|
|
57
|
-
var t = f(i), n = f(e), s = t.getTime() - n.getTime();
|
|
58
|
-
return s < 0 ? -1 : s > 0 ? 1 : s;
|
|
59
|
-
}
|
|
60
|
-
var Ze = 6e4, Ne = 36e5;
|
|
61
|
-
function Fe(i, e) {
|
|
62
|
-
g(2, arguments);
|
|
63
|
-
var t = f(i), n = f(e), s = t.getFullYear() - n.getFullYear(), o = t.getMonth() - n.getMonth();
|
|
64
|
-
return s * 12 + o;
|
|
65
|
-
}
|
|
66
|
-
function Ve(i, e) {
|
|
67
|
-
g(2, arguments);
|
|
68
|
-
var t = f(i), n = f(e);
|
|
69
|
-
return t.getFullYear() - n.getFullYear();
|
|
70
|
-
}
|
|
71
|
-
function _(i, e) {
|
|
72
|
-
var t = i.getFullYear() - e.getFullYear() || i.getMonth() - e.getMonth() || i.getDate() - e.getDate() || i.getHours() - e.getHours() || i.getMinutes() - e.getMinutes() || i.getSeconds() - e.getSeconds() || i.getMilliseconds() - e.getMilliseconds();
|
|
73
|
-
return t < 0 ? -1 : t > 0 ? 1 : t;
|
|
74
|
-
}
|
|
75
|
-
function He(i, e) {
|
|
76
|
-
g(2, arguments);
|
|
77
|
-
var t = f(i), n = f(e), s = _(t, n), o = Math.abs(Ce(t, n));
|
|
78
|
-
t.setDate(t.getDate() - s * o);
|
|
79
|
-
var a = +(_(t, n) === -s), r = s * (o - a);
|
|
80
|
-
return r === 0 ? 0 : r;
|
|
81
|
-
}
|
|
82
|
-
function w(i, e) {
|
|
83
|
-
return g(2, arguments), f(i).getTime() - f(e).getTime();
|
|
84
|
-
}
|
|
85
|
-
var U = {
|
|
86
|
-
ceil: Math.ceil,
|
|
87
|
-
round: Math.round,
|
|
88
|
-
floor: Math.floor,
|
|
89
|
-
trunc: function(e) {
|
|
90
|
-
return e < 0 ? Math.ceil(e) : Math.floor(e);
|
|
91
|
-
}
|
|
92
|
-
// Math.trunc is not supported by IE
|
|
93
|
-
}, Ye = "trunc";
|
|
94
|
-
function Z(i) {
|
|
95
|
-
return i ? U[i] : U[Ye];
|
|
96
|
-
}
|
|
97
|
-
function ze(i, e, t) {
|
|
98
|
-
g(2, arguments);
|
|
99
|
-
var n = w(i, e) / Ne;
|
|
100
|
-
return Z(t == null ? void 0 : t.roundingMethod)(n);
|
|
101
|
-
}
|
|
102
|
-
function $(i, e, t) {
|
|
103
|
-
g(2, arguments);
|
|
104
|
-
var n = w(i, e) / Ze;
|
|
105
|
-
return Z(t == null ? void 0 : t.roundingMethod)(n);
|
|
106
|
-
}
|
|
107
|
-
function Xe(i) {
|
|
108
|
-
g(1, arguments);
|
|
109
|
-
var e = f(i);
|
|
110
|
-
return e.setHours(23, 59, 59, 999), e;
|
|
111
|
-
}
|
|
112
|
-
function ke(i) {
|
|
113
|
-
g(1, arguments);
|
|
114
|
-
var e = f(i), t = e.getMonth();
|
|
115
|
-
return e.setFullYear(e.getFullYear(), t + 1, 0), e.setHours(23, 59, 59, 999), e;
|
|
116
|
-
}
|
|
117
|
-
function Ge(i) {
|
|
118
|
-
g(1, arguments);
|
|
119
|
-
var e = f(i);
|
|
120
|
-
return Xe(e).getTime() === ke(e).getTime();
|
|
121
|
-
}
|
|
122
|
-
function _e(i, e) {
|
|
123
|
-
g(2, arguments);
|
|
124
|
-
var t = f(i), n = f(e), s = M(t, n), o = Math.abs(Fe(t, n)), a;
|
|
125
|
-
if (o < 1)
|
|
126
|
-
a = 0;
|
|
127
|
-
else {
|
|
128
|
-
t.getMonth() === 1 && t.getDate() > 27 && t.setDate(30), t.setMonth(t.getMonth() - s * o);
|
|
129
|
-
var r = M(t, n) === -s;
|
|
130
|
-
Ge(f(i)) && o === 1 && M(i, n) === 1 && (r = !1), a = s * (o - Number(r));
|
|
131
|
-
}
|
|
132
|
-
return a === 0 ? 0 : a;
|
|
133
|
-
}
|
|
134
|
-
function j(i, e, t) {
|
|
135
|
-
g(2, arguments);
|
|
136
|
-
var n = w(i, e) / 1e3;
|
|
137
|
-
return Z(t == null ? void 0 : t.roundingMethod)(n);
|
|
138
|
-
}
|
|
139
|
-
function Ue(i, e) {
|
|
140
|
-
g(2, arguments);
|
|
141
|
-
var t = f(i), n = f(e), s = M(t, n), o = Math.abs(Ve(t, n));
|
|
142
|
-
t.setFullYear(1584), n.setFullYear(1584);
|
|
143
|
-
var a = M(t, n) === -s, r = s * (o - Number(a));
|
|
144
|
-
return r === 0 ? 0 : r;
|
|
145
|
-
}
|
|
146
|
-
function $e(i, e) {
|
|
147
|
-
g(2, arguments);
|
|
148
|
-
var t = D(e);
|
|
149
|
-
return J(i, -t);
|
|
150
|
-
}
|
|
151
|
-
function je(i, e) {
|
|
152
|
-
g(2, arguments);
|
|
153
|
-
var t = D(e);
|
|
154
|
-
return C(i, -t);
|
|
155
|
-
}
|
|
156
|
-
function Ke(i, e) {
|
|
157
|
-
g(2, arguments);
|
|
158
|
-
var t = D(e);
|
|
159
|
-
return Q(i, -t);
|
|
160
|
-
}
|
|
161
|
-
function K(i, e) {
|
|
162
|
-
g(2, arguments);
|
|
163
|
-
var t = D(e);
|
|
164
|
-
return E(i, -t);
|
|
165
|
-
}
|
|
166
|
-
function q(i, e) {
|
|
167
|
-
g(2, arguments);
|
|
168
|
-
var t = D(e);
|
|
169
|
-
return I(i, -t);
|
|
170
|
-
}
|
|
171
|
-
function qe(i, e) {
|
|
172
|
-
g(2, arguments);
|
|
173
|
-
var t = D(e);
|
|
174
|
-
return ee(i, -t);
|
|
175
|
-
}
|
|
176
|
-
function We(i) {
|
|
1
|
+
import { select as te, max as ne, extent as $, scaleTime as se, scaleLog as ie, scaleBand as oe, scaleLinear as ae, curveLinear as re, curveLinearClosed as ce, curveBasis as le, curveBasisClosed as ue, curveBasisOpen as me, curveBundle as de, curveCardinal as he, curveCardinalClosed as ge, curveCardinalOpen as fe, curveCatmullRom as pe, curveCatmullRomClosed as xe, curveCatmullRomOpen as De, curveMonotoneX as ye, curveMonotoneY as Ae, curveNatural as Oe, curveStep as ve, curveStepAfter as Te, curveStepBefore as Me } from "d3";
|
|
2
|
+
import { S as y, D as Pe } from "./angle-utils-DHfDhGau.mjs";
|
|
3
|
+
import { _ as S, e as l, i as N, S as d } from "./enums-tMKLWMMm.mjs";
|
|
4
|
+
import { C as Se, D as H, m as c, E as _, F as g, G as B, H as Be, I as j, J as K, K as z, v as Re, L as Le } from "./color-scale-utils-7ngqnWVI.mjs";
|
|
5
|
+
function Ee(i) {
|
|
177
6
|
var e = i == null ? 0 : i.length;
|
|
178
|
-
return e ?
|
|
7
|
+
return e ? Se(i, 1) : [];
|
|
179
8
|
}
|
|
180
|
-
class
|
|
9
|
+
class We extends y {
|
|
181
10
|
/**
|
|
182
11
|
* focal: object to zoom into
|
|
183
12
|
* canvasElements: all the elements to translate and zoom on the chart area
|
|
@@ -185,24 +14,24 @@ class it extends O {
|
|
|
185
14
|
* */
|
|
186
15
|
zoomIn(e, t, n) {
|
|
187
16
|
let s, o, a;
|
|
188
|
-
const r = n ||
|
|
17
|
+
const r = n || H;
|
|
189
18
|
e && (s = e.x, o = e.y, a = 2);
|
|
190
|
-
const { width:
|
|
19
|
+
const { width: u, height: h } = Pe.getSVGElementSize(this.services.domUtils.getHolder(), {
|
|
191
20
|
useClientDimensions: !0
|
|
192
21
|
});
|
|
193
22
|
t.transition().duration(r.duration).ease(r.ease).attr(
|
|
194
23
|
"transform",
|
|
195
|
-
`translate(${
|
|
196
|
-
), this.services.events.dispatchEvent(
|
|
197
|
-
element:
|
|
24
|
+
`translate(${u / 2}, ${h / 2}) scale(${a}) translate(${-s},${-o})`
|
|
25
|
+
), this.services.events.dispatchEvent(S.CanvasZoom.CANVAS_ZOOM_IN, {
|
|
26
|
+
element: te(e)
|
|
198
27
|
});
|
|
199
28
|
}
|
|
200
29
|
zoomOut(e, t) {
|
|
201
|
-
const n = t ||
|
|
202
|
-
e.transition().duration(n.duration).ease(n.ease).attr("transform", ""), this.services.events.dispatchEvent(
|
|
30
|
+
const n = t || H;
|
|
31
|
+
e.transition().duration(n.duration).ease(n.ease).attr("transform", ""), this.services.events.dispatchEvent(S.CanvasZoom.CANVAS_ZOOM_OUT);
|
|
203
32
|
}
|
|
204
33
|
}
|
|
205
|
-
class
|
|
34
|
+
class qe extends y {
|
|
206
35
|
init() {
|
|
207
36
|
this.documentFragment = document.createDocumentFragment();
|
|
208
37
|
}
|
|
@@ -219,7 +48,7 @@ class ot extends O {
|
|
|
219
48
|
}) : (n = document.createEvent("Event"), n.initEvent(e, !1, !0)), this.documentFragment.dispatchEvent(n);
|
|
220
49
|
}
|
|
221
50
|
}
|
|
222
|
-
class
|
|
51
|
+
class Je extends y {
|
|
223
52
|
constructor(e, t) {
|
|
224
53
|
super(e, t);
|
|
225
54
|
}
|
|
@@ -247,26 +76,151 @@ class at extends O {
|
|
|
247
76
|
n.download = t, n.href = e, document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
248
77
|
}
|
|
249
78
|
}
|
|
250
|
-
class
|
|
79
|
+
class Qe extends y {
|
|
251
80
|
constructor() {
|
|
252
81
|
super(...arguments), this.pendingTransitions = {};
|
|
253
82
|
}
|
|
254
83
|
init() {
|
|
255
84
|
var e;
|
|
256
|
-
(e = this.services.events) == null || e.addEventListener(
|
|
85
|
+
(e = this.services.events) == null || e.addEventListener(S.Model.UPDATE, () => {
|
|
257
86
|
this.pendingTransitions = {};
|
|
258
87
|
});
|
|
259
88
|
}
|
|
260
89
|
setupTransition({ transition: e, name: t, animate: n }) {
|
|
261
90
|
return this.pendingTransitions[e._id] = e, e.on("end interrupt cancel", () => {
|
|
262
91
|
delete this.pendingTransitions[e._id];
|
|
263
|
-
}), this.model.getOptions().animations === !1 || n === !1 ? e.duration(0) : e.duration(
|
|
92
|
+
}), this.model.getOptions().animations === !1 || n === !1 ? e.duration(0) : e.duration(c(_, t, "duration") || _.default.duration);
|
|
264
93
|
}
|
|
265
94
|
getPendingTransitions() {
|
|
266
95
|
return this.pendingTransitions;
|
|
267
96
|
}
|
|
268
97
|
}
|
|
269
|
-
|
|
98
|
+
function v(i, e) {
|
|
99
|
+
const t = g(i), n = g(e), s = t.getTime() - n.getTime();
|
|
100
|
+
return s < 0 ? -1 : s > 0 ? 1 : s;
|
|
101
|
+
}
|
|
102
|
+
function be(i, e) {
|
|
103
|
+
const t = g(i), n = g(e);
|
|
104
|
+
return t.getFullYear() - n.getFullYear();
|
|
105
|
+
}
|
|
106
|
+
function Ie(i, e) {
|
|
107
|
+
const t = g(i), n = g(e), s = v(t, n), o = Math.abs(be(t, n));
|
|
108
|
+
t.setFullYear(1584), n.setFullYear(1584);
|
|
109
|
+
const a = v(t, n) === -s, r = s * (o - +a);
|
|
110
|
+
return r === 0 ? 0 : r;
|
|
111
|
+
}
|
|
112
|
+
function b(i, e) {
|
|
113
|
+
const t = g(i);
|
|
114
|
+
if (isNaN(e))
|
|
115
|
+
return B(i, NaN);
|
|
116
|
+
if (!e)
|
|
117
|
+
return t;
|
|
118
|
+
const n = t.getDate(), s = B(i, t.getTime());
|
|
119
|
+
s.setMonth(t.getMonth() + e + 1, 0);
|
|
120
|
+
const o = s.getDate();
|
|
121
|
+
return n >= o ? s : (t.setFullYear(
|
|
122
|
+
s.getFullYear(),
|
|
123
|
+
s.getMonth(),
|
|
124
|
+
n
|
|
125
|
+
), t);
|
|
126
|
+
}
|
|
127
|
+
function W(i, e) {
|
|
128
|
+
return b(i, e * 12);
|
|
129
|
+
}
|
|
130
|
+
function Ce(i, e) {
|
|
131
|
+
return W(i, -e);
|
|
132
|
+
}
|
|
133
|
+
function Ze(i, e) {
|
|
134
|
+
const t = g(i), n = g(e), s = t.getFullYear() - n.getFullYear(), o = t.getMonth() - n.getMonth();
|
|
135
|
+
return s * 12 + o;
|
|
136
|
+
}
|
|
137
|
+
function we(i) {
|
|
138
|
+
const e = g(i);
|
|
139
|
+
return e.setHours(23, 59, 59, 999), e;
|
|
140
|
+
}
|
|
141
|
+
function Fe(i) {
|
|
142
|
+
const e = g(i), t = e.getMonth();
|
|
143
|
+
return e.setFullYear(e.getFullYear(), t + 1, 0), e.setHours(23, 59, 59, 999), e;
|
|
144
|
+
}
|
|
145
|
+
function Ve(i) {
|
|
146
|
+
const e = g(i);
|
|
147
|
+
return +we(e) == +Fe(e);
|
|
148
|
+
}
|
|
149
|
+
function Ne(i, e) {
|
|
150
|
+
const t = g(i), n = g(e), s = v(t, n), o = Math.abs(
|
|
151
|
+
Ze(t, n)
|
|
152
|
+
);
|
|
153
|
+
let a;
|
|
154
|
+
if (o < 1)
|
|
155
|
+
a = 0;
|
|
156
|
+
else {
|
|
157
|
+
t.getMonth() === 1 && t.getDate() > 27 && t.setDate(30), t.setMonth(t.getMonth() - s * o);
|
|
158
|
+
let r = v(t, n) === -s;
|
|
159
|
+
Ve(g(i)) && o === 1 && v(i, n) === 1 && (r = !1), a = s * (o - Number(r));
|
|
160
|
+
}
|
|
161
|
+
return a === 0 ? 0 : a;
|
|
162
|
+
}
|
|
163
|
+
function He(i, e) {
|
|
164
|
+
return b(i, -e);
|
|
165
|
+
}
|
|
166
|
+
function _e(i, e) {
|
|
167
|
+
const t = g(i), n = g(e), s = Y(t, n), o = Math.abs(Be(t, n));
|
|
168
|
+
t.setDate(t.getDate() - s * o);
|
|
169
|
+
const a = +(Y(t, n) === -s), r = s * (o - a);
|
|
170
|
+
return r === 0 ? 0 : r;
|
|
171
|
+
}
|
|
172
|
+
function Y(i, e) {
|
|
173
|
+
const t = i.getFullYear() - e.getFullYear() || i.getMonth() - e.getMonth() || i.getDate() - e.getDate() || i.getHours() - e.getHours() || i.getMinutes() - e.getMinutes() || i.getSeconds() - e.getSeconds() || i.getMilliseconds() - e.getMilliseconds();
|
|
174
|
+
return t < 0 ? -1 : t > 0 ? 1 : t;
|
|
175
|
+
}
|
|
176
|
+
function q(i, e) {
|
|
177
|
+
const t = g(i);
|
|
178
|
+
return isNaN(e) ? B(i, NaN) : (e && t.setDate(t.getDate() + e), t);
|
|
179
|
+
}
|
|
180
|
+
function ze(i, e) {
|
|
181
|
+
return q(i, -e);
|
|
182
|
+
}
|
|
183
|
+
function I(i, e) {
|
|
184
|
+
return g(i).getTime() - g(e).getTime();
|
|
185
|
+
}
|
|
186
|
+
function C(i) {
|
|
187
|
+
return i ? Math[i] : Math.trunc;
|
|
188
|
+
}
|
|
189
|
+
function Ye(i, e, t) {
|
|
190
|
+
const n = I(i, e) / j;
|
|
191
|
+
return C(t == null ? void 0 : t.roundingMethod)(n);
|
|
192
|
+
}
|
|
193
|
+
function Z(i, e) {
|
|
194
|
+
const t = +g(i);
|
|
195
|
+
return B(i, t + e);
|
|
196
|
+
}
|
|
197
|
+
function J(i, e) {
|
|
198
|
+
return Z(i, e * j);
|
|
199
|
+
}
|
|
200
|
+
function Xe(i, e) {
|
|
201
|
+
return J(i, -e);
|
|
202
|
+
}
|
|
203
|
+
function X(i, e, t) {
|
|
204
|
+
const n = I(i, e) / K;
|
|
205
|
+
return C(t == null ? void 0 : t.roundingMethod)(n);
|
|
206
|
+
}
|
|
207
|
+
function L(i, e) {
|
|
208
|
+
return Z(i, e * K);
|
|
209
|
+
}
|
|
210
|
+
function G(i, e) {
|
|
211
|
+
return L(i, -e);
|
|
212
|
+
}
|
|
213
|
+
function k(i, e, t) {
|
|
214
|
+
const n = I(i, e) / 1e3;
|
|
215
|
+
return C(t == null ? void 0 : t.roundingMethod)(n);
|
|
216
|
+
}
|
|
217
|
+
function E(i, e) {
|
|
218
|
+
return Z(i, e * 1e3);
|
|
219
|
+
}
|
|
220
|
+
function U(i, e) {
|
|
221
|
+
return E(i, -e);
|
|
222
|
+
}
|
|
223
|
+
class et extends y {
|
|
270
224
|
constructor() {
|
|
271
225
|
super(...arguments), this.scaleTypes = {
|
|
272
226
|
top: null,
|
|
@@ -283,7 +237,7 @@ class lt extends O {
|
|
|
283
237
|
}
|
|
284
238
|
getDomainAxisPosition({ datum: e = null } = {}) {
|
|
285
239
|
if (this.dualAxes && e) {
|
|
286
|
-
const t = this.model.getOptions(), { groupMapsTo: n } = t.data, s =
|
|
240
|
+
const t = this.model.getOptions(), { groupMapsTo: n } = t.data, s = c(t, "axes", this.secondaryDomainAxisPosition), o = e[n];
|
|
287
241
|
if (s != null && s.correspondingDatasets && s.correspondingDatasets.includes(o))
|
|
288
242
|
return this.secondaryDomainAxisPosition;
|
|
289
243
|
}
|
|
@@ -291,7 +245,7 @@ class lt extends O {
|
|
|
291
245
|
}
|
|
292
246
|
getRangeAxisPosition({ datum: e = null, groups: t = null } = {}) {
|
|
293
247
|
if (this.dualAxes) {
|
|
294
|
-
const n = this.model.getOptions(), { groupMapsTo: s } = n.data, o =
|
|
248
|
+
const n = this.model.getOptions(), { groupMapsTo: s } = n.data, o = c(n, "axes", this.secondaryRangeAxisPosition);
|
|
295
249
|
let a;
|
|
296
250
|
if (e !== null ? a = e[s] : t && t.length > 0 && (a = t[0]), o != null && o.correspondingDatasets && o.correspondingDatasets.includes(a))
|
|
297
251
|
return this.secondaryRangeAxisPosition;
|
|
@@ -299,7 +253,7 @@ class lt extends O {
|
|
|
299
253
|
return this.rangeAxisPosition;
|
|
300
254
|
}
|
|
301
255
|
getAxisOptions(e) {
|
|
302
|
-
return
|
|
256
|
+
return c(this.model.getOptions(), "axes", e);
|
|
303
257
|
}
|
|
304
258
|
getDomainAxisOptions() {
|
|
305
259
|
const e = this.getDomainAxisPosition();
|
|
@@ -311,7 +265,7 @@ class lt extends O {
|
|
|
311
265
|
}
|
|
312
266
|
getScaleLabel(e) {
|
|
313
267
|
const n = this.getAxisOptions(e).title;
|
|
314
|
-
return n || (e ===
|
|
268
|
+
return n || (e === l.BOTTOM || e === l.TOP ? "x-value" : "y-value");
|
|
315
269
|
}
|
|
316
270
|
getDomainLabel() {
|
|
317
271
|
return this.getScaleLabel(this.getDomainAxisPosition());
|
|
@@ -320,8 +274,8 @@ class lt extends O {
|
|
|
320
274
|
return this.getScaleLabel(this.getRangeAxisPosition());
|
|
321
275
|
}
|
|
322
276
|
update() {
|
|
323
|
-
this.determineAxisDuality(), this.findDomainAndRangeAxes(), this.determineOrientation(), Object.keys(
|
|
324
|
-
(t) =>
|
|
277
|
+
this.determineAxisDuality(), this.findDomainAndRangeAxes(), this.determineOrientation(), Object.keys(l).map(
|
|
278
|
+
(t) => l[t]
|
|
325
279
|
).forEach((t) => {
|
|
326
280
|
this.scales[t] = this.createScale(t);
|
|
327
281
|
});
|
|
@@ -334,7 +288,7 @@ class lt extends O {
|
|
|
334
288
|
this.domainAxisPosition = n.primaryDomainAxisPosition, this.rangeAxisPosition = n.primaryRangeAxisPosition, this.isDualAxes() && (this.secondaryDomainAxisPosition = n.secondaryDomainAxisPosition, this.secondaryRangeAxisPosition = n.secondaryRangeAxisPosition);
|
|
335
289
|
}
|
|
336
290
|
determineOrientation() {
|
|
337
|
-
(this.rangeAxisPosition ===
|
|
291
|
+
(this.rangeAxisPosition === l.LEFT || this.rangeAxisPosition === l.RIGHT) && (this.domainAxisPosition === l.BOTTOM || this.domainAxisPosition === l.TOP) ? this.orientation = N.VERTICAL : this.orientation = N.HORIZONTAL;
|
|
338
292
|
}
|
|
339
293
|
isDualAxes() {
|
|
340
294
|
return this.dualAxes;
|
|
@@ -343,11 +297,11 @@ class lt extends O {
|
|
|
343
297
|
// it does not count as dual axes if it just has another axis turned on but is not actually using it to map a dataset
|
|
344
298
|
determineAxisDuality() {
|
|
345
299
|
var n, s, o, a;
|
|
346
|
-
const e = this.model.getOptions(), t =
|
|
347
|
-
((n = t[
|
|
300
|
+
const e = this.model.getOptions(), t = c(e, "axes");
|
|
301
|
+
((n = t[l.LEFT]) != null && n.correspondingDatasets && t[l.RIGHT] || (s = t[l.RIGHT]) != null && s.correspondingDatasets && t[l.LEFT] || (o = t[l.TOP]) != null && o.correspondingDatasets && t[l.BOTTOM] || (a = t[l.BOTTOM]) != null && a.correspondingDatasets && t[l.TOP]) && (this.dualAxes = !0);
|
|
348
302
|
}
|
|
349
303
|
getCustomDomainValuesByposition(e) {
|
|
350
|
-
const t =
|
|
304
|
+
const t = c(this.model.getOptions(), "axes", e, "domain");
|
|
351
305
|
if (t && !Array.isArray(t))
|
|
352
306
|
throw new Error(`Domain in ${e} axis is not a valid array`);
|
|
353
307
|
if (Array.isArray(t) && (this.scaleTypes[e] === d.LINEAR || this.scaleTypes[e] === d.TIME) && t.length !== 2)
|
|
@@ -381,14 +335,14 @@ class lt extends O {
|
|
|
381
335
|
}
|
|
382
336
|
// Find the main x-axis out of the 2 x-axis on the chart (when 2D axis is used)
|
|
383
337
|
getMainXAxisPosition() {
|
|
384
|
-
const e = [
|
|
338
|
+
const e = [l.BOTTOM, l.TOP];
|
|
385
339
|
return [this.domainAxisPosition, this.rangeAxisPosition].find(
|
|
386
340
|
(t) => e.indexOf(t) > -1
|
|
387
341
|
);
|
|
388
342
|
}
|
|
389
343
|
// Find the main y-axis out of the 2 y-axis on the chart (when 2D axis is used)
|
|
390
344
|
getMainYAxisPosition() {
|
|
391
|
-
const e = [
|
|
345
|
+
const e = [l.LEFT, l.RIGHT];
|
|
392
346
|
return [this.domainAxisPosition, this.rangeAxisPosition].find(
|
|
393
347
|
(t) => e.indexOf(t) > -1
|
|
394
348
|
);
|
|
@@ -400,28 +354,28 @@ class lt extends O {
|
|
|
400
354
|
return this.scales[this.getMainYAxisPosition()];
|
|
401
355
|
}
|
|
402
356
|
getValueFromScale(e, t, n, s) {
|
|
403
|
-
const o = this.model.getOptions(), r =
|
|
404
|
-
let
|
|
357
|
+
const o = this.model.getOptions(), r = c(o, "axes")[n], { mapsTo: u } = r, h = c(s, u) !== null ? s[u] : s;
|
|
358
|
+
let p;
|
|
405
359
|
switch (t) {
|
|
406
360
|
case d.LABELS:
|
|
407
|
-
|
|
361
|
+
p = e(h) + e.step() / 2;
|
|
408
362
|
break;
|
|
409
363
|
case d.TIME:
|
|
410
|
-
|
|
364
|
+
p = e(new Date(h));
|
|
411
365
|
break;
|
|
412
366
|
default:
|
|
413
|
-
|
|
367
|
+
p = e(h);
|
|
414
368
|
}
|
|
415
|
-
return
|
|
369
|
+
return p;
|
|
416
370
|
}
|
|
417
371
|
getBoundedScaledValues(e) {
|
|
418
|
-
const { bounds: t } = this.model.getOptions(), n = this.getRangeAxisPosition({ datum: e }), s = this.scales[n], o = this.model.getOptions(), r =
|
|
372
|
+
const { bounds: t } = this.model.getOptions(), n = this.getRangeAxisPosition({ datum: e }), s = this.scales[n], o = this.model.getOptions(), r = c(o, "axes")[n], { mapsTo: u } = r, h = e[u] !== void 0 ? e[u] : e;
|
|
419
373
|
return [
|
|
420
374
|
s(
|
|
421
|
-
|
|
375
|
+
c(e, t.upperBoundMapsTo) !== null ? e[t.upperBoundMapsTo] : h
|
|
422
376
|
),
|
|
423
377
|
s(
|
|
424
|
-
|
|
378
|
+
c(e, t.lowerBoundMapsTo) !== null ? e[t.lowerBoundMapsTo] : h
|
|
425
379
|
)
|
|
426
380
|
];
|
|
427
381
|
}
|
|
@@ -445,120 +399,120 @@ class lt extends O {
|
|
|
445
399
|
}
|
|
446
400
|
getDomainIdentifier(e) {
|
|
447
401
|
const t = this.model.getOptions();
|
|
448
|
-
return
|
|
402
|
+
return c(t, "axes", this.getDomainAxisPosition({ datum: e }), "mapsTo");
|
|
449
403
|
}
|
|
450
404
|
getRangeIdentifier(e) {
|
|
451
405
|
const t = this.model.getOptions();
|
|
452
|
-
return
|
|
406
|
+
return c(t, "axes", this.getRangeAxisPosition({ datum: e }), "mapsTo");
|
|
453
407
|
}
|
|
454
408
|
extendsDomain(e, t) {
|
|
455
|
-
const n = this.model.getOptions(), s =
|
|
409
|
+
const n = this.model.getOptions(), s = c(n, "axes", e);
|
|
456
410
|
if (s.scaleType === d.TIME) {
|
|
457
|
-
const o =
|
|
458
|
-
return
|
|
411
|
+
const o = c(n, "timeScale", "addSpaceOnEdges");
|
|
412
|
+
return Ge(t, o);
|
|
459
413
|
} else
|
|
460
|
-
return
|
|
414
|
+
return ke(t, z.paddingRatio, s.scaleType);
|
|
461
415
|
}
|
|
462
416
|
findVerticalAxesPositions() {
|
|
463
|
-
const e = this.model.getOptions(), t =
|
|
464
|
-
return
|
|
465
|
-
primary:
|
|
466
|
-
secondary:
|
|
467
|
-
} : { primary:
|
|
417
|
+
const e = this.model.getOptions(), t = c(e, "axes"), n = this.isDualAxes();
|
|
418
|
+
return c(t, l.LEFT) === null && c(t, l.RIGHT) !== null || c(t, l.RIGHT, "main") === !0 || n && c(t, l.LEFT, "correspondingDatasets") ? {
|
|
419
|
+
primary: l.RIGHT,
|
|
420
|
+
secondary: l.LEFT
|
|
421
|
+
} : { primary: l.LEFT, secondary: l.RIGHT };
|
|
468
422
|
}
|
|
469
423
|
findHorizontalAxesPositions() {
|
|
470
|
-
const e = this.model.getOptions(), t =
|
|
471
|
-
return
|
|
472
|
-
primary:
|
|
473
|
-
secondary:
|
|
474
|
-
} : { primary:
|
|
424
|
+
const e = this.model.getOptions(), t = c(e, "axes"), n = this.isDualAxes();
|
|
425
|
+
return c(t, l.BOTTOM) === null && c(t, l.TOP) !== null || c(t, l.TOP, "main") === !0 || n && c(t, l.BOTTOM, "correspondingDatasets") ? {
|
|
426
|
+
primary: l.TOP,
|
|
427
|
+
secondary: l.BOTTOM
|
|
428
|
+
} : { primary: l.BOTTOM, secondary: l.TOP };
|
|
475
429
|
}
|
|
476
430
|
findDomainAndRangeAxesPositions(e, t) {
|
|
477
|
-
const n = this.model.getOptions(), s =
|
|
431
|
+
const n = this.model.getOptions(), s = c(n, "axes", e.primary), o = c(n, "axes", t.primary), a = s.scaleType || d.LINEAR, r = o.scaleType || d.LINEAR, u = {
|
|
478
432
|
primaryDomainAxisPosition: null,
|
|
479
433
|
secondaryDomainAxisPosition: null,
|
|
480
434
|
primaryRangeAxisPosition: null,
|
|
481
435
|
secondaryRangeAxisPosition: null
|
|
482
436
|
};
|
|
483
|
-
return
|
|
437
|
+
return u.primaryDomainAxisPosition = t.primary, u.primaryRangeAxisPosition = e.primary, u.secondaryDomainAxisPosition = t.secondary, u.secondaryRangeAxisPosition = e.secondary, (!(r === d.LABELS || r === d.TIME) && a === d.LABELS || a === d.TIME) && (u.primaryDomainAxisPosition = e.primary, u.primaryRangeAxisPosition = t.primary, u.secondaryDomainAxisPosition = e.secondary, u.secondaryRangeAxisPosition = t.secondary), u;
|
|
484
438
|
}
|
|
485
439
|
getScaleDomain(e) {
|
|
486
|
-
const t = this.model.getOptions(), n =
|
|
440
|
+
const t = this.model.getOptions(), n = c(t, "axes", e), s = c(t, "bounds"), { includeZero: o } = n, a = c(n, "scaleType") || d.LINEAR;
|
|
487
441
|
if (this.model.isDataEmpty())
|
|
488
442
|
return [];
|
|
489
443
|
if (n.binned) {
|
|
490
444
|
const { bins: m } = this.model.getBinConfigurations();
|
|
491
|
-
return [0,
|
|
445
|
+
return [0, ne(m, (f) => f.length)];
|
|
492
446
|
} else if (n.limitDomainToBins) {
|
|
493
|
-
const { bins: m } = this.model.getBinConfigurations(),
|
|
494
|
-
return [
|
|
447
|
+
const { bins: m } = this.model.getBinConfigurations(), f = this.model.getStackKeys({ bins: m });
|
|
448
|
+
return [f[0].split(":")[0], f[f.length - 1].split(":")[1]];
|
|
495
449
|
}
|
|
496
|
-
const r = this.model.getDisplayData(), { extendLinearDomainBy:
|
|
450
|
+
const r = this.model.getDisplayData(), { extendLinearDomainBy: u, mapsTo: h, percentage: p, thresholds: D } = n, { reference: A, compareTo: T } = z.ratio;
|
|
497
451
|
if (n.domain)
|
|
498
452
|
return a === d.LABELS ? n.domain : (a === d.TIME && (n.domain = n.domain.map(
|
|
499
453
|
(m) => m.getTime === void 0 ? new Date(m) : m
|
|
500
454
|
)), this.extendsDomain(e, n.domain));
|
|
501
|
-
if (
|
|
455
|
+
if (p)
|
|
502
456
|
return [0, 100];
|
|
503
457
|
if (n && a === d.LABELS)
|
|
504
|
-
return
|
|
505
|
-
let
|
|
506
|
-
const
|
|
458
|
+
return Re(r.map((m) => m[h]));
|
|
459
|
+
let M, x;
|
|
460
|
+
const R = this.model.getDataGroupNames();
|
|
507
461
|
if (a === d.LABELS_RATIO)
|
|
508
|
-
return r.map((m) => `${m[A]}/${m[
|
|
462
|
+
return r.map((m) => `${m[A]}/${m[T]}`);
|
|
509
463
|
if (a === d.TIME)
|
|
510
464
|
x = r.map((m) => +new Date(m[h]));
|
|
511
465
|
else if (s && t.axes)
|
|
512
466
|
x = [], r.forEach((m) => {
|
|
513
467
|
x.push(m[h]), m[s.upperBoundMapsTo] && x.push(m[s.upperBoundMapsTo]), m[s.lowerBoundMapsTo] && x.push(m[s.lowerBoundMapsTo]);
|
|
514
468
|
});
|
|
515
|
-
else if (n.stacked === !0 &&
|
|
516
|
-
const { groupMapsTo: m } = t.data,
|
|
517
|
-
groups:
|
|
518
|
-
}),
|
|
519
|
-
(
|
|
520
|
-
),
|
|
521
|
-
|
|
522
|
-
const { ...
|
|
469
|
+
else if (n.stacked === !0 && R && e === this.getRangeAxisPosition()) {
|
|
470
|
+
const { groupMapsTo: m } = t.data, f = this.model.getDataValuesGroupedByKeys({
|
|
471
|
+
groups: R
|
|
472
|
+
}), Q = r.filter(
|
|
473
|
+
(O) => !R.includes(O[m])
|
|
474
|
+
), w = [];
|
|
475
|
+
f.forEach((O) => {
|
|
476
|
+
const { ...ee } = O;
|
|
523
477
|
let F = 0, V = 0;
|
|
524
|
-
Object.values(
|
|
525
|
-
isNaN(
|
|
526
|
-
}),
|
|
478
|
+
Object.values(ee).forEach((P) => {
|
|
479
|
+
isNaN(P) || (P < 0 ? V += P : F += P);
|
|
480
|
+
}), w.push([V, F]);
|
|
527
481
|
}), x = [
|
|
528
|
-
...
|
|
529
|
-
...
|
|
482
|
+
...Ee(w),
|
|
483
|
+
...Q.map((O) => O[h])
|
|
530
484
|
];
|
|
531
485
|
} else
|
|
532
486
|
x = [], r.forEach((m) => {
|
|
533
|
-
const
|
|
534
|
-
Array.isArray(
|
|
487
|
+
const f = m[h];
|
|
488
|
+
Array.isArray(f) && f.length === 2 ? (x.push(f[0]), x.push(f[1])) : (u && x.push(Math.max(m[h], m[u])), x.push(f));
|
|
535
489
|
});
|
|
536
|
-
return a !== d.TIME && a !== d.LOG && o && x.push(0),
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
}),
|
|
490
|
+
return a !== d.TIME && a !== d.LOG && o && x.push(0), D && D.length > 0 && D.forEach((m) => {
|
|
491
|
+
const f = c(m, "value");
|
|
492
|
+
f !== null && x.push(f);
|
|
493
|
+
}), M = $(x), M = this.extendsDomain(e, M), M;
|
|
540
494
|
}
|
|
541
495
|
createScale(e) {
|
|
542
|
-
const t = this.model.getOptions(), n =
|
|
496
|
+
const t = this.model.getOptions(), n = c(t, "axes", e);
|
|
543
497
|
if (!n)
|
|
544
498
|
return null;
|
|
545
|
-
const s =
|
|
499
|
+
const s = c(n, "scaleType") || d.LINEAR;
|
|
546
500
|
this.scaleTypes[e] = s;
|
|
547
501
|
let o;
|
|
548
|
-
return s === d.TIME ? o =
|
|
502
|
+
return s === d.TIME ? o = se() : s === d.LOG ? o = ie().base(n.base || 10) : s === d.LABELS || s === d.LABELS_RATIO ? o = oe() : o = ae(), o.domain(this.getScaleDomain(e)), o;
|
|
549
503
|
}
|
|
550
504
|
getHighestDomainThreshold() {
|
|
551
|
-
const e =
|
|
505
|
+
const e = c(this.model.getOptions(), "axes"), t = this.getDomainAxisPosition(), { thresholds: n } = e[t];
|
|
552
506
|
if (!Array.isArray(n) || Array.isArray(n) && !n.length)
|
|
553
507
|
return null;
|
|
554
|
-
const s = this.getDomainScale(), o = n.sort((r,
|
|
508
|
+
const s = this.getDomainScale(), o = n.sort((r, u) => u.value - r.value)[0];
|
|
555
509
|
return this.getScaleTypeByPosition(t) === d.TIME && (typeof o.value == "string" || o.value.getTime === void 0) && (o.value = new Date(o.value)), {
|
|
556
510
|
threshold: o,
|
|
557
511
|
scaleValue: s(o.value)
|
|
558
512
|
};
|
|
559
513
|
}
|
|
560
514
|
getHighestRangeThreshold() {
|
|
561
|
-
const e =
|
|
515
|
+
const e = c(this.model.getOptions(), "axes"), t = this.getRangeAxisPosition(), { thresholds: n } = e[t];
|
|
562
516
|
if (!Array.isArray(n) || Array.isArray(n) && !n.length)
|
|
563
517
|
return null;
|
|
564
518
|
const s = this.getRangeScale(), o = n.sort((a, r) => r.value - a.value)[0];
|
|
@@ -568,17 +522,17 @@ class lt extends O {
|
|
|
568
522
|
};
|
|
569
523
|
}
|
|
570
524
|
}
|
|
571
|
-
function
|
|
525
|
+
function Ge(i, e) {
|
|
572
526
|
const t = new Date(i[0]), n = new Date(i[1]);
|
|
573
|
-
return
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
] :
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
] :
|
|
580
|
-
}
|
|
581
|
-
function
|
|
527
|
+
return Ie(n, t) > 1 ? [Ce(t, e), W(n, e)] : Ne(n, t) > 1 ? [He(t, e), b(n, e)] : _e(n, t) > 1 ? [ze(t, e), q(n, e)] : Ye(n, t) > 1 ? [Xe(t, e), J(n, e)] : X(n, t) > 30 ? [
|
|
528
|
+
G(t, e * 30),
|
|
529
|
+
L(n, e * 30)
|
|
530
|
+
] : X(n, t) > 1 ? [G(t, e), L(n, e)] : k(n, t) > 15 ? [
|
|
531
|
+
U(t, e * 15),
|
|
532
|
+
E(n, e * 15)
|
|
533
|
+
] : k(n, t) > 1 ? [U(t, e), E(n, e)] : [t, n];
|
|
534
|
+
}
|
|
535
|
+
function ke([i, e], t, n) {
|
|
582
536
|
const o = (e - i) * t, a = e <= 0 && e + o > 0 ? 0 : e + o;
|
|
583
537
|
let r = i >= 0 && i - o < 0 ? 0 : i - o;
|
|
584
538
|
if (n === d.LOG && r <= 0) {
|
|
@@ -588,27 +542,27 @@ function Qe([i, e], t, n) {
|
|
|
588
542
|
}
|
|
589
543
|
return [r, a];
|
|
590
544
|
}
|
|
591
|
-
class
|
|
545
|
+
class tt extends y {
|
|
592
546
|
constructor() {
|
|
593
547
|
super(...arguments), this.curveTypes = {
|
|
594
|
-
curveLinear:
|
|
548
|
+
curveLinear: re,
|
|
595
549
|
curveLinearClosed: ce,
|
|
596
|
-
curveBasis:
|
|
597
|
-
curveBasisClosed:
|
|
598
|
-
curveBasisOpen:
|
|
599
|
-
curveBundle:
|
|
600
|
-
curveCardinal:
|
|
601
|
-
curveCardinalClosed:
|
|
602
|
-
curveCardinalOpen:
|
|
603
|
-
curveCatmullRom:
|
|
604
|
-
curveCatmullRomClosed:
|
|
605
|
-
curveCatmullRomOpen:
|
|
606
|
-
curveMonotoneX:
|
|
550
|
+
curveBasis: le,
|
|
551
|
+
curveBasisClosed: ue,
|
|
552
|
+
curveBasisOpen: me,
|
|
553
|
+
curveBundle: de,
|
|
554
|
+
curveCardinal: he,
|
|
555
|
+
curveCardinalClosed: ge,
|
|
556
|
+
curveCardinalOpen: fe,
|
|
557
|
+
curveCatmullRom: pe,
|
|
558
|
+
curveCatmullRomClosed: xe,
|
|
559
|
+
curveCatmullRomOpen: De,
|
|
560
|
+
curveMonotoneX: ye,
|
|
607
561
|
curveMonotoneY: Ae,
|
|
608
|
-
curveNatural:
|
|
609
|
-
curveStep:
|
|
610
|
-
curveStepAfter:
|
|
611
|
-
curveStepBefore:
|
|
562
|
+
curveNatural: Oe,
|
|
563
|
+
curveStep: ve,
|
|
564
|
+
curveStepAfter: Te,
|
|
565
|
+
curveStepBefore: Me
|
|
612
566
|
};
|
|
613
567
|
}
|
|
614
568
|
getD3Curve() {
|
|
@@ -623,18 +577,18 @@ class ut extends O {
|
|
|
623
577
|
return console.warn(`The curve type '${e}' is invalid, using 'curveLinear' instead`), this.curveTypes.curveLinear;
|
|
624
578
|
}
|
|
625
579
|
}
|
|
626
|
-
class
|
|
580
|
+
class nt extends y {
|
|
627
581
|
isZoomBarEnabled() {
|
|
628
|
-
if (!this.services.cartesianScales || !
|
|
582
|
+
if (!this.services.cartesianScales || !c(this.model.getOptions(), "zoomBar", "top", "enabled"))
|
|
629
583
|
return !1;
|
|
630
584
|
this.services.cartesianScales.findDomainAndRangeAxes();
|
|
631
|
-
const e = this.services.cartesianScales.getMainXAxisPosition(), t =
|
|
585
|
+
const e = this.services.cartesianScales.getMainXAxisPosition(), t = c(
|
|
632
586
|
this.model.getOptions(),
|
|
633
587
|
"axes",
|
|
634
588
|
e,
|
|
635
589
|
"scaleType"
|
|
636
590
|
);
|
|
637
|
-
return e ===
|
|
591
|
+
return e === l.BOTTOM && t === d.TIME;
|
|
638
592
|
}
|
|
639
593
|
// get display data for zoom bar
|
|
640
594
|
// basically it's sum of value grouped by time
|
|
@@ -648,24 +602,24 @@ class ct extends O {
|
|
|
648
602
|
const t = e || this.services.zoom.getZoomBarData(), { cartesianScales: n } = this.services;
|
|
649
603
|
if (!n)
|
|
650
604
|
throw new Error("Services cartesianScales undefined");
|
|
651
|
-
const s = n.getMainXAxisPosition(), o = n.getDomainIdentifier(), a =
|
|
605
|
+
const s = n.getMainXAxisPosition(), o = n.getDomainIdentifier(), a = c(this.model.getOptions(), "axes", s, "domain");
|
|
652
606
|
if (Array.isArray(a) && a.length === 2)
|
|
653
607
|
return a;
|
|
654
608
|
if (!s)
|
|
655
609
|
throw new Error("Not defined: mainXAxisPosition");
|
|
656
610
|
return n.extendsDomain(
|
|
657
611
|
s,
|
|
658
|
-
|
|
612
|
+
$(t, (r) => r[o])
|
|
659
613
|
);
|
|
660
614
|
}
|
|
661
615
|
handleDomainChange(e, t = { dispatchEvent: !0 }) {
|
|
662
616
|
var n;
|
|
663
|
-
this.model.set({ zoomDomain: e }, { animate: !1 }), t.dispatchEvent && ((n = this.services.events) == null || n.dispatchEvent(
|
|
617
|
+
this.model.set({ zoomDomain: e }, { animate: !1 }), t.dispatchEvent && ((n = this.services.events) == null || n.dispatchEvent(S.ZoomDomain.CHANGE, {
|
|
664
618
|
newDomain: e
|
|
665
619
|
}));
|
|
666
620
|
}
|
|
667
621
|
getZoomRatio() {
|
|
668
|
-
return
|
|
622
|
+
return c(this.model.getOptions(), "zoomBar", "zoomRatio");
|
|
669
623
|
}
|
|
670
624
|
// filter out data not inside zoom domain
|
|
671
625
|
// to get better range value for axis label
|
|
@@ -675,27 +629,27 @@ class ct extends O {
|
|
|
675
629
|
{ stacked: !1 },
|
|
676
630
|
// default configs
|
|
677
631
|
t
|
|
678
|
-
), o =
|
|
632
|
+
), o = c(this.model.getOptions(), "zoomBar", "updateRangeAxis");
|
|
679
633
|
if (this.isZoomBarEnabled() && o && n) {
|
|
680
|
-
const r = s.stacked ? "sharedStackKey" : (a = this.services.cartesianScales) == null ? void 0 : a.getDomainIdentifier(),
|
|
634
|
+
const r = s.stacked ? "sharedStackKey" : (a = this.services.cartesianScales) == null ? void 0 : a.getDomainIdentifier(), u = e.filter(
|
|
681
635
|
(h) => new Date(h[r]) >= n[0] && new Date(h[r]) <= n[1]
|
|
682
636
|
);
|
|
683
|
-
if (
|
|
684
|
-
return
|
|
637
|
+
if (u.length > 0)
|
|
638
|
+
return u;
|
|
685
639
|
}
|
|
686
640
|
return e;
|
|
687
641
|
}
|
|
688
642
|
zoomIn(e = this.getZoomRatio()) {
|
|
689
|
-
var
|
|
690
|
-
const t = this.model.get("zoomDomain"), n =
|
|
643
|
+
var T;
|
|
644
|
+
const t = this.model.get("zoomDomain"), n = Le.handleWidth, s = (T = this.services.cartesianScales) == null ? void 0 : T.getMainXScale().copy();
|
|
691
645
|
s.domain(this.getDefaultZoomBarDomain());
|
|
692
646
|
const o = s(t[0]), a = s(t[1]);
|
|
693
647
|
if (a - o < n + 1)
|
|
694
648
|
return;
|
|
695
|
-
const r = s.range(),
|
|
696
|
-
let
|
|
697
|
-
|
|
698
|
-
const A = [s.invert(
|
|
649
|
+
const r = s.range(), u = a - o, h = Math.min((r[1] - r[0]) / 2 * (e / 2), u / 2);
|
|
650
|
+
let p = o + h, D = a - h;
|
|
651
|
+
p >= D && (p = o + u / 2 - n / 2, D = a - u / 2 + n / 2);
|
|
652
|
+
const A = [s.invert(p), s.invert(D)];
|
|
699
653
|
(t[0].valueOf() !== A[0].valueOf() || t[1].valueOf() !== A[1].valueOf()) && this.handleDomainChange(A);
|
|
700
654
|
}
|
|
701
655
|
zoomOut(e = this.getZoomRatio()) {
|
|
@@ -704,8 +658,8 @@ class ct extends O {
|
|
|
704
658
|
throw new Error("Services cartesianScales undefined");
|
|
705
659
|
const n = this.services.cartesianScales.getMainXScale().copy();
|
|
706
660
|
n.domain(this.getDefaultZoomBarDomain());
|
|
707
|
-
const s = n(t[0]), o = n(t[1]), a = n.range(), r = (a[1] - a[0]) / 2 * (e / 2),
|
|
708
|
-
(t[0].valueOf() !==
|
|
661
|
+
const s = n(t[0]), o = n(t[1]), a = n.range(), r = (a[1] - a[0]) / 2 * (e / 2), u = Math.max(s - r, a[0]), h = Math.min(o + r, a[1]), p = [n.invert(u), n.invert(h)];
|
|
662
|
+
(t[0].valueOf() !== p[0].valueOf() || t[1].valueOf() !== p[1].valueOf()) && this.handleDomainChange(p);
|
|
709
663
|
}
|
|
710
664
|
resetZoomDomain() {
|
|
711
665
|
const e = this.model.get("zoomDomain"), t = this.getDefaultZoomBarDomain();
|
|
@@ -718,7 +672,7 @@ class ct extends O {
|
|
|
718
672
|
const e = this.model.get("zoomDomain"), t = this.getDefaultZoomBarDomain();
|
|
719
673
|
if (!e || !t)
|
|
720
674
|
return !1;
|
|
721
|
-
const n = e[1].valueOf() - e[0].valueOf(), s = t[1].valueOf() - t[0].valueOf(), o =
|
|
675
|
+
const n = e[1].valueOf() - e[0].valueOf(), s = t[1].valueOf() - t[0].valueOf(), o = c(this.model.getOptions(), "zoomBar", "minZoomRatio");
|
|
722
676
|
return n / s < o;
|
|
723
677
|
}
|
|
724
678
|
// check if current zoom domain is already the max zoom domain
|
|
@@ -730,20 +684,20 @@ class ct extends O {
|
|
|
730
684
|
return this.getZoomBarData().length === 0;
|
|
731
685
|
}
|
|
732
686
|
isZoomBarLoading(e) {
|
|
733
|
-
return
|
|
687
|
+
return c(this.model.getOptions(), "zoomBar", e, "loading");
|
|
734
688
|
}
|
|
735
689
|
isZoomBarLocked(e) {
|
|
736
|
-
return
|
|
690
|
+
return c(this.model.getOptions(), "zoomBar", e, "locked");
|
|
737
691
|
}
|
|
738
692
|
}
|
|
739
693
|
export {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
694
|
+
We as C,
|
|
695
|
+
qe as E,
|
|
696
|
+
Je as F,
|
|
697
|
+
Qe as T,
|
|
698
|
+
nt as Z,
|
|
699
|
+
tt as a,
|
|
700
|
+
et as b,
|
|
701
|
+
Ee as f
|
|
748
702
|
};
|
|
749
|
-
//# sourceMappingURL=zoom-
|
|
703
|
+
//# sourceMappingURL=zoom-i_u9NbAF.mjs.map
|