@milaboratories/miplots4 1.0.127 → 1.0.129

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 (52) hide show
  1. package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
  2. package/dist/heatmap/ChartRenderer.js +251 -233
  3. package/dist/heatmap/ChartRenderer.js.map +1 -1
  4. package/dist/heatmap/components/Captions/GroupCaptions.d.ts.map +1 -1
  5. package/dist/heatmap/components/Captions/GroupCaptions.js +45 -36
  6. package/dist/heatmap/components/Captions/GroupCaptions.js.map +1 -1
  7. package/dist/heatmap/components/Chart.d.ts.map +1 -1
  8. package/dist/heatmap/components/Chart.js +71 -69
  9. package/dist/heatmap/components/Chart.js.map +1 -1
  10. package/dist/heatmap/components/Dendrograms.d.ts +3 -1
  11. package/dist/heatmap/components/Dendrograms.d.ts.map +1 -1
  12. package/dist/heatmap/components/Dendrograms.js +54 -48
  13. package/dist/heatmap/components/Dendrograms.js.map +1 -1
  14. package/dist/heatmap/components/types.d.ts +2 -2
  15. package/dist/heatmap/components/types.d.ts.map +1 -1
  16. package/dist/heatmap/getDendrograms.d.ts +2 -2
  17. package/dist/heatmap/getDendrograms.d.ts.map +1 -1
  18. package/dist/heatmap/getDendrograms.js +36 -36
  19. package/dist/heatmap/getDendrograms.js.map +1 -1
  20. package/dist/heatmap/utils/calculateCaptionTails.d.ts +2 -2
  21. package/dist/heatmap/utils/calculateCaptionTails.d.ts.map +1 -1
  22. package/dist/heatmap/utils/calculateCaptionTails.js +89 -54
  23. package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  24. package/dist/heatmap/utils/calculateChartSideElementSizes.js +19 -19
  25. package/dist/heatmap/utils/calculateChartSideElementSizes.js.map +1 -1
  26. package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
  27. package/dist/scatterplot/ChartRenderer.js +191 -178
  28. package/dist/scatterplot/ChartRenderer.js.map +1 -1
  29. package/dist/scatterplot/components/ChartsGroup.js +3 -3
  30. package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
  31. package/dist/scatterplot-umap/ChartRenderer.d.ts +3 -9
  32. package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
  33. package/dist/scatterplot-umap/ChartRenderer.js +183 -186
  34. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  35. package/dist/scatterplot-umap/components/Lasso.d.ts.map +1 -1
  36. package/dist/scatterplot-umap/components/Lasso.js +141 -117
  37. package/dist/scatterplot-umap/components/Lasso.js.map +1 -1
  38. package/dist/scatterplot-umap/components/LowerSVG.d.ts +1 -5
  39. package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
  40. package/dist/scatterplot-umap/components/LowerSVG.js +59 -60
  41. package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  42. package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
  43. package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
  44. package/dist/scatterplot-umap/components/SVGLayer.js +29 -31
  45. package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
  46. package/dist/scatterplot-umap/index.d.ts +0 -4
  47. package/dist/scatterplot-umap/index.d.ts.map +1 -1
  48. package/dist/scatterplot-umap/index.js +92 -97
  49. package/dist/scatterplot-umap/index.js.map +1 -1
  50. package/dist/scatterplot-umap/types.d.ts +0 -4
  51. package/dist/scatterplot-umap/types.d.ts.map +1 -1
  52. package/package.json +1 -1
