chartai 1.0.0 → 1.1.0

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.
Files changed (87) hide show
  1. package/dist/chart-library.d.ts +1 -0
  2. package/dist/chart-library.d.ts.map +1 -1
  3. package/dist/chart-library.js +43 -11
  4. package/dist/chart-library.min.js +1 -1
  5. package/dist/charts/area.js +1 -1
  6. package/dist/charts/area.min.js +1 -1
  7. package/dist/charts/bar.js +1 -1
  8. package/dist/charts/bar.min.js +1 -1
  9. package/dist/charts/boids.js +9 -9
  10. package/dist/charts/boids.min.js +1 -1
  11. package/dist/charts/candlestick.js +5 -127
  12. package/dist/charts/candlestick.min.js +1 -32
  13. package/dist/charts/experimental/baseline-area.js +70 -0
  14. package/dist/charts/experimental/baseline-area.min.js +1 -0
  15. package/dist/charts/experimental/bubble.js +48 -0
  16. package/dist/charts/experimental/bubble.min.js +1 -0
  17. package/dist/charts/experimental/error-band.js +111 -0
  18. package/dist/charts/experimental/error-band.min.js +1 -0
  19. package/dist/charts/experimental/heatmap.js +69 -0
  20. package/dist/charts/experimental/heatmap.min.js +1 -0
  21. package/dist/charts/experimental/histogram.js +139 -0
  22. package/dist/charts/experimental/histogram.min.js +7 -0
  23. package/dist/charts/experimental/ohlc.js +132 -0
  24. package/dist/charts/experimental/ohlc.min.js +32 -0
  25. package/dist/charts/experimental/step.js +67 -0
  26. package/dist/charts/experimental/step.min.js +1 -0
  27. package/dist/charts/experimental/waterfall.js +121 -0
  28. package/dist/charts/experimental/waterfall.min.js +7 -0
  29. package/dist/charts/line.js +1 -1
  30. package/dist/charts/line.min.js +1 -1
  31. package/dist/charts/scatter.js +1 -1
  32. package/dist/charts/scatter.min.js +1 -1
  33. package/dist/{chunk-e7d3zgw5.min.js → chunk-0eh4rzy9.min.js} +1 -1
  34. package/dist/{chunk-a27be8p9.js → chunk-1ngxm8t2.js} +25 -1
  35. package/dist/chunk-50bcv2hw.min.js +2 -0
  36. package/dist/{chunk-dmaxrg6s.min.js → chunk-64q9a7nw.min.js} +1 -1
  37. package/dist/{chunk-me3qaz3m.min.js → chunk-bbyt23tw.min.js} +1 -1
  38. package/dist/chunk-cbydth3q.min.js +2 -0
  39. package/dist/chunk-cvtt04m6.min.js +2 -0
  40. package/dist/chunk-g2qmt43n.min.js +33 -0
  41. package/dist/{chunk-1p45ex5n.min.js → chunk-gm0d4cgx.min.js} +2 -2
  42. package/dist/chunk-mmsy3yqt.js +27 -0
  43. package/dist/{chunk-g6m56ptf.js → chunk-n8ew0z0e.js} +38 -10
  44. package/dist/chunk-t0kdz02m.js +129 -0
  45. package/dist/{chunk-bfyv7z27.min.js → chunk-wdfq2fpx.min.js} +1 -1
  46. package/dist/gpu-worker.js +8 -3
  47. package/dist/gpu-worker.min.js +1 -1
  48. package/dist/plugins/experimental/annotations.js +164 -0
  49. package/dist/plugins/experimental/annotations.min.js +1 -0
  50. package/dist/plugins/experimental/crosshair.js +82 -0
  51. package/dist/plugins/experimental/crosshair.min.js +1 -0
  52. package/dist/plugins/experimental/minimap.js +190 -0
  53. package/dist/plugins/experimental/minimap.min.js +1 -0
  54. package/dist/plugins/experimental/range-selector.js +220 -0
  55. package/dist/plugins/experimental/range-selector.min.js +1 -0
  56. package/dist/plugins/experimental/ruler.js +434 -0
  57. package/dist/plugins/experimental/ruler.min.js +59 -0
  58. package/dist/plugins/experimental/stats.js +229 -0
  59. package/dist/plugins/experimental/stats.min.js +8 -0
  60. package/dist/plugins/experimental/threshold.js +96 -0
  61. package/dist/plugins/experimental/threshold.min.js +1 -0
  62. package/dist/plugins/experimental/tooltip-pin.js +177 -0
  63. package/dist/plugins/experimental/tooltip-pin.min.js +1 -0
  64. package/dist/plugins/experimental/watermark.js +76 -0
  65. package/dist/plugins/experimental/watermark.min.js +1 -0
  66. package/dist/plugins/hover.d.ts.map +1 -1
  67. package/dist/plugins/hover.js +12 -30
  68. package/dist/plugins/hover.min.js +1 -1
  69. package/dist/plugins/labels-panel.js +3 -3
  70. package/dist/plugins/labels-panel.min.js +1 -1
  71. package/dist/plugins/labels.d.ts.map +1 -1
  72. package/dist/plugins/labels.js +3 -3
  73. package/dist/plugins/labels.min.js +1 -1
  74. package/dist/plugins/legend.d.ts.map +1 -1
  75. package/dist/plugins/legend.js +87 -16
  76. package/dist/plugins/legend.min.js +23 -7
  77. package/dist/plugins/zoom.js +2 -2
  78. package/dist/plugins/zoom.min.js +1 -1
  79. package/dist/types.d.ts +8 -0
  80. package/dist/types.d.ts.map +1 -1
  81. package/dist/worker-inline.d.ts +1 -1
  82. package/dist/worker-inline.d.ts.map +1 -1
  83. package/package.json +1 -1
  84. package/readme.md +6 -3
  85. package/dist/chunk-94kc81rr.min.js +0 -2
  86. package/dist/chunk-qr6mweck.min.js +0 -2
  87. /package/dist/{chunk-m17t3vjq.js → chunk-5gtx3pza.js} +0 -0
