charts-core 0.0.13 → 0.0.15

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,44 +1,44 @@
1
- import * as u from "d3";
2
- const N = (t) => {
3
- const { svg: e, config: n, y: i } = t, { width: l, margin: o, yAxis: s } = n, { customTicks: r, tickFormat: a, tickValues: d, ticks: c, isShow: m } = s;
4
- if (!m) return null;
5
- e.append("g").attr("transform", `translate(${l - o.right},0)`).call((g) => {
6
- let f = u.axisRight(i);
7
- r ? (a && (f = f.tickFormat(a)), c && (f = Array.isArray(c) ? f.ticks(...c) : f.ticks(c)), d && (f = f.tickValues(d))) : f = f.tickFormat((h) => {
8
- const v = Number(h), y = v < 0 ? "-" : "", x = u.format(".0s")(Math.abs(v));
9
- return `${y}${x}`;
10
- }), g.call(f);
11
- }).call((g) => g.select(".domain").remove()).call((g) => g.selectAll("text").attr("fill", "var(--sc-color-axis-text)")).call((g) => g.selectAll(".tick line").remove());
12
- }, A = (t) => {
13
- const { svg: e, config: n, x: i } = t, { height: l, margin: o, xAxis: s } = n, { isShow: r } = s;
1
+ import * as g from "d3";
2
+ const k = (t) => {
3
+ const { svg: e, config: i, y: n } = t, { width: l, margin: o, yAxis: a } = i, { customTicks: r, tickFormat: s, tickValues: d, ticks: c, isShow: f } = a;
4
+ if (!f) return null;
5
+ e.append("g").attr("transform", `translate(${l - o.right},0)`).call((C) => {
6
+ let p = g.axisRight(n);
7
+ r ? (s && (p = p.tickFormat(s)), c && (p = Array.isArray(c) ? p.ticks(...c) : p.ticks(c)), d && (p = p.tickValues(d))) : p = p.tickFormat((u) => {
8
+ const h = Number(u), v = h < 0 ? "-" : "", y = g.format(".0s")(Math.abs(h));
9
+ return `${v}${y}`;
10
+ }), C.call(p);
11
+ }).call((C) => C.select(".domain").remove()).call((C) => C.selectAll("text").attr("fill", "var(--sc-color-axis-text)")).call((C) => C.selectAll(".tick line").remove());
12
+ }, F = (t) => {
13
+ const { svg: e, config: i, x: n } = t, { height: l, margin: o, xAxis: a } = i, { isShow: r } = a;
14
14
  if (!r) return null;
15
- e.append("g").attr("transform", `translate(0,${l - o.bottom})`).call(u.axisBottom(i).ticks(5)).call((a) => a.select(".domain").remove()).call((a) => a.selectAll(".tick line").remove()).call((a) => a.selectAll("text").attr("fill", "var(--sc-color-axis-text)"));
16
- }, R = (t) => {
17
- const { svg: e, config: n, y: i } = t, { width: l, height: o, margin: s, logo: r } = n;
18
- A(t), N(t), r && e.append("image").attr("xlink:href", `scope-logo-${n.theme}.svg`).attr("width", r.width).attr("height", r.height).attr("x", (l - s.left - s.right) / 2 - r.width / 2 + s.left).attr("y", (o - s.top - s.bottom) / 2 - r.height / 2 + s.top), e.append("line").attr("x1", 0 + s.left).attr("x2", l - s.right).attr("y1", i(0)).attr("y2", i(0)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-dasharray", "4 4").attr("stroke-width", 1);
19
- }, B = (t, e = {}) => {
20
- let n = t.append("rect").classed("sc-charts__sc-selection", !0).style("display", e.hidden ? "none" : "block");
21
- const i = "sc-charts__selection";
15
+ e.append("g").attr("transform", `translate(0,${l - o.bottom})`).call(g.axisBottom(n).ticks(5)).call((s) => s.select(".domain").remove()).call((s) => s.selectAll(".tick line").remove()).call((s) => s.selectAll("text").attr("fill", "var(--sc-color-axis-text)"));
16
+ }, M = "data:image/svg+xml,%3Csvg width='406' height='113' viewBox='0 0 406 113' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M192.818 23.0378C168.597 23.0378 151.856 36.6984 151.856 56.6851C151.856 76.6718 168.597 90.5572 192.818 90.5572C217.038 90.5572 233.39 76.6645 233.39 56.6561C233.39 36.6476 216.906 23.0378 192.818 23.0378ZM192.818 78.2243C176.839 78.2243 165.642 69.4316 165.642 56.5618C165.642 43.6919 176.817 35.4071 192.818 35.4071C208.818 35.4071 219.612 43.9459 219.612 56.5618C219.612 69.1777 208.4 78.2025 192.818 78.2025V78.2315V78.2243Z' fill='url(%23paint0_linear_825_50654)'/%3E%3Cpath d='M47.275 50.6822H25.511C12.6272 50.6822 9.15141 35.3893 35.9457 35.3893C47.2823 35.3893 56.1697 40.2354 60.0341 42.7746L66.993 32.3278C60.4155 26.5893 48.8295 23.02 35.821 23.02C-7.20087 23.02 -7.7215 62.783 25.643 62.783H47.5389C61.706 62.783 64.0232 78.2065 35.9457 78.2065C21.9033 78.2065 10.8233 70.8139 6.95889 68.0064L0 78.4604C6.57758 84.1916 20.4807 90.5612 36.063 90.5612C81.1455 90.5322 81.6661 50.6749 47.275 50.6749V50.6822Z' fill='url(%23paint1_linear_825_50654)'/%3E%3Cpath d='M117.971 78.1952C101.487 78.1952 90.7959 69.4026 90.7959 56.7867C90.7959 44.1708 101.355 35.3998 117.839 35.3998C127.248 35.3998 136.003 40.246 141.283 45.0848L149.173 34.2536C141.701 28.3991 130.232 23.0378 117.869 23.0378C93.1351 23.0378 77.0394 36.8072 77.0394 56.8157C77.0394 76.8241 93.3771 90.5572 118.125 90.5572C130.745 90.5572 142.214 84.9494 149.679 79.0876L141.569 68.503C136.267 73.3709 127.504 78.1952 117.971 78.1952Z' fill='url(%23paint2_linear_825_50654)'/%3E%3Cpath d='M366.96 23.0273C343.774 23.0273 327.671 36.7967 327.671 56.8051C327.671 76.8136 346.091 90.5467 371.213 90.5467C384.479 90.5467 395.537 86.2156 402.51 80.3538L394.385 69.7983C389.619 74.8983 381.897 78.591 371.074 78.591C355.998 78.591 345.255 72.3519 342.146 62.7902H406.001V56.6673C405.979 36.6588 390.14 23.02 366.953 23.02L366.96 23.0273ZM366.828 35.0048C380.101 35.0048 389.179 41.193 391.569 51.0594H341.889C344.353 41.2801 353.343 35.0048 366.828 35.0048Z' fill='url(%23paint3_linear_825_50654)'/%3E%3Cpath d='M284.304 23.0273C272.777 23.0273 263.632 27.0319 257.348 33.2056C255.72 28.1128 251.225 24.9425 245.132 24.9425H236.772V37.0506H244.494V113H258.023V80.9052C264.27 86.7597 273.143 90.5684 284.318 90.5684C305.826 90.5684 320.638 76.6757 320.638 56.6673C320.638 36.6588 305.804 23.02 284.296 23.02L284.304 23.0273ZM282.625 78.1847C267.937 78.1847 258.023 69.392 258.023 56.5222C258.023 43.6524 267.937 35.3675 282.625 35.3675C297.312 35.3675 306.845 43.9063 306.845 56.5222C306.83 69.421 296.667 78.1847 282.625 78.1847Z' fill='url(%23paint4_linear_825_50654)'/%3E%3Cpath d='M362.631 5.86774H364.279C365.579 5.86774 366.453 5.10272 366.453 3.99282C366.453 2.88292 365.674 2.18688 364.26 2.18688C362.942 2.18688 362.067 2.95817 361.991 4.13704H359.374C359.475 1.64761 361.44 0.0297852 364.387 0.0297852C367.334 0.0297852 369.141 1.46576 369.141 3.61658C369.141 5.26576 368 6.45717 366.333 6.75816V6.8146C368.361 6.98391 369.667 8.19414 369.667 10.0565C369.667 12.4707 367.455 14.076 364.317 14.076C361.18 14.076 359.241 12.408 359.107 9.9311H361.827C361.909 11.0661 362.853 11.8123 364.349 11.8123C365.845 11.8123 366.77 11.0222 366.77 9.88094C366.77 8.65189 365.839 7.90569 364.305 7.90569H362.625V5.87401L362.631 5.86774Z' fill='%23141718'/%3E%3Cpath d='M372.393 11.5986C371.638 10.4636 371.252 8.93982 371.252 7.15269C371.252 2.70055 373.438 0.0167236 376.95 0.0167236C379.542 0.0167236 381.564 1.53421 381.944 3.7352H379.149C378.877 2.8385 378.002 2.24279 376.937 2.24279C375.042 2.24279 373.895 4.04246 373.958 7.07745H374.015C374.56 5.76061 375.898 4.889 377.634 4.889C380.214 4.889 382.128 6.77018 382.128 9.32233C382.128 12.0877 379.954 14.0755 376.912 14.0755C374.96 14.0755 373.35 13.1976 372.399 11.5986H372.393ZM379.352 9.41012C379.352 8.02431 378.306 7.00847 376.886 7.00847C375.467 7.00847 374.402 8.02431 374.402 9.38504C374.402 10.7458 375.486 11.8368 376.88 11.8368C378.274 11.8368 379.358 10.7646 379.358 9.41639L379.352 9.41012Z' fill='%23141718'/%3E%3Cpath d='M383.665 7.01056C383.665 2.66502 385.763 0 389.167 0C392.57 0 394.655 2.65874 394.655 6.99802C394.655 11.3373 392.583 14.0525 389.167 14.0525C385.75 14.0525 383.665 11.3624 383.665 7.00429V7.01056ZM391.765 7.01056C391.765 3.96931 390.776 2.25743 389.167 2.25743C387.557 2.25743 386.555 3.98185 386.555 7.01056C386.555 10.0393 387.544 11.8013 389.167 11.8013C390.789 11.8013 391.765 10.0769 391.765 7.01056Z' fill='%23141718'/%3E%3Cpath d='M395.968 3.15424C395.968 1.48625 397.267 0.188232 398.959 0.188232C400.652 0.188232 401.957 1.48625 401.957 3.15424C401.957 4.82222 400.645 6.12651 398.959 6.12651C397.273 6.12651 395.968 4.82849 395.968 3.15424ZM400.322 3.15424C400.322 2.40176 399.726 1.79351 398.966 1.79351C398.205 1.79351 397.609 2.40176 397.609 3.15424C397.609 3.90671 398.23 4.52123 398.966 4.52123C399.739 4.52123 400.322 3.8879 400.322 3.15424Z' fill='%23141718'/%3E%3Cdefs%3E%3ClinearGradient id='paint0_linear_825_50654' x1='195.535' y1='92.2815' x2='195.535' y2='24.1985' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23181C1D' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23141718'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint1_linear_825_50654' x1='38.3756' y1='92.2861' x2='38.3756' y2='24.1811' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23181C1D' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23141718'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint2_linear_825_50654' x1='115.953' y1='92.2815' x2='115.953' y2='24.1985' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23181C1D' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23141718'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint3_linear_825_50654' x1='369.633' y1='92.2712' x2='369.633' y2='24.1808' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23181C1D' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23141718'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint4_linear_825_50654' x1='281.7' y1='115.298' x2='281.7' y2='24.5668' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23181C1D' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23141718'/%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E", H = "data:image/svg+xml,%3Csvg width='406' height='113' viewBox='0 0 406 113' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M192.818 23.0378C168.597 23.0378 151.856 36.6984 151.856 56.685C151.856 76.6717 168.597 90.5572 192.818 90.5572C217.038 90.5572 233.391 76.6645 233.391 56.656C233.391 36.6476 216.906 23.0378 192.818 23.0378ZM192.818 78.2242C176.839 78.2242 165.642 69.4315 165.642 56.5617C165.642 43.6919 176.817 35.407 192.818 35.407C208.818 35.407 219.612 43.9458 219.612 56.5617C219.612 69.1776 208.4 78.2025 192.818 78.2025V78.2315V78.2242Z' fill='url(%23paint0_linear_825_29332)'/%3E%3Cpath d='M47.275 50.6821H25.511C12.6272 50.6821 9.15141 35.3892 35.9457 35.3892C47.2823 35.3892 56.1697 40.2354 60.0341 42.7745L66.993 32.3278C60.4155 26.5893 48.8295 23.02 35.821 23.02C-7.20087 23.02 -7.7215 62.783 25.643 62.783H47.5389C61.706 62.783 64.0232 78.2064 35.9457 78.2064C21.9033 78.2064 10.8233 70.8139 6.95889 68.0063L0 78.4604C6.57758 84.1916 20.4807 90.5612 36.063 90.5612C81.1455 90.5322 81.6661 50.6749 47.275 50.6749V50.6821Z' fill='url(%23paint1_linear_825_29332)'/%3E%3Cpath d='M117.971 78.1952C101.487 78.1952 90.7955 69.4025 90.7955 56.7866C90.7955 44.1707 101.355 35.3998 117.839 35.3998C127.247 35.3998 136.003 40.2459 141.282 45.0848L149.172 34.2535C141.7 28.399 130.232 23.0378 117.868 23.0378C93.1347 23.0378 77.0391 36.8072 77.0391 56.8156C77.0391 76.8241 93.3767 90.5572 118.125 90.5572C130.745 90.5572 142.214 84.9493 149.678 79.0875L141.568 68.5029C136.267 73.3708 127.504 78.1952 117.971 78.1952Z' fill='url(%23paint2_linear_825_29332)'/%3E%3Cpath d='M366.96 23.0273C343.774 23.0273 327.671 36.7967 327.671 56.8051C327.671 76.8136 346.091 90.5467 371.213 90.5467C384.479 90.5467 395.537 86.2156 402.51 80.3538L394.385 69.7983C389.619 74.8983 381.897 78.591 371.074 78.591C355.998 78.591 345.255 72.3519 342.146 62.7902H406.001V56.6673C405.979 36.6588 390.14 23.02 366.953 23.02L366.96 23.0273ZM366.828 35.0048C380.101 35.0048 389.179 41.193 391.569 51.0594H341.889C344.353 41.2801 353.343 35.0048 366.828 35.0048Z' fill='url(%23paint3_linear_825_29332)'/%3E%3Cpath d='M284.304 23.0272C272.777 23.0272 263.632 27.0318 257.348 33.2056C255.72 28.1128 251.225 24.9425 245.132 24.9425H236.772V37.0506H244.494V113H258.023V80.9052C264.27 86.7597 273.143 90.5684 284.318 90.5684C305.826 90.5684 320.638 76.6757 320.638 56.6672C320.638 36.6588 305.804 23.02 284.296 23.02L284.304 23.0272ZM282.625 78.1847C267.937 78.1847 258.023 69.392 258.023 56.5222C258.023 43.6523 267.937 35.3675 282.625 35.3675C297.312 35.3675 306.845 43.9062 306.845 56.5222C306.83 69.421 296.667 78.1847 282.625 78.1847Z' fill='url(%23paint4_linear_825_29332)'/%3E%3Cpath d='M362.631 5.86768H364.279C365.579 5.86768 366.453 5.10266 366.453 3.99276C366.453 2.88286 365.674 2.18682 364.26 2.18682C362.942 2.18682 362.067 2.95811 361.991 4.13698H359.374C359.475 1.64754 361.44 0.0297241 364.387 0.0297241C367.334 0.0297241 369.141 1.4657 369.141 3.61652C369.141 5.2657 368 6.45711 366.333 6.7581V6.81454C368.361 6.98385 369.667 8.19408 369.667 10.0565C369.667 12.4706 367.455 14.0759 364.317 14.0759C361.18 14.0759 359.241 12.4079 359.107 9.93104H361.827C361.909 11.066 362.853 11.8122 364.349 11.8122C365.845 11.8122 366.77 11.0221 366.77 9.88087C366.77 8.65183 365.839 7.90563 364.305 7.90563H362.625V5.87395L362.631 5.86768Z' fill='%23F8F8F8'/%3E%3Cpath d='M372.393 11.5985C371.638 10.4635 371.252 8.93976 371.252 7.15263C371.252 2.70049 373.438 0.0166626 376.95 0.0166626C379.542 0.0166626 381.564 1.53415 381.944 3.73514H379.149C378.877 2.83844 378.002 2.24273 376.937 2.24273C375.042 2.24273 373.895 4.0424 373.958 7.07738H374.015C374.56 5.76055 375.898 4.88894 377.634 4.88894C380.214 4.88894 382.128 6.77012 382.128 9.32227C382.128 12.0876 379.954 14.0754 376.912 14.0754C374.96 14.0754 373.35 13.1975 372.399 11.5985H372.393ZM379.352 9.41006C379.352 8.02425 378.306 7.00841 376.886 7.00841C375.467 7.00841 374.402 8.02425 374.402 9.38497C374.402 10.7457 375.486 11.8368 376.88 11.8368C378.274 11.8368 379.358 10.7645 379.358 9.41633L379.352 9.41006Z' fill='%23F8F8F8'/%3E%3Cpath d='M383.665 7.0105C383.665 2.66495 385.763 -6.10352e-05 389.167 -6.10352e-05C392.57 -6.10352e-05 394.655 2.65868 394.655 6.99796C394.655 11.3372 392.583 14.0524 389.167 14.0524C385.75 14.0524 383.665 11.3623 383.665 7.00423V7.0105ZM391.765 7.0105C391.765 3.96924 390.776 2.25736 389.167 2.25736C387.557 2.25736 386.555 3.98179 386.555 7.0105C386.555 10.0392 387.544 11.8013 389.167 11.8013C390.789 11.8013 391.765 10.0768 391.765 7.0105Z' fill='%23F8F8F8'/%3E%3Cpath d='M395.968 3.15422C395.968 1.48624 397.267 0.188217 398.959 0.188217C400.652 0.188217 401.957 1.48624 401.957 3.15422C401.957 4.82221 400.645 6.1265 398.959 6.1265C397.273 6.1265 395.968 4.82848 395.968 3.15422ZM400.322 3.15422C400.322 2.40175 399.726 1.7935 398.966 1.7935C398.205 1.7935 397.609 2.40175 397.609 3.15422C397.609 3.9067 398.23 4.52122 398.966 4.52122C399.739 4.52122 400.322 3.88788 400.322 3.15422Z' fill='%23F8F8F8'/%3E%3Cdefs%3E%3ClinearGradient id='paint0_linear_825_29332' x1='195.535' y1='92.2815' x2='195.535' y2='24.1985' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23EDEDED' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23F8F8F8'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint1_linear_825_29332' x1='38.3756' y1='92.286' x2='38.3756' y2='24.181' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23EDEDED' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23F8F8F8'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint2_linear_825_29332' x1='115.953' y1='92.2815' x2='115.953' y2='24.1985' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23EDEDED' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23F8F8F8'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint3_linear_825_29332' x1='369.633' y1='92.2712' x2='369.633' y2='24.1808' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23EDEDED' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23F8F8F8'/%3E%3C/linearGradient%3E%3ClinearGradient id='paint4_linear_825_29332' x1='281.7' y1='115.298' x2='281.7' y2='24.5667' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23EDEDED' stop-opacity='0.2'/%3E%3Cstop offset='1' stop-color='%23F8F8F8'/%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E", N = (t) => {
17
+ const { svg: e, config: i, y: n } = t, { width: l, height: o, margin: a, logo: r } = i;
18
+ F(t), k(t), r && e.append("image").attr("xlink:href", i.theme === "dark" ? M : H).attr("width", r.width).attr("height", r.height).attr("x", (l - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", (o - a.top - a.bottom) / 2 - r.height / 2 + a.top), e.append("line").attr("x1", 0 + a.left).attr("x2", l - a.right).attr("y1", n(0)).attr("y2", n(0)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-dasharray", "4 4").attr("stroke-width", 1);
19
+ }, G = (t, e = {}) => {
20
+ let i = t.append("rect").classed("sc-charts__sc-selection", !0).style("display", e.hidden ? "none" : "block");
21
+ const n = "sc-charts__selection";
22
22
  return {
23
23
  className(l, o) {
24
- l === "remove" ? n.classed(`${i}${o}`, !1) : n.classed(`${i}${o}`, !0);
24
+ l === "remove" ? i.classed(`${n}${o}`, !1) : i.classed(`${n}${o}`, !0);
25
25
  },
26
- update({ width: l, x: o, y: s, height: r, fill: a, hidden: d }) {
27
- l !== void 0 && n.attr("width", l), o !== void 0 && n.attr("x", o), s !== void 0 && n.attr("y", s), r !== void 0 && n.attr("height", r), a !== void 0 && n.attr("fill", a), d !== void 0 && n.style("display", d ? "none" : "block");
26
+ update({ width: l, x: o, y: a, height: r, fill: s, hidden: d }) {
27
+ l !== void 0 && i.attr("width", l), o !== void 0 && i.attr("x", o), a !== void 0 && i.attr("y", a), r !== void 0 && i.attr("height", r), s !== void 0 && i.attr("fill", s), d !== void 0 && i.style("display", d ? "none" : "block");
28
28
  },
29
29
  destroy() {
30
- n.remove();
30
+ i.remove();
31
31
  }
32
32
  };
33
- }, _ = (t, e, n) => {
34
- let i = t.select(`#${e}`);
35
- return i.empty() && (i = t.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", e)), i.attr("x1", n.x1).attr("y1", n.x2).attr("x2", n.y1).attr("y2", n.y2), n.stops.forEach(({ offset: l, stopColor: o }) => {
36
- i.append("stop").attr("offset", l).attr("stop-color", o);
37
- }), i;
38
- }, C = (t) => {
39
- const e = u.select(t).select("defs");
40
- return e.empty() ? u.select(t).append("defs") : e;
41
- }, b = (t, e) => ({
33
+ }, $ = (t, e, i) => {
34
+ let n = t.select(`#${e}`);
35
+ return n.empty() && (n = t.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", e)), n.attr("x1", i.x1).attr("y1", i.x2).attr("x2", i.y1).attr("y2", i.y2), i.stops.forEach(({ offset: l, stopColor: o }) => {
36
+ n.append("stop").attr("offset", l).attr("stop-color", o);
37
+ }), n;
38
+ }, b = (t) => {
39
+ const e = g.select(t).select("defs");
40
+ return e.empty() ? g.select(t).append("defs") : e;
41
+ }, x = (t, e) => ({
42
42
  ...t,
43
43
  ...e,
44
44
  margin: {
@@ -57,182 +57,182 @@ const N = (t) => {
57
57
  ...t.yAxis,
58
58
  ...e == null ? void 0 : e.yAxis
59
59
  }
60
- }), w = (t, e = {}) => {
61
- const n = t.node(), i = C(n), l = (r, a) => _(i, r, {
60
+ }), E = (t, e = {}) => {
61
+ const i = t.node(), n = b(i), l = (r, s) => $(n, r, {
62
62
  x1: "0%",
63
63
  y1: "0%",
64
64
  x2: "0%",
65
65
  y2: "100%",
66
66
  stops: [
67
67
  { offset: "0%", stopColor: "rgba(255, 255, 255, 0)" },
68
- { offset: "20%", stopColor: a },
69
- { offset: "60%", stopColor: a },
68
+ { offset: "20%", stopColor: s },
69
+ { offset: "60%", stopColor: s },
70
70
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
71
71
  ]
72
72
  });
73
73
  l("gradient-range-borders-up", "var(--sc-color-selection-up)"), l("gradient-range-borders-down", "var(--sc-color-selection-down)");
74
- const o = "sc-charts__border-range-line", s = t.append("line").classed(o, !0).style("display", e.hidden ? "none" : "block");
74
+ const o = "sc-charts__border-range-line", a = t.append("line").classed(o, !0).style("display", e.hidden ? "none" : "block");
75
75
  return {
76
- className(r, a) {
77
- r === "remove" ? s.classed(`${o}${a}`, !1) : s.classed(`${o}${a}`, !0);
76
+ className(r, s) {
77
+ r === "remove" ? a.classed(`${o}${s}`, !1) : a.classed(`${o}${s}`, !0);
78
78
  },
79
- update({ x1: r, x2: a, y1: d, y2: c, hidden: m }) {
80
- r !== void 0 && s.attr("x1", r), a !== void 0 && s.attr("x2", a), d !== void 0 && s.attr("y1", d), c !== void 0 && s.attr("y2", c), m !== void 0 && s.style("display", m ? "none" : "block");
79
+ update({ x1: r, x2: s, y1: d, y2: c, hidden: f }) {
80
+ r !== void 0 && a.attr("x1", r), s !== void 0 && a.attr("x2", s), d !== void 0 && a.attr("y1", d), c !== void 0 && a.attr("y2", c), f !== void 0 && a.style("display", f ? "none" : "block");
81
81
  },
82
82
  destroy() {
83
- s.remove();
83
+ a.remove();
84
84
  }
85
85
  };
86
- }, $ = (t, e = {}) => {
87
- const n = t.append("circle").attr("r", e.radius || 4).style("display", e.hidden ? "none" : "block"), i = e.className || "";
88
- return i && n.classed(i, !0), {
86
+ }, _ = (t, e = {}) => {
87
+ const i = t.append("circle").attr("r", e.radius || 4).style("display", e.hidden ? "none" : "block"), n = e.className || "";
88
+ return n && i.classed(n, !0), {
89
89
  className(l, o) {
90
- l === "remove" ? n.classed(`${i}${o}`, !1) : n.classed(`${i}${o}`, !0);
90
+ l === "remove" ? i.classed(`${n}${o}`, !1) : i.classed(`${n}${o}`, !0);
91
91
  },
92
- update({ cx: l, cy: o, hidden: s, fill: r }) {
93
- l !== void 0 && n.attr("cx", l), o !== void 0 && n.attr("cy", o), r !== void 0 && n.attr("fill", r), s !== void 0 && n.style("display", s ? "none" : "block");
92
+ update({ cx: l, cy: o, hidden: a, fill: r }) {
93
+ l !== void 0 && i.attr("cx", l), o !== void 0 && i.attr("cy", o), r !== void 0 && i.attr("fill", r), a !== void 0 && i.style("display", a ? "none" : "block");
94
94
  },
95
95
  destroy() {
96
- n.remove();
96
+ i.remove();
97
97
  }
98
98
  };
99
- }, F = (t, e = {}) => {
100
- const n = "sc-charts__hover-line", i = t.append("line").style("display", e.hidden ? "none" : "block").classed(n, !0), l = t.node(), o = C(l);
101
- return ((r, a) => _(o, r, {
99
+ }, Z = (t, e = {}) => {
100
+ const i = "sc-charts__hover-line", n = t.append("line").style("display", e.hidden ? "none" : "block").classed(i, !0), l = t.node(), o = b(l);
101
+ return ((r, s) => $(o, r, {
102
102
  x1: "0%",
103
103
  y1: "0%",
104
104
  x2: "0%",
105
105
  y2: "100%",
106
106
  stops: [
107
107
  { offset: "0%", stopColor: "rgba(255, 255, 255, 0)" },
108
- { offset: "15%", stopColor: a },
109
- { offset: "75%", stopColor: a },
108
+ { offset: "15%", stopColor: s },
109
+ { offset: "75%", stopColor: s },
110
110
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
111
111
  ]
112
112
  }))("hover-line-gradient", "var(--sc-color-hover-line)"), {
113
- className(r, a) {
114
- r === "remove" ? i.classed(`${n}${a}`, !1) : i.classed(`${n}${a}`, !0);
113
+ className(r, s) {
114
+ r === "remove" ? n.classed(`${i}${s}`, !1) : n.classed(`${i}${s}`, !0);
115
115
  },
116
- update({ x1: r, x2: a, y1: d, y2: c, hidden: m }) {
117
- r !== void 0 && i.attr("x1", r), a !== void 0 && i.attr("x2", a), d !== void 0 && i.attr("y1", d), c !== void 0 && i.attr("y2", c), m !== void 0 && i.style("display", m ? "none" : "block");
116
+ update({ x1: r, x2: s, y1: d, y2: c, hidden: f }) {
117
+ r !== void 0 && n.attr("x1", r), s !== void 0 && n.attr("x2", s), d !== void 0 && n.attr("y1", d), c !== void 0 && n.attr("y2", c), f !== void 0 && n.style("display", f ? "none" : "block");
118
118
  },
119
119
  destroy() {
120
- i.remove();
120
+ n.remove();
121
121
  }
122
122
  };
123
- }, T = ({ svg: t, x: e, y: n }, i = {}) => {
124
- const l = u.line().x((r) => e(r.date)).y((r) => n(r.value)).curve(u.curveLinear), o = i.className || "sc-charts__range-line", s = t.append("path").classed(i.className || "sc-charts__range-line", !0).style("display", i.hidden ? "none" : "block");
123
+ }, D = ({ svg: t, x: e, y: i }, n = {}) => {
124
+ const l = g.line().x((r) => e(r.date)).y((r) => i(r.value)).curve(g.curveLinear), o = n.className || "sc-charts__range-line", a = t.append("path").classed(n.className || "sc-charts__range-line", !0).style("display", n.hidden ? "none" : "block");
125
125
  return {
126
- className(r, a) {
127
- r === "remove" ? s.classed(`${o}${a}`, !1) : s.classed(`${o}${a}`, !0);
126
+ className(r, s) {
127
+ r === "remove" ? a.classed(`${o}${s}`, !1) : a.classed(`${o}${s}`, !0);
128
128
  },
129
- update({ data: r, hidden: a, stroke: d }) {
130
- r !== void 0 && s.datum(r).attr("d", l), d !== void 0 && s.attr("stroke", d), a !== void 0 && s.style("display", a ? "none" : "block");
129
+ update({ data: r, hidden: s, stroke: d }) {
130
+ r !== void 0 && a.datum(r).attr("d", l), d !== void 0 && a.attr("stroke", d), s !== void 0 && a.style("display", s ? "none" : "block");
131
131
  },
132
132
  destroy() {
133
- s.remove();
133
+ a.remove();
134
134
  }
135
135
  };
136
- }, G = ({
136
+ }, V = ({
137
137
  svg: t,
138
138
  data: e,
139
- x: n,
140
- y: i
139
+ x: i,
140
+ y: n
141
141
  }) => {
142
- const l = u.line().x((r) => n(r.date)).y((r) => i(r.value)).curve(u.curveLinear), o = "sc-charts__main-line", s = t.append("path").classed(o, !0).datum(e).attr("d", l);
142
+ const l = g.line().x((r) => i(r.date)).y((r) => n(r.value)).curve(g.curveLinear), o = "sc-charts__main-line", a = t.append("path").classed(o, !0).datum(e).attr("d", l);
143
143
  return {
144
- className(r, a) {
145
- r === "remove" ? s.classed(`${o}${a}`, !1) : s.classed(`${o}${a}`, !0);
144
+ className(r, s) {
145
+ r === "remove" ? a.classed(`${o}${s}`, !1) : a.classed(`${o}${s}`, !0);
146
146
  },
147
- update({ data: r, hidden: a, stroke: d }) {
148
- r !== void 0 && s.datum(r).attr("d", l), d !== void 0 && s.attr("stroke", d), a !== void 0 && s.style("display", a ? "none" : "block");
147
+ update({ data: r, hidden: s, stroke: d }) {
148
+ r !== void 0 && a.datum(r).attr("d", l), d !== void 0 && a.attr("stroke", d), s !== void 0 && a.style("display", s ? "none" : "block");
149
149
  },
150
150
  destroy() {
151
- s.remove();
151
+ a.remove();
152
152
  }
153
153
  };
154
- }, S = (t) => {
155
- const e = "sc-charts__range-label", n = t.svg.append("foreignObject").classed(e, !0).style("display", "none"), i = n.append("xhtml:div").attr("xmlns", "http://www.w3.org/1999/xhtml").attr("class", `${e}-container`), l = i.append("xhtml:div").attr("xmlns", "http://www.w3.org/1999/xhtml").attr("class", `${e}-sum`), o = i.append("xhtml:div").attr("xmlns", "http://www.w3.org/1999/xhtml").attr("class", `${e}-time`), s = u.timeFormat("%b %e, %I:%M %p");
154
+ }, U = (t) => {
155
+ const e = "sc-charts__range-label", i = t.svg.append("foreignObject").classed(e, !0).style("display", "none"), n = i.append("xhtml:div").attr("xmlns", "http://www.w3.org/1999/xhtml").attr("class", `${e}-container`), l = n.append("xhtml:div").attr("xmlns", "http://www.w3.org/1999/xhtml").attr("class", `${e}-sum`), o = n.append("xhtml:div").attr("xmlns", "http://www.w3.org/1999/xhtml").attr("class", `${e}-time`), a = g.timeFormat("%b %e, %I:%M %p");
156
156
  return {
157
- className(r, a) {
158
- r === "remove" ? n.classed(`${e}${a}`, !1) : n.classed(`${e}${a}`, !0);
157
+ className(r, s) {
158
+ r === "remove" ? i.classed(`${e}${s}`, !1) : i.classed(`${e}${s}`, !0);
159
159
  },
160
- update({ leftPoint: r, rightPoint: a, x: d, y: c, hidden: m }) {
161
- if (d !== void 0 && n.attr("x", d), c !== void 0 && n.attr("y", c), r && a) {
162
- const g = a.value - r.value, f = (g / r.value * 100).toFixed(2), h = `${g < 0 ? "-" : ""}$${Math.abs(g).toFixed(2)} (${f}%)`, v = `${s(r.date)} to ${s(a.date)}`;
163
- l.text(h), o.text(v);
164
- const y = t.x(t.data[t.data.length - 1].date), x = t.x(t.data[0].date), p = i.node().getBoundingClientRect();
165
- p.x < x && n.attr("x", x + p.width / 2), p.x > y - p.width && n.attr("x", y - p.width / 2);
160
+ update({ leftPoint: r, rightPoint: s, x: d, y: c, hidden: f }) {
161
+ if (d !== void 0 && i.attr("x", d), c !== void 0 && i.attr("y", c), r && s) {
162
+ const C = s.value - r.value, p = (C / r.value * 100).toFixed(2), u = `${C < 0 ? "-" : ""}$${Math.abs(C).toFixed(2)} (${p}%)`, h = `${a(r.date)} to ${a(s.date)}`;
163
+ l.text(u), o.text(h);
164
+ const v = t.x(t.data[t.data.length - 1].date), y = t.x(t.data[0].date), m = n.node().getBoundingClientRect();
165
+ m.x < y && i.attr("x", y + m.width / 2), m.x > v - m.width && i.attr("x", v - m.width / 2);
166
166
  }
167
- m !== void 0 && n.style("display", m ? "none" : "block");
167
+ f !== void 0 && i.style("display", f ? "none" : "block");
168
168
  },
169
169
  destroy() {
170
- n.remove();
170
+ i.remove();
171
171
  }
172
172
  };
173
- }, I = ({ svg: t, x: e, y: n }, i = {}) => {
174
- const l = u.line().x((r) => e(r.date)).y((r) => n(r.value)).curve(u.curveLinear), o = i.className || "sc-charts__highlight-line", s = t.append("path").classed(o, !0).style("display", i.hidden ? "none" : "block");
173
+ }, A = ({ svg: t, x: e, y: i }, n = {}) => {
174
+ const l = g.line().x((r) => e(r.date)).y((r) => i(r.value)).curve(g.curveLinear), o = n.className || "sc-charts__highlight-line", a = t.append("path").classed(o, !0).style("display", n.hidden ? "none" : "block");
175
175
  return {
176
- className(r, a) {
177
- r === "remove" ? s.classed(`${o}${a}`, !1) : s.classed(`${o}${a}`, !0);
176
+ className(r, s) {
177
+ r === "remove" ? a.classed(`${o}${s}`, !1) : a.classed(`${o}${s}`, !0);
178
178
  },
179
- update({ data: r, hidden: a, stroke: d }) {
180
- r !== void 0 && s.datum(r).attr("d", l), d !== void 0 && s.attr("stroke", d), a !== void 0 && s.style("display", a ? "none" : "block");
179
+ update({ data: r, hidden: s, stroke: d }) {
180
+ r !== void 0 && a.datum(r).attr("d", l), d !== void 0 && a.attr("stroke", d), s !== void 0 && a.style("display", s ? "none" : "block");
181
181
  },
182
182
  destroy() {
183
- s.remove();
183
+ a.remove();
184
184
  }
185
185
  };
186
186
  }, L = (t) => {
187
- const e = G(t), n = B(t.svg), i = F(t.svg), l = I(t), o = $(t.svg, {
187
+ const e = V(t), i = G(t.svg), n = Z(t.svg), l = A(t), o = _(t.svg, {
188
188
  className: "sc-charts__hover-circle",
189
189
  hidden: !0
190
- }), s = w(t.svg), r = w(t.svg), a = T(t), d = $(t.svg, {
190
+ }), a = E(t.svg), r = E(t.svg), s = D(t), d = _(t.svg, {
191
191
  className: "sc-charts__range-circle-left",
192
192
  hidden: !0
193
- }), c = $(t.svg, {
193
+ }), c = _(t.svg, {
194
194
  className: "sc-charts__range-circle-right",
195
195
  hidden: !0
196
- }), m = S(t);
196
+ }), f = U(t);
197
197
  return {
198
- selection: n,
199
- hoverLine: i,
198
+ selection: i,
199
+ hoverLine: n,
200
200
  hoverCircle: o,
201
- rangeBorderLeft: s,
201
+ rangeBorderLeft: a,
202
202
  rangeBorderRight: r,
203
- rangeLine: a,
203
+ rangeLine: s,
204
204
  rangeCircleLeft: d,
205
205
  rangeCircleRight: c,
206
206
  mainLine: e,
207
- rangeLabel: m,
207
+ rangeLabel: f,
208
208
  highlightLine: l
209
209
  };
210
- }, M = (t, e) => {
210
+ }, S = (t, e) => {
211
211
  const {
212
- x: n,
213
- y: i,
212
+ x: i,
213
+ y: n,
214
214
  data: l,
215
215
  elements: o,
216
- config: { margin: s, height: r }
216
+ config: { margin: a, height: r }
217
217
  } = t;
218
218
  o.hoverLine.update({
219
- x1: n(e.date),
220
- x2: n(e.date),
221
- y1: s.top,
222
- y2: r - s.bottom,
219
+ x1: i(e.date),
220
+ x2: i(e.date),
221
+ y1: a.top,
222
+ y2: r - a.bottom,
223
223
  hidden: !1
224
224
  }), o.hoverCircle.update({
225
- cx: n(e.date),
226
- cy: i(e.value),
225
+ cx: i(e.date),
226
+ cy: n(e.value),
227
227
  hidden: !1
228
228
  }), o.highlightLine.update({
229
- data: l.filter((a) => a.date.getFullYear() === e.date.getFullYear() && a.date.getMonth() === e.date.getMonth()),
229
+ data: l.filter((s) => s.date.getFullYear() === e.date.getFullYear() && s.date.getMonth() === e.date.getMonth()),
230
230
  hidden: !1
231
231
  }), o.mainLine.className("add", "_muted");
232
- }, k = (t) => {
232
+ }, w = (t) => {
233
233
  const { elements: e } = t;
234
234
  e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted");
235
- }, D = (t, e) => {
235
+ }, B = (t, e) => {
236
236
  [
237
237
  "rangeBorderLeft",
238
238
  "rangeBorderRight",
@@ -240,67 +240,67 @@ const N = (t) => {
240
240
  "rangeCircleRight",
241
241
  "rangeLine",
242
242
  "rangeLabel"
243
- ].forEach((i) => {
244
- e ? (t[i].className("remove", "_down"), t[i].className("add", "_up")) : (t[i].className("remove", "_up"), t[i].className("add", "_down"));
243
+ ].forEach((n) => {
244
+ e ? (t[n].className("remove", "_down"), t[n].className("add", "_up")) : (t[n].className("remove", "_up"), t[n].className("add", "_down"));
245
245
  });
246
- }, E = (t, e, n) => {
246
+ }, R = (t, e, i) => {
247
247
  const {
248
- x: i,
248
+ x: n,
249
249
  y: l,
250
250
  data: o,
251
- config: { margin: s, height: r },
252
- elements: a
253
- } = t, d = i(e.date) < i(n.date) ? e : n, c = i(e.date) >= i(n.date) ? e : n, m = c.value - d.value >= 0, g = i(d.date), f = i(c.date), h = f - g, v = o.findIndex((p) => p.date.getTime() === d.date.getTime()), y = o.findIndex((p) => p.date.getTime() === c.date.getTime()), x = o.slice(v, y + 1);
254
- a.rangeBorderLeft.update({
255
- x1: g,
256
- x2: g,
257
- y1: s.top,
258
- y2: r - s.bottom,
251
+ config: { margin: a, height: r },
252
+ elements: s
253
+ } = t, d = n(e.date) < n(i.date) ? e : i, c = n(e.date) >= n(i.date) ? e : i, f = c.value - d.value >= 0, C = n(d.date), p = n(c.date), u = p - C, h = o.findIndex((m) => m.date.getTime() === d.date.getTime()), v = o.findIndex((m) => m.date.getTime() === c.date.getTime()), y = o.slice(h, v + 1);
254
+ s.rangeBorderLeft.update({
255
+ x1: C,
256
+ x2: C,
257
+ y1: a.top,
258
+ y2: r - a.bottom,
259
259
  hidden: !1
260
- }), a.rangeBorderRight.update({
261
- x1: f,
262
- x2: f,
263
- y1: s.top,
264
- y2: r - s.bottom,
260
+ }), s.rangeBorderRight.update({
261
+ x1: p,
262
+ x2: p,
263
+ y1: a.top,
264
+ y2: r - a.bottom,
265
265
  hidden: !1
266
- }), a.rangeCircleLeft.update({
267
- cx: g,
266
+ }), s.rangeCircleLeft.update({
267
+ cx: C,
268
268
  cy: l(d.value),
269
269
  hidden: !1
270
- }), a.rangeCircleRight.update({
271
- cx: f,
270
+ }), s.rangeCircleRight.update({
271
+ cx: p,
272
272
  cy: l(c.value),
273
273
  hidden: !1
274
- }), a.rangeLine.update({
275
- data: x,
274
+ }), s.rangeLine.update({
275
+ data: y,
276
276
  hidden: !1
277
- }), a.rangeLabel.update({
277
+ }), s.rangeLabel.update({
278
278
  rightPoint: c,
279
279
  leftPoint: d,
280
- x: g + h / 2,
281
- y: s.top,
280
+ x: C + u / 2,
281
+ y: a.top,
282
282
  hidden: !1
283
- }), D(a, m), a.mainLine.className("add", "_selected-muted");
284
- }, H = (t) => {
283
+ }), B(s, f), s.mainLine.className("add", "_selected-muted");
284
+ }, O = (t) => {
285
285
  const { elements: e } = t;
286
286
  e.selection.update({ hidden: !0 }), e.rangeLine.update({ hidden: !0 }), e.rangeBorderLeft.update({ hidden: !0 }), e.rangeBorderRight.update({ hidden: !0 }), e.rangeCircleLeft.update({ hidden: !0 }), e.rangeCircleRight.update({ hidden: !0 }), e.rangeLabel.update({ hidden: !0 }), e.mainLine.className("remove", "_selected-muted");
287
- }, V = (t) => {
288
- const { svg: e, data: n, x: i, config: l } = t, { height: o, margin: s, width: r } = l;
289
- let a = null, d = !1;
290
- const c = (g) => n.reduce((f, h) => Math.abs(i(f.date) - g) < Math.abs(i(h.date) - g) ? f : h);
291
- e.append("rect").attr("width", r - s.left - s.right).attr("height", o - s.top - s.bottom).attr("x", s.left).attr("y", s.top).attr("fill", "transparent").on("mousemove", function(g) {
292
- const [f] = u.pointer(g, this), h = c(f);
293
- d ? k(t) : M(t, h), a && E(t, a, h);
287
+ }, T = (t) => {
288
+ const { svg: e, data: i, x: n, config: l } = t, { height: o, margin: a, width: r } = l;
289
+ let s = null, d = !1;
290
+ const c = (C) => i.reduce((p, u) => Math.abs(n(p.date) - C) < Math.abs(n(u.date) - C) ? p : u);
291
+ e.append("rect").attr("width", r - a.left - a.right).attr("height", o - a.top - a.bottom).attr("x", a.left).attr("y", a.top).attr("fill", "transparent").on("mousemove", function(C) {
292
+ const [p] = g.pointer(C, this), u = c(p);
293
+ d ? w(t) : S(t, u), s && R(t, s, u);
294
294
  }).on("mouseleave", () => {
295
- k(t);
296
- }).on("mousedown", function(g) {
295
+ w(t);
296
+ }).on("mousedown", function(C) {
297
297
  d = !0;
298
- const [f] = u.pointer(g, this);
299
- a = c(f);
298
+ const [p] = g.pointer(C, this);
299
+ s = c(p);
300
300
  }).on("mouseup", () => {
301
- d = !1, a = null, H(t);
301
+ d = !1, s = null, O(t);
302
302
  });
303
- }, X = {
303
+ }, I = {
304
304
  width: 800,
305
305
  height: 300,
306
306
  margin: { top: 10, right: 30, bottom: 20, left: 0 },
@@ -323,32 +323,32 @@ const N = (t) => {
323
323
  tickValues: null,
324
324
  isShow: !0
325
325
  }
326
- }, Y = (t, e) => {
327
- const n = u.select(t);
328
- if (n.empty())
326
+ }, X = (t, e) => {
327
+ const i = g.select(t);
328
+ if (i.empty())
329
329
  return console.error(`Element with selector ${t} not found!`), null;
330
- const i = n.append("svg");
331
- let l = b(X, e.config);
332
- const o = (s, r = !1) => {
333
- r && s.config && (l = b(l, s.config));
334
- const { width: a, height: d, margin: c } = l, m = s.data.map((v) => ({ date: new Date(v.date), value: v.value })), g = u.scaleTime().domain(u.extent(m, (v) => v.date)).range([c.left, a - c.right]), f = u.scaleLinear().domain(u.extent(m, (v) => v.value)).range([d - c.bottom, c.top]);
335
- i.attr("width", a).attr("height", d).attr("class", `sc-charts sc-charts__${l.theme}`).selectAll("*").remove();
336
- const h = {
337
- svg: i,
338
- data: m,
339
- x: g,
340
- y: f,
330
+ const n = i.append("svg");
331
+ let l = x(I, e.config);
332
+ const o = (a, r = !1) => {
333
+ r && a.config && (l = x(l, a.config));
334
+ const { width: s, height: d, margin: c } = l, f = a.data.map((h) => ({ date: new Date(h.date), value: h.value })), C = g.scaleTime().domain(g.extent(f, (h) => h.date)).range([c.left, s - c.right]), p = g.scaleLinear().domain(g.extent(f, (h) => h.value)).range([d - c.bottom, c.top]);
335
+ n.attr("width", s).attr("height", d).attr("class", `sc-charts sc-charts__${l.theme}`).selectAll("*").remove();
336
+ const u = {
337
+ svg: n,
338
+ data: f,
339
+ x: C,
340
+ y: p,
341
341
  config: l,
342
- elements: L({ svg: i, data: m, x: g, y: f, config: l })
342
+ elements: L({ svg: n, data: f, x: C, y: p, config: l })
343
343
  };
344
- R(h), h.elements = L(h), V(h);
344
+ N(u), u.elements = L(u), T(u);
345
345
  };
346
346
  return o(e), {
347
- update: (s) => o(s, !0),
348
- destroy: () => i.remove()
347
+ update: (a) => o(a, !0),
348
+ destroy: () => n.remove()
349
349
  };
350
350
  };
351
351
  export {
352
- Y as createLineChart
352
+ X as createLineChart
353
353
  };
354
354
  //# sourceMappingURL=charts-core.js.map