charts-core 1.0.10 → 1.0.11

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,27 +1,36 @@
1
1
  import * as x from "d3";
2
2
  const P = (e) => {
3
- const { svg: t, config: r, y: a, width: n } = e, { margin: s, yAxis: o } = r, { customTicks: l, tickFormat: d, tickValues: i, ticks: c, isShow: u } = o;
4
- if (!u) return null;
5
- t.append("g").attr("transform", `translate(${n - s.right},0)`).call((h) => {
6
- let g = x.axisRight(a);
7
- l && d ? g = g.tickFormat(d) : g = g.tickFormat((m) => {
8
- const f = Number(m), y = (p) => p.toString().replace(/\.0+$/, "");
3
+ const { svg: t, config: r, y: a, width: n } = e, { margin: s, yAxis: o } = r, { customTicks: c, tickFormat: d, tickValues: i, ticks: l, isShow: g } = o;
4
+ if (!g) return null;
5
+ t.append("g").attr("transform", `translate(${n - s.right},0)`).call((u) => {
6
+ let h = x.axisRight(a);
7
+ c && d ? h = h.tickFormat(d) : h = h.tickFormat((m) => {
8
+ const f = Number(m), y = (w) => w.toString().replace(/\.0+$/, "");
9
9
  return Math.abs(f) >= 1e12 ? y(f / 1e12) + "T" : Math.abs(f) >= 1e9 ? y(f / 1e9) + "B" : Math.abs(f) >= 1e6 ? y(f / 1e6) + "M" : Math.abs(f) >= 1e3 ? y(f / 1e3) + "K" : y(f);
10
- }), l && c && (g = Array.isArray(c) ? g.ticks(...c) : g.ticks(c)), l && i && (g = g.tickValues(i)), h.call(g);
11
- }).call((h) => {
12
- let g = [];
13
- h.selectAll(".tick").each((m) => g.push(m)), e.yTicks = g;
14
- }).call((h) => h.select(".domain").remove()).call((h) => h.selectAll(".tick line").remove()).call((h) => h.selectAll(".tick text").classed("sc-charts__y-axis-tick", !0)).attr("font-family", "inherit");
10
+ }), c && l && (h = Array.isArray(l) ? h.ticks(...l) : h.ticks(l)), c && i && (h = h.tickValues(i)), u.call(h);
11
+ }).call((u) => {
12
+ let h = [];
13
+ u.selectAll(".tick").each((m) => h.push(m)), e.yTicks = h;
14
+ }).call((u) => u.select(".domain").remove()).call((u) => u.selectAll(".tick line").remove()).call((u) => {
15
+ const h = u.selectAll(".tick text");
16
+ h.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
17
+ const m = h.nodes().map((y) => y.getBBox().width), f = Math.max(...m);
18
+ u.selectAll(".tick").each(function(y, w) {
19
+ var A;
20
+ const p = x.select(this), v = p.select("text"), N = m[w], C = f - N, M = p.append("g").attr("transform", "translate(10, 0)");
21
+ v.attr("x", C), v.remove(), (A = M.node()) == null || A.appendChild(v.node());
22
+ });
23
+ }).attr("font-family", "inherit");
15
24
  }, W = (e) => {
16
- const { svg: t, config: r, x: a, height: n } = e, { margin: s, xAxis: o } = r, { isShow: l, tickValues: d, tickFormat: i, customTicks: c, ticks: u } = o;
17
- if (!l) return null;
18
- t.append("g").attr("transform", `translate(0,${n - s.bottom})`).call((h) => {
19
- let g = x.axisBottom(a);
20
- c ? (i && (g = g.tickFormat(i)), u && (g = Array.isArray(u) ? g.ticks(...u) : g.ticks(u)), d && (g = g.tickValues(d))) : g.ticks(5), h.call(g);
21
- }).call((h) => h.select(".domain").remove()).call((h) => {
22
- let g = [];
23
- h.selectAll(".tick").each((m) => g.push(m)), e.xTicks = g;
24
- }).call((h) => h.selectAll(".tick line").remove()).call((h) => h.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
25
+ const { svg: t, config: r, x: a, height: n } = e, { margin: s, xAxis: o } = r, { isShow: c, tickValues: d, tickFormat: i, customTicks: l, ticks: g } = o;
26
+ if (!c) return null;
27
+ t.append("g").attr("transform", `translate(0,${n - s.bottom})`).call((u) => {
28
+ let h = x.axisBottom(a);
29
+ l ? (i && (h = h.tickFormat(i)), g && (h = Array.isArray(g) ? h.ticks(...g) : h.ticks(g)), d && (h = h.tickValues(d))) : h.ticks(5), u.call(h);
30
+ }).call((u) => u.select(".domain").remove()).call((u) => {
31
+ let h = [];
32
+ u.selectAll(".tick").each((m) => h.push(m)), e.xTicks = h;
33
+ }).call((u) => u.selectAll(".tick line").remove()).call((u) => u.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
25
34
  }, X = (e) => {
26
35
  const { svg: t, config: r, y: a, width: n } = e, {
27
36
  margin: s,
@@ -29,8 +38,8 @@ const P = (e) => {
29
38
  } = r;
30
39
  if (o !== "none") {
31
40
  if (o.startsWith("zero-line")) {
32
- const l = t.append("line").attr("x1", 0 + s.left).attr("x2", n - s.right).attr("y1", a(0)).attr("y2", a(0)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
33
- o === "zero-line-dashed" && l.attr("stroke-dasharray", "4 4");
41
+ const c = t.append("line").attr("x1", 0 + s.left).attr("x2", n - s.right).attr("y1", a(0)).attr("y2", a(0)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
42
+ o === "zero-line-dashed" && c.attr("stroke-dasharray", "4 4");
34
43
  }
35
44
  o.startsWith("every-line") && (e.yTicks || a.ticks()).forEach((d) => {
36
45
  const i = t.append("line").attr("x1", 0 + s.left).attr("x2", n - s.right).attr("y1", a(d)).attr("y2", a(d)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
@@ -78,35 +87,35 @@ function V(e, t, r, a) {
78
87
  return s < r ? r : o > a ? a - e.width : t - n;
79
88
  }
80
89
  const D = (e, { x1: t, x2: r, y1: a, y2: n }) => e.append("line").attr("x1", t).attr("x2", r).attr("y1", a).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), K = (e) => {
81
- const { svg: t, config: r, x: a, y: n, height: s, data: o, wrapperNode: l } = e, {
90
+ const { svg: t, config: r, x: a, y: n, height: s, data: o, wrapperNode: c } = e, {
82
91
  margin: d,
83
- grid: { verticalStyle: i, tooltipNode: c, hoverCirclesRadius: u, hoverCirclesAdditionalArea: h }
92
+ grid: { verticalStyle: i, tooltipNode: l, hoverCirclesRadius: g, hoverCirclesAdditionalArea: u }
84
93
  } = r;
85
94
  if (i !== "none" && (i.startsWith("every-line") && (e.xTicks || a.ticks()).forEach((m) => {
86
95
  const f = t.append("line").attr("x1", a(m)).attr("x2", a(m)).attr("y1", d.top).attr("y2", s - d.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
87
96
  i === "every-line-dashed" && f.attr("stroke-dasharray", "4 4");
88
97
  }), i === "hovered-circles")) {
89
- const g = n.range()[0], m = a(o[0].date), f = a(o[o.length - 1].date);
90
- D(t, { x1: m, x2: f, y1: g, y2: g });
91
- const { tooltipContainer: y, tooltip: p, tooltipArrow: v } = J(l);
92
- o.forEach((w, N) => {
93
- const A = a(w.date), M = n(w.value), $ = o[N - 1], b = N > 0 && $ && w.value === $.value;
94
- b || D(t, { x1: A, x2: A, y1: M, y2: g });
95
- const G = U(t, b, {
96
- x: A,
97
- y: g,
98
- r: u,
99
- hr: h
98
+ const h = n.range()[0], m = a(o[0].date), f = a(o[o.length - 1].date);
99
+ D(t, { x1: m, x2: f, y1: h, y2: h });
100
+ const { tooltipContainer: y, tooltip: w, tooltipArrow: p } = J(c);
101
+ o.forEach((v, N) => {
102
+ const C = a(v.date), M = n(v.value), A = o[N - 1], k = N > 0 && A && v.value === A.value;
103
+ k || D(t, { x1: C, x2: C, y1: M, y2: h });
104
+ const G = U(t, k, {
105
+ x: C,
106
+ y: h,
107
+ r: g,
108
+ hr: u
100
109
  });
101
- c && G.on("mouseover", function() {
102
- Q(p), y.style.display = "block", p.append(c({ date: w.date, value: b ? null : w.value }));
103
- const H = p.getBoundingClientRect(), O = V(
110
+ l && G.on("mouseover", function() {
111
+ Q(w), y.style.display = "block", w.append(l({ date: v.date, value: k ? null : v.value }));
112
+ const H = w.getBoundingClientRect(), O = V(
104
113
  H,
105
- a(w.date),
114
+ a(v.date),
106
115
  e.config.margin.left - e.config.grid.tooltipArrowSize,
107
116
  e.width - e.config.margin.right + e.config.grid.tooltipArrowSize
108
117
  );
109
- p.style.left = O + "px", v.style.left = a(w.date) + "px";
118
+ w.style.left = O + "px", p.style.left = a(v.date) + "px";
110
119
  }).on("mouseout", function() {
111
120
  y.style.display = "none";
112
121
  });
@@ -122,7 +131,7 @@ const D = (e, { x1: t, x2: r, y1: a, y2: n }) => e.append("line").attr("x1", t).
122
131
  return a.empty() && (a = e.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", t)), a.attr("x1", r.x1).attr("y1", r.x2).attr("x2", r.y1).attr("y2", r.y2), r.stops.forEach(({ offset: n, stopColor: s }) => {
123
132
  a.append("stop").attr("offset", n).attr("stop-color", s);
124
133
  }), a;
125
- }, k = (e) => {
134
+ }, $ = (e) => {
126
135
  const t = x.select(e).select("defs");
127
136
  return t.empty() ? x.select(e).append("defs") : t;
128
137
  }, Y = (e) => {
@@ -167,7 +176,7 @@ const D = (e, { x1: t, x2: r, y1: a, y2: n }) => e.append("line").attr("x1", t).
167
176
  ...t == null ? void 0 : t.selection
168
177
  }
169
178
  }), j = (e, t = {}) => {
170
- const r = e.node(), a = k(r), n = (l, d) => T(a, l, {
179
+ const r = e.node(), a = $(r), n = (c, d) => T(a, c, {
171
180
  x1: "0%",
172
181
  y1: "0%",
173
182
  x2: "0%",
@@ -182,11 +191,11 @@ const D = (e, { x1: t, x2: r, y1: a, y2: n }) => e.append("line").attr("x1", t).
182
191
  n("gradient-range-borders-up", "var(--sc-color-selection-up)"), n("gradient-range-borders-down", "var(--sc-color-selection-down)");
183
192
  const s = "sc-charts__border-range-line", o = e.append("line").classed(s, !0).style("display", t.hidden ? "none" : "block");
184
193
  return {
185
- className(l, d) {
186
- l === "remove" ? o.classed(`${s}${d}`, !1) : o.classed(`${s}${d}`, !0);
194
+ className(c, d) {
195
+ c === "remove" ? o.classed(`${s}${d}`, !1) : o.classed(`${s}${d}`, !0);
187
196
  },
188
- update({ x1: l, x2: d, y1: i, y2: c, hidden: u }) {
189
- l !== void 0 && o.attr("x1", l), d !== void 0 && o.attr("x2", d), i !== void 0 && o.attr("y1", i), c !== void 0 && o.attr("y2", c), u !== void 0 && o.style("display", u ? "none" : "block");
197
+ update({ x1: c, x2: d, y1: i, y2: l, hidden: g }) {
198
+ c !== void 0 && o.attr("x1", c), d !== void 0 && o.attr("x2", d), i !== void 0 && o.attr("y1", i), l !== void 0 && o.attr("y2", l), g !== void 0 && o.style("display", g ? "none" : "block");
190
199
  },
191
200
  destroy() {
192
201
  o.remove();
@@ -198,16 +207,16 @@ const D = (e, { x1: t, x2: r, y1: a, y2: n }) => e.append("line").attr("x1", t).
198
207
  className(n, s) {
199
208
  n === "remove" ? r.classed(`${a}${s}`, !1) : r.classed(`${a}${s}`, !0);
200
209
  },
201
- update({ cx: n, cy: s, hidden: o, fill: l }) {
202
- n !== void 0 && r.attr("cx", n), s !== void 0 && r.attr("cy", s), l !== void 0 && r.attr("fill", l), o !== void 0 && r.style("display", o ? "none" : "block");
210
+ update({ cx: n, cy: s, hidden: o, fill: c }) {
211
+ n !== void 0 && r.attr("cx", n), s !== void 0 && r.attr("cy", s), c !== void 0 && r.attr("fill", c), o !== void 0 && r.style("display", o ? "none" : "block");
203
212
  },
204
213
  destroy() {
205
214
  r.remove();
206
215
  }
207
216
  };
208
217
  }, te = (e, t = {}) => {
209
- const r = "sc-charts__hover-line", a = e.append("line").style("display", t.hidden ? "none" : "block").classed(r, !0), n = e.node(), s = k(n);
210
- return ((l, d) => T(s, l, {
218
+ const r = "sc-charts__hover-line", a = e.append("line").style("display", t.hidden ? "none" : "block").classed(r, !0), n = e.node(), s = $(n);
219
+ return ((c, d) => T(s, c, {
211
220
  x1: "0%",
212
221
  y1: "0%",
213
222
  x2: "0%",
@@ -219,62 +228,62 @@ const D = (e, { x1: t, x2: r, y1: a, y2: n }) => e.append("line").attr("x1", t).
219
228
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
220
229
  ]
221
230
  }))("hover-line-gradient", "var(--sc-color-hover-line)"), {
222
- className(l, d) {
223
- l === "remove" ? a.classed(`${r}${d}`, !1) : a.classed(`${r}${d}`, !0);
231
+ className(c, d) {
232
+ c === "remove" ? a.classed(`${r}${d}`, !1) : a.classed(`${r}${d}`, !0);
224
233
  },
225
- update({ x1: l, x2: d, y1: i, y2: c, hidden: u }) {
226
- l !== void 0 && a.attr("x1", l), d !== void 0 && a.attr("x2", d), i !== void 0 && a.attr("y1", i), c !== void 0 && a.attr("y2", c), u !== void 0 && a.style("display", u ? "none" : "block");
234
+ update({ x1: c, x2: d, y1: i, y2: l, hidden: g }) {
235
+ c !== void 0 && a.attr("x1", c), d !== void 0 && a.attr("x2", d), i !== void 0 && a.attr("y1", i), l !== void 0 && a.attr("y2", l), g !== void 0 && a.style("display", g ? "none" : "block");
227
236
  },
228
237
  destroy() {
229
238
  a.remove();
230
239
  }
231
240
  };
232
- }, C = "sc-charts__range-tooltip", F = x.timeFormat("%b %e, %I:%M %p"), re = (e) => {
241
+ }, b = "sc-charts__range-tooltip", F = x.timeFormat("%b %e, %I:%M %p"), re = (e) => {
233
242
  const t = x.format(",.2f");
234
243
  return `${e < 0 ? "-" : ""}$${t(Math.abs(e))}`;
235
244
  };
236
245
  function ae(e) {
237
246
  const t = "http://www.w3.org/2000/svg", r = document.createElement("div");
238
- r.className = C, r.style.position = "absolute", r.style.top = "0", r.style.pointerEvents = "none", r.style.display = "none", e.append(r);
247
+ r.className = b, r.style.position = "absolute", r.style.top = "0", r.style.pointerEvents = "none", r.style.display = "none", e.append(r);
239
248
  const a = document.createElement("div");
240
- a.className = `${C}-container`, r.append(a);
249
+ a.className = `${b}-container`, r.append(a);
241
250
  const n = document.createElement("div");
242
- n.className = `${C}-sum`, a.append(n);
251
+ n.className = `${b}-sum`, a.append(n);
243
252
  const s = document.createElement("div");
244
- s.className = `${C}-sum-icon`;
253
+ s.className = `${b}-sum-icon`;
245
254
  const o = document.createElementNS(t, "svg");
246
255
  o.setAttribute("width", "14"), o.setAttribute("height", "14"), o.setAttribute("viewBox", "0 0 14 14"), o.setAttribute("fill", "none"), o.setAttribute("xmlns", t);
247
- const l = document.createElementNS(t, "path");
248
- l.setAttribute(
256
+ const c = document.createElementNS(t, "path");
257
+ c.setAttribute(
249
258
  "d",
250
259
  "M7 0.5C5.71442 0.5 4.45772 0.881218 3.3888 1.59545C2.31988 2.30968 1.48676 3.32484 0.994786 4.51256C0.502816 5.70028 0.374095 7.00721 0.624899 8.26809C0.875703 9.52896 1.49477 10.6872 2.40381 11.5962C3.31285 12.5052 4.47104 13.1243 5.73192 13.3751C6.99279 13.6259 8.29973 13.4972 9.48744 13.0052C10.6752 12.5132 11.6903 11.6801 12.4046 10.6112C13.1188 9.54229 13.5 8.28558 13.5 7C13.4982 5.27665 12.8128 3.62441 11.5942 2.40582C10.3756 1.18722 8.72335 0.50182 7 0.5ZM9.35375 6.85375C9.30732 6.90024 9.25217 6.93712 9.19147 6.96228C9.13077 6.98744 9.06571 7.00039 9 7.00039C8.93429 7.00039 8.86923 6.98744 8.80853 6.96228C8.74783 6.93712 8.69269 6.90024 8.64625 6.85375L7.5 5.70687V9.5C7.5 9.63261 7.44732 9.75979 7.35356 9.85355C7.25979 9.94732 7.13261 10 7 10C6.86739 10 6.74022 9.94732 6.64645 9.85355C6.55268 9.75979 6.5 9.63261 6.5 9.5V5.70687L5.35375 6.85375C5.25993 6.94757 5.13268 7.00028 5 7.00028C4.86732 7.00028 4.74007 6.94757 4.64625 6.85375C4.55243 6.75993 4.49972 6.63268 4.49972 6.5C4.49972 6.36732 4.55243 6.24007 4.64625 6.14625L6.64625 4.14625C6.69269 4.09976 6.74783 4.06288 6.80853 4.03772C6.86923 4.01256 6.9343 3.99961 7 3.99961C7.06571 3.99961 7.13077 4.01256 7.19147 4.03772C7.25217 4.06288 7.30732 4.09976 7.35375 4.14625L9.35375 6.14625C9.40024 6.19269 9.43712 6.24783 9.46228 6.30853C9.48744 6.36923 9.5004 6.43429 9.5004 6.5C9.5004 6.56571 9.48744 6.63077 9.46228 6.69147C9.43712 6.75217 9.40024 6.80731 9.35375 6.85375Z"
251
- ), l.setAttribute("fill", "currentColor"), o.appendChild(l), s.appendChild(o), n.append(s);
260
+ ), c.setAttribute("fill", "currentColor"), o.appendChild(c), s.appendChild(o), n.append(s);
252
261
  const d = document.createElement("div");
253
262
  n.append(d);
254
263
  const i = document.createElement("div");
255
- return i.className = `${C}-time`, a.append(i), { wrapper: r, sumNode: d, timeNode: i };
264
+ return i.className = `${b}-time`, a.append(i), { wrapper: r, sumNode: d, timeNode: i };
256
265
  }
257
266
  const se = (e) => {
258
267
  const { wrapper: t, sumNode: r, timeNode: a } = ae(e.wrapperNode);
259
268
  return {
260
269
  className(n, s) {
261
- n === "remove" ? t.classList.remove(`${C}${s}`) : t.classList.add(`${C}${s}`);
270
+ n === "remove" ? t.classList.remove(`${b}${s}`) : t.classList.add(`${b}${s}`);
262
271
  },
263
- update({ leftPoint: n, rightPoint: s, x: o, y: l, hidden: d, closest: i }) {
272
+ update({ leftPoint: n, rightPoint: s, x: o, y: c, hidden: d, closest: i }) {
264
273
  if (n && s && i && o !== void 0) {
265
- const c = s.value - n.value, { sumFormatter: u, timeFormatter: h } = e.config.selection, g = (e.x(s.date) + e.x(n.date)) / 2, m = e.x(i.date) < g ? "left" : "right";
274
+ const l = s.value - n.value, { sumFormatter: g, timeFormatter: u } = e.config.selection, h = (e.x(s.date) + e.x(n.date)) / 2, m = e.x(i.date) < h ? "left" : "right";
266
275
  let f = "", y = "";
267
- if (u)
268
- f = u({ left: n.value, right: s.value, direction: m });
276
+ if (g)
277
+ f = g({ left: n.value, right: s.value, direction: m });
269
278
  else {
270
- const p = (c / Math.abs(n.value) * 100).toFixed(2);
271
- f = `${re(c)} (${p}%)`;
279
+ const w = (l / Math.abs(n.value) * 100).toFixed(2);
280
+ f = `${re(l)} (${w}%)`;
272
281
  }
273
- h ? y = h({ left: n.date, right: s.date, direction: m }) : y = `${F(n.date)} to ${F(s.date)}`, r.textContent = f, a.textContent = y, requestAnimationFrame(() => {
274
- const p = t.getBoundingClientRect(), v = e.wrapperNode.getBoundingClientRect(), w = e.x(n.date), N = e.x(s.date);
275
- let M = (w + N) / 2 - p.width / 2;
276
- const $ = 0, b = v.width - p.width;
277
- M < $ && (M = $), M > b && (M = b), t.style.left = `${M}px`, t.style.top = `${l}px`;
282
+ u ? y = u({ left: n.date, right: s.date, direction: m }) : y = `${F(n.date)} to ${F(s.date)}`, r.textContent = f, a.textContent = y, requestAnimationFrame(() => {
283
+ const w = t.getBoundingClientRect(), p = e.wrapperNode.getBoundingClientRect(), v = e.x(n.date), N = e.x(s.date);
284
+ let M = (v + N) / 2 - w.width / 2;
285
+ const A = 0, k = p.width - w.width;
286
+ M < A && (M = A), M > k && (M = k), t.style.left = `${M}px`, t.style.top = `${c}px`;
278
287
  });
279
288
  }
280
289
  d !== void 0 && (t.style.display = d ? "none" : "block");
@@ -295,10 +304,10 @@ function ie(e) {
295
304
  const a = document.createElement("div");
296
305
  return a.className = `${L}-time`, t.appendChild(a), { wrapper: t, sumNode: r, timeNode: a };
297
306
  }
298
- function le(e, t, r) {
307
+ function ce(e, t, r) {
299
308
  return e ? t + E + e.width < r ? t + E : t - E - e.width : null;
300
309
  }
301
- const ce = (e) => {
310
+ const le = (e) => {
302
311
  const { wrapper: t, sumNode: r, timeNode: a } = ie(e.wrapperNode);
303
312
  return {
304
313
  className(n, s) {
@@ -306,9 +315,9 @@ const ce = (e) => {
306
315
  },
307
316
  update({ hidden: n, dataItem: s }) {
308
317
  if (s) {
309
- const { sumFormatter: o, timeFormatter: l } = e.config.hover;
310
- r.textContent = o ? o(s.value) : ne(s.value), a.textContent = l ? l(s.date) : oe(s.date), requestAnimationFrame(() => {
311
- const d = t.getBoundingClientRect(), i = le(
318
+ const { sumFormatter: o, timeFormatter: c } = e.config.hover;
319
+ r.textContent = o ? o(s.value) : ne(s.value), a.textContent = c ? c(s.date) : oe(s.date), requestAnimationFrame(() => {
320
+ const d = t.getBoundingClientRect(), i = ce(
312
321
  d,
313
322
  e.x(s.date),
314
323
  e.width - e.config.margin.right
@@ -374,8 +383,8 @@ const ce = (e) => {
374
383
  enableBelowZeroLine: !1,
375
384
  curveTension: 1
376
385
  }, _ = (e) => x.curveCardinal.tension(e.config.curveTension), he = (e) => {
377
- const { svg: t, data: r, x: a, y: n, config: s } = e, o = t.node(), l = k(o);
378
- T(l, "main-line-area-gradient", {
386
+ const { svg: t, data: r, x: a, y: n, config: s } = e, o = t.node(), c = $(o);
387
+ T(c, "main-line-area-gradient", {
379
388
  x1: "0%",
380
389
  y1: "0%",
381
390
  x2: "0%",
@@ -385,24 +394,24 @@ const ce = (e) => {
385
394
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
386
395
  ]
387
396
  });
388
- const i = x.area().x((h) => a(h.date)).y0(n.range()[0]).y1((h) => n(h.value)).curve(_(e)), c = "sc-charts__main-line-area", u = t.append("path").datum(r).attr("d", i).attr("class", c).classed(`${c}_hidden`, !s.hasMainLineArea);
397
+ const i = x.area().x((u) => a(u.date)).y0(n.range()[0]).y1((u) => n(u.value)).curve(_(e)), l = "sc-charts__main-line-area", g = t.append("path").datum(r).attr("d", i).attr("class", l).classed(`${l}_hidden`, !s.hasMainLineArea);
389
398
  return {
390
- className(h, g) {
391
- h === "remove" ? u.classed(`${c}${g}`, !1) : u.classed(`${c}${g}`, !0);
399
+ className(u, h) {
400
+ u === "remove" ? g.classed(`${l}${h}`, !1) : g.classed(`${l}${h}`, !0);
392
401
  },
393
- update({ data: h, hidden: g }) {
394
- if (h !== void 0 && u.datum(h).attr("d", i), g !== void 0) {
402
+ update({ data: u, hidden: h }) {
403
+ if (u !== void 0 && g.datum(u).attr("d", i), h !== void 0) {
395
404
  if (!s.hasMainLineArea) return null;
396
- u.classed(`${c}_hidden`, g);
405
+ g.classed(`${l}_hidden`, h);
397
406
  }
398
407
  },
399
408
  destroy() {
400
- u.remove();
409
+ g.remove();
401
410
  }
402
411
  };
403
412
  }, ue = (e, t = {}) => {
404
- const r = "sc-charts__range-line-area", { svg: a, x: n, y: s, config: o, data: l, chartId: d } = e, { clip: i } = t, c = a.node(), u = k(c), h = "range-line-area-gradient";
405
- T(u, h + "_up", {
413
+ const r = "sc-charts__range-line-area", { svg: a, x: n, y: s, config: o, data: c, chartId: d } = e, { clip: i } = t, l = a.node(), g = $(l), u = "range-line-area-gradient";
414
+ T(g, u + "_up", {
406
415
  x1: "0%",
407
416
  y1: "0%",
408
417
  x2: "0%",
@@ -411,7 +420,7 @@ const ce = (e) => {
411
420
  { offset: "0%", stopColor: "var(--sc-color-selection-up)" },
412
421
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
413
422
  ]
414
- }), T(u, h + "_down", {
423
+ }), T(g, u + "_down", {
415
424
  x1: "0%",
416
425
  y1: "0%",
417
426
  x2: "0%",
@@ -421,42 +430,42 @@ const ce = (e) => {
421
430
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
422
431
  ]
423
432
  });
424
- const g = x.area().x((v) => n(v.date)).y0(s.range()[0]).y1((v) => s(v.value)).curve(_(e)), m = `${d}-clip-${r}`, y = u.append("clipPath").attr("id", m).append("rect").attr("x", (i == null ? void 0 : i.x) || 0).attr("y", (i == null ? void 0 : i.y) || 0).attr("width", (i == null ? void 0 : i.width) || "100%").attr("height", (i == null ? void 0 : i.height) || "100%"), p = a.append("path").datum(l).attr("d", g).attr("class", r).classed(`${r}_hidden`, !o.hasMainLineArea).attr("clip-path", `url(#${m})`);
433
+ const h = x.area().x((p) => n(p.date)).y0(s.range()[0]).y1((p) => s(p.value)).curve(_(e)), m = `${d}-clip-${r}`, y = g.append("clipPath").attr("id", m).append("rect").attr("x", (i == null ? void 0 : i.x) || 0).attr("y", (i == null ? void 0 : i.y) || 0).attr("width", (i == null ? void 0 : i.width) || "100%").attr("height", (i == null ? void 0 : i.height) || "100%"), w = a.append("path").datum(c).attr("d", h).attr("class", r).classed(`${r}_hidden`, !o.hasMainLineArea).attr("clip-path", `url(#${m})`);
425
434
  return {
426
- className(v, w) {
427
- v === "remove" ? p.classed(`${r}${w}`, !1) : p.classed(`${r}${w}`, !0);
435
+ className(p, v) {
436
+ p === "remove" ? w.classed(`${r}${v}`, !1) : w.classed(`${r}${v}`, !0);
428
437
  },
429
- update({ data: v, hidden: w, clip: N }) {
430
- v !== void 0 && p.datum(v).attr("d", g), w !== void 0 && p.classed(`${r}_hidden`, w), N !== void 0 && y.attr("x", N.x).attr("y", N.y).attr("width", N.width).attr("height", N.height);
438
+ update({ data: p, hidden: v, clip: N }) {
439
+ p !== void 0 && w.datum(p).attr("d", h), v !== void 0 && w.classed(`${r}_hidden`, v), N !== void 0 && y.attr("x", N.x).attr("y", N.y).attr("width", N.width).attr("height", N.height);
431
440
  },
432
441
  destroy() {
433
- p.remove();
442
+ w.remove();
434
443
  }
435
444
  };
436
445
  }, S = (e, t) => {
437
- const { svg: r, data: a, x: n, y: s, chartId: o } = e, { baseClassName: l, id: d, clip: i } = t, c = r.node(), u = k(c), h = x.line().x((p) => n(p.date)).y((p) => s(p.value)).curve(_(e)), g = `${o}-clip-${l}`, f = u.append("clipPath").attr("id", g).append("rect").attr("x", (i == null ? void 0 : i.x) || 0).attr("y", (i == null ? void 0 : i.y) || 0).attr("width", (i == null ? void 0 : i.width) || "100%").attr("height", (i == null ? void 0 : i.height) || "100%"), y = r.append("path").classed(l, !0).datum(a).attr("d", h).attr("id", d).attr("clip-path", `url(#${g})`);
446
+ const { svg: r, data: a, x: n, y: s, chartId: o } = e, { baseClassName: c, id: d, clip: i } = t, l = r.node(), g = $(l), u = x.line().x((w) => n(w.date)).y((w) => s(w.value)).curve(_(e)), h = `${o}-clip-${c}`, f = g.append("clipPath").attr("id", h).append("rect").attr("x", (i == null ? void 0 : i.x) || 0).attr("y", (i == null ? void 0 : i.y) || 0).attr("width", (i == null ? void 0 : i.width) || "100%").attr("height", (i == null ? void 0 : i.height) || "100%"), y = r.append("path").classed(c, !0).datum(a).attr("d", u).attr("id", d).attr("clip-path", `url(#${h})`);
438
447
  return {
439
- className(p, v) {
440
- p === "remove" ? y.classed(`${l}${v}`, !1) : y.classed(`${l}${v}`, !0);
448
+ className(w, p) {
449
+ w === "remove" ? y.classed(`${c}${p}`, !1) : y.classed(`${c}${p}`, !0);
441
450
  },
442
- update({ data: p, clip: v, hidden: w }) {
443
- p !== void 0 && y.datum(p).attr("d", h), w !== void 0 && y.classed(`${l}_hidden`, w), v !== void 0 && f.attr("x", v.x).attr("y", v.y).attr("width", v.width).attr("height", v.height);
451
+ update({ data: w, clip: p, hidden: v }) {
452
+ w !== void 0 && y.datum(w).attr("d", u), v !== void 0 && y.classed(`${c}_hidden`, v), p !== void 0 && f.attr("x", p.x).attr("y", p.y).attr("width", p.width).attr("height", p.height);
444
453
  },
445
454
  destroy() {
446
455
  y.remove();
447
456
  }
448
457
  };
449
458
  }, ge = (e, t) => {
450
- const { svg: r, data: a, x: n, y: s, chartId: o, config: l } = e, { baseClassName: d, id: i, clip: c } = t, u = r.node(), h = k(u), g = x.line().x((v) => n(v.date)).y((v) => s(v.value)).curve(_(e)), m = `${o}-clip-${d}`, y = h.append("clipPath").attr("id", m).append("rect").attr("x", (c == null ? void 0 : c.x) || 0).attr("y", (c == null ? void 0 : c.y) || 0).attr("width", (c == null ? void 0 : c.width) || "100%").attr("height", (c == null ? void 0 : c.height) || "100%"), p = r.append("path").classed(d, !0).datum(a).attr("d", g).attr("id", i).attr("clip-path", `url(#${m})`);
459
+ const { svg: r, data: a, x: n, y: s, chartId: o, config: c } = e, { baseClassName: d, id: i, clip: l } = t, g = r.node(), u = $(g), h = x.line().x((p) => n(p.date)).y((p) => s(p.value)).curve(_(e)), m = `${o}-clip-${d}`, y = u.append("clipPath").attr("id", m).append("rect").attr("x", (l == null ? void 0 : l.x) || 0).attr("y", (l == null ? void 0 : l.y) || 0).attr("width", (l == null ? void 0 : l.width) || "100%").attr("height", (l == null ? void 0 : l.height) || "100%"), w = r.append("path").classed(d, !0).datum(a).attr("d", h).attr("id", i).attr("clip-path", `url(#${m})`);
451
460
  return {
452
- className(v, w) {
453
- v === "remove" ? p.classed(`${d}${w}`, !1) : p.classed(`${d}${w}`, !0);
461
+ className(p, v) {
462
+ p === "remove" ? w.classed(`${d}${v}`, !1) : w.classed(`${d}${v}`, !0);
454
463
  },
455
- update({ data: v, clip: w, hidden: N }) {
456
- v !== void 0 && p.datum(v).attr("d", g), N !== void 0 && p.classed(`${d}_hidden`, N), w !== void 0 && (l.hover.transitionName === "default" ? y.transition().duration(l.hover.transitionDuration).attr("x", w.x).attr("y", w.y).attr("width", w.width).attr("height", w.height).ease(x.easeLinear) : y.attr("x", w.x).attr("y", w.y).attr("width", w.width).attr("height", w.height));
464
+ update({ data: p, clip: v, hidden: N }) {
465
+ p !== void 0 && w.datum(p).attr("d", h), N !== void 0 && w.classed(`${d}_hidden`, N), v !== void 0 && (c.hover.transitionName === "default" ? y.transition().duration(c.hover.transitionDuration).attr("x", v.x).attr("y", v.y).attr("width", v.width).attr("height", v.height).ease(x.easeLinear) : y.attr("x", v.x).attr("y", v.y).attr("width", v.width).attr("height", v.height));
457
466
  },
458
467
  destroy() {
459
- p.remove();
468
+ w.remove();
460
469
  }
461
470
  };
462
471
  }, me = (e) => {
@@ -464,22 +473,22 @@ const ce = (e) => {
464
473
  let r;
465
474
  return t >= 1e9 ? r = (e / 1e9).toFixed(1) + "B" : t >= 1e6 ? r = (e / 1e6).toFixed(1) + "M" : t >= 1e3 ? r = (e / 1e3).toFixed(1) + "K" : r = e.toFixed(1), r;
466
475
  }, fe = (e, t) => {
467
- const { svg: r, data: a, x: n, y: s } = e, { baseClassName: o } = t, l = r.append("g").classed(o, !0), d = l.append("circle").attr("r", 5).classed(`${o}-circle`, !0), i = l.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${o}-label`, !0);
468
- return ((u) => {
469
- if (!u || u.length === 0) return;
470
- const h = u[u.length - 1], g = n(h.date), m = s(h.value);
471
- d.attr("cx", g).attr("cy", m);
476
+ const { svg: r, data: a, x: n, y: s } = e, { baseClassName: o } = t, c = r.append("g").classed(o, !0), d = c.append("circle").attr("r", 5).classed(`${o}-circle`, !0), i = c.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${o}-label`, !0);
477
+ return ((g) => {
478
+ if (!g || g.length === 0) return;
479
+ const u = g[g.length - 1], h = n(u.date), m = s(u.value);
480
+ d.attr("cx", h).attr("cy", m);
472
481
  const f = e.config.extremePointFormatter || me;
473
- i.attr("x", g).attr("y", m).text(f(h.value));
482
+ i.attr("x", h).attr("y", m).text(f(u.value));
474
483
  })(a), {
475
- className(u, h) {
476
- u === "remove" ? l.classed(`${o}${h}`, !1) : l.classed(`${o}${h}`, !0);
484
+ className(g, u) {
485
+ g === "remove" ? c.classed(`${o}${u}`, !1) : c.classed(`${o}${u}`, !0);
477
486
  },
478
- update({ hidden: u }) {
479
- u !== void 0 && l.classed(`${o}_hidden`, u);
487
+ update({ hidden: g }) {
488
+ g !== void 0 && c.classed(`${o}_hidden`, g);
480
489
  },
481
490
  destroy() {
482
- l.remove();
491
+ c.remove();
483
492
  }
484
493
  };
485
494
  }, pe = (e) => {
@@ -502,31 +511,31 @@ const ce = (e) => {
502
511
  id: `${e.chartId}-sc-charts__below-zero-line`,
503
512
  clip: Y(e)
504
513
  }));
505
- const l = I(e.svg, {
514
+ const c = I(e.svg, {
506
515
  className: "sc-charts__hover-circle",
507
516
  hidden: !0
508
- }), d = j(e.svg), i = j(e.svg), c = S(e, {
517
+ }), d = j(e.svg), i = j(e.svg), l = S(e, {
509
518
  baseClassName: "sc-charts__range-line",
510
519
  id: `${e.chartId}-sc-charts__range-line`,
511
520
  clip: { x: 0, y: 0, width: "0", height: "0" }
512
- }), u = I(e.svg, {
521
+ }), g = I(e.svg, {
513
522
  className: "sc-charts__range-circle-left",
514
523
  hidden: !0
515
- }), h = I(e.svg, {
524
+ }), u = I(e.svg, {
516
525
  className: "sc-charts__range-circle-right",
517
526
  hidden: !0
518
- }), g = se(e), m = ce(e), f = ue(e);
527
+ }), h = se(e), m = le(e), f = ue(e);
519
528
  return {
520
529
  hoverLine: n,
521
- hoverCircle: l,
530
+ hoverCircle: c,
522
531
  rangeBorderLeft: d,
523
532
  rangeBorderRight: i,
524
- rangeLine: c,
533
+ rangeLine: l,
525
534
  rangeLineArea: f,
526
- rangeCircleLeft: u,
527
- rangeCircleRight: h,
535
+ rangeCircleLeft: g,
536
+ rangeCircleRight: u,
528
537
  mainLine: t,
529
- rangeTooltip: g,
538
+ rangeTooltip: h,
530
539
  highlightLine: s,
531
540
  hoverTooltip: m,
532
541
  mainLineArea: r,
@@ -542,25 +551,25 @@ const ce = (e) => {
542
551
  width: "100%",
543
552
  height: "100%"
544
553
  };
545
- const [, n, s] = a, o = parseInt(n, 10), [l, d] = r.domain();
546
- let i = new Date(l);
554
+ const [, n, s] = a, o = parseInt(n, 10), [c, d] = r.domain();
555
+ let i = new Date(c);
547
556
  for (; i < d; ) {
548
- let c = new Date(i);
557
+ let l = new Date(i);
549
558
  switch (s) {
550
559
  case "M":
551
- c.setMinutes(c.getMinutes() + o);
560
+ l.setMinutes(l.getMinutes() + o);
552
561
  break;
553
562
  case "h":
554
- c.setHours(c.getHours() + o);
563
+ l.setHours(l.getHours() + o);
555
564
  break;
556
565
  case "d":
557
- c.setDate(c.getDate() + o);
566
+ l.setDate(l.getDate() + o);
558
567
  break;
559
568
  case "w":
560
- c.setDate(c.getDate() + o * 7);
569
+ l.setDate(l.getDate() + o * 7);
561
570
  break;
562
571
  case "m":
563
- c = new Date(i.getFullYear(), i.getMonth() + o, 1);
572
+ l = new Date(i.getFullYear(), i.getMonth() + o, 1);
564
573
  break;
565
574
  default:
566
575
  return {
@@ -570,41 +579,41 @@ const ce = (e) => {
570
579
  height: "100%"
571
580
  };
572
581
  }
573
- if (t >= i && t < c) {
574
- const u = r(i), h = r(c);
582
+ if (t >= i && t < l) {
583
+ const g = r(i), u = r(l);
575
584
  return {
576
- x: u,
585
+ x: g,
577
586
  y: 0,
578
- width: h - u,
587
+ width: u - g,
579
588
  height: "100%"
580
589
  };
581
590
  }
582
- i = new Date(c);
591
+ i = new Date(l);
583
592
  }
584
593
  if (t.getTime() === d.getTime()) {
585
- let c = new Date(d);
594
+ let l = new Date(d);
586
595
  switch (s) {
587
596
  case "M":
588
- c.setMinutes(c.getMinutes() - o);
597
+ l.setMinutes(l.getMinutes() - o);
589
598
  break;
590
599
  case "h":
591
- c.setHours(c.getHours() - o);
600
+ l.setHours(l.getHours() - o);
592
601
  break;
593
602
  case "d":
594
- c.setDate(c.getDate() - o);
603
+ l.setDate(l.getDate() - o);
595
604
  break;
596
605
  case "w":
597
- c.setDate(c.getDate() - o * 7);
606
+ l.setDate(l.getDate() - o * 7);
598
607
  break;
599
608
  case "m":
600
- c = new Date(d.getFullYear(), d.getMonth() - o, 1);
609
+ l = new Date(d.getFullYear(), d.getMonth() - o, 1);
601
610
  break;
602
611
  }
603
- const u = r(c), h = r(d);
612
+ const g = r(l), u = r(d);
604
613
  return {
605
- x: u,
614
+ x: g,
606
615
  y: 0,
607
- width: h - u,
616
+ width: u - g,
608
617
  height: "100%"
609
618
  };
610
619
  }
@@ -637,15 +646,15 @@ const ce = (e) => {
637
646
  dataItem: t,
638
647
  hidden: !1
639
648
  });
640
- const l = ve(e.config.hover.range, t.date, r);
649
+ const c = ve(e.config.hover.range, t.date, r);
641
650
  n.highlightLine.update({
642
- clip: l,
651
+ clip: c,
643
652
  hidden: !1
644
653
  });
645
654
  const d = a.range()[0] - a(0) + s.bottom;
646
655
  d >= 0 && ((i = n.belowZeroLine) == null || i.update({
647
656
  clip: {
648
- ...l,
657
+ ...c,
649
658
  y: a(0),
650
659
  height: d
651
660
  }
@@ -675,78 +684,78 @@ const ce = (e) => {
675
684
  y: n,
676
685
  config: { margin: s },
677
686
  height: o,
678
- elements: l
679
- } = e, d = a(t.date) < a(r.date) ? t : r, i = a(t.date) >= a(r.date) ? t : r, c = i.value - d.value >= 0, u = a(d.date), h = a(i.date), g = h - u;
680
- l.rangeBorderLeft.update({
681
- x1: u,
682
- x2: u,
687
+ elements: c
688
+ } = e, d = a(t.date) < a(r.date) ? t : r, i = a(t.date) >= a(r.date) ? t : r, l = i.value - d.value >= 0, g = a(d.date), u = a(i.date), h = u - g;
689
+ c.rangeBorderLeft.update({
690
+ x1: g,
691
+ x2: g,
683
692
  y1: s.top,
684
693
  y2: o - s.bottom,
685
694
  hidden: !1
686
- }), l.rangeBorderRight.update({
687
- x1: h,
688
- x2: h,
695
+ }), c.rangeBorderRight.update({
696
+ x1: u,
697
+ x2: u,
689
698
  y1: s.top,
690
699
  y2: o - s.bottom,
691
700
  hidden: !1
692
- }), l.rangeCircleLeft.update({
693
- cx: u,
701
+ }), c.rangeCircleLeft.update({
702
+ cx: g,
694
703
  cy: n(d.value),
695
704
  hidden: !1
696
- }), l.rangeCircleRight.update({
697
- cx: h,
705
+ }), c.rangeCircleRight.update({
706
+ cx: u,
698
707
  cy: n(i.value),
699
708
  hidden: !1
700
- }), l.rangeLine.update({
709
+ }), c.rangeLine.update({
701
710
  clip: {
702
- x: u,
711
+ x: g,
703
712
  y: 0,
704
- width: g,
713
+ width: h,
705
714
  height: n.range()[0]
706
715
  },
707
716
  hidden: !1
708
- }), l.rangeLineArea.update({
717
+ }), c.rangeLineArea.update({
709
718
  clip: {
710
- x: u,
719
+ x: g,
711
720
  y: 0,
712
- width: g,
721
+ width: h,
713
722
  height: n.range()[0]
714
723
  },
715
724
  hidden: !1
716
- }), l.rangeTooltip.update({
725
+ }), c.rangeTooltip.update({
717
726
  rightPoint: i,
718
727
  leftPoint: d,
719
728
  closest: r,
720
- x: u + g / 2,
729
+ x: g + h / 2,
721
730
  y: 0,
722
731
  hidden: !1
723
- }), (m = l.belowZeroLine) == null || m.update({
732
+ }), (m = c.belowZeroLine) == null || m.update({
724
733
  hidden: !0
725
- }), l.mainLineArea.update({ hidden: !0 }), ye(l, c), l.mainLine.className("add", "_selected-muted");
734
+ }), c.mainLineArea.update({ hidden: !0 }), ye(c, l), c.mainLine.className("add", "_selected-muted");
726
735
  }, Z = (e) => {
727
736
  var r;
728
737
  const { elements: t } = e;
729
738
  t.rangeLine.update({ hidden: !0 }), t.rangeLineArea.update({ hidden: !0 }), t.rangeBorderLeft.update({ hidden: !0 }), t.rangeBorderRight.update({ hidden: !0 }), t.rangeCircleLeft.update({ hidden: !0 }), t.rangeCircleRight.update({ hidden: !0 }), t.rangeTooltip.update({ hidden: !0 }), t.mainLine.className("remove", "_selected-muted"), t.mainLineArea.update({ hidden: !1 }), (r = t.belowZeroLine) == null || r.update({ hidden: !1 });
730
739
  }, xe = (e) => {
731
- const { svg: t, data: r, x: a, config: n, width: s, height: o } = e, { margin: l, hover: d, selection: i } = n;
732
- let c = null, u = !1;
733
- const h = (m) => r.reduce(
740
+ const { svg: t, data: r, x: a, config: n, width: s, height: o } = e, { margin: c, hover: d, selection: i } = n;
741
+ let l = null, g = !1;
742
+ const u = (m) => r.reduce(
734
743
  (f, y) => Math.abs(a(f.date) - m) < Math.abs(a(y.date) - m) ? f : y
735
744
  );
736
- t.append("rect").attr("width", s - l.left - l.right).attr("height", o - l.top - l.bottom).attr("x", l.left).attr("y", l.top).attr("fill", "transparent").on("mousemove", function(m) {
737
- const [f] = x.pointer(m, this), y = h(f);
738
- !u && d.enable ? (e.action = "hover", B(e, y)) : (e.action = u ? "selection" : "none", R(e)), c && i.enable && (e.action = "selection", we(e, c, y));
745
+ t.append("rect").attr("width", s - c.left - c.right).attr("height", o - c.top - c.bottom).attr("x", c.left).attr("y", c.top).attr("fill", "transparent").on("mousemove", function(m) {
746
+ const [f] = x.pointer(m, this), y = u(f);
747
+ !g && d.enable ? (e.action = "hover", B(e, y)) : (e.action = g ? "selection" : "none", R(e)), l && i.enable && (e.action = "selection", we(e, l, y));
739
748
  }).on("mouseleave", () => {
740
- e.action = "none", u = !1, c = null, R(e), Z(e);
749
+ e.action = "none", g = !1, l = null, R(e), Z(e);
741
750
  }).on("mousedown", function(m) {
742
751
  if (i.enable) {
743
- u = !0, e.action = "selection";
752
+ g = !0, e.action = "selection";
744
753
  const [f] = x.pointer(m, this);
745
- c = h(f);
754
+ l = u(f);
746
755
  }
747
756
  }).on("mouseup", function(m) {
748
- const [f] = x.pointer(m, this), y = h(f);
749
- u = !1, c = null, e.action = "hover", i.enable && Z(e), d.enable && B(e, y);
757
+ const [f] = x.pointer(m, this), y = u(f);
758
+ g = !1, l = null, e.action = "hover", i.enable && Z(e), d.enable && B(e, y);
750
759
  });
751
760
  }, Ne = (e, t, r) => {
752
761
  const { margin: a } = t, n = x.scaleTime(), s = x.extent(e, (o) => new Date(o.date));
@@ -762,38 +771,38 @@ const ce = (e) => {
762
771
  return console.error(`chartId is required and must be a valid id
763
772
  (only letters, numbers or underscores. The first character must be a letter)`), null;
764
773
  const a = r.append("div"), n = a.append("svg"), s = r.node();
765
- let o = s.getBoundingClientRect(), l = o.width, d = o.height, i = z({ ...de }, t.config), c = t.data;
766
- const u = () => {
767
- o = s.getBoundingClientRect(), l = o.width, d = o.height, h({ data: c, config: i });
774
+ let o = s.getBoundingClientRect(), c = o.width, d = o.height, i = z({ ...de }, t.config), l = t.data;
775
+ const g = () => {
776
+ o = s.getBoundingClientRect(), c = o.width, d = o.height, u({ data: l, config: i });
768
777
  };
769
- window.addEventListener("resize", u);
770
- const h = (g, m = !1) => {
771
- m && g.config && (i = z(i, g.config)), m && g.data && (c = g.data);
772
- const f = c.map((N) => ({ date: new Date(N.date), value: N.value })).sort((N, A) => N.date.getTime() - A.date.getTime()), y = Ne(f, i, l), p = Me(f, i, d);
773
- a.attr("class", `sc-charts sc-charts__${i.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${l} ${d}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
774
- const v = {
778
+ window.addEventListener("resize", g);
779
+ const u = (h, m = !1) => {
780
+ m && h.config && (i = z(i, h.config)), m && h.data && (l = h.data);
781
+ const f = l.map((N) => ({ date: new Date(N.date), value: N.value })).sort((N, C) => N.date.getTime() - C.date.getTime()), y = Ne(f, i, c), w = Me(f, i, d);
782
+ a.attr("class", `sc-charts sc-charts__${i.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${c} ${d}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
783
+ const p = {
775
784
  chartId: t.chartId,
776
785
  svg: n,
777
786
  wrapperNode: a.node(),
778
787
  data: f,
779
788
  x: y,
780
- y: p,
789
+ y: w,
781
790
  config: i,
782
791
  action: "none",
783
- width: l,
792
+ width: c,
784
793
  height: d
785
794
  };
786
- ee(v);
787
- const w = {
788
- ...v,
789
- elements: pe(v)
795
+ ee(p);
796
+ const v = {
797
+ ...p,
798
+ elements: pe(p)
790
799
  };
791
- xe(w);
800
+ xe(v);
792
801
  };
793
- return h(t), {
794
- update: (g) => h(g, !0),
802
+ return u(t), {
803
+ update: (h) => u(h, !0),
795
804
  destroy: () => {
796
- window.removeEventListener("resize", u), n.remove();
805
+ window.removeEventListener("resize", g), n.remove();
797
806
  }
798
807
  };
799
808
  };