@milaboratories/miplots4 1.0.125 → 1.0.127

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 (118) hide show
  1. package/dist/DataFrame.d.ts +7 -5
  2. package/dist/DataFrame.d.ts.map +1 -1
  3. package/dist/DataFrame.js +67 -60
  4. package/dist/DataFrame.js.map +1 -1
  5. package/dist/bubble/components/Chart.d.ts +3 -3
  6. package/dist/bubble/components/Chart.d.ts.map +1 -1
  7. package/dist/bubble/components/Chart.js +23 -23
  8. package/dist/bubble/components/Chart.js.map +1 -1
  9. package/dist/common/Tooltip.d.ts +1 -1
  10. package/dist/common/Tooltip.d.ts.map +1 -1
  11. package/dist/common/Tooltip.js +17 -17
  12. package/dist/common/Tooltip.js.map +1 -1
  13. package/dist/discrete/components/layers/BinnedDotsElement.d.ts +2 -2
  14. package/dist/discrete/components/layers/BinnedDotsElement.d.ts.map +1 -1
  15. package/dist/discrete/components/layers/BinnedDotsElement.js +9 -9
  16. package/dist/discrete/components/layers/BinnedDotsElement.js.map +1 -1
  17. package/dist/discrete/components/layers/BoxElement.d.ts +2 -2
  18. package/dist/discrete/components/layers/BoxElement.d.ts.map +1 -1
  19. package/dist/discrete/components/layers/BoxElement.js +19 -19
  20. package/dist/discrete/components/layers/BoxElement.js.map +1 -1
  21. package/dist/discrete/components/layers/DotsGroupElement.d.ts +3 -3
  22. package/dist/discrete/components/layers/DotsGroupElement.d.ts.map +1 -1
  23. package/dist/discrete/components/layers/DotsGroupElement.js +10 -10
  24. package/dist/discrete/components/layers/DotsGroupElement.js.map +1 -1
  25. package/dist/discrete/components/layers/ErrorBarElement.d.ts +2 -2
  26. package/dist/discrete/components/layers/ErrorBarElement.d.ts.map +1 -1
  27. package/dist/discrete/components/layers/ErrorBarElement.js +15 -15
  28. package/dist/discrete/components/layers/ErrorBarElement.js.map +1 -1
  29. package/dist/discrete/components/layers/LineElement.d.ts +2 -2
  30. package/dist/discrete/components/layers/LineElement.d.ts.map +1 -1
  31. package/dist/discrete/components/layers/LineElement.js +12 -12
  32. package/dist/discrete/components/layers/LineElement.js.map +1 -1
  33. package/dist/discrete/components/layers/LogoElement.d.ts +2 -2
  34. package/dist/discrete/components/layers/LogoElement.d.ts.map +1 -1
  35. package/dist/discrete/components/layers/LogoElement.js +19 -19
  36. package/dist/discrete/components/layers/LogoElement.js.map +1 -1
  37. package/dist/discrete/components/layers/PairedPointsElement.d.ts +2 -2
  38. package/dist/discrete/components/layers/PairedPointsElement.d.ts.map +1 -1
  39. package/dist/discrete/components/layers/PairedPointsElement.js +37 -37
  40. package/dist/discrete/components/layers/PairedPointsElement.js.map +1 -1
  41. package/dist/discrete/components/layers/StackedBarElement.d.ts +3 -3
  42. package/dist/discrete/components/layers/StackedBarElement.d.ts.map +1 -1
  43. package/dist/discrete/components/layers/StackedBarElement.js +18 -18
  44. package/dist/discrete/components/layers/StackedBarElement.js.map +1 -1
  45. package/dist/discrete/components/layers/ViolinElement.d.ts +4 -4
  46. package/dist/discrete/components/layers/ViolinElement.d.ts.map +1 -1
  47. package/dist/discrete/components/layers/ViolinElement.js +7 -7
  48. package/dist/discrete/components/layers/ViolinElement.js.map +1 -1
  49. package/dist/heatmap/components/Annotations/Annotation.d.ts +2 -2
  50. package/dist/heatmap/components/Annotations/Annotation.d.ts.map +1 -1
  51. package/dist/heatmap/components/Annotations/Annotation.js +16 -16
  52. package/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  53. package/dist/heatmap/components/Chart.d.ts +1 -1
  54. package/dist/heatmap/components/Chart.d.ts.map +1 -1
  55. package/dist/heatmap/components/Chart.js +28 -28
  56. package/dist/heatmap/components/Chart.js.map +1 -1
  57. package/dist/histogram/components/Chart.d.ts +2 -2
  58. package/dist/histogram/components/Chart.d.ts.map +1 -1
  59. package/dist/histogram/components/Chart.js +22 -22
  60. package/dist/histogram/components/Chart.js.map +1 -1
  61. package/dist/node_modules/react/index.js +1 -1
  62. package/dist/node_modules/react-dom/index.js +1 -1
  63. package/dist/scatterplot/components/Chart.d.ts +6 -11
  64. package/dist/scatterplot/components/Chart.d.ts.map +1 -1
  65. package/dist/scatterplot/components/Chart.js +101 -331
  66. package/dist/scatterplot/components/Chart.js.map +1 -1
  67. package/dist/scatterplot/components/ChartAxis.d.ts +20 -0
  68. package/dist/scatterplot/components/ChartAxis.d.ts.map +1 -0
  69. package/dist/scatterplot/components/ChartAxis.js +52 -0
  70. package/dist/scatterplot/components/ChartAxis.js.map +1 -0
  71. package/dist/scatterplot/components/ChartAxisTitles.d.ts +15 -0
  72. package/dist/scatterplot/components/ChartAxisTitles.d.ts.map +1 -0
  73. package/dist/scatterplot/components/ChartAxisTitles.js +56 -0
  74. package/dist/scatterplot/components/ChartAxisTitles.js.map +1 -0
  75. package/dist/scatterplot/components/ChartFacetTitle.d.ts +11 -0
  76. package/dist/scatterplot/components/ChartFacetTitle.d.ts.map +1 -0
  77. package/dist/scatterplot/components/ChartFacetTitle.js +37 -0
  78. package/dist/scatterplot/components/ChartFacetTitle.js.map +1 -0
  79. package/dist/scatterplot/components/ChartLayersData.d.ts +39 -0
  80. package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -0
  81. package/dist/scatterplot/components/ChartLayersData.js +250 -0
  82. package/dist/scatterplot/components/ChartLayersData.js.map +1 -0
  83. package/dist/scatterplot/components/ChartTooltip.d.ts +18 -0
  84. package/dist/scatterplot/components/ChartTooltip.d.ts.map +1 -0
  85. package/dist/scatterplot/components/ChartTooltip.js +58 -0
  86. package/dist/scatterplot/components/ChartTooltip.js.map +1 -0
  87. package/dist/scatterplot/components/ChartTrendsData.d.ts +11 -0
  88. package/dist/scatterplot/components/ChartTrendsData.d.ts.map +1 -0
  89. package/dist/scatterplot/components/ChartTrendsData.js +65 -0
  90. package/dist/scatterplot/components/ChartTrendsData.js.map +1 -0
  91. package/dist/scatterplot/components/ChartsGroup.d.ts +3 -3
  92. package/dist/scatterplot/components/ChartsGroup.d.ts.map +1 -1
  93. package/dist/scatterplot/components/ChartsGroup.js +81 -73
  94. package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
  95. package/dist/scatterplot/dots.d.ts +0 -2
  96. package/dist/scatterplot/dots.d.ts.map +1 -1
  97. package/dist/scatterplot/dots.js +26 -22
  98. package/dist/scatterplot/dots.js.map +1 -1
  99. package/dist/scatterplot-umap/ChartRenderer.d.ts +3 -1
  100. package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
  101. package/dist/scatterplot-umap/ChartRenderer.js +159 -158
  102. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  103. package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
  104. package/dist/scatterplot-umap/components/SVGLayer.js +32 -32
  105. package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
  106. package/dist/scatterplot-umap/components/UpperSVG.d.ts +1 -1
  107. package/dist/scatterplot-umap/components/UpperSVG.d.ts.map +1 -1
  108. package/dist/scatterplot-umap/components/UpperSVG.js +18 -18
  109. package/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  110. package/dist/scatterplot-umap/index.d.ts +2 -2
  111. package/dist/scatterplot-umap/index.d.ts.map +1 -1
  112. package/dist/scatterplot-umap/index.js +26 -25
  113. package/dist/scatterplot-umap/index.js.map +1 -1
  114. package/dist/utils/hooks/useFunction.d.ts +2 -0
  115. package/dist/utils/hooks/useFunction.d.ts.map +1 -0
  116. package/dist/utils/hooks/useFunction.js +9 -0
  117. package/dist/utils/hooks/useFunction.js.map +1 -0
  118. package/package.json +2 -1
