@hybridcore/ui 1.5.88 → 1.5.90

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.
@@ -1,8 +1,9 @@
1
- import { jsx as k } from "react/jsx-runtime";
2
- import { h as S, m as F, i as p, j as v, k as L, l as X, V as z, b as Y, A as j, X as E, c as G, g as O, d as Z, f as w } from "../../AxisRendererY-kADUad00.js";
3
- import { useRef as q, useLayoutEffect as V } from "react";
4
- import { C as B } from "../../ColumnSeries-BTcqshjB.js";
5
- import { L as W } from "../../LineSeries-CfcpoYla.js";
1
+ import { jsx as F } from "react/jsx-runtime";
2
+ import { h as S, m as k, i as p, j as b, k as L, l as X, V as z, b as Y, A as j, X as O, c as E, g as G, d as Z, f as R } from "../../AxisRendererY-kADUad00.js";
3
+ import { useTheme as q, alpha as B } from "@mui/material";
4
+ import { useRef as V, useLayoutEffect as W } from "react";
5
+ import { C as H } from "../../ColumnSeries-BTcqshjB.js";
6
+ import { L as J } from "../../LineSeries-CfcpoYla.js";
6
7
  class P extends S {
7
8
  constructor() {
8
9
  super(...arguments), Object.defineProperty(this, "_frequency", {
@@ -18,7 +19,7 @@ class P extends S {
18
19
  });
19
20
  }
20
21
  _afterNew() {
21
- this._settings.themeTags = F(this._settings.themeTags, ["axis"]), this.fields.push("category", "id", "cellSize"), this.setPrivateRaw("name", "category"), this.addTag("category"), super._afterNew();
22
+ this._settings.themeTags = k(this._settings.themeTags, ["axis"]), this.fields.push("category", "id", "cellSize"), this.setPrivateRaw("name", "category"), this.addTag("category"), super._afterNew();
22
23
  }
23
24
  _afterDataChange() {
24
25
  super._afterDataChange();
@@ -29,11 +30,11 @@ class P extends S {
29
30
  super._prepareChildren();
30
31
  const t = this.dataItems.length;
31
32
  let e = 0;
32
- this._valuesDirty && (this._itemMap = {}, p(this.dataItems, (r) => {
33
- r.setRaw("index", e), this._itemMap[r.get("category")] = r, e++;
33
+ this._valuesDirty && (this._itemMap = {}, p(this.dataItems, (n) => {
34
+ n.setRaw("index", e), this._itemMap[n.get("category")] = n, e++;
34
35
  }), this.setPrivateRaw("maxZoomFactor", t));
35
- let a = this.get("start", 0), i = this.get("end", 1), s = this._getIndices(a, i);
36
- this.setPrivateRaw("startIndex", s.startIndex), this.setPrivateRaw("endIndex", s.endIndex), (this._sizeDirty || this._valuesDirty || this.isDirty("start") || this.isDirty("end") || this.isPrivateDirty("endIndex") || this.isPrivateDirty("startIndex") || this.isPrivateDirty("width") || this.isPrivateDirty("height")) && this.dataItems.length > 0 && (this._handleRangeChange(), this._prepareAxisItems(), this._updateAxisRanges());
36
+ let s = this.get("start", 0), i = this.get("end", 1), a = this._getIndices(s, i);
37
+ this.setPrivateRaw("startIndex", a.startIndex), this.setPrivateRaw("endIndex", a.endIndex), (this._sizeDirty || this._valuesDirty || this.isDirty("start") || this.isDirty("end") || this.isPrivateDirty("endIndex") || this.isPrivateDirty("startIndex") || this.isPrivateDirty("width") || this.isPrivateDirty("height")) && this.dataItems.length > 0 && (this._handleRangeChange(), this._prepareAxisItems(), this._updateAxisRanges());
37
38
  }
38
39
  /**
39
40
  * @ignore
@@ -41,96 +42,96 @@ class P extends S {
41
42
  adjustZoom() {
42
43
  const t = this.dataItems.length;
43
44
  if (t > 1) {
44
- let e = this.get("maxZoomCount", this.dataItems.length), a = this.get("minZoomCount", 1), i = 0, s = this.getPrivate("startIndex", 0), r = this.getPrivate("endIndex", 0);
45
+ let e = this.get("maxZoomCount", this.dataItems.length), s = this.get("minZoomCount", 1), i = 0, a = this.getPrivate("startIndex", 0), n = this.getPrivate("endIndex", 0);
45
46
  const d = this._sAnimation, o = this._eAnimation;
46
- let l = this.get("start", 0), n = !1;
47
- d && !d.stopped && (l = Number(d.to), n = !0);
48
- let m = this.get("end", 1);
49
- if (o && !o.stopped && (m = Number(o.to), n = !0), n) {
50
- const h = this._getIndices(l, m);
51
- s = h.startIndex, r = h.endIndex;
47
+ let l = this.get("start", 0), r = !1;
48
+ d && !d.stopped && (l = Number(d.to), r = !0);
49
+ let h = this.get("end", 1);
50
+ if (o && !o.stopped && (h = Number(o.to), r = !0), r) {
51
+ const g = this._getIndices(l, h);
52
+ a = g.startIndex, n = g.endIndex;
52
53
  }
53
- for (let h = s; h < r; h++) {
54
- const g = this.dataItems[h];
55
- i += g.get("finalCellSize", 1);
54
+ for (let g = a; g < n; g++) {
55
+ const m = this.dataItems[g];
56
+ i += m.get("finalCellSize", 1);
56
57
  }
57
- if (i <= a) {
58
- let h = 0;
59
- for (let g = s; g < t; g++) {
60
- const f = this.dataItems[g];
61
- if (h += f.get("finalCellSize", 1), r = g + 1, h >= a)
58
+ if (i <= s) {
59
+ let g = 0;
60
+ for (let m = a; m < t; m++) {
61
+ const f = this.dataItems[m];
62
+ if (g += f.get("finalCellSize", 1), n = m + 1, g >= s)
62
63
  break;
63
64
  }
64
- if (h < a)
65
- for (let g = s - 1; g >= 0; g--) {
66
- const f = this.dataItems[g];
67
- if (h += f.get("finalCellSize", 1), s = g, h >= a)
65
+ if (g < s)
66
+ for (let m = a - 1; m >= 0; m--) {
67
+ const f = this.dataItems[m];
68
+ if (g += f.get("finalCellSize", 1), a = m, g >= s)
68
69
  break;
69
70
  }
70
- this.zoomToIndexes(s, r);
71
+ this.zoomToIndexes(a, n);
71
72
  } else if (i >= e) {
72
- let h = i;
73
- for (let g = r - 1; g >= s; g--) {
74
- const f = this.dataItems[g];
75
- if (h -= f.get("finalCellSize", 1), h <= e) {
76
- r = g + 1;
73
+ let g = i;
74
+ for (let m = n - 1; m >= a; m--) {
75
+ const f = this.dataItems[m];
76
+ if (g -= f.get("finalCellSize", 1), g <= e) {
77
+ n = m + 1;
77
78
  break;
78
79
  }
79
80
  }
80
- this.zoomToIndexes(s, r);
81
+ this.zoomToIndexes(a, n);
81
82
  }
82
83
  }
83
84
  }
84
85
  _handleRangeChange() {
85
86
  p(this.series, (t) => {
86
- let e = this.dataItems[this.startIndex()].get("category"), a = this.dataItems[this.endIndex() - 1].get("category"), i = t.get("baseAxis"), s = t.get("xAxis"), r = t.get("yAxis");
87
- if (s instanceof P && r instanceof P)
87
+ let e = this.dataItems[this.startIndex()].get("category"), s = this.dataItems[this.endIndex() - 1].get("category"), i = t.get("baseAxis"), a = t.get("xAxis"), n = t.get("yAxis");
88
+ if (a instanceof P && n instanceof P)
88
89
  t._markDirtyAxes();
89
90
  else if (i === this) {
90
- let d, o, l = r;
91
- if (s === i ? (t.get("categoryXField") && (d = "categoryX"), t.get("openCategoryXField") && (o = "openCategoryX")) : r === i && (t.get("categoryYField") && (d = "categoryY"), t.get("openCategoryYField") && (o = "openCategoryY"), l = s), l instanceof z && (d || o)) {
92
- let h = function(u, y, c, _, N, R) {
91
+ let d, o, l = n;
92
+ if (a === i ? (t.get("categoryXField") && (d = "categoryX"), t.get("openCategoryXField") && (o = "openCategoryX")) : n === i && (t.get("categoryYField") && (d = "categoryY"), t.get("openCategoryYField") && (o = "openCategoryY"), l = a), l instanceof z && (d || o)) {
93
+ let g = function(c, y, u, v, N, w) {
93
94
  let x, C = y.categoryToIndex(N);
94
95
  for (; !x && C >= 0 && C < y.dataItems.length; ) {
95
96
  let D = y.dataItems[C].get("category");
96
- if (R == "previous")
97
- for (let I = u.dataItems.length - 1; I >= 0; I--) {
98
- let b = u.dataItems[I];
99
- if (c && b.get(c) === D) {
100
- x = b;
97
+ if (w == "previous")
98
+ for (let I = c.dataItems.length - 1; I >= 0; I--) {
99
+ let _ = c.dataItems[I];
100
+ if (u && _.get(u) === D) {
101
+ x = _;
101
102
  break;
102
103
  }
103
- if (_ && b.get(_) === D) {
104
- x = b;
104
+ if (v && _.get(v) === D) {
105
+ x = _;
105
106
  break;
106
107
  }
107
108
  }
108
109
  else
109
- for (let I = 0, b = u.dataItems.length; I < b; I++) {
110
- let M = u.dataItems[I];
111
- if (c && M.get(c) === D) {
110
+ for (let I = 0, _ = c.dataItems.length; I < _; I++) {
111
+ let M = c.dataItems[I];
112
+ if (u && M.get(u) === D) {
112
113
  x = M;
113
114
  break;
114
115
  }
115
- if (_ && M.get(_) === D) {
116
+ if (v && M.get(v) === D) {
116
117
  x = M;
117
118
  break;
118
119
  }
119
120
  }
120
- x || (C += R === "previous" ? -1 : 1);
121
+ x || (C += w === "previous" ? -1 : 1);
121
122
  }
122
123
  return x;
123
- }, n, m;
124
- n = h(t, this, d, o, e, "next"), m = h(t, this, d, o, a, "previous");
125
- let g = 0, f = t.dataItems.length;
126
- n && (g = t.dataItems.indexOf(n)), m && (f = t.dataItems.indexOf(m) + 1), t.setPrivate("startIndex", g), t.setPrivate("endIndex", f);
124
+ }, r, h;
125
+ r = g(t, this, d, o, e, "next"), h = g(t, this, d, o, s, "previous");
126
+ let m = 0, f = t.dataItems.length;
127
+ r && (m = t.dataItems.indexOf(r)), h && (f = t.dataItems.indexOf(h) + 1), t.setPrivate("startIndex", m), t.setPrivate("endIndex", f);
127
128
  let T = !1;
128
- for (let u = g; u < f; u++) {
129
- const y = t.dataItems[u];
130
- if (p(t.__valueXShowFields, (c) => {
131
- y.get(c) != null && (T = !0);
132
- }), p(t.__valueYShowFields, (c) => {
133
- y.get(c) != null && (T = !0);
129
+ for (let c = m; c < f; c++) {
130
+ const y = t.dataItems[c];
131
+ if (p(t.__valueXShowFields, (u) => {
132
+ y.get(u) != null && (T = !0);
133
+ }), p(t.__valueYShowFields, (u) => {
134
+ y.get(u) != null && (T = !0);
134
135
  }), T)
135
136
  break;
136
137
  }
@@ -142,44 +143,44 @@ class P extends S {
142
143
  }
143
144
  _prepareAxisItems() {
144
145
  var t;
145
- const e = this.get("renderer"), a = this.dataItems.length;
146
+ const e = this.get("renderer"), s = this.dataItems.length;
146
147
  let i = this.startIndex();
147
148
  i > 0 && i--;
148
- let s = this.endIndex();
149
- s < a && s++;
150
- const r = e.get("minorLabelsEnabled"), d = e.get("minorGridEnabled", r);
151
- let o = e.axisLength() / Math.max(e.get("minGridDistance"), 1), l = Math.max(1, Math.min(a, Math.ceil((s - i) / o)));
149
+ let a = this.endIndex();
150
+ a < s && a++;
151
+ const n = e.get("minorLabelsEnabled"), d = e.get("minorGridEnabled", n);
152
+ let o = e.axisLength() / Math.max(e.get("minGridDistance"), 1), l = Math.max(1, Math.min(s, Math.ceil((a - i) / o)));
152
153
  i = Math.floor(i / l) * l, this._frequency = l;
153
- for (let m = 0; m < a; m++)
154
- this._toggleDataItem(this.dataItems[m], !1);
155
- let n = this.dataItems[i].get("index", 0);
156
- for (let m = i; m < s; m = m + l) {
157
- let h = this.dataItems[m];
158
- this._createAssets(h, []), this._toggleDataItem(h, !0);
159
- let g = l;
160
- d && (g = 1), this._prepareDataItem(h, n, g), n++;
154
+ for (let h = 0; h < s; h++)
155
+ this._toggleDataItem(this.dataItems[h], !1);
156
+ let r = this.dataItems[i].get("index", 0);
157
+ for (let h = i; h < a; h = h + l) {
158
+ let g = this.dataItems[h];
159
+ this._createAssets(g, []), this._toggleDataItem(g, !0);
160
+ let m = l;
161
+ d && (m = 1), this._prepareDataItem(g, r, m), r++;
161
162
  }
162
163
  if (e.get("minorGridEnabled"))
163
- for (let m = i; m < s; m++) {
164
- let h = this.dataItems[m];
165
- m % l != 0 && (this._createAssets(h, ["minor"], !0), this._toggleDataItem(h, !0), this._prepareDataItem(h, 0, 1), r || (t = h.get("label")) === null || t === void 0 || t.setPrivate("visible", !1));
164
+ for (let h = i; h < a; h++) {
165
+ let g = this.dataItems[h];
166
+ h % l != 0 && (this._createAssets(g, ["minor"], !0), this._toggleDataItem(g, !0), this._prepareDataItem(g, 0, 1), n || (t = g.get("label")) === null || t === void 0 || t.setPrivate("visible", !1));
166
167
  }
167
168
  this._updateGhost();
168
169
  }
169
- _prepareDataItem(t, e, a) {
170
- let i = this.get("renderer"), s = t.get("categoryLocation", 0), r = t.get("endCategoryLocation", 1), d = t.get("index");
171
- v(d) || (d = this.categoryToIndex(t.get("category")));
172
- let o = this.indexToPosition(d, s), l = t.get("endCategory"), n;
173
- l ? (n = this.categoryToIndex(l), v(n) || (n = d)) : n = d;
174
- let m = this.indexToPosition(n, r), h, g;
170
+ _prepareDataItem(t, e, s) {
171
+ let i = this.get("renderer"), a = t.get("categoryLocation", 0), n = t.get("endCategoryLocation", 1), d = t.get("index");
172
+ b(d) || (d = this.categoryToIndex(t.get("category")));
173
+ let o = this.indexToPosition(d, a), l = t.get("endCategory"), r;
174
+ l ? (r = this.categoryToIndex(l), b(r) || (r = d)) : r = d;
175
+ let h = this.indexToPosition(r, n), g, m;
175
176
  if (t.get("isRange")) {
176
- if (h = n, !v(d)) {
177
+ if (g = r, !b(d)) {
177
178
  this._toggleDataItem(t, !1);
178
179
  return;
179
180
  }
180
181
  } else
181
- h = d + this._frequency - 1;
182
- g = this.indexToPosition(h, r), i.updateLabel(t.get("label"), o, m, a), i.updateGrid(t.get("grid"), o, m), i.updateTick(t.get("tick"), o, m, a), i.updateFill(t.get("axisFill"), o, g), this._processBullet(t), i.updateBullet(t.get("bullet"), o, m);
182
+ g = d + this._frequency - 1;
183
+ m = this.indexToPosition(g, n), i.updateLabel(t.get("label"), o, h, s), i.updateGrid(t.get("grid"), o, h), i.updateTick(t.get("tick"), o, h, s), i.updateFill(t.get("axisFill"), o, m), this._processBullet(t), i.updateBullet(t.get("bullet"), o, h);
183
184
  const f = this.get("fillRule");
184
185
  f && f(t, e);
185
186
  }
@@ -225,28 +226,28 @@ class P extends S {
225
226
  /**
226
227
  * @ignore
227
228
  */
228
- getDataItemPositionX(t, e, a, i) {
229
- const s = t.get(e), r = this._itemMap[s];
230
- return r ? this.indexToPosition(r.get("index", 0), a) : NaN;
229
+ getDataItemPositionX(t, e, s, i) {
230
+ const a = t.get(e), n = this._itemMap[a];
231
+ return n ? this.indexToPosition(n.get("index", 0), s) : NaN;
231
232
  }
232
233
  /**
233
234
  * @ignore
234
235
  */
235
- getDataItemCoordinateX(t, e, a, i) {
236
- return this._settings.renderer.positionToCoordinate(this.getDataItemPositionX(t, e, a, i));
236
+ getDataItemCoordinateX(t, e, s, i) {
237
+ return this._settings.renderer.positionToCoordinate(this.getDataItemPositionX(t, e, s, i));
237
238
  }
238
239
  /**
239
240
  * @ignore
240
241
  */
241
- getDataItemPositionY(t, e, a, i) {
242
- const s = t.get(e), r = this._itemMap[s];
243
- return r ? this.indexToPosition(r.get("index", 0), a) : NaN;
242
+ getDataItemPositionY(t, e, s, i) {
243
+ const a = t.get(e), n = this._itemMap[a];
244
+ return n ? this.indexToPosition(n.get("index", 0), s) : NaN;
244
245
  }
245
246
  /**
246
247
  * @ignore
247
248
  */
248
- getDataItemCoordinateY(t, e, a, i) {
249
- return this._settings.renderer.positionToCoordinate(this.getDataItemPositionY(t, e, a, i));
249
+ getDataItemCoordinateY(t, e, s, i) {
250
+ return this._settings.renderer.positionToCoordinate(this.getDataItemPositionY(t, e, s, i));
250
251
  }
251
252
  /**
252
253
  * Converts category index to a relative position.
@@ -259,31 +260,31 @@ class P extends S {
259
260
  * @param location Location
260
261
  * @return Index
261
262
  */
262
- indexToPosition(t, e, a) {
263
- let i = this.dataItems.length, s = 0;
264
- if (i == 0 || (t >= i && (t = i - 1, e = 1), v(e) || (e = 0.5), !v(t)))
263
+ indexToPosition(t, e, s) {
264
+ let i = this.dataItems.length, a = 0;
265
+ if (i == 0 || (t >= i && (t = i - 1, e = 1), b(e) || (e = 0.5), !b(t)))
265
266
  return 0;
266
- let r = this.get("startLocation", 0), d = this.get("endLocation", 1);
267
+ let n = this.get("startLocation", 0), d = this.get("endLocation", 1);
267
268
  if (!this.get("cellSizeField"))
268
- i -= r, i -= 1 - d, s = (t + e - r) / i;
269
+ i -= n, i -= 1 - d, a = (t + e - n) / i;
269
270
  else {
270
- let o = a ? "finalCellSize" : "cellSize";
271
+ let o = s ? "finalCellSize" : "cellSize";
271
272
  const l = this.dataItems;
272
- let n = 0;
273
- p(this.dataItems, (g) => {
274
- n += g.get(o, 1);
275
- }), n -= r * l[0].get(o, 1), n -= (1 - d) * l[l.length - 1].get(o, 1);
276
- let m = 0;
277
- for (let g = 0; g < t; g++)
278
- m += l[g].get(o, 1);
279
- let h = l[t].get(o, 1);
280
- s = (m + e * h - r * l[0].get(o, 1)) / n;
273
+ let r = 0;
274
+ p(this.dataItems, (m) => {
275
+ r += m.get(o, 1);
276
+ }), r -= n * l[0].get(o, 1), r -= (1 - d) * l[l.length - 1].get(o, 1);
277
+ let h = 0;
278
+ for (let m = 0; m < t; m++)
279
+ h += l[m].get(o, 1);
280
+ let g = l[t].get(o, 1);
281
+ a = (h + e * g - n * l[0].get(o, 1)) / r;
281
282
  }
282
- if (!a) {
283
+ if (!s) {
283
284
  let o = this.dataItems[t];
284
- o && (s += o.get("deltaPosition", 0));
285
+ o && (a += o.get("deltaPosition", 0));
285
286
  }
286
- return s;
287
+ return a;
287
288
  }
288
289
  /**
289
290
  * Returns a position of a category.
@@ -329,19 +330,19 @@ class P extends S {
329
330
  if (e === 0)
330
331
  return 0;
331
332
  if (this.get("cellSizeField")) {
332
- let a = 0, i = [];
333
+ let s = 0, i = [];
333
334
  p(this.dataItems, (l) => {
334
- const n = l.get("cellSize", 1);
335
- i.push(n), a += n;
335
+ const r = l.get("cellSize", 1);
336
+ i.push(r), s += r;
336
337
  });
337
- let s = this.get("startLocation", 0), r = this.get("endLocation", 1);
338
- a -= s, a -= 1 - r;
339
- let d = t * a + s, o = 0;
338
+ let a = this.get("startLocation", 0), n = this.get("endLocation", 1);
339
+ s -= a, s -= 1 - n;
340
+ let d = t * s + a, o = 0;
340
341
  for (let l = 0; l < e; l++) {
341
- const n = i[l];
342
- if (d < o + n)
342
+ const r = i[l];
343
+ if (d < o + r)
343
344
  return l;
344
- o += n;
345
+ o += r;
345
346
  }
346
347
  return e - 1;
347
348
  } else
@@ -354,9 +355,9 @@ class P extends S {
354
355
  * @return Tooltip text
355
356
  */
356
357
  getTooltipText(t, e) {
357
- const a = this.dataItems[this.axisPositionToIndex(t)];
358
- if (a) {
359
- const i = a.get("label");
358
+ const s = this.dataItems[this.axisPositionToIndex(t)];
359
+ if (s) {
360
+ const i = s.get("label");
360
361
  if (i)
361
362
  return X(i, this.get("tooltipText", ""));
362
363
  }
@@ -373,41 +374,41 @@ class P extends S {
373
374
  */
374
375
  getSeriesItem(t, e) {
375
376
  if (this.dataItems.length > 0) {
376
- let a = this.getPrivate("name") + this.get("renderer").getPrivate("letter"), i = this.axisPositionToIndex(e), s = t.dataItems[i], r = this.dataItems[i], d = r.get("category");
377
- if (s && r && s.get(a) === d)
378
- return s;
377
+ let s = this.getPrivate("name") + this.get("renderer").getPrivate("letter"), i = this.axisPositionToIndex(e), a = t.dataItems[i], n = this.dataItems[i], d = n.get("category");
378
+ if (a && n && a.get(s) === d)
379
+ return a;
379
380
  for (let o = 0, l = t.dataItems.length; o < l; o++) {
380
- let n = t.dataItems[o];
381
- if (n.get(a) === d)
382
- return n;
381
+ let r = t.dataItems[o];
382
+ if (r.get(s) === d)
383
+ return r;
383
384
  }
384
385
  }
385
386
  }
386
387
  _getIndices(t, e) {
387
- let a = this.dataItems.length, i = 0, s = a, r = "cellSize";
388
+ let s = this.dataItems.length, i = 0, a = s, n = "cellSize";
388
389
  if (this.get("cellSizeField")) {
389
390
  let d = 0;
390
391
  const o = this.dataItems;
391
392
  if (o.length == 0)
392
393
  return { startIndex: 0, endIndex: 0 };
393
- p(o, (n) => {
394
- d += n.get(r, 1);
395
- }), d -= this.get("startLocation", 0) * o[0].get(r, 1), d -= (1 - this.get("endLocation", 1)) * o[o.length - 1].get(r, 1);
394
+ p(o, (r) => {
395
+ d += r.get(n, 1);
396
+ }), d -= this.get("startLocation", 0) * o[0].get(n, 1), d -= (1 - this.get("endLocation", 1)) * o[o.length - 1].get(n, 1);
396
397
  let l = 0;
397
- for (let n = 0; n < a; n++)
398
- if (l += this.dataItems[n].get(r, 1), Math.round(l) > Math.round(t * d)) {
399
- i = n;
398
+ for (let r = 0; r < s; r++)
399
+ if (l += this.dataItems[r].get(n, 1), Math.round(l) > Math.round(t * d)) {
400
+ i = r;
400
401
  break;
401
402
  }
402
- for (let n = i + 1; n < a; n++)
403
- if (l += this.dataItems[n].get(r, 1), Math.round(l) >= Math.round(e * d)) {
404
- s = n + 1;
403
+ for (let r = i + 1; r < s; r++)
404
+ if (l += this.dataItems[r].get(n, 1), Math.round(l) >= Math.round(e * d)) {
405
+ a = r + 1;
405
406
  break;
406
407
  }
407
- i = Math.max(i, 0), s = Math.min(s, a);
408
+ i = Math.max(i, 0), a = Math.min(a, s);
408
409
  } else
409
- i = Math.max(Math.round(this.get("start", 0) * a), 0), s = Math.min(Math.round(this.get("end", 1) * a), a);
410
- return { startIndex: i, endIndex: s };
410
+ i = Math.max(Math.round(this.get("start", 0) * s), 0), a = Math.min(Math.round(this.get("end", 1) * s), s);
411
+ return { startIndex: i, endIndex: a };
411
412
  }
412
413
  /**
413
414
  * Zooms the axis to specific `start` and `end` indexes.
@@ -418,12 +419,12 @@ class P extends S {
418
419
  * @param end End index
419
420
  * @param duration Duration in milliseconds
420
421
  */
421
- zoomToIndexes(t, e, a) {
422
+ zoomToIndexes(t, e, s) {
422
423
  let i = this.dataItems.length;
423
- this.get("cellSizeField") ? (t = Math.min(Math.max(t, 0), i), e = Math.max(Math.min(e, i), 1), this.setPrivateRaw("startIndex", t), this.setPrivateRaw("endIndex", e), this.zoom(this.indexToPosition(t, 0, !0), this.indexToPosition(e, 0, !0), a)) : this.zoom(t / i, e / i, a);
424
+ this.get("cellSizeField") ? (t = Math.min(Math.max(t, 0), i), e = Math.max(Math.min(e, i), 1), this.setPrivateRaw("startIndex", t), this.setPrivateRaw("endIndex", e), this.zoom(this.indexToPosition(t, 0, !0), this.indexToPosition(e, 0, !0), s)) : this.zoom(t / i, e / i, s);
424
425
  }
425
- zoomToCategories(t, e, a) {
426
- this.zoomToIndexes(this.categoryToIndex(t), this.categoryToIndex(e) + 1, a);
426
+ zoomToCategories(t, e, s) {
427
+ this.zoomToIndexes(this.categoryToIndex(t), this.categoryToIndex(e) + 1, s);
427
428
  }
428
429
  /**
429
430
  * Returns position span between start and end of a single cell in axis.
@@ -439,8 +440,8 @@ class P extends S {
439
440
  */
440
441
  nextPosition(t) {
441
442
  t == null && (t = 1), this.get("renderer").getPrivate("letter") == "Y" && (t *= -1);
442
- const e = this.getPrivate("tooltipPosition", 0), a = L(this.axisPositionToIndex(e) + t, 0, this.dataItems.length - 1);
443
- return this.toGlobalPosition(this.indexToPosition(a));
443
+ const e = this.getPrivate("tooltipPosition", 0), s = L(this.axisPositionToIndex(e) + t, 0, this.dataItems.length - 1);
444
+ return this.toGlobalPosition(this.indexToPosition(s));
444
445
  }
445
446
  }
446
447
  Object.defineProperty(P, "className", {
@@ -455,14 +456,14 @@ Object.defineProperty(P, "classNames", {
455
456
  writable: !0,
456
457
  value: S.classNames.concat([P.className])
457
458
  });
458
- const $ = ({ data: A, type: t, color: e }) => {
459
- const a = q(null);
460
- return V(() => {
461
- if (!a.current) return;
462
- const i = Y.new(a.current);
463
- i.setThemes([j.new(i)]);
464
- const s = i.container.children.push(
465
- E.new(i, {
459
+ const it = ({ data: A, type: t, color: e }) => {
460
+ const s = V(null), i = q();
461
+ return W(() => {
462
+ if (!s.current) return;
463
+ const a = Y.new(s.current);
464
+ a.setThemes([j.new(a)]);
465
+ const n = a.container.children.push(
466
+ O.new(a, {
466
467
  panX: !1,
467
468
  panY: !1,
468
469
  wheelX: "none",
@@ -472,54 +473,71 @@ const $ = ({ data: A, type: t, color: e }) => {
472
473
  paddingTop: 0,
473
474
  paddingBottom: 0
474
475
  })
475
- ), r = s.xAxes.push(
476
- P.new(i, {
476
+ ), d = n.xAxes.push(
477
+ P.new(a, {
477
478
  categoryField: "t",
478
- renderer: G.new(i, {
479
+ renderer: E.new(a, {
479
480
  minGridDistance: 10
480
481
  }),
481
- tooltip: O.new(i, {})
482
+ tooltip: G.new(a, {})
482
483
  })
483
- ), d = r.get("renderer");
484
- d.grid.template.set("visible", !1), d.labels.template.set("visible", !1), r.data.setAll(A);
485
- const o = s.yAxes.push(
486
- z.new(i, {
487
- renderer: Z.new(i, {})
484
+ ), o = d.get("renderer");
485
+ o.grid.template.set("visible", !1), o.labels.template.set("visible", !1), d.setAll({
486
+ startLocation: 0.5,
487
+ endLocation: 0.5
488
+ }), d.data.setAll(A);
489
+ const l = n.yAxes.push(
490
+ z.new(a, {
491
+ renderer: Z.new(a, {})
488
492
  })
489
- ), l = o.get("renderer");
490
- l.grid.template.set("visible", !1), l.labels.template.set("visible", !1);
491
- let n;
492
- return t === "column" ? (n = s.series.push(
493
- B.new(i, {
493
+ ), r = l.get("renderer");
494
+ r.grid.template.set("visible", !1), r.labels.template.set("visible", !1);
495
+ let h;
496
+ return t === "column" ? (h = n.series.push(
497
+ H.new(a, {
494
498
  name: "Series",
495
- xAxis: r,
496
- yAxis: o,
499
+ xAxis: d,
500
+ yAxis: l,
497
501
  valueYField: "v",
498
502
  categoryXField: "t",
499
- fill: w(e),
500
- stroke: w(e)
503
+ fill: R(i.palette.divider)
501
504
  })
502
- ), n.columns.template.setAll({
505
+ ), h.columns.template.setAll({
503
506
  cornerRadiusTL: 2,
504
507
  cornerRadiusTR: 2,
505
508
  strokeOpacity: 0
506
- })) : (n = s.series.push(
507
- W.new(i, {
509
+ })) : (h = n.series.push(
510
+ J.new(a, {
508
511
  name: "Series",
509
- xAxis: r,
510
- yAxis: o,
512
+ xAxis: d,
513
+ yAxis: l,
511
514
  valueYField: "v",
512
515
  categoryXField: "t",
513
- fill: w(e),
514
- stroke: w(e)
516
+ // @ts-expect-error amcharts5 typing accepts string/Color; alpha returns rgba string
517
+ fill: B(i.palette.divider, 0.25),
518
+ stroke: R(i.palette.divider)
515
519
  })
516
- ), n.strokes.template.setAll({
517
- strokeWidth: 2
518
- })), n.data.setAll(A), n.appear(1e3), s.appear(1e3, 100), () => {
519
- i.dispose();
520
+ ), h.strokes.template.setAll({
521
+ strokeWidth: 1
522
+ }), h.fills.template.setAll({
523
+ fillOpacity: 1,
524
+ visible: !0
525
+ })), h.data.setAll(A), h.appear(1e3), n.appear(1e3, 100), () => {
526
+ a.dispose();
520
527
  };
521
- }, [A, t, e]), /* @__PURE__ */ k("div", { ref: a, style: { width: "100%", height: "100%" } });
528
+ }, [A, t, e, i.palette.mode, i.palette.divider]), /* @__PURE__ */ F(
529
+ "div",
530
+ {
531
+ ref: s,
532
+ style: {
533
+ width: "calc(100% + 10px)",
534
+ height: "100%",
535
+ marginBottom: -21,
536
+ marginLeft: -10
537
+ }
538
+ }
539
+ );
522
540
  };
523
541
  export {
524
- $ as MetricChart
542
+ it as MetricChart
525
543
  };