@@ -0,0 +1,164 @@
1
+ import {
2
+ dataToScreen
3
+ } from "../../chunk-mmsy3yqt.js";
4
+ import {
5
+ DEFAULT_FONT
6
+ } from "../../chunk-1ngxm8t2.js";
7
+ import {
8
+ MARGIN
9
+ } from "../../chunk-831dem4f.js";
10
+ import {
11
+ ChartManager
12
+ } from "../../chunk-n8ew0z0e.js";
13
+ import"../../chunk-93yrr7er.js";
14
+ import"../../chunk-5gtx3pza.js";
15
+
16
+ // src/plugins/experimental/annotations.ts
17
+ var DEFAULT_COLOR = "rgba(100,100,200,0.8)";
18
+ function drawPill(ctx, txt, cx, cy, color, dark, fontFamily) {
19
+ ctx.font = `600 10px ${fontFamily}`;
20
+ const tw = ctx.measureText(txt).width;
21
+ const pw = tw + 12;
22
+ const ph = 18;
23
+ const px = cx - pw / 2;
24
+ const py = cy - ph / 2;
25
+ ctx.beginPath();
26
+ ctx.roundRect(px, py, pw, ph, 4);
27
+ ctx.fillStyle = dark ? "rgba(0,0,0,0.7)" : "rgba(255,255,255,0.9)";
28
+ ctx.fill();
29
+ ctx.strokeStyle = color;
30
+ ctx.lineWidth = 1.5;
31
+ ctx.setLineDash([]);
32
+ ctx.stroke();
33
+ ctx.fillStyle = color;
34
+ ctx.textAlign = "center";
35
+ ctx.textBaseline = "middle";
36
+ ctx.fillText(txt, cx, cy);
37
+ }
38
+ var annotationsPlugin = {
39
+ name: "annotations",
40
+ beforeDraw(ctx, chart) {
41
+ const annotations = chart.config.annotations ?? [];
42
+ const { width: w, height: h } = chart;
43
+ const m = MARGIN;
44
+ const dark = ChartManager.isDark;
45
+ const fontFamily = chart.config.fontFamily ?? DEFAULT_FONT;
46
+ const regions = annotations.filter((a) => a.type === "hregion" || a.type === "vregion");
47
+ if (regions.length === 0)
48
+ return;
49
+ ctx.save();
50
+ ctx.save();
51
+ ctx.beginPath();
52
+ ctx.rect(m.left, m.top, w - m.left - m.right, h - m.top - m.bottom);
53
+ ctx.clip();
54
+ for (const ann of regions) {
55
+ const color = ann.color ?? (dark ? "rgba(255,255,255,0.12)" : "rgba(0,0,0,0.08)");
56
+ const { y: sy1 } = dataToScreen(0, ann.value, chart, w, h);
57
+ const { x: sx1 } = dataToScreen(ann.value, 0, chart, w, h);
58
+ const v2 = ann.value2 ?? ann.value;
59
+ const { y: sy2 } = dataToScreen(0, v2, chart, w, h);
60
+ const { x: sx2 } = dataToScreen(v2, 0, chart, w, h);
61
+ ctx.fillStyle = color;
62
+ if (ann.type === "hregion") {
63
+ const top = Math.min(sy1, sy2);
64
+ const bottom = Math.max(sy1, sy2);
65
+ ctx.fillRect(m.left, top, w - m.left - m.right, bottom - top);
66
+ } else {
67
+ const left = Math.min(sx1, sx2);
68
+ const right = Math.max(sx1, sx2);
69
+ ctx.fillRect(left, m.top, right - left, h - m.top - m.bottom);
70
+ }
71
+ }
72
+ ctx.restore();
73
+ for (const ann of regions) {
74
+ if (!ann.label)
75
+ continue;
76
+ const color = ann.color ?? (dark ? "rgba(255,255,255,0.12)" : "rgba(0,0,0,0.08)");
77
+ const { y: sy1 } = dataToScreen(0, ann.value, chart, w, h);
78
+ const { x: sx1 } = dataToScreen(ann.value, 0, chart, w, h);
79
+ const v2 = ann.value2 ?? ann.value;
80
+ const { y: sy2 } = dataToScreen(0, v2, chart, w, h);
81
+ const { x: sx2 } = dataToScreen(v2, 0, chart, w, h);
82
+ if (ann.type === "hregion") {
83
+ const cy = (sy1 + sy2) / 2;
84
+ if (cy < m.top - 9 || cy > h - m.bottom + 9)
85
+ continue;
86
+ ctx.font = `600 10px ${fontFamily}`;
87
+ const pw = ctx.measureText(ann.label).width + 12;
88
+ const cx = w - m.right - pw / 2 - 4;
89
+ drawPill(ctx, ann.label, cx, cy, color, dark, fontFamily);
90
+ } else {
91
+ ctx.font = `600 10px ${fontFamily}`;
92
+ const tw = ctx.measureText(ann.label).width;
93
+ const pw = tw + 12;
94
+ const cx = (sx1 + sx2) / 2;
95
+ if (cx < m.left - (pw / 2 + 2) || cx > w - m.right + (pw / 2 + 2))
96
+ continue;
97
+ const cy = h - m.bottom / 2;
98
+ drawPill(ctx, ann.label, cx, cy, color, dark, fontFamily);
99
+ }
100
+ }
101
+ ctx.restore();
102
+ },
103
+ afterDraw(ctx, chart) {
104
+ const annotations = chart.config.annotations ?? [];
105
+ const { width: w, height: h } = chart;
106
+ const m = MARGIN;
107
+ const dark = ChartManager.isDark;
108
+ const fontFamily = chart.config.fontFamily ?? DEFAULT_FONT;
109
+ const lines = annotations.filter((a) => a.type === "hline" || a.type === "vline");
110
+ if (lines.length === 0)
111
+ return;
112
+ ctx.save();
113
+ ctx.save();
114
+ ctx.beginPath();
115
+ ctx.rect(m.left, m.top, w - m.left - m.right, h - m.top - m.bottom);
116
+ ctx.clip();
117
+ for (const ann of lines) {
118
+ const color = ann.color ?? DEFAULT_COLOR;
119
+ ctx.strokeStyle = color;
120
+ ctx.lineWidth = ann.lineWidth ?? 1.5;
121
+ ctx.setLineDash(ann.dash ?? []);
122
+ ctx.beginPath();
123
+ if (ann.type === "hline") {
124
+ const { y: sy } = dataToScreen(0, ann.value, chart, w, h);
125
+ ctx.moveTo(m.left, sy);
126
+ ctx.lineTo(w - m.right, sy);
127
+ } else {
128
+ const { x: sx } = dataToScreen(ann.value, 0, chart, w, h);
129
+ ctx.moveTo(sx, m.top);
130
+ ctx.lineTo(sx, h - m.bottom);
131
+ }
132
+ ctx.stroke();
133
+ }
134
+ ctx.restore();
135
+ for (const ann of lines) {
136
+ if (!ann.label)
137
+ continue;
138
+ const color = ann.color ?? DEFAULT_COLOR;
139
+ if (ann.type === "hline") {
140
+ const { y: sy } = dataToScreen(0, ann.value, chart, w, h);
141
+ if (sy < m.top - 9 || sy > h - m.bottom + 9)
142
+ continue;
143
+ ctx.font = `600 10px ${fontFamily}`;
144
+ const tw = ctx.measureText(ann.label).width;
145
+ const pw = tw + 12;
146
+ const cx = w - m.right - pw / 2 - 4;
147
+ drawPill(ctx, ann.label, cx, sy, color, dark, fontFamily);
148
+ } else {
149
+ const { x: sx } = dataToScreen(ann.value, 0, chart, w, h);
150
+ ctx.font = `600 10px ${fontFamily}`;
151
+ const tw = ctx.measureText(ann.label).width;
152
+ const pw = tw + 12;
153
+ if (sx < m.left - (pw / 2 + 2) || sx > w - m.right + (pw / 2 + 2))
154
+ continue;
155
+ const cy = h - m.bottom / 2;
156
+ drawPill(ctx, ann.label, sx, cy, color, dark, fontFamily);
157
+ }
158
+ }
159
+ ctx.restore();
160
+ }
161
+ };
162
+ export {
163
+ annotationsPlugin
164
+ };
@@ -0,0 +1 @@
1
+ import{j as K}from"../../chunk-cbydth3q.js";import{l as N}from"../../chunk-cvtt04m6.js";import{o as M}from"../../chunk-0eh4rzy9.js";import{q as E}from"../../chunk-50bcv2hw.js";import"../../chunk-wdfq2fpx.js";import"../../chunk-bbyt23tw.js";var R="rgba(100,100,200,0.8)";function D(j,H,I,z,B,u,Z){j.font=`600 10px ${Z}`;let W=j.measureText(H).width+12,q=18,Q=I-W/2,J=z-q/2;j.beginPath(),j.roundRect(Q,J,W,q,4),j.fillStyle=u?"rgba(0,0,0,0.7)":"rgba(255,255,255,0.9)",j.fill(),j.strokeStyle=B,j.lineWidth=1.5,j.setLineDash([]),j.stroke(),j.fillStyle=B,j.textAlign="center",j.textBaseline="middle",j.fillText(H,I,z)}var O={name:"annotations",beforeDraw(j,H){let I=H.config.annotations??[],{width:z,height:B}=H,u=M,Z=E.isDark,V=H.config.fontFamily??N,W=I.filter((q)=>q.type==="hregion"||q.type==="vregion");if(W.length===0)return;j.save(),j.save(),j.beginPath(),j.rect(u.left,u.top,z-u.left-u.right,B-u.top-u.bottom),j.clip();for(let q of W){let Q=q.color??(Z?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.08)"),{y:J}=K(0,q.value,H,z,B),{x:b}=K(q.value,0,H,z,B),X=q.value2??q.value,{y:$}=K(0,X,H,z,B),{x:C}=K(X,0,H,z,B);if(j.fillStyle=Q,q.type==="hregion"){let Y=Math.min(J,$),G=Math.max(J,$);j.fillRect(u.left,Y,z-u.left-u.right,G-Y)}else{let Y=Math.min(b,C),G=Math.max(b,C);j.fillRect(Y,u.top,G-Y,B-u.top-u.bottom)}}j.restore();for(let q of W){if(!q.label)continue;let Q=q.color??(Z?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.08)"),{y:J}=K(0,q.value,H,z,B),{x:b}=K(q.value,0,H,z,B),X=q.value2??q.value,{y:$}=K(0,X,H,z,B),{x:C}=K(X,0,H,z,B);if(q.type==="hregion"){let Y=(J+$)/2;if(Y<u.top-9||Y>B-u.bottom+9)continue;j.font=`600 10px ${V}`;let G=j.measureText(q.label).width+12,v=z-u.right-G/2-4;D(j,q.label,v,Y,Q,Z,V)}else{j.font=`600 10px ${V}`;let G=j.measureText(q.label).width+12,v=(b+C)/2;if(v<u.left-(G/2+2)||v>z-u.right+(G/2+2))continue;let U=B-u.bottom/2;D(j,q.label,v,U,Q,Z,V)}}j.restore()},afterDraw(j,H){let I=H.config.annotations??[],{width:z,height:B}=H,u=M,Z=E.isDark,V=H.config.fontFamily??N,W=I.filter((q)=>q.type==="hline"||q.type==="vline");if(W.length===0)return;j.save(),j.save(),j.beginPath(),j.rect(u.left,u.top,z-u.left-u.right,B-u.top-u.bottom),j.clip();for(let q of W){let Q=q.color??R;if(j.strokeStyle=Q,j.lineWidth=q.lineWidth??1.5,j.setLineDash(q.dash??[]),j.beginPath(),q.type==="hline"){let{y:J}=K(0,q.value,H,z,B);j.moveTo(u.left,J),j.lineTo(z-u.right,J)}else{let{x:J}=K(q.value,0,H,z,B);j.moveTo(J,u.top),j.lineTo(J,B-u.bottom)}j.stroke()}j.restore();for(let q of W){if(!q.label)continue;let Q=q.color??R;if(q.type==="hline"){let{y:J}=K(0,q.value,H,z,B);if(J<u.top-9||J>B-u.bottom+9)continue;j.font=`600 10px ${V}`;let X=j.measureText(q.label).width+12,$=z-u.right-X/2-4;D(j,q.label,$,J,Q,Z,V)}else{let{x:J}=K(q.value,0,H,z,B);j.font=`600 10px ${V}`;let X=j.measureText(q.label).width+12;if(J<u.left-(X/2+2)||J>z-u.right+(X/2+2))continue;let $=B-u.bottom/2;D(j,q.label,J,$,Q,Z,V)}}j.restore()}};export{O as annotationsPlugin};
@@ -0,0 +1,82 @@
1
+ import {
2
+ MARGIN
3
+ } from "../../chunk-831dem4f.js";
4
+ import {
5
+ ChartManager
6
+ } from "../../chunk-n8ew0z0e.js";
7
+ import"../../chunk-93yrr7er.js";
8
+ import"../../chunk-5gtx3pza.js";
9
+
10
+ // src/plugins/experimental/crosshair.ts
11
+ var states = new WeakMap;
12
+ var crosshairPlugin = {
13
+ name: "crosshair",
14
+ install(chart, el) {
15
+ const ac = new AbortController;
16
+ const state = {
17
+ mouseX: 0,
18
+ mouseY: 0,
19
+ visible: false,
20
+ abort: ac
21
+ };
22
+ states.set(chart, state);
23
+ el.addEventListener("mousemove", (e) => {
24
+ e.preventDefault();
25
+ if (chart.dragging)
26
+ return;
27
+ const r = el.getBoundingClientRect();
28
+ state.mouseX = e.clientX - r.left;
29
+ state.mouseY = e.clientY - r.top;
30
+ state.visible = true;
31
+ ChartManager.drawChart(chart);
32
+ }, { signal: ac.signal });
33
+ ["mouseleave", "pointerdown"].forEach((ev) => el.addEventListener(ev, () => {
34
+ state.visible = false;
35
+ ChartManager.drawChart(chart);
36
+ }, { signal: ac.signal }));
37
+ },
38
+ afterDraw(ctx, chart) {
39
+ const state = states.get(chart);
40
+ if (!state?.visible)
41
+ return;
42
+ const cfg = chart.config;
43
+ const showX = cfg.crosshairX ?? true;
44
+ const showY = cfg.crosshairY ?? true;
45
+ if (!showX && !showY)
46
+ return;
47
+ const { width: w, height: h } = chart;
48
+ const m = MARGIN;
49
+ const dark = ChartManager.isDark;
50
+ const color = cfg.crosshairColor ?? (dark ? "rgba(255,255,255,0.4)" : "rgba(0,0,0,0.3)");
51
+ const dash = cfg.crosshairDash ?? [4, 3];
52
+ const lineWidth = cfg.crosshairWidth ?? 1;
53
+ const { mouseX: mx, mouseY: my } = state;
54
+ if (mx < m.left || mx > w - m.right || my < m.top || my > h - m.bottom) {
55
+ state.visible = false;
56
+ return;
57
+ }
58
+ ctx.save();
59
+ ctx.strokeStyle = color;
60
+ ctx.lineWidth = lineWidth;
61
+ ctx.setLineDash(dash);
62
+ ctx.beginPath();
63
+ if (showX) {
64
+ ctx.moveTo(mx, m.top);
65
+ ctx.lineTo(mx, h - m.bottom);
66
+ }
67
+ if (showY) {
68
+ ctx.moveTo(m.left, my);
69
+ ctx.lineTo(w - m.right, my);
70
+ }
71
+ ctx.stroke();
72
+ ctx.restore();
73
+ },
74
+ uninstall(chart) {
75
+ const state = states.get(chart);
76
+ state?.abort.abort();
77
+ states.delete(chart);
78
+ }
79
+ };
80
+ export {
81
+ crosshairPlugin
82
+ };
@@ -0,0 +1 @@
1
+ import{o as g}from"../../chunk-0eh4rzy9.js";import{q as m}from"../../chunk-50bcv2hw.js";import"../../chunk-wdfq2fpx.js";import"../../chunk-bbyt23tw.js";var h=new WeakMap,w={name:"crosshair",install(e,s){let n=new AbortController,r={mouseX:0,mouseY:0,visible:!1,abort:n};h.set(e,r),s.addEventListener("mousemove",(o)=>{if(o.preventDefault(),e.dragging)return;let i=s.getBoundingClientRect();r.mouseX=o.clientX-i.left,r.mouseY=o.clientY-i.top,r.visible=!0,m.drawChart(e)},{signal:n.signal}),["mouseleave","pointerdown"].forEach((o)=>s.addEventListener(o,()=>{r.visible=!1,m.drawChart(e)},{signal:n.signal}))},afterDraw(e,s){let n=h.get(s);if(!n?.visible)return;let r=s.config,o=r.crosshairX??!0,i=r.crosshairY??!0;if(!o&&!i)return;let{width:u,height:b}=s,t=g,c=m.isDark,f=r.crosshairColor??(c?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.3)"),C=r.crosshairDash??[4,3],d=r.crosshairWidth??1,{mouseX:a,mouseY:l}=n;if(a<t.left||a>u-t.right||l<t.top||l>b-t.bottom){n.visible=!1;return}if(e.save(),e.strokeStyle=f,e.lineWidth=d,e.setLineDash(C),e.beginPath(),o)e.moveTo(a,t.top),e.lineTo(a,b-t.bottom);if(i)e.moveTo(t.left,l),e.lineTo(u-t.right,l);e.stroke(),e.restore()},uninstall(e){h.get(e)?.abort.abort(),h.delete(e)}};export{w as crosshairPlugin};
@@ -0,0 +1,190 @@
1
+ import {
2
+ MARGIN
3
+ } from "../../chunk-831dem4f.js";
4
+ import {
5
+ ChartManager
6
+ } from "../../chunk-n8ew0z0e.js";
7
+ import"../../chunk-93yrr7er.js";
8
+ import"../../chunk-5gtx3pza.js";
9
+
10
+ // src/plugins/experimental/minimap.ts
11
+ var states = new WeakMap;
12
+ function getMinimapOrigin(pos, mSize, cw, ch) {
13
+ const pad = 8;
14
+ const m = MARGIN;
15
+ switch (pos) {
16
+ case "top-left":
17
+ return { mx: m.left + pad, my: m.top + pad };
18
+ case "top-right":
19
+ return { mx: cw - m.right - mSize - pad, my: m.top + pad };
20
+ case "bottom-left":
21
+ return { mx: m.left + pad, my: ch - m.bottom - mSize - pad };
22
+ case "bottom-right":
23
+ return { mx: cw - m.right - mSize - pad, my: ch - m.bottom - mSize - pad };
24
+ }
25
+ }
26
+ var minimapPlugin = {
27
+ name: "minimap",
28
+ install(chart, el) {
29
+ const ac = new AbortController;
30
+ states.set(chart, { abort: ac, drag: null, didDrag: false });
31
+ const getMinimapCoords = (e) => {
32
+ const cfg = chart.config;
33
+ const mSize = cfg.minimapSize ?? 120;
34
+ const pos = cfg.minimapPosition ?? "bottom-right";
35
+ const { width: cw, height: ch } = chart;
36
+ const r = el.getBoundingClientRect();
37
+ const scaleX = cw / r.width;
38
+ const scaleY = ch / r.height;
39
+ const cx = (e.clientX - r.left) * scaleX;
40
+ const cy = (e.clientY - r.top) * scaleY;
41
+ const { mx, my } = getMinimapOrigin(pos, mSize, cw, ch);
42
+ return { cx, cy, mx, my, mSize };
43
+ };
44
+ el.addEventListener("pointerdown", (e) => {
45
+ const { cx, cy, mx, my, mSize } = getMinimapCoords(e);
46
+ if (cx < mx || cx > mx + mSize || cy < my || cy > my + mSize)
47
+ return;
48
+ e.preventDefault();
49
+ e.stopPropagation();
50
+ el.setPointerCapture(e.pointerId);
51
+ const state = states.get(chart);
52
+ if (!state)
53
+ return;
54
+ const fx = (cx - mx) / mSize;
55
+ const fy = (cy - my) / mSize;
56
+ state.drag = {
57
+ startFx: fx,
58
+ startFy: fy,
59
+ startPanX: chart.view.panX,
60
+ startPanY: chart.view.panY
61
+ };
62
+ }, { signal: ac.signal });
63
+ window.addEventListener("pointermove", (e) => {
64
+ const state = states.get(chart);
65
+ if (!state?.drag)
66
+ return;
67
+ if (e.buttons === 0) {
68
+ state.drag = null;
69
+ return;
70
+ }
71
+ const { cx, cy, mx, my, mSize } = getMinimapCoords(e);
72
+ const fx = (cx - mx) / mSize;
73
+ const fy = (cy - my) / mSize;
74
+ const dfx = fx - state.drag.startFx;
75
+ const dfy = fy - state.drag.startFy;
76
+ const hv = chart.homeView;
77
+ chart.view.panX = Math.max(hv.panX, Math.min(hv.panX + 1 / hv.zoomX - 1 / chart.view.zoomX, state.drag.startPanX + dfx / hv.zoomX));
78
+ chart.view.panY = Math.max(hv.panY, Math.min(hv.panY + 1 / hv.zoomY - 1 / chart.view.zoomY, state.drag.startPanY - dfy / hv.zoomY));
79
+ if (Math.abs(dfx) > 0.005 || Math.abs(dfy) > 0.005)
80
+ state.didDrag = true;
81
+ ChartManager.requestRender(chart.id);
82
+ ChartManager.drawChart(chart);
83
+ }, { signal: ac.signal });
84
+ window.addEventListener("pointerup", () => {
85
+ const state = states.get(chart);
86
+ if (state) {
87
+ if (state.drag) {
88
+ setTimeout(() => {
89
+ if (state)
90
+ state.didDrag = false;
91
+ }, 50);
92
+ }
93
+ state.drag = null;
94
+ }
95
+ }, { signal: ac.signal });
96
+ el.addEventListener("click", (e) => {
97
+ const state = states.get(chart);
98
+ if (!state)
99
+ return;
100
+ if (state.didDrag) {
101
+ state.didDrag = false;
102
+ return;
103
+ }
104
+ const { cx, cy, mx, my, mSize } = getMinimapCoords(e);
105
+ if (cx < mx || cx > mx + mSize || cy < my || cy > my + mSize)
106
+ return;
107
+ e.preventDefault();
108
+ e.stopPropagation();
109
+ const fx = (cx - mx) / mSize;
110
+ const fy = (cy - my) / mSize;
111
+ const fyData = 1 - fy;
112
+ const hv = chart.homeView;
113
+ chart.view.panX = Math.max(hv.panX, Math.min(hv.panX + 1 / hv.zoomX - 1 / chart.view.zoomX, hv.panX + fx / hv.zoomX - 0.5 / chart.view.zoomX));
114
+ chart.view.panY = Math.max(hv.panY, Math.min(hv.panY + 1 / hv.zoomY - 1 / chart.view.zoomY, hv.panY + fyData / hv.zoomY - 0.5 / chart.view.zoomY));
115
+ ChartManager.requestRender(chart.id);
116
+ ChartManager.drawChart(chart);
117
+ }, { signal: ac.signal });
118
+ },
119
+ afterDraw(ctx, chart) {
120
+ const cfg = chart.config;
121
+ const mSize = cfg.minimapSize ?? 120;
122
+ const opacity = cfg.minimapOpacity ?? 0.85;
123
+ const pos = cfg.minimapPosition ?? "bottom-right";
124
+ const { width: cw, height: ch } = chart;
125
+ const dark = ChartManager.isDark;
126
+ const { mx, my } = getMinimapOrigin(pos, mSize, cw, ch);
127
+ const mw = mSize;
128
+ const mh = mSize;
129
+ const borderR = 6;
130
+ const innerPad = 4;
131
+ ctx.save();
132
+ ctx.globalAlpha = opacity;
133
+ const bgColor = cfg.bgColor ?? (dark ? [0.11, 0.11, 0.12] : [0.98, 0.98, 0.98]);
134
+ ctx.fillStyle = `rgb(${bgColor.map((c) => Math.round(c * 255)).join(",")})`;
135
+ ctx.beginPath();
136
+ ctx.roundRect(mx, my, mw, mh, borderR);
137
+ ctx.fill();
138
+ ctx.strokeStyle = dark ? "rgba(255,255,255,0.18)" : "rgba(0,0,0,0.14)";
139
+ ctx.lineWidth = 1;
140
+ ctx.stroke();
141
+ ctx.beginPath();
142
+ ctx.roundRect(mx + 1, my + 1, mw - 2, mh - 2, borderR - 1);
143
+ ctx.clip();
144
+ const { bounds: b } = chart;
145
+ const rangeX = b.maxX - b.minX || 1;
146
+ const rangeY = b.maxY - b.minY || 1;
147
+ for (const series of chart.series) {
148
+ if (series.rawX.length === 0)
149
+ continue;
150
+ const { r, g, b: bv } = series.color;
151
+ ctx.strokeStyle = `rgba(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(bv * 255)},0.7)`;
152
+ ctx.lineWidth = 1;
153
+ ctx.beginPath();
154
+ const step = Math.max(1, Math.floor(series.rawX.length / mw));
155
+ for (let i = 0;i < series.rawX.length; i += step) {
156
+ const px = mx + innerPad + (series.rawX[i] - b.minX) / rangeX * (mw - innerPad * 2);
157
+ const py = my + innerPad + (1 - (series.rawY[i] - b.minY) / rangeY) * (mh - innerPad * 2);
158
+ if (i === 0)
159
+ ctx.moveTo(px, py);
160
+ else
161
+ ctx.lineTo(px, py);
162
+ }
163
+ ctx.stroke();
164
+ }
165
+ const { view: v } = chart;
166
+ const hv = chart.homeView;
167
+ const homeRangeX = 1 / hv.zoomX;
168
+ const homeRangeY = 1 / hv.zoomY;
169
+ const vx = mx + innerPad + (v.panX - hv.panX) * hv.zoomX * (mw - innerPad * 2);
170
+ const vy = my + innerPad + (1 - (v.panY - hv.panY) * hv.zoomY - 1 / v.zoomY / homeRangeY) * (mh - innerPad * 2);
171
+ const vw = 1 / v.zoomX / homeRangeX * (mw - innerPad * 2);
172
+ const vh = 1 / v.zoomY / homeRangeY * (mh - innerPad * 2);
173
+ ctx.fillStyle = dark ? "rgba(255,255,255,0.12)" : "rgba(0,100,255,0.1)";
174
+ ctx.fillRect(vx, vy, vw, vh);
175
+ ctx.strokeStyle = dark ? "rgba(255,255,255,0.5)" : "rgba(0,100,255,0.6)";
176
+ ctx.lineWidth = 1.5;
177
+ ctx.strokeRect(vx, vy, vw, vh);
178
+ ctx.restore();
179
+ },
180
+ uninstall(chart) {
181
+ const s = states.get(chart);
182
+ if (s) {
183
+ s.abort.abort();
184
+ states.delete(chart);
185
+ }
186
+ }
187
+ };
188
+ export {
189
+ minimapPlugin
190
+ };
@@ -0,0 +1 @@
1
+ import{o as M}from"../../chunk-0eh4rzy9.js";import{q as G}from"../../chunk-50bcv2hw.js";import"../../chunk-wdfq2fpx.js";import"../../chunk-bbyt23tw.js";var A=new WeakMap;function b(j,F,Q,W){let q=M;switch(j){case"top-left":return{mx:q.left+8,my:q.top+8};case"top-right":return{mx:Q-q.right-F-8,my:q.top+8};case"bottom-left":return{mx:q.left+8,my:W-q.bottom-F-8};case"bottom-right":return{mx:Q-q.right-F-8,my:W-q.bottom-F-8}}}var g={name:"minimap",install(j,F){let Q=new AbortController;A.set(j,{abort:Q,drag:null,didDrag:!1});let W=(B)=>{let q=j.config,L=q.minimapSize??120,T=q.minimapPosition??"bottom-right",{width:J,height:H}=j,E=F.getBoundingClientRect(),P=J/E.width,U=H/E.height,$=(B.clientX-E.left)*P,K=(B.clientY-E.top)*U,{mx:V,my:Z}=b(T,L,J,H);return{cx:$,cy:K,mx:V,my:Z,mSize:L}};F.addEventListener("pointerdown",(B)=>{let{cx:q,cy:L,mx:T,my:J,mSize:H}=W(B);if(q<T||q>T+H||L<J||L>J+H)return;B.preventDefault(),B.stopPropagation(),F.setPointerCapture(B.pointerId);let E=A.get(j);if(!E)return;let P=(q-T)/H,U=(L-J)/H;E.drag={startFx:P,startFy:U,startPanX:j.view.panX,startPanY:j.view.panY}},{signal:Q.signal}),window.addEventListener("pointermove",(B)=>{let q=A.get(j);if(!q?.drag)return;if(B.buttons===0){q.drag=null;return}let{cx:L,cy:T,mx:J,my:H,mSize:E}=W(B),P=(L-J)/E,U=(T-H)/E,$=P-q.drag.startFx,K=U-q.drag.startFy,V=j.homeView;if(j.view.panX=Math.max(V.panX,Math.min(V.panX+1/V.zoomX-1/j.view.zoomX,q.drag.startPanX+$/V.zoomX)),j.view.panY=Math.max(V.panY,Math.min(V.panY+1/V.zoomY-1/j.view.zoomY,q.drag.startPanY-K/V.zoomY)),Math.abs($)>0.005||Math.abs(K)>0.005)q.didDrag=!0;G.requestRender(j.id),G.drawChart(j)},{signal:Q.signal}),window.addEventListener("pointerup",()=>{let B=A.get(j);if(B){if(B.drag)setTimeout(()=>{if(B)B.didDrag=!1},50);B.drag=null}},{signal:Q.signal}),F.addEventListener("click",(B)=>{let q=A.get(j);if(!q)return;if(q.didDrag){q.didDrag=!1;return}let{cx:L,cy:T,mx:J,my:H,mSize:E}=W(B);if(L<J||L>J+E||T<H||T>H+E)return;B.preventDefault(),B.stopPropagation();let P=(L-J)/E,$=1-(T-H)/E,K=j.homeView;j.view.panX=Math.max(K.panX,Math.min(K.panX+1/K.zoomX-1/j.view.zoomX,K.panX+P/K.zoomX-0.5/j.view.zoomX)),j.view.panY=Math.max(K.panY,Math.min(K.panY+1/K.zoomY-1/j.view.zoomY,K.panY+$/K.zoomY-0.5/j.view.zoomY)),G.requestRender(j.id),G.drawChart(j)},{signal:Q.signal})},afterDraw(j,F){let Q=F.config,W=Q.minimapSize??120,B=Q.minimapOpacity??0.85,q=Q.minimapPosition??"bottom-right",{width:L,height:T}=F,J=G.isDark,{mx:H,my:E}=b(q,W,L,T),P=W,U=W,$=6,K=4;j.save(),j.globalAlpha=B;let V=Q.bgColor??(J?[0.11,0.11,0.12]:[0.98,0.98,0.98]);j.fillStyle=`rgb(${V.map((_)=>Math.round(_*255)).join(",")})`,j.beginPath(),j.roundRect(H,E,P,U,6),j.fill(),j.strokeStyle=J?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.14)",j.lineWidth=1,j.stroke(),j.beginPath(),j.roundRect(H+1,E+1,P-2,U-2,5),j.clip();let{bounds:Z}=F,l=Z.maxX-Z.minX||1,d=Z.maxY-Z.minY||1;for(let _ of F.series){if(_.rawX.length===0)continue;let{r:p,g:o,b:w}=_.color;j.strokeStyle=`rgba(${Math.round(p*255)},${Math.round(o*255)},${Math.round(w*255)},0.7)`,j.lineWidth=1,j.beginPath();let n=Math.max(1,Math.floor(_.rawX.length/P));for(let N=0;N<_.rawX.length;N+=n){let Y=H+4+(_.rawX[N]-Z.minX)/l*(P-8),C=E+4+(1-(_.rawY[N]-Z.minY)/d)*(U-8);if(N===0)j.moveTo(Y,C);else j.lineTo(Y,C)}j.stroke()}let{view:I}=F,D=F.homeView,f=1/D.zoomX,u=1/D.zoomY,O=H+4+(I.panX-D.panX)*D.zoomX*(P-8),X=E+4+(1-(I.panY-D.panY)*D.zoomY-1/I.zoomY/u)*(U-8),k=1/I.zoomX/f*(P-8),R=1/I.zoomY/u*(U-8);j.fillStyle=J?"rgba(255,255,255,0.12)":"rgba(0,100,255,0.1)",j.fillRect(O,X,k,R),j.strokeStyle=J?"rgba(255,255,255,0.5)":"rgba(0,100,255,0.6)",j.lineWidth=1.5,j.strokeRect(O,X,k,R),j.restore()},uninstall(j){let F=A.get(j);if(F)F.abort.abort(),A.delete(j)}};export{g as minimapPlugin};
@@ -0,0 +1,220 @@
1
+ import {
2
+ ChartManager
3
+ } from "../../chunk-n8ew0z0e.js";
4
+ import"../../chunk-93yrr7er.js";
5
+ import"../../chunk-5gtx3pza.js";
6
+
7
+ // src/plugins/experimental/range-selector.ts
8
+ var states = new WeakMap;
9
+ function drawMiniCanvas(chart, state) {
10
+ const { canvas, ctx } = state;
11
+ const w = canvas.width;
12
+ const h = canvas.height;
13
+ const dark = ChartManager.isDark;
14
+ const cfg = chart.config;
15
+ const bgColor = cfg.bgColor ?? (dark ? [0.11, 0.11, 0.12] : [0.98, 0.98, 0.98]);
16
+ ctx.fillStyle = `rgb(${bgColor.map((c) => Math.round(c * 255)).join(",")})`;
17
+ ctx.fillRect(0, 0, w, h);
18
+ const { bounds: b } = chart;
19
+ const rangeX = b.maxX - b.minX || 1;
20
+ const rangeY = b.maxY - b.minY || 1;
21
+ for (const series of chart.series) {
22
+ if (series.rawX.length === 0)
23
+ continue;
24
+ const { r, g, b: bv } = series.color;
25
+ ctx.strokeStyle = `rgba(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(bv * 255)},0.7)`;
26
+ ctx.lineWidth = 1;
27
+ ctx.beginPath();
28
+ const step = Math.max(1, Math.floor(series.rawX.length / w));
29
+ for (let i = 0;i < series.rawX.length; i += step) {
30
+ const sx = (series.rawX[i] - b.minX) / rangeX * w;
31
+ const sy = h - (series.rawY[i] - b.minY) / rangeY * h;
32
+ if (i === 0)
33
+ ctx.moveTo(sx, sy);
34
+ else
35
+ ctx.lineTo(sx, sy);
36
+ }
37
+ ctx.stroke();
38
+ }
39
+ const { view: v } = chart;
40
+ const hv = chart.homeView;
41
+ const homeRange = 1 / hv.zoomX;
42
+ const brushL = (v.panX - hv.panX) / homeRange * w;
43
+ const brushR = (v.panX - hv.panX + 1 / v.zoomX) / homeRange * w;
44
+ const brushColor = cfg.brushColor ?? (dark ? "rgba(255,255,255,0.12)" : "rgba(0,100,255,0.1)");
45
+ const brushBorder = dark ? "rgba(255,255,255,0.35)" : "rgba(0,100,255,0.5)";
46
+ ctx.fillStyle = dark ? "rgba(0,0,0,0.35)" : "rgba(255,255,255,0.5)";
47
+ ctx.fillRect(0, 0, brushL, h);
48
+ ctx.fillRect(brushR, 0, w - brushR, h);
49
+ ctx.fillStyle = brushColor;
50
+ ctx.fillRect(brushL, 0, brushR - brushL, h);
51
+ ctx.strokeStyle = brushBorder;
52
+ ctx.lineWidth = 1.5;
53
+ ctx.strokeRect(brushL, 0.75, brushR - brushL, h - 1.5);
54
+ }
55
+ var rangeSelectorPlugin = {
56
+ name: "range-selector",
57
+ install(chart, el) {
58
+ const cfg = chart.config;
59
+ const height = cfg.rangeSelectorHeight ?? 60;
60
+ const margin = cfg.rangeSelectorMargin ?? 4;
61
+ const ac = new AbortController;
62
+ const canvas = document.createElement("canvas");
63
+ canvas.style.cssText = `display:block;margin-top:${margin}px;`;
64
+ canvas.height = height;
65
+ canvas.width = el.offsetWidth || 400;
66
+ if (el.parentElement) {
67
+ el.parentElement.insertBefore(canvas, el.nextSibling);
68
+ }
69
+ const ctx2d = canvas.getContext("2d");
70
+ const state = {
71
+ canvas,
72
+ ctx: ctx2d,
73
+ abort: ac,
74
+ resizeObserver: null,
75
+ brushDrag: null
76
+ };
77
+ states.set(chart, state);
78
+ const getRelX = (e) => {
79
+ const rect = canvas.getBoundingClientRect();
80
+ return Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
81
+ };
82
+ canvas.addEventListener("mousemove", (e) => {
83
+ if (state.brushDrag)
84
+ return;
85
+ const rx = getRelX(e);
86
+ const { view: v } = chart;
87
+ const hv = chart.homeView;
88
+ const homeRange = 1 / hv.zoomX;
89
+ const brushL = (v.panX - hv.panX) / homeRange;
90
+ const brushR = brushL + hv.zoomX / v.zoomX;
91
+ const edgeTol = 5 / canvas.getBoundingClientRect().width;
92
+ if (Math.abs(rx - brushL) < edgeTol || Math.abs(rx - brushR) < edgeTol) {
93
+ canvas.style.cursor = "ew-resize";
94
+ } else if (rx > brushL && rx < brushR) {
95
+ canvas.style.cursor = "grab";
96
+ } else {
97
+ canvas.style.cursor = "default";
98
+ }
99
+ }, { signal: ac.signal });
100
+ canvas.addEventListener("mousedown", (e) => {
101
+ const rx = getRelX(e);
102
+ const { view: v } = chart;
103
+ const hv = chart.homeView;
104
+ const homeRange = 1 / hv.zoomX;
105
+ const brushL = (v.panX - hv.panX) / homeRange;
106
+ const brushR = brushL + hv.zoomX / v.zoomX;
107
+ const edgeTol = 5 / canvas.getBoundingClientRect().width;
108
+ if (Math.abs(rx - brushL) < edgeTol) {
109
+ state.brushDrag = {
110
+ type: "left",
111
+ startX: rx,
112
+ startPanX: v.panX,
113
+ startZoomX: v.zoomX
114
+ };
115
+ } else if (Math.abs(rx - brushR) < edgeTol) {
116
+ state.brushDrag = {
117
+ type: "right",
118
+ startX: rx,
119
+ startPanX: v.panX,
120
+ startZoomX: v.zoomX
121
+ };
122
+ } else if (rx > brushL && rx < brushR) {
123
+ state.brushDrag = {
124
+ type: "move",
125
+ startX: rx,
126
+ startPanX: v.panX,
127
+ startZoomX: v.zoomX
128
+ };
129
+ canvas.style.cursor = "grabbing";
130
+ } else {
131
+ const hv2 = chart.homeView;
132
+ const homeRange2 = 1 / hv2.zoomX;
133
+ const brushWidth = 1 / v.zoomX;
134
+ const newPanX = Math.max(hv2.panX, Math.min(hv2.panX + homeRange2 - brushWidth, hv2.panX + rx * homeRange2 - brushWidth / 2));
135
+ chart.view.panX = newPanX;
136
+ ChartManager.requestRender(chart.id);
137
+ ChartManager.drawChart(chart);
138
+ drawMiniCanvas(chart, state);
139
+ }
140
+ e.preventDefault();
141
+ }, { signal: ac.signal });
142
+ window.addEventListener("mousemove", (e) => {
143
+ if (!state.brushDrag)
144
+ return;
145
+ const rect = canvas.getBoundingClientRect();
146
+ const rx = (e.clientX - rect.left) / rect.width;
147
+ const dx = rx - state.brushDrag.startX;
148
+ const { startPanX, startZoomX } = state.brushDrag;
149
+ const hv = chart.homeView;
150
+ const homeRange = 1 / hv.zoomX;
151
+ if (state.brushDrag.type === "move") {
152
+ chart.view.panX = Math.max(hv.panX, Math.min(hv.panX + homeRange - 1 / startZoomX, startPanX + dx * homeRange));
153
+ } else if (state.brushDrag.type === "left") {
154
+ const newLeft = Math.max(hv.panX, startPanX + dx * homeRange);
155
+ const newRight = startPanX + 1 / startZoomX;
156
+ if (newLeft < newRight - 0.01) {
157
+ chart.view.panX = newLeft;
158
+ chart.view.zoomX = Math.max(hv.zoomX, 1 / (newRight - newLeft));
159
+ }
160
+ } else if (state.brushDrag.type === "right") {
161
+ const newRight = Math.min(hv.panX + homeRange, startPanX + 1 / startZoomX + dx * homeRange);
162
+ if (newRight > startPanX + 0.01) {
163
+ chart.view.zoomX = Math.max(hv.zoomX, 1 / (newRight - startPanX));
164
+ }
165
+ }
166
+ ChartManager.requestRender(chart.id);
167
+ ChartManager.drawChart(chart);
168
+ drawMiniCanvas(chart, state);
169
+ }, { signal: ac.signal });
170
+ window.addEventListener("mouseup", (e) => {
171
+ state.brushDrag = null;
172
+ const rect = canvas.getBoundingClientRect();
173
+ const rx = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
174
+ const { view: v } = chart;
175
+ const hv = chart.homeView;
176
+ const homeRange = 1 / hv.zoomX;
177
+ const brushL = (v.panX - hv.panX) / homeRange;
178
+ const brushR = brushL + hv.zoomX / v.zoomX;
179
+ const edgeTol = 5 / canvas.getBoundingClientRect().width;
180
+ if (Math.abs(rx - brushL) < edgeTol || Math.abs(rx - brushR) < edgeTol) {
181
+ canvas.style.cursor = "ew-resize";
182
+ } else if (rx > brushL && rx < brushR) {
183
+ canvas.style.cursor = "grab";
184
+ } else {
185
+ canvas.style.cursor = "default";
186
+ }
187
+ }, { signal: ac.signal });
188
+ const ro = new ResizeObserver(() => {
189
+ const w = el.offsetWidth;
190
+ if (w > 0)
191
+ canvas.width = w;
192
+ drawMiniCanvas(chart, state);
193
+ });
194
+ ro.observe(el);
195
+ state.resizeObserver = ro;
196
+ drawMiniCanvas(chart, state);
197
+ },
198
+ afterDraw(_, chart) {
199
+ const state = states.get(chart);
200
+ if (!state)
201
+ return;
202
+ const elW = chart.el.offsetWidth;
203
+ if (elW > 0 && state.canvas.width !== elW) {
204
+ state.canvas.width = elW;
205
+ }
206
+ drawMiniCanvas(chart, state);
207
+ },
208
+ uninstall(chart) {
209
+ const state = states.get(chart);
210
+ if (state) {
211
+ state.abort.abort();
212
+ state.resizeObserver.disconnect();
213
+ state.canvas.remove();
214
+ states.delete(chart);
215
+ }
216
+ }
217
+ };
218
+ export {
219
+ rangeSelectorPlugin
220
+ };