@@ -1,69 +1,69 @@
1
- var J = Object.defineProperty;
2
- var Z = (n, t, e) => t in n ? J(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var a = (n, t, e) => Z(n, typeof t != "symbol" ? t + "" : t, e);
1
+ var $ = Object.defineProperty;
2
+ var J = (h, t, e) => t in h ? $(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
+ var a = (h, t, e) => J(h, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { j as E } from "../node_modules/react/jsx-runtime.js";
5
- import { Error as tt } from "../common/Error.js";
6
- import { BLACK as W, DEFAULT_HEIGHT as P, DEFAULT_WIDTH as w, TITLE_LINE_HEIGHT as et, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as st, TITLE_MARGIN as it } from "../constants.js";
7
- import { splitTextByWidth as ot } from "../discrete/utils/splitTextByWidth.js";
8
- import { SVGLayer as at } from "./components/SVGLayer.js";
9
- import { MIN_MARGIN as C, DEFAULT_DOT_AES as R } from "../scatterplot/constants.js";
10
- import { PADDINGS as H, TITLE_LINE as V, LEGEND_OFFSET as rt } from "./constants.js";
5
+ import { Error as Z } from "../common/Error.js";
6
+ import { BLACK as W, DEFAULT_HEIGHT as P, DEFAULT_WIDTH as w, TITLE_LINE_HEIGHT as tt, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as et, TITLE_MARGIN as st } from "../constants.js";
7
+ import { splitTextByWidth as it } from "../discrete/utils/splitTextByWidth.js";
8
+ import { SVGLayer as ot } from "./components/SVGLayer.js";
9
+ import { MIN_MARGIN as b, DEFAULT_DOT_AES as A } from "../scatterplot/constants.js";
10
+ import { PADDINGS as H, TITLE_LINE as I, LEGEND_OFFSET as at } from "./constants.js";
11
11
  import { createAesGetter as D } from "../scatterplot/utils/createAesGetter.js";
12
- import { getTicksAndFormat as lt } from "../scatterplot/utils/getTicksAndFormat.js";
13
- import { getFilteredLabels as k, updateLabelsBBoxes as nt } from "../scatterplot/utils/getVisibleLabels.js";
14
- import { isContinuousAes as q } from "../types/common.js";
12
+ import { getTicksAndFormat as rt } from "../scatterplot/utils/getTicksAndFormat.js";
13
+ import { getFilteredLabels as U, updateLabelsBBoxes as lt } from "../scatterplot/utils/getVisibleLabels.js";
14
+ import { isContinuousAes as B } from "../types/common.js";
15
15
  import "../types/discrete.js";
16
16
  import "../types/scatterplot.js";
17
17
  import "../types/heatmap.js";
18
18
  import "../types/dendro.js";
19
19
  import "../types/histogram.js";
20
20
  import "../types/bubble.js";
21
- import { getContinuousColorScale as ht } from "../utils/getContinuousColorScale.js";
22
- import { getContinuousLegendTicks as ct } from "../utils/getContinuousLegendTicks.js";
23
- import { TextMeasurer as dt } from "../utils/TextMeasurer.js";
24
- import { createRoot as pt } from "../node_modules/react-dom/client.js";
21
+ import { getContinuousColorScale as nt } from "../utils/getContinuousColorScale.js";
22
+ import { getContinuousLegendTicks as ht } from "../utils/getContinuousLegendTicks.js";
23
+ import { TextMeasurer as ct } from "../utils/TextMeasurer.js";
24
+ import { createRoot as dt } from "../node_modules/react-dom/client.js";
25
25
  import mt from "../node_modules/d3-zoom/src/zoom.js";
26
26
  import "../node_modules/d3-zoom/src/transform.js";
27
- import gt from "../node_modules/@d3fc/d3fc-chart/src/cartesian.js";
27
+ import pt from "../node_modules/@d3fc/d3fc-chart/src/cartesian.js";
28
28
  import "../node_modules/@d3fc/d3fc-webgl/src/scale/scaleMapper.js";
29
- import ut from "../node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
30
- import yt from "../node_modules/@d3fc/d3fc-series/src/webgl/point.js";
29
+ import gt from "../node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
30
+ import ut from "../node_modules/@d3fc/d3fc-series/src/webgl/point.js";
31
31
  import ft from "../node_modules/@d3fc/d3fc-series/src/svg/multi.js";
32
- import St from "../node_modules/@d3fc/d3fc-series/src/webgl/multi.js";
33
- import vt from "../node_modules/@d3fc/d3fc-pointer/src/pointer.js";
34
- import { arrangeLegendParts as xt } from "../utils/arrangeLegendParts.js";
35
- import T from "../node_modules/d3-scale/src/linear.js";
36
- import X from "../node_modules/d3-scale/src/log.js";
37
- import N from "../node_modules/d3-selection/src/select.js";
32
+ import yt from "../node_modules/@d3fc/d3fc-series/src/webgl/multi.js";
33
+ import St from "../node_modules/@d3fc/d3fc-pointer/src/pointer.js";
34
+ import { arrangeLegendParts as vt } from "../utils/arrangeLegendParts.js";
35
+ import C from "../node_modules/d3-scale/src/linear.js";
36
+ import V from "../node_modules/d3-scale/src/log.js";
37
+ import T from "../node_modules/d3-selection/src/select.js";
38
38
  import zt from "../node_modules/d3-scale/src/ordinal.js";
39
- import Lt from "../node_modules/d3-scale/src/symlog.js";
40
- import { sqrt as bt } from "../node_modules/d3-scale/src/pow.js";
39
+ import xt from "../node_modules/d3-scale/src/symlog.js";
40
+ import { sqrt as Lt } from "../node_modules/d3-scale/src/pow.js";
41
41
  import { rgb as G } from "../node_modules/d3-color/src/color.js";
42
- import Y from "../node_modules/d3-quadtree/src/quadtree.js";
42
+ import bt from "../node_modules/d3-quadtree/src/quadtree.js";
43
43
  import Ct from "../node_modules/d3-polygon/src/contains.js";
44
- function K(n) {
45
- return n / 2.35 * (n / 2.35) * 64;
44
+ function k(h) {
45
+ return h / 2.35 * (h / 2.35) * 64;
46
46
  }
47
- function O(n, t) {
48
- return n + (1 - n) * (1 - t);
47
+ function F(h, t) {
48
+ return h + (1 - h) * (1 - t);
49
49
  }
50
- function A(n, t) {
50
+ function O(h, t) {
51
51
  return [
52
- O(n.r / 255, t),
53
- O(n.g / 255, t),
54
- O(n.b / 255, t),
52
+ F(h.r / 255, t),
53
+ F(h.g / 255, t),
54
+ F(h.b / 255, t),
55
55
  1
56
56
  ];
57
57
  }
58
- function M(n, t, e) {
59
- return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && Ct(i.points, [n, t]));
58
+ function M(h, t, e) {
59
+ return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && Ct(i.points, [h, t]));
60
60
  }
61
- function j(n, t) {
62
- const e = t.find((h) => h.type === "dots"), i = t.find((h) => h.type === "curve");
61
+ function K(h, t) {
62
+ const e = t.find((c) => c.type === "dots"), i = t.find((c) => c.type === "curve");
63
63
  return {
64
- dotFill: D(n, (e == null ? void 0 : e.aes.dotFill) ?? R.color, "dotFill"),
65
- dotSize: D(n, (e == null ? void 0 : e.aes.dotSize) ?? R.size, "dotSize"),
66
- lineType: D(n, (i == null ? void 0 : i.aes.lineShape) ?? "solid", "lineShape")
64
+ dotFill: D(h, (e == null ? void 0 : e.aes.dotFill) ?? A.color, "dotFill"),
65
+ dotSize: D(h, (e == null ? void 0 : e.aes.dotSize) ?? A.size, "dotSize"),
66
+ lineType: D(h, (i == null ? void 0 : i.aes.lineShape) ?? "solid", "lineShape")
67
67
  };
68
68
  }
69
69
  class me {
@@ -81,10 +81,10 @@ class me {
81
81
  });
82
82
  a(this, "tools", null);
83
83
  a(this, "margins", {
84
- top: C,
85
- bottom: C,
86
- left: C,
87
- right: C
84
+ top: b,
85
+ bottom: b,
86
+ left: b,
87
+ right: b
88
88
  });
89
89
  a(this, "chartSizes", {
90
90
  chartWidth: w,
@@ -97,10 +97,10 @@ class me {
97
97
  // width of all charts in charts height, plus bottom axis, plus top title
98
98
  });
99
99
  a(this, "scales", {
100
- x: T().domain([0, 10]).range([0, w]),
101
- y: T().domain([0, 10]).range([P, 0]),
102
- xOriginal: T().domain([0, 10]).range([0, w]),
103
- yOriginal: T().domain([0, 10]).range([P, 0])
100
+ x: C().domain([0, 10]).range([0, w]),
101
+ y: C().domain([0, 10]).range([P, 0]),
102
+ xOriginal: C().domain([0, 10]).range([0, w]),
103
+ yOriginal: C().domain([0, 10]).range([P, 0])
104
104
  });
105
105
  a(this, "polygons", []);
106
106
  a(this, "onPolygonUpdateOutside", () => {
@@ -109,6 +109,7 @@ class me {
109
109
  });
110
110
  a(this, "onLassoControlsStateUpdate", () => {
111
111
  });
112
+ a(this, "zoomTransform", null);
112
113
  a(this, "zoomStateKey", "");
113
114
  a(this, "selectedDot", null);
114
115
  a(this, "captionsSizes", {
@@ -136,202 +137,202 @@ class me {
136
137
  });
137
138
  }
138
139
  init(t) {
139
- this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.canvasNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.parentNode.appendChild(this.canvasNode), this.reactRoot = pt(this.rootNode));
140
+ this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.canvasNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.parentNode.appendChild(this.canvasNode), this.reactRoot = dt(this.rootNode));
140
141
  }
141
142
  updateChartSizes(t) {
142
143
  this.chartSizes.chartWidth = t.width, this.chartSizes.chartHeight = t.height;
143
144
  }
144
145
  updateViewport(t, e, i) {
145
- const h = t.scale === "log" ? X() : T();
146
- let { minX: l, minY: m, maxX: f, maxY: g } = i;
147
- if (t.lowerValue !== void 0 && (l = Math.max(l, t.lowerValue)), t.upperValue !== void 0 && (f = Math.min(f, t.upperValue)), e.lowerValue !== void 0 && (m = Math.max(m, e.lowerValue)), e.upperValue !== void 0 && (g = Math.min(g, e.upperValue)), t.symmetricRange !== void 0) {
148
- const r = t.symmetricRange;
149
- if (r >= l && r <= f) {
150
- const c = Math.max(r - l, f - r);
151
- l = r - c, f = r + c;
146
+ const c = t.scale === "log" ? V() : C();
147
+ let { minX: n, minY: p, maxX: y, maxY: g } = i;
148
+ if (t.lowerValue !== void 0 && (n = Math.max(n, t.lowerValue)), t.upperValue !== void 0 && (y = Math.min(y, t.upperValue)), e.lowerValue !== void 0 && (p = Math.max(p, e.lowerValue)), e.upperValue !== void 0 && (g = Math.min(g, e.upperValue)), t.symmetricRange !== void 0) {
149
+ const l = t.symmetricRange;
150
+ if (l >= n && l <= y) {
151
+ const d = Math.max(l - n, y - l);
152
+ n = l - d, y = l + d;
152
153
  }
153
154
  }
154
155
  if (typeof e.symmetricRange < "u") {
155
- const r = e.symmetricRange;
156
- if (r >= m && r <= g) {
157
- const c = Math.max(r - m, g - r);
158
- m = r - c, g = r + c;
156
+ const l = e.symmetricRange;
157
+ if (l >= p && l <= g) {
158
+ const d = Math.max(l - p, g - l);
159
+ p = l - d, g = l + d;
159
160
  }
160
161
  }
161
- const x = [0, this.chartSizes.chartWidth], z = h.copy().domain([l, f]).range([H.LEFT, this.chartSizes.chartWidth - H.RIGHT]);
162
- h.domain([z.invert(0), z.invert(this.chartSizes.chartWidth)]).range(x).nice(), this.scales.x = h, this.scales.xOriginal = h.copy();
163
- const d = e.scale === "log" ? X() : T(), o = [this.chartSizes.chartHeight, 0], y = d.copy().domain([m, g]).range([this.chartSizes.chartHeight - H.BOTTOM, H.TOP]);
164
- d.domain([y.invert(this.chartSizes.chartHeight), y.invert(0)]).range(o).nice(), this.scales.y = d, this.scales.yOriginal = d.copy();
162
+ const v = [0, this.chartSizes.chartWidth], z = c.copy().domain([n, y]).range([H.LEFT, this.chartSizes.chartWidth - H.RIGHT]);
163
+ c.domain([z.invert(0), z.invert(this.chartSizes.chartWidth)]).range(v).nice(), this.scales.x = c, this.scales.xOriginal = c.copy();
164
+ const m = e.scale === "log" ? V() : C(), r = [this.chartSizes.chartHeight, 0], f = m.copy().domain([p, g]).range([this.chartSizes.chartHeight - H.BOTTOM, H.TOP]);
165
+ m.domain([f.invert(this.chartSizes.chartHeight), f.invert(0)]).range(r).nice(), this.scales.y = m, this.scales.yOriginal = m.copy();
165
166
  }
166
167
  updateCaptionsSize(t) {
167
- const e = new dt("600 14px Arial");
168
- function i(f) {
169
- return Math.max(...f.map((g) => e.getTextWidth(g)));
168
+ const e = new ct("600 14px Arial");
169
+ function i(y) {
170
+ return Math.max(...y.map((g) => e.getTextWidth(g)));
170
171
  }
171
- const { ticks: h, format: l } = lt(this.scales.y, t), m = i(h.map(l));
172
+ const { ticks: c, format: n } = rt(this.scales.y, t), p = i(c.map(n));
172
173
  this.captionsSizes = {
173
174
  xAxisCaptionsWidth: 20,
174
- yAxisCaptionsWidth: m
175
+ yAxisCaptionsWidth: p
175
176
  };
176
177
  }
177
178
  createMainTitle(t) {
178
- this.mainTitle = ot(
179
+ this.mainTitle = it(
179
180
  t.name,
180
181
  this.chartSizes.totalWidth - this.margins.left - this.margins.right,
181
182
  20
182
183
  );
183
184
  }
184
185
  updateMargins() {
185
- const t = et * this.mainTitle.length, e = t > 0 ? t + it * 2 : 0;
186
+ const t = tt * this.mainTitle.length, e = t > 0 ? t + st * 2 : 0;
186
187
  this.margins = {
187
- top: Math.max(e, C),
188
- bottom: C + this.captionsSizes.xAxisCaptionsWidth + V,
189
- left: C + this.captionsSizes.yAxisCaptionsWidth + V,
190
- right: this.legend.width + C
191
- }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartHeight, this.legend.height) + this.margins.bottom, N(this.canvasNode).style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
188
+ top: Math.max(e, b),
189
+ bottom: b + this.captionsSizes.xAxisCaptionsWidth + I,
190
+ left: b + this.captionsSizes.yAxisCaptionsWidth + I,
191
+ right: this.legend.width + b
192
+ }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartHeight, this.legend.height) + this.margins.bottom, T(this.canvasNode).style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
192
193
  }
193
- updateLegendSize(t, e, i, h) {
194
+ updateLegendSize(t, e, i, c) {
194
195
  if (!t.show) {
195
196
  this.legend = { width: 0, height: 0, items: [] };
196
197
  return;
197
198
  }
198
- const l = [], m = { width: 0, height: 0, left: 0, top: 0 };
199
- if (i.forEach((d) => {
200
- const o = e[d.value];
201
- if (o.usedAes.length === 0 || !o.aesMap)
199
+ const n = [], p = { width: 0, height: 0, left: 0, top: 0 };
200
+ if (i.forEach((m) => {
201
+ const r = e[m.value];
202
+ if (r.usedAes.length === 0 || !r.aesMap)
202
203
  return;
203
- if (o.values.length > st) {
204
- console.warn(`Too many values for discrete legend (${o.values.length})`);
204
+ if (r.values.length > et) {
205
+ console.warn(`Too many values for discrete legend (${r.values.length})`);
205
206
  return;
206
207
  }
207
- const y = {};
208
- o.values.forEach((u) => {
209
- y[u] || (y[u] = { ...R }), o.usedAes.forEach((v) => {
210
- var L, s;
211
- v === "dotFill" && (y[u].color = ((L = o.aesMap[u]) == null ? void 0 : L[v]) ?? W), v === "dotSize" && (y[u].size = ((s = o.aesMap[u]) == null ? void 0 : s[v]) ?? 3);
208
+ const f = {};
209
+ r.values.forEach((u) => {
210
+ f[u] || (f[u] = { ...A }), r.usedAes.forEach((S) => {
211
+ var x, s;
212
+ S === "dotFill" && (f[u].color = ((x = r.aesMap[u]) == null ? void 0 : x[S]) ?? W), S === "dotSize" && (f[u].size = ((s = r.aesMap[u]) == null ? void 0 : s[S]) ?? 3);
212
213
  });
213
214
  });
214
- const r = d.label ?? d.value, c = zt().domain(o.values).range(o.values.map((u) => y[u]));
215
- l.push({ ...m, id: d.value, type: "dots", title: r, scale: c, values: o.values, labels: o.labels });
216
- }), h.forEach((d) => {
217
- if (d.type === "dots" && q(d.aes.dotFill)) {
218
- const { domain: o, range: y, columnName: r, type: c = "linear" } = d.aes.dotFill, u = r.label ?? r.value, v = ht(y, o, "linear"), L = (c === "log" ? Lt() : T()).domain(o).range([this.chartSizes.chartHeight, 0]), s = ct(L, o);
219
- l.push({ ...m, id: "dotFill", type: "continuous", title: u, scale: v, tickPositionScale: L, values: s });
215
+ const l = m.label ?? m.value, d = zt().domain(r.values).range(r.values.map((u) => f[u]));
216
+ n.push({ ...p, id: m.value, type: "dots", title: l, scale: d, values: r.values, labels: r.labels });
217
+ }), c.forEach((m) => {
218
+ if (m.type === "dots" && B(m.aes.dotFill)) {
219
+ const { domain: r, range: f, columnName: l, type: d = "linear" } = m.aes.dotFill, u = l.label ?? l.value, S = nt(f, r, "linear"), x = (d === "log" ? xt() : C()).domain(r).range([this.chartSizes.chartHeight, 0]), s = ht(x, r);
220
+ n.push({ ...p, id: "dotFill", type: "continuous", title: u, scale: S, tickPositionScale: x, values: s });
220
221
  }
221
- if (d.type === "dots" && q(d.aes.dotSize)) {
222
- const { columnName: o, domain: y, range: r } = d.aes.dotSize, c = o.label ?? o.value, u = bt(y, r), v = u.ticks(3), L = u.tickFormat(3), s = v.reduce((p, b) => (p[String(b)] = L(b), p), {});
223
- l.push({ ...m, id: o.value, type: "size", title: c, scale: u, values: v, labels: s });
222
+ if (m.type === "dots" && B(m.aes.dotSize)) {
223
+ const { columnName: r, domain: f, range: l } = m.aes.dotSize, d = r.label ?? r.value, u = Lt(f, l), S = u.ticks(3), x = u.tickFormat(3), s = S.reduce((o, L) => (o[String(L)] = x(L), o), {});
224
+ n.push({ ...p, id: r.value, type: "size", title: d, scale: u, values: S, labels: s });
224
225
  }
225
- }), !l.length) {
226
+ }), !n.length) {
226
227
  this.legend = { width: 0, height: 0, items: [] };
227
228
  return;
228
229
  }
229
- const f = xt(l, this.chartSizes.chartHeight), g = f[f.length - 1], x = g.left + g.width + rt, z = this.chartSizes.chartHeight;
230
+ const y = vt(n, this.chartSizes.chartHeight), g = y[y.length - 1], v = g.left + g.width + at, z = this.chartSizes.chartHeight;
230
231
  this.legend = {
231
- width: x,
232
+ width: v,
232
233
  height: z,
233
- items: f
234
+ items: y
234
235
  };
235
236
  }
236
- initSettings(t, e, i, h, l, m, f) {
237
- const { xAxis: g, yAxis: x, size: z, title: d, legend: o } = e;
238
- this.updateChartSizes(z), this.updateViewport(g, x, i), this.updateCaptionsSize(h.y), this.updateLegendSize(o, l, f, m), this.createMainTitle(d), this.updateMargins(), this.aesGetters = j(l, m);
239
- const y = ut().data(t).value((s) => {
240
- const p = G(this.aesGetters.dotFill(s.data)), b = !s.dimmed && M(s.x, s.y, this.polygons) ? 1 : 0.4;
241
- return A(p, b);
242
- }), r = yt().equals((s, p) => s === p).size((s) => K(this.aesGetters.dotSize(s.data))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => y(s)), c = mt().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey).on("start", () => {
237
+ initSettings(t, e, i, c, n, p, y) {
238
+ const { xAxis: g, yAxis: v, size: z, title: m, legend: r } = e;
239
+ this.updateChartSizes(z), this.updateViewport(g, v, i), this.updateCaptionsSize(c.y), this.updateLegendSize(r, n, y, p), this.createMainTitle(m), this.updateMargins(), this.aesGetters = K(n, p);
240
+ const f = gt().data(t).value((s) => {
241
+ const o = G(this.aesGetters.dotFill(s.data)), L = !s.dimmed && M(s.x, s.y, this.polygons) ? 1 : 0.4;
242
+ return O(o, L);
243
+ }), l = ut().equals((s, o) => s === o).size((s) => k(this.aesGetters.dotSize(s.data))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => f(s)), d = mt().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey || s.ctrlKey).on("start", () => {
243
244
  this.selectedDot = null;
244
245
  }).on("zoom", (s) => {
245
- const p = s.transform, b = p.rescaleX(this.scales.xOriginal), F = p.rescaleY(this.scales.yOriginal);
246
- this.scales.x.domain(b.domain()), this.scales.y.domain(F.domain()), this.zoomStateKey = `${p.x}_${p.y}_${p.k}`, this.renderSvgLayer(), this.renderWebglLayer();
246
+ const o = s.transform, L = o.rescaleX(this.scales.xOriginal), N = o.rescaleY(this.scales.yOriginal);
247
+ this.scales.x.domain(L.domain()), this.scales.y.domain(N.domain()), this.zoomTransform = o, this.zoomStateKey = `${o.x}_${o.y}_${o.k}`, this.renderSvgLayer(), this.renderWebglLayer();
247
248
  }).on("end", () => {
248
249
  this.allPossibleLabels.forEach((s) => {
249
250
  s.x = this.scales.x(s.dot.x), s.y = this.scales.y(s.dot.y);
250
- }), this.visibleLabels = k(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.renderSvgLayer();
251
- }), u = Y().x((s) => this.scales.xOriginal(s.x)).y((s) => this.scales.yOriginal(s.y)).addAll(t), v = vt().on("point", ([s]) => {
252
- var U, B;
253
- if (!s) {
254
- this.selectedDot = null, this.renderSvgLayer();
255
- return;
251
+ }), this.visibleLabels = U(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.renderSvgLayer();
252
+ }), u = this.createQuadtree(t), S = St().on("point", ([s]) => {
253
+ var N, R, _;
254
+ let o;
255
+ if (s) {
256
+ const q = this.scales.x.invert(s.x), X = this.scales.y.invert(s.y), Y = this.scales.xOriginal(q), j = this.scales.yOriginal(X), Q = 20 / (((N = this.zoomTransform) == null ? void 0 : N.k) || 1);
257
+ o = (R = this.tools) == null ? void 0 : R.qt.find(Y, j, Q);
256
258
  }
257
- const p = this.scales.x.invert(s.x), b = this.scales.y.invert(s.y), F = this.scales.xOriginal(p), $ = this.scales.yOriginal(b);
258
- let S = (U = this.tools) == null ? void 0 : U.qt.find(F, $);
259
- const _ = this.scales.x((S == null ? void 0 : S.x) ?? 0), I = this.scales.y((S == null ? void 0 : S.y) ?? 0);
260
- (Math.abs(s.x - _) > 20 || Math.abs(s.y - I) > 20 || Math.sqrt((s.x - _) ** 2 + (s.y - I) ** 2) > 20) && (S = void 0);
261
- const Q = this.selectedDot && !S || !this.selectedDot && S || ((B = this.selectedDot) == null ? void 0 : B.id) !== (S == null ? void 0 : S.id);
262
- this.selectedDot = S ?? null, Q && this.renderSvgLayer();
263
- }), L = gt({
259
+ const L = this.selectedDot && !o || !this.selectedDot && o || ((_ = this.selectedDot) == null ? void 0 : _.id) !== (o == null ? void 0 : o.id);
260
+ this.selectedDot = o ?? null, L && this.renderSvgLayer();
261
+ }), x = pt({
264
262
  xScale: this.scales.x,
265
263
  yScale: this.scales.y
266
264
  }).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(ft()).webglPlotArea(
267
265
  // only render the point series on the WebGL layer
268
- St().series([r]).mapping((s) => s)
266
+ yt().series([l]).mapping((s) => s)
269
267
  ).decorate((s) => {
270
- const p = s.enter();
271
- p && !this.svgLayerElement && (p.style("grid-template-columns", "0 auto 1fr auto 0"), p.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = p.select(".svg-plot-area.plot-area svg").node()), p.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(c).call(v);
268
+ const o = s.enter();
269
+ o && !this.svgLayerElement && (o.style("grid-template-columns", "0 auto 1fr auto 0"), o.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = o.select(".svg-plot-area.plot-area svg").node()), o.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(d).call(S);
272
270
  });
273
271
  this.tools = {
274
- webglChart: L,
275
- zoom: c,
272
+ webglChart: x,
273
+ zoom: d,
276
274
  qt: u,
277
- fillColor: y,
278
- pointSeries: r
279
- }, N(this.canvasNode).datum(t).style("position", "absolute").style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
275
+ fillColor: f,
276
+ pointSeries: l
277
+ }, T(this.canvasNode).datum(t).style("position", "absolute").style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
280
278
  }
281
279
  updateAes(t, e) {
282
- this.tools !== null && (this.aesGetters = j(t, e), this.tools.fillColor.value((i) => {
283
- const h = this.aesGetters.dotFill ?? (() => W), l = G(h(i.data)), m = !i.dimmed && M(i.x, i.y, this.polygons) ? 1 : 0.4;
284
- return A(l, m);
280
+ this.tools !== null && (this.aesGetters = K(t, e), this.tools.fillColor.value((i) => {
281
+ const c = this.aesGetters.dotFill ?? (() => W), n = G(c(i.data)), p = !i.dimmed && M(i.x, i.y, this.polygons) ? 1 : 0.4;
282
+ return O(n, p);
285
283
  }));
286
284
  }
287
285
  updatePointSize() {
288
- this.tools !== null && (N(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => K(this.aesGetters.dotSize(t.data))));
286
+ this.tools !== null && (T(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => k(this.aesGetters.dotSize(t.data))));
289
287
  }
290
288
  updateByLasso() {
291
289
  var t;
292
290
  this.tools !== null && ((t = this.tools) == null || t.fillColor.value((e) => {
293
- const i = this.aesGetters.dotFill ?? (() => W), h = G(i(e.data)), l = !e.dimmed && M(e.x, e.y, this.polygons) ? 1 : 0.4;
294
- return A(h, l);
291
+ const i = this.aesGetters.dotFill ?? (() => W), c = G(i(e.data)), n = !e.dimmed && M(e.x, e.y, this.polygons) ? 1 : 0.4;
292
+ return O(c, n);
295
293
  }), this.renderWebglLayer());
296
294
  }
295
+ createQuadtree(t) {
296
+ return bt().x((e) => this.scales.xOriginal(e.x)).y((e) => this.scales.yOriginal(e.y)).addAll(t);
297
+ }
297
298
  updateData(t) {
298
- this.tools !== null && (N(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt = Y().x((e) => e.x).y((e) => e.y).addAll(t));
299
+ this.tools !== null && (T(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt = this.createQuadtree(t));
299
300
  }
300
- render(t, e, i, h, l, m, f, g, x, z, d, o, y, r) {
301
+ render(t, e, i, c, n, p, y, g, v, z, m, r, f, l) {
301
302
  if (this.tools === null)
302
303
  this.initSettings(
303
- l,
304
+ n,
304
305
  e,
305
- m,
306
- h,
307
- x,
306
+ p,
307
+ c,
308
+ v,
308
309
  g,
309
310
  z
310
- ), this.onPolygonUpdateOutside = o, this.onTooltipHintSwitch = y, this.onLassoControlsStateUpdate = r;
311
+ ), this.onPolygonUpdateOutside = r, this.onTooltipHintSwitch = f, this.onLassoControlsStateUpdate = l;
311
312
  else {
312
- const { title: c, legend: u } = e;
313
- this.updateLegendSize(u, x, z, g), this.createMainTitle(c), this.updateMargins(), this.updateAes(x, g);
313
+ const { title: d, legend: u } = e;
314
+ this.updateLegendSize(u, v, z, g), this.createMainTitle(d), this.updateMargins(), this.updateAes(v, g);
314
315
  }
315
- this.allDots = l, this.allPossibleLabels = d, this.allPossibleLabels.forEach((c) => {
316
- c.x = this.scales.x(c.dot.x), c.y = this.scales.y(c.dot.y);
317
- }), this.visibleLabels = k(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.notCalculatedProps = {
316
+ this.allDots = n, this.allPossibleLabels = m, this.allPossibleLabels.forEach((d) => {
317
+ d.x = this.scales.x(d.dot.x), d.y = this.scales.y(d.dot.y);
318
+ }), this.visibleLabels = U(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.notCalculatedProps = {
318
319
  settingsId: t,
319
320
  chartSettings: e,
320
- onlyPositive: h,
321
+ onlyPositive: c,
321
322
  keyColumn: i,
322
- dotsByGrouping: f,
323
+ dotsByGrouping: y,
323
324
  layers: g
324
325
  }, this.renderWebglLayer(), this.renderSvgLayer();
325
326
  }
326
327
  renderWebglLayer() {
327
328
  var t, e;
328
- (t = this.tools) != null && t.webglChart && N(this.canvasNode).call((e = this.tools) == null ? void 0 : e.webglChart);
329
+ (t = this.tools) != null && t.webglChart && T(this.canvasNode).call((e = this.tools) == null ? void 0 : e.webglChart);
329
330
  }
330
331
  renderSvgLayer() {
331
332
  var e;
332
333
  this.visibleLabels.forEach((i) => {
333
334
  i.x = this.scales.x(i.dot.x), i.y = this.scales.y(i.dot.y);
334
- }), nt(this.visibleLabels);
335
+ }), lt(this.visibleLabels);
335
336
  const t = {
336
337
  settingsId: this.notCalculatedProps.settingsId,
337
338
  chartSettings: this.notCalculatedProps.chartSettings,
@@ -355,11 +356,11 @@ class me {
355
356
  onTooltipHintSwitch: this.onTooltipHintSwitch,
356
357
  onLassoControlsStateUpdate: this.onLassoControlsStateUpdate
357
358
  };
358
- this.svgLayerComponent = /* @__PURE__ */ E.jsx(at, { ...t }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
359
+ this.svgLayerComponent = /* @__PURE__ */ E.jsx(ot, { ...t }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
359
360
  }
360
361
  renderError(t) {
361
362
  var e;
362
- (e = this.reactRoot) == null || e.render(/* @__PURE__ */ E.jsx(tt, { message: t }));
363
+ (e = this.reactRoot) == null || e.render(/* @__PURE__ */ E.jsx(Z, { message: t }));
363
364
  }
364
365
  }
365
366
  export {