@milaboratories/miplots4 1.0.126 → 1.0.128

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