@@ -1,108 +1,108 @@
1
- var P = Object.defineProperty;
2
- var V = (l, i, t) => i in l ? P(l, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[i] = t;
3
- var C = (l, i, t) => V(l, typeof i != "symbol" ? i + "" : i, t);
4
- import { j as W } from "../node_modules/react/jsx-runtime.js";
5
- import { Error as q } from "../common/Error.js";
6
- import { DEFAULT_HEIGHT as _, DEFAULT_WIDTH as R, TITLE_LINE_HEIGHT as Q, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as Z, BLACK as U, TITLE_MARGIN as $ } from "../constants.js";
7
- import { FACET_TITLE_LINE as J } from "../discrete/constants.js";
8
- import { splitTextByWidth as L } from "../discrete/utils/splitTextByWidth.js";
9
- import { MIN_MARGIN as A, PADDINGS as D, DEFAULT_DOT_AES as F, LEGEND_OFFSET as k, TICK_OFFSET as v, DEFAULT_TICKS_SIZE as X, MIN_PADDING as I, FACET_TITLE_OFFSET as K, FACET_AXIS_OFFSET as G, TITLE_LINE as B } from "./constants.js";
10
- import { createAesGetter as Y } from "./utils/createAesGetter.js";
11
- import { getTicksAndFormat as y } from "./utils/getTicksAndFormat.js";
12
- import { isContinuousAes as O } from "../types/common.js";
1
+ var $ = Object.defineProperty;
2
+ var J = (h, i, t) => i in h ? $(h, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[i] = t;
3
+ var E = (h, i, t) => J(h, typeof i != "symbol" ? i + "" : i, t);
4
+ import { j as L } from "../node_modules/react/jsx-runtime.js";
5
+ import { Error as k } from "../common/Error.js";
6
+ import { DEFAULT_HEIGHT as X, DEFAULT_WIDTH as G, TITLE_LINE_HEIGHT as K, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as y, BLACK as Z, TITLE_MARGIN as tt } from "../constants.js";
7
+ import { FACET_TITLE_LINE as it } from "../discrete/constants.js";
8
+ import { splitTextByWidth as U } from "../discrete/utils/splitTextByWidth.js";
9
+ import { MIN_MARGIN as W, PADDINGS as B, DEFAULT_DOT_AES as R, LEGEND_OFFSET as et, TICK_OFFSET as O, DEFAULT_TICKS_SIZE as j, MIN_PADDING as D, FACET_TITLE_OFFSET as st, FACET_AXIS_OFFSET as P, TITLE_LINE as V } from "./constants.js";
10
+ import { createAesGetter as _ } from "./utils/createAesGetter.js";
11
+ import { getTicksAndFormat as ot } from "./utils/getTicksAndFormat.js";
12
+ import { isContinuousAes as q } from "../types/common.js";
13
13
  import "../types/discrete.js";
14
14
  import "../types/scatterplot.js";
15
15
  import "../types/heatmap.js";
16
16
  import "../types/dendro.js";
17
17
  import "../types/histogram.js";
18
18
  import "../types/bubble.js";
19
- import { getContinuousColorScale as tt } from "../utils/getContinuousColorScale.js";
20
- import { getContinuousLegendTicks as it } from "../utils/getContinuousLegendTicks.js";
21
- import { TextMeasurer as et } from "../utils/TextMeasurer.js";
22
- import { createRoot as st } from "../node_modules/react-dom/client.js";
23
- import { ChartsGroup as ot } from "./components/ChartsGroup.js";
24
- import { arrangeLegendParts as nt } from "../utils/arrangeLegendParts.js";
25
- import H from "../node_modules/d3-scale/src/linear.js";
26
- import j from "../node_modules/d3-scale/src/log.js";
27
- import ht from "../node_modules/d3-scale/src/ordinal.js";
28
- import at from "../node_modules/d3-scale/src/symlog.js";
29
- import { sqrt as rt } from "../node_modules/d3-scale/src/pow.js";
30
- function lt(l, i, t, e) {
19
+ import { getContinuousColorScale as nt } from "../utils/getContinuousColorScale.js";
20
+ import { getContinuousLegendTicks as at } from "../utils/getContinuousLegendTicks.js";
21
+ import { TextMeasurer as ht } from "../utils/TextMeasurer.js";
22
+ import { createRoot as rt } from "../node_modules/react-dom/client.js";
23
+ import { ChartsGroup as lt } from "./components/ChartsGroup.js";
24
+ import { arrangeLegendParts as ct } from "../utils/arrangeLegendParts.js";
25
+ import b from "../node_modules/d3-scale/src/linear.js";
26
+ import Q from "../node_modules/d3-scale/src/log.js";
27
+ import mt from "../node_modules/d3-scale/src/ordinal.js";
28
+ import dt from "../node_modules/d3-scale/src/symlog.js";
29
+ import { sqrt as pt } from "../node_modules/d3-scale/src/pow.js";
30
+ function ut(h, i, t, e) {
31
31
  const s = [];
32
- return l % t === t - 1 && s.push("right"), l % t === 0 && s.push("left"), l < t && s.push("top"), (Math.ceil((l + 1) / t) === e || Math.ceil((l + 1) / t) === e - 1 && l % t > (i - 1) % t) && s.push("bottom"), s;
32
+ return h % t === t - 1 && s.push("right"), h % t === 0 && s.push("left"), h < t && s.push("top"), (Math.ceil((h + 1) / t) === e || Math.ceil((h + 1) / t) === e - 1 && h % t > (i - 1) % t) && s.push("bottom"), s;
33
33
  }
34
- function ct(l, i, t, e, s, r, u) {
35
- const g = r.includes("left") || !(u != null && u.sharedY), M = r.includes("left") && i.title !== "", N = r.includes("bottom") || !(u != null && u.sharedX), z = r.includes("bottom") && l.title !== "", c = t.yAxisCaptionsWidth + 2 * v, a = (i.showTicks ? X : 0) + v, d = M ? B + I : 0, T = t.xAxisCaptionsWidth + 2 * v, E = l.showTicks ? X : 0, n = z ? B + I : 0, o = c + a + d + G, p = T + E + n + G, h = Math.max(...e.map((m) => s[m].length));
34
+ function gt(h, i, t, e, s, a, p) {
35
+ const u = a.includes("left") || !(p != null && p.sharedY), F = a.includes("left") && i.title !== "", H = a.includes("bottom") || !(p != null && p.sharedX), N = a.includes("bottom") && h.title !== "", r = t.yAxisCaptionsWidth + 2 * O, o = (i.showTicks ? j : 0) + O, d = F ? V + D : 0, x = t.xAxisCaptionsWidth + 2 * O, z = h.showTicks ? j : 0, l = N ? V + D : 0, c = r + o + d + P, f = x + z + l + P, S = Math.max(...e.map((m) => s[m].length));
36
36
  return {
37
- left: g ? o : I,
38
- top: h === 0 ? 0 : K * 2 + h * J,
39
- bottom: N ? p + 8 : I,
40
- right: I
37
+ left: u ? c : D,
38
+ top: S === 0 ? 0 : st * 2 + S * it,
39
+ bottom: H ? f + 8 : D,
40
+ right: D
41
41
  };
42
42
  }
43
- function mt(l, i, t) {
43
+ function ft(h, i, t) {
44
44
  const e = [];
45
45
  for (let s = 0; s < i; s++)
46
- e.push(l.slice(s * t, s * t + t));
46
+ e.push(h.slice(s * t, s * t + t));
47
47
  return e;
48
48
  }
49
- function dt(l, i) {
50
- const t = Math.floor(l / i), e = l - t * i;
49
+ function Tt(h, i) {
50
+ const t = Math.floor(h / i), e = h - t * i;
51
51
  return [t, e];
52
52
  }
53
- function pt(l, i, t) {
54
- const e = i.find((r) => r.type === "dots"), s = i.find((r) => r.type === "curve");
53
+ function St(h, i, t) {
54
+ const e = i.find((a) => a.type === "dots"), s = i.find((a) => a.type === "curve");
55
55
  return {
56
- dotShape: Y(l, (e == null ? void 0 : e.aes.dotShape) ?? F.shape, "dotShape"),
57
- dotColor: Y(l, (e == null ? void 0 : e.aes.dotFill) ?? F.color, "dotFill"),
58
- dotSize: Y(l, (e == null ? void 0 : e.aes.dotSize) ?? F.size, "dotSize"),
59
- lineShape: Y(l, (s == null ? void 0 : s.aes.lineShape) ?? "solid", "lineShape"),
60
- lineColor: Y(l, (s == null ? void 0 : s.aes.lineColor) ?? U, "lineColor"),
61
- trendColor: Y(l, (t == null ? void 0 : t.color) ?? F.color, "fillColor")
56
+ dotShape: _(h, (e == null ? void 0 : e.aes.dotShape) ?? R.shape, "dotShape"),
57
+ dotColor: _(h, (e == null ? void 0 : e.aes.dotFill) ?? R.color, "dotFill"),
58
+ dotSize: _(h, (e == null ? void 0 : e.aes.dotSize) ?? R.size, "dotSize"),
59
+ lineShape: _(h, (s == null ? void 0 : s.aes.lineShape) ?? "solid", "lineShape"),
60
+ lineColor: _(h, (s == null ? void 0 : s.aes.lineColor) ?? Z, "lineColor"),
61
+ trendColor: _(h, (t == null ? void 0 : t.color) ?? R.color, "fillColor")
62
62
  };
63
63
  }
64
- class Ot {
64
+ class qt {
65
65
  constructor() {
66
- C(this, "reactRoot", null);
67
- C(this, "parentNode", null);
68
- C(this, "rootNode", null);
69
- C(this, "component", /* @__PURE__ */ W.jsx(W.Fragment, {}));
70
- C(this, "margins", {
71
- top: A,
72
- bottom: A,
73
- left: A,
74
- right: A
66
+ E(this, "reactRoot", null);
67
+ E(this, "parentNode", null);
68
+ E(this, "rootNode", null);
69
+ E(this, "component", /* @__PURE__ */ L.jsx(L.Fragment, {}));
70
+ E(this, "margins", {
71
+ top: W,
72
+ bottom: W,
73
+ left: W,
74
+ right: W
75
75
  });
76
- C(this, "chartsDimensions", {});
77
- C(this, "chartSizes", {
78
- chartWidth: R,
76
+ E(this, "chartsDimensions", {});
77
+ E(this, "chartSizes", {
78
+ chartWidth: G,
79
79
  // width of single chart
80
- chartHeight: _,
80
+ chartHeight: X,
81
81
  // height of single chart
82
- chartsWidth: R,
82
+ chartsWidth: G,
83
83
  // width of all charts in charts row
84
- chartsHeight: _,
84
+ chartsHeight: X,
85
85
  // width of all charts in charts column, without axes
86
- totalWidth: R,
86
+ totalWidth: G,
87
87
  // width of all charts in charts row, plus left axis, plus legend
88
- totalHeight: _
88
+ totalHeight: X
89
89
  // width of all charts in charts height, plus bottom axis, plus top title
90
90
  });
91
- C(this, "columnsCount", 1);
92
- C(this, "rowsCount", 1);
93
- C(this, "scales", {
94
- x: { null: H().domain([0, 10]).range([0, R]) },
95
- y: { null: H().domain([0, 10]).range([_, 0]) }
91
+ E(this, "columnsCount", 1);
92
+ E(this, "rowsCount", 1);
93
+ E(this, "scales", {
94
+ x: { null: b().domain([0, 10]).range([0, G]) },
95
+ y: { null: b().domain([0, 10]).range([X, 0]) }
96
96
  });
97
- C(this, "captionsSizes", {
97
+ E(this, "captionsSizes", {
98
98
  xAxisCaptionsWidth: 30,
99
99
  yAxisCaptionsWidth: 100
100
100
  });
101
- C(this, "facetTitles", {});
101
+ E(this, "facetTitles", {});
102
102
  // can be multiline
103
- C(this, "mainTitle", []);
103
+ E(this, "mainTitle", []);
104
104
  // can be multiline
105
- C(this, "legend", { width: 0, height: 0, items: [] });
105
+ E(this, "legend", { width: 0, height: 0, items: [] });
106
106
  }
107
107
  clear() {
108
108
  var i;
@@ -112,94 +112,107 @@ class Ot {
112
112
  });
113
113
  }
114
114
  init(i) {
115
- this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = st(this.rootNode));
115
+ this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = rt(this.rootNode));
116
116
  }
117
117
  updateChartSizes(i) {
118
118
  this.chartSizes.chartWidth = i.width, this.chartSizes.chartHeight = i.height;
119
119
  }
120
120
  updateChartDimensions(i, t, e, s) {
121
- const { chartWidth: r, chartHeight: u } = this.chartSizes;
122
- let g = 0, M = 0;
123
- this.chartsDimensions = i.reduce((c, a, d) => {
124
- const [T, E] = dt(d, this.columnsCount), n = lt(d, i.length, this.columnsCount, this.rowsCount), o = ct(
121
+ const { chartWidth: a, chartHeight: p } = this.chartSizes;
122
+ let u = 0, F = 0;
123
+ this.chartsDimensions = i.reduce((r, o, d) => {
124
+ const [x, z] = Tt(d, this.columnsCount), l = ut(d, i.length, this.columnsCount, this.rowsCount), c = gt(
125
125
  e,
126
126
  s,
127
127
  this.captionsSizes,
128
- mt(i, this.rowsCount, this.columnsCount)[T],
128
+ ft(i, this.rowsCount, this.columnsCount)[x],
129
129
  this.facetTitles,
130
- n,
130
+ l,
131
131
  t
132
- ), p = r + o.left + o.right, h = u + o.top + o.bottom;
133
- return c[a] = {
134
- left: g,
135
- top: M,
136
- chartEdgeSides: n,
137
- padding: o,
138
- inner: { width: r, height: u },
139
- outer: { width: p, height: h }
140
- }, g += p, E === this.columnsCount - 1 && (g = 0, M += h), c;
132
+ ), f = a + c.left + c.right, S = p + c.top + c.bottom;
133
+ return r[o] = {
134
+ left: u,
135
+ top: F,
136
+ chartEdgeSides: l,
137
+ padding: c,
138
+ inner: { width: a, height: p },
139
+ outer: { width: f, height: S }
140
+ }, u += f, z === this.columnsCount - 1 && (u = 0, F += S), r;
141
141
  }, {});
142
- const N = Math.max(
143
- ...i.map((c) => this.chartsDimensions[c].outer.width + this.chartsDimensions[c].left)
144
- ), z = Math.max(
145
- ...i.map((c) => this.chartsDimensions[c].outer.height + this.chartsDimensions[c].top)
142
+ const H = Math.max(
143
+ ...i.map((r) => this.chartsDimensions[r].outer.width + this.chartsDimensions[r].left)
144
+ ), N = Math.max(
145
+ ...i.map((r) => this.chartsDimensions[r].outer.height + this.chartsDimensions[r].top)
146
146
  );
147
- this.chartSizes.chartsWidth = N, this.chartSizes.chartsHeight = z;
147
+ this.chartSizes.chartsWidth = H, this.chartSizes.chartsHeight = N;
148
148
  }
149
- updateViewport(i, t, e, s, r, u) {
150
- const g = i.length, M = Math.min(t.nRows ?? g, g), N = Math.min(t.nCols ?? g, g);
151
- this.columnsCount = t.nRows ? Math.ceil(g / M) : N, this.rowsCount = Math.ceil(g / this.columnsCount);
152
- let [z, c] = [1 / 0, -1 / 0], [a, d] = [1 / 0, -1 / 0];
153
- const T = i.reduce((n, o) => {
154
- const p = r[o], { minX: h, minY: m, maxX: f, maxY: x } = p;
155
- return z = Math.min(z, h), a = Math.min(a, m), c = Math.max(c, f), d = Math.max(d, x), n[o] = { minX: h, maxX: f, minY: m, maxY: x }, n;
156
- }, {});
157
- i.forEach((n) => {
158
- const o = e.scale === "log" ? j() : H(), p = T[n];
159
- let h = e.lowerValue ? Number(e.lowerValue) : t.sharedX ? z : p.minX, m = e.upperValue ? Number(e.upperValue) : t.sharedX ? c : p.maxX;
149
+ updateViewport(i, t, e, s, a, p) {
150
+ const u = i.length, F = Math.min(t.nRows ?? u, u), H = Math.min(t.nCols ?? u, u);
151
+ this.columnsCount = t.nRows ? Math.ceil(u / F) : H, this.rowsCount = Math.ceil(u / this.columnsCount);
152
+ let [N, r] = [1 / 0, -1 / 0], [o, d] = [1 / 0, -1 / 0];
153
+ const x = i.reduce((m, n) => {
154
+ const w = a[n], { minX: g, minY: T, maxX: Y, maxY: A } = w;
155
+ return N = Math.min(N, g), o = Math.min(o, T), r = Math.max(r, Y), d = Math.max(d, A), m[n] = { minX: g, maxX: Y, minY: T, maxY: A }, m;
156
+ }, {}), z = {}, l = {};
157
+ let c = !1, f = !1;
158
+ i.forEach((m) => {
159
+ const n = e.scale === "log" ? Q() : b(), w = x[m];
160
+ let g = e.lowerValue ? Number(e.lowerValue) : t.sharedX ? N : w.minX, T = e.upperValue ? Number(e.upperValue) : t.sharedX ? r : w.maxX;
160
161
  if (typeof e.symmetricRange < "u") {
161
- const S = e.symmetricRange;
162
- if (S >= h && S <= m) {
163
- const w = Math.max(S - h, m - S);
164
- h = S - w, m = S + w;
162
+ const M = e.symmetricRange;
163
+ if (M >= g && M <= T) {
164
+ const C = Math.max(M - g, T - M);
165
+ g = M - C, T = M + C;
165
166
  }
166
167
  }
167
- const f = [0, this.chartSizes.chartWidth], x = o.copy().domain([h, m]).range([D.LEFT, this.chartSizes.chartWidth - D.RIGHT]);
168
- o.domain([x.invert(0), x.invert(this.chartSizes.chartWidth)]).range(f).nice(), this.scales.x[n] = o;
168
+ const Y = [0, this.chartSizes.chartWidth], A = n.copy().domain([g, T]).range([B.LEFT, this.chartSizes.chartWidth - B.RIGHT]);
169
+ n.domain([A.invert(0), A.invert(this.chartSizes.chartWidth)]).range(Y).nice();
170
+ const I = this.scales.x[m];
171
+ if (I && !c) {
172
+ const M = I.domain(), C = I.domain();
173
+ (M[0] !== n.domain()[0] || M[1] !== n.domain()[1] || C[0] !== n.range()[0] || C[1] !== n.range()[1]) && (c = !0);
174
+ }
175
+ z[m] = n;
169
176
  });
170
- const E = i.reduce((n, o) => {
171
- const p = u ? u[o] : [];
172
- return n[o] = p.reduce(
173
- (h, m) => {
174
- const f = m.bounded ? m.xBounds : this.scales.x[o].domain(), x = m.getInterval(f[0]), S = m.getInterval(f[1]);
175
- return h.minY = Math.min(h.minY, isNaN(x.left) ? h.minY : x.left, isNaN(S.left) ? h.minY : S.left), h.maxY = Math.max(h.maxY, isNaN(x.right) ? h.maxY : x.right, isNaN(S.right) ? h.maxY : S.right), h;
177
+ const S = i.reduce((m, n) => {
178
+ const w = p ? p[n] : [];
179
+ return m[n] = w.reduce(
180
+ (g, T) => {
181
+ const Y = T.bounded ? T.xBounds : this.scales.x[n].domain(), A = T.getInterval(Y[0]), I = T.getInterval(Y[1]);
182
+ return g.minY = Math.min(g.minY, isNaN(A.left) ? g.minY : A.left, isNaN(I.left) ? g.minY : I.left), g.maxY = Math.max(g.maxY, isNaN(A.right) ? g.maxY : A.right, isNaN(I.right) ? g.maxY : I.right), g;
176
183
  },
177
184
  { minY: 1 / 0, maxY: -1 / 0 }
178
- ), a = Math.min(a, n[o].minY), d = Math.max(d, n[o].maxY), n;
185
+ ), o = Math.min(o, m[n].minY), d = Math.max(d, m[n].maxY), m;
179
186
  }, {});
180
- i.forEach((n) => {
181
- const o = s.scale === "log" ? j() : H(), p = T[n], h = E[n];
182
- let m = s.lowerValue ? Number(s.lowerValue) : t.sharedY ? a : Math.min(p.minY, h.minY), f = s.upperValue ? Number(s.upperValue) : t.sharedY ? d : Math.max(p.maxY, h.maxY);
187
+ i.forEach((m) => {
188
+ const n = s.scale === "log" ? Q() : b(), w = x[m], g = S[m];
189
+ let T = s.lowerValue ? Number(s.lowerValue) : t.sharedY ? o : Math.min(w.minY, g.minY), Y = s.upperValue ? Number(s.upperValue) : t.sharedY ? d : Math.max(w.maxY, g.maxY);
183
190
  if (typeof s.symmetricRange < "u") {
184
- const w = s.symmetricRange;
185
- if (w >= m && w <= f) {
186
- const b = Math.max(w - m, f - w);
187
- m = w - b, f = w + b;
191
+ const C = s.symmetricRange;
192
+ if (C >= T && C <= Y) {
193
+ const v = Math.max(C - T, Y - C);
194
+ T = C - v, Y = C + v;
188
195
  }
189
196
  }
190
- const x = [this.chartSizes.chartHeight, 0], S = o.copy().domain([m, f]).range([this.chartSizes.chartHeight - D.BOTTOM, D.TOP]);
191
- o.domain([S.invert(this.chartSizes.chartHeight), S.invert(0)]).range(x).nice(), this.scales.y[n] = o;
192
- });
197
+ const A = [this.chartSizes.chartHeight, 0], I = n.copy().domain([T, Y]).range([this.chartSizes.chartHeight - B.BOTTOM, B.TOP]);
198
+ n.domain([I.invert(this.chartSizes.chartHeight), I.invert(0)]).range(A).nice();
199
+ const M = this.scales.y[m];
200
+ if (M && !f) {
201
+ const C = M.domain(), v = M.domain();
202
+ (C[0] !== n.domain()[0] || C[1] !== n.domain()[1] || v[0] !== n.range()[0] || v[1] !== n.range()[1]) && (f = !0);
203
+ }
204
+ l[m] = n;
205
+ }), c && (this.scales.x = z), f && (this.scales.y = l);
193
206
  }
194
207
  updateCaptionsSize(i) {
195
- const t = new et("600 14px Arial");
208
+ const t = new ht("600 14px Arial");
196
209
  let e = 0;
197
- function s(r) {
198
- return Math.max(...r.map((u) => t.getTextWidth(u)));
210
+ function s(a) {
211
+ return Math.max(...a.map((p) => t.getTextWidth(p)));
199
212
  }
200
- Object.values(this.scales.y).forEach((r) => {
201
- const { ticks: u, format: g } = y(r, i);
202
- e = Math.max(e, s(u.map(g)));
213
+ Object.values(this.scales.y).forEach((a) => {
214
+ const { ticks: p, format: u } = ot(a, i);
215
+ e = Math.max(e, s(p.map(u)));
203
216
  }), this.captionsSizes = {
204
217
  xAxisCaptionsWidth: 20,
205
218
  yAxisCaptionsWidth: e
@@ -207,22 +220,22 @@ class Ot {
207
220
  }
208
221
  createMainTitle(i, t) {
209
222
  const e = this.chartsDimensions[i[0]], s = this.chartsDimensions[i[i.length - 1]];
210
- this.mainTitle = L(
223
+ this.mainTitle = U(
211
224
  t.name,
212
225
  this.chartSizes.chartsWidth - e.padding.left - s.padding.right,
213
226
  20
214
227
  );
215
228
  }
216
229
  createFacetTitles(i, t) {
217
- this.facetTitles = i.reduce((e, s, r) => (t[r].length === 1 && t[r][0] === "null" ? e[s] = [] : e[s] = L(t[r].join(", "), this.chartSizes.chartWidth, 14), e), {});
230
+ this.facetTitles = i.reduce((e, s, a) => (t[a].length === 1 && t[a][0] === "null" ? e[s] = [] : e[s] = U(t[a].join(", "), this.chartSizes.chartWidth, 14), e), {});
218
231
  }
219
232
  updateMargins() {
220
- const i = Q * this.mainTitle.length, t = i > 0 ? i + $ * 2 : 0;
233
+ const i = K * this.mainTitle.length, t = i > 0 ? i + tt * 2 : 0;
221
234
  this.margins = {
222
- top: Math.max(t, A),
223
- bottom: A,
224
- left: A,
225
- right: this.legend.width + A
235
+ top: Math.max(t, W),
236
+ bottom: W,
237
+ left: W,
238
+ right: this.legend.width + W
226
239
  }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartsHeight, this.legend.height) + this.margins.bottom;
227
240
  }
228
241
  updateLegendSize(i, t, e, s) {
@@ -230,50 +243,50 @@ class Ot {
230
243
  this.legend = { width: 0, height: 0, items: [] };
231
244
  return;
232
245
  }
233
- const r = [], u = { width: 0, height: 0, left: 0, top: 0 };
234
- if (e.forEach((c) => {
235
- const a = t[c.value];
236
- if (a.usedAes.length === 0 || !a.aesMap)
246
+ const a = [], p = { width: 0, height: 0, left: 0, top: 0 };
247
+ if (e.forEach((r) => {
248
+ const o = t[r.value];
249
+ if (o.usedAes.length === 0 || !o.aesMap)
237
250
  return;
238
- if (a.values.length > Z) {
239
- console.warn(`Too many values for discrete legend (${a.values.length})`);
251
+ if (o.values.length > y) {
252
+ console.warn(`Too many values for discrete legend (${o.values.length})`);
240
253
  return;
241
254
  }
242
255
  const d = {};
243
- a.values.forEach((n) => {
244
- d[n] || (d[n] = { ...F }), a.usedAes.forEach((o) => {
245
- var p, h, m;
246
- (o === "dotFill" || o === "lineColor") && (d[n].color = ((p = a.aesMap[n]) == null ? void 0 : p[o]) ?? U), o === "dotShape" && (d[n].shape = ((h = a.aesMap[n]) == null ? void 0 : h[o]) ?? "21"), o === "dotSize" && (d[n].size = ((m = a.aesMap[n]) == null ? void 0 : m[o]) ?? 3);
256
+ o.values.forEach((l) => {
257
+ d[l] || (d[l] = { ...R }), o.usedAes.forEach((c) => {
258
+ var f, S, m;
259
+ (c === "dotFill" || c === "lineColor") && (d[l].color = ((f = o.aesMap[l]) == null ? void 0 : f[c]) ?? Z), c === "dotShape" && (d[l].shape = ((S = o.aesMap[l]) == null ? void 0 : S[c]) ?? "21"), c === "dotSize" && (d[l].size = ((m = o.aesMap[l]) == null ? void 0 : m[c]) ?? 3);
247
260
  });
248
261
  });
249
- const T = c.label ?? c.value, E = ht().domain(a.values).range(a.values.map((n) => d[n])).unknown(F);
250
- r.push({ ...u, id: c.value, type: "dots", title: T, scale: E, values: a.values, labels: a.labels });
251
- }), s.forEach((c) => {
252
- if (c.type === "dots" && O(c.aes.dotFill)) {
253
- const { domain: a, range: d, columnName: T, type: E = "linear" } = c.aes.dotFill, n = T.label ?? T.value, o = tt(d, a, "linear"), p = (E === "log" ? at() : H()).domain(a).range([this.chartSizes.chartHeight, 0]), h = it(p, a);
254
- r.push({ ...u, id: "dotFill", type: "continuous", title: n, scale: o, tickPositionScale: p, values: h });
262
+ const x = r.label ?? r.value, z = mt().domain(o.values).range(o.values.map((l) => d[l])).unknown(R);
263
+ a.push({ ...p, id: r.value, type: "dots", title: x, scale: z, values: o.values, labels: o.labels });
264
+ }), s.forEach((r) => {
265
+ if (r.type === "dots" && q(r.aes.dotFill)) {
266
+ const { domain: o, range: d, columnName: x, type: z = "linear" } = r.aes.dotFill, l = x.label ?? x.value, c = nt(d, o, "linear"), f = (z === "log" ? dt() : b()).domain(o).range([this.chartSizes.chartHeight, 0]), S = at(f, o);
267
+ a.push({ ...p, id: "dotFill", type: "continuous", title: l, scale: c, tickPositionScale: f, values: S });
255
268
  }
256
- if (c.type === "dots" && O(c.aes.dotSize)) {
257
- const { columnName: a, domain: d, range: T } = c.aes.dotSize, E = a.label ?? a.value, n = rt(d, T), o = n.ticks(3), p = n.tickFormat(3), h = o.reduce((m, f) => (m[String(f)] = p(f), m), {});
258
- r.push({ ...u, id: a.value, type: "size", title: E, scale: n, values: o, labels: h });
269
+ if (r.type === "dots" && q(r.aes.dotSize)) {
270
+ const { columnName: o, domain: d, range: x } = r.aes.dotSize, z = o.label ?? o.value, l = pt(d, x), c = l.ticks(3), f = l.tickFormat(3), S = c.reduce((m, n) => (m[String(n)] = f(n), m), {});
271
+ a.push({ ...p, id: o.value, type: "size", title: z, scale: l, values: c, labels: S });
259
272
  }
260
- }), !r.length) {
273
+ }), !a.length) {
261
274
  this.legend = { width: 0, height: 0, items: [] };
262
275
  return;
263
276
  }
264
- const g = nt(r, this.chartSizes.chartHeight), M = g[g.length - 1], N = M.left + M.width + k, z = this.chartSizes.chartHeight;
277
+ const u = ct(a, this.chartSizes.chartHeight), F = u[u.length - 1], H = F.left + F.width + et, N = this.chartSizes.chartHeight;
265
278
  this.legend = {
266
- width: N,
267
- height: z,
268
- items: g
279
+ width: H,
280
+ height: N,
281
+ items: u
269
282
  };
270
283
  }
271
- render(i, t, e, s, r, u, g, M, N, z, c, a, d, T, E) {
272
- var x;
273
- const { xAxis: n, yAxis: o, size: p, title: h, legend: m } = t;
274
- this.updateChartSizes(p), this.updateViewport(s, e, n, o, u, g), this.updateCaptionsSize(N.y), this.createFacetTitles(s, r), this.updateChartDimensions(s, e, n, o), this.updateLegendSize(m, z, a, d), this.createMainTitle(s, h), this.updateMargins();
275
- const f = /* @__PURE__ */ W.jsx(
276
- ot,
284
+ render(i, t, e, s, a, p, u, F, H, N, r, o, d, x, z) {
285
+ var w;
286
+ const { xAxis: l, yAxis: c, size: f, title: S, legend: m } = t;
287
+ this.updateChartSizes(f), this.updateViewport(s, e, l, c, p, u), this.updateCaptionsSize(H.y), this.createFacetTitles(s, a), this.updateChartDimensions(s, e, l, c), this.updateLegendSize(m, N, o, d), this.createMainTitle(s, S), this.updateMargins();
288
+ const n = /* @__PURE__ */ L.jsx(
289
+ lt,
277
290
  {
278
291
  settingsId: i,
279
292
  chartSettings: t,
@@ -282,29 +295,29 @@ class Ot {
282
295
  chartSizes: this.chartSizes,
283
296
  chartsDimensions: this.chartsDimensions,
284
297
  scales: this.scales,
285
- groupedDots: u,
286
- trendsData: g,
298
+ groupedDots: p,
299
+ trendsData: u,
287
300
  legendData: this.legend,
288
301
  columnsCount: this.columnsCount,
289
302
  margins: this.margins,
290
- keyColumn: M,
303
+ keyColumn: F,
291
304
  mainTitle: this.mainTitle,
292
305
  facetTitles: this.facetTitles,
293
306
  captionsSizes: this.captionsSizes,
294
- onlyPositive: N,
295
- layersData: c,
296
- aesGetters: pt(z, d, T),
297
- onTooltipHintSwitch: E
307
+ onlyPositive: H,
308
+ layersData: r,
309
+ aesGetters: St(N, d, x),
310
+ onTooltipHintSwitch: z
298
311
  }
299
312
  );
300
- this.component = f, (x = this.reactRoot) == null || x.render(f);
313
+ this.component = n, (w = this.reactRoot) == null || w.render(n);
301
314
  }
302
315
  renderError(i) {
303
316
  var t;
304
- (t = this.reactRoot) == null || t.render(/* @__PURE__ */ W.jsx(q, { message: i }));
317
+ (t = this.reactRoot) == null || t.render(/* @__PURE__ */ L.jsx(k, { message: i }));
305
318
  }
306
319
  }
307
320
  export {
308
- Ot as default
321
+ qt as default
309
322
  };
310
323
  //# sourceMappingURL=ChartRenderer.js.map