@milaboratories/miplots4 1.0.171 → 1.0.172

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  var st = Object.defineProperty;
2
2
  var ot = (a, t, i) => t in a ? st(a, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[t] = i;
3
- var S = (a, t, i) => ot(a, typeof t != "symbol" ? t + "" : t, i);
4
- import { j as v } from "../_virtual/jsx-runtime.js";
3
+ var M = (a, t, i) => ot(a, typeof t != "symbol" ? t + "" : t, i);
4
+ import { j as F } from "../_virtual/jsx-runtime.js";
5
5
  import { c as nt } from "../_virtual/client.js";
6
6
  import { Error as at } from "../common/Error.js";
7
7
  import { DataFrameProvider as ht } from "../common/useDataFrame.js";
8
8
  import { DEFAULT_HEIGHT as X, DEFAULT_WIDTH as G, TITLE_LINE_HEIGHT as rt, MIN_LEGEND_GRADIENT_HEIGHT as lt, MAX_LEGEND_GRADIENT_HEIGHT as ct, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as mt, BLACK as et, TITLE_MARGIN as dt } from "../constants.js";
9
9
  import { FACET_TITLE_LINE as pt } from "../discrete/constants.js";
10
10
  import { splitTextByWidth as V } from "../utils/splitTextByWidth.js";
11
- import { isContinuousAes as q } from "../types/common.js";
11
+ import { isContinuousAes as Q } from "../types/common.js";
12
12
  import "../types/discrete.js";
13
13
  import "../types/scatterplot.js";
14
14
  import "../types/heatmap.js";
@@ -16,28 +16,28 @@ import "../types/dendro.js";
16
16
  import "../types/histogram.js";
17
17
  import "../types/bubble.js";
18
18
  import { arrangeLegendParts as ut } from "../utils/arrangeLegendParts.js";
19
- import { getContinuousColorScale as gt } from "../utils/getContinuousColorScale.js";
20
- import { getContinuousLegendTicks as ft } from "../utils/getContinuousLegendTicks.js";
21
- import { TextMeasurer as Tt } from "../utils/TextMeasurer/TextMeasurer.js";
22
- import { ChartsGroup as Ct } from "./components/ChartsGroup.js";
23
- import { MIN_MARGIN as D, PADDINGS as P, DEFAULT_DOT_AES as A, LEGEND_OFFSET as Et, TICK_OFFSET as F, DEFAULT_TICKS_SIZE as Q, MIN_PADDING as U, FACET_TITLE_OFFSET as Mt, TITLE_LINE as O, FACET_AXIS_OFFSET as Z } from "./constants.js";
24
- import { createAesGetter as Y } from "./utils/createAesGetter.js";
25
- import { getTicksAndFormat as xt } from "./utils/getTicksAndFormat.js";
26
- import { isContinuousAxis as $ } from "./utils/isNumericScale.js";
19
+ import { getSizeLegendItem as gt } from "../utils/getSizeLegendItem.js";
20
+ import { getContinuousColorScale as ft } from "../utils/getContinuousColorScale.js";
21
+ import { getContinuousLegendTicks as Tt } from "../utils/getContinuousLegendTicks.js";
22
+ import { TextMeasurer as Ct } from "../utils/TextMeasurer/TextMeasurer.js";
23
+ import { ChartsGroup as Et } from "./components/ChartsGroup.js";
24
+ import { MIN_MARGIN as H, PADDINGS as P, DEFAULT_DOT_AES as Y, LEGEND_OFFSET as Mt, TICK_OFFSET as v, DEFAULT_TICKS_SIZE as Z, MIN_PADDING as U, FACET_TITLE_OFFSET as xt, TITLE_LINE as O, FACET_AXIS_OFFSET as $ } from "./constants.js";
25
+ import { createAesGetter as D } from "./utils/createAesGetter.js";
26
+ import { getTicksAndFormat as St } from "./utils/getTicksAndFormat.js";
27
+ import { isContinuousAxis as q } from "./utils/isNumericScale.js";
27
28
  import { createMultilineDiscreteLabels as J } from "../utils/createMultilineDiscreteLabels.js";
28
29
  import { measureMultilineDiscreteLabels as k } from "../utils/measureMultilineDiscreteLabels.js";
29
30
  import B from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
30
31
  import { point as y } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js";
31
32
  import K from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/log.js";
32
- import St from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
33
+ import Nt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
33
34
  import bt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/symlog.js";
34
- import { sqrt as Nt } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/pow.js";
35
35
  function tt(a, t) {
36
36
  if (a === void 0)
37
37
  return !0;
38
38
  {
39
39
  const i = a.domain(), s = a.range(), e = t.domain(), o = t.range();
40
- if (i.length !== e.length || i.some((f, T) => f !== e[T]) || s[0] !== o[0] || s[1] !== o[1])
40
+ if (i.length !== e.length || i.some((g, f) => g !== e[f]) || s[0] !== o[0] || s[1] !== o[1])
41
41
  return !0;
42
42
  }
43
43
  return !1;
@@ -46,13 +46,13 @@ function zt(a, t, i, s) {
46
46
  const e = [];
47
47
  return a % i === i - 1 && e.push("right"), a % i === 0 && e.push("left"), a < i && e.push("top"), (Math.ceil((a + 1) / i) === s || Math.ceil((a + 1) / i) === s - 1 && a % i > (t - 1) % i) && e.push("bottom"), e;
48
48
  }
49
- function wt(a, t, i, s, e, o, f, T, x, d) {
50
- const I = a.scale === "discrete", w = t.scale === "discrete", h = o.includes("left") || !(d != null && d.sharedY), n = o.includes("left") && t.title !== "", r = o.includes("bottom") || !(d != null && d.sharedX), g = o.includes("bottom") && a.title !== "", E = t.hiddenLabels ? 0 : w ? i.leftAxisCaptionsWidthByColumns[T] + 2 * F : i.yAxisCaptionsWidth + 2 * F, l = (t.showTicks ? Q : 0) + F, m = n ? O : 0, C = a.hiddenLabels ? 0 : I ? i.bottomAxisCaptionsWidthByRows[f] + 2 * F : i.xAxisCaptionsWidth + 2 * F, M = a.showTicks ? Q : 0, H = g ? O : 0, p = E + l + m + Z, c = C + M + H + Z, W = Math.max(...s.map((u) => e[u].length));
49
+ function wt(a, t, i, s, e, o, g, f, C, c) {
50
+ const I = a.scale === "discrete", w = t.scale === "discrete", h = o.includes("left") || !(c != null && c.sharedY), n = o.includes("left") && t.title !== "", r = o.includes("bottom") || !(c != null && c.sharedX), T = o.includes("bottom") && a.title !== "", x = t.hiddenLabels ? 0 : w ? i.leftAxisCaptionsWidthByColumns[f] + 2 * v : i.yAxisCaptionsWidth + 2 * v, m = (t.showTicks ? Z : 0) + v, p = n ? O : 0, E = a.hiddenLabels ? 0 : I ? i.bottomAxisCaptionsWidthByRows[g] + 2 * v : i.xAxisCaptionsWidth + 2 * v, S = a.showTicks ? Z : 0, A = T ? O : 0, u = x + m + p + $, l = E + S + A + $, W = Math.max(...s.map((d) => e[d].length));
51
51
  return {
52
- left: h ? p : U,
53
- top: W === 0 ? 0 : Mt * 2 + W * pt,
54
- bottom: r ? c + 8 : U,
55
- right: x ? 0 : U
52
+ left: h ? u : U,
53
+ top: W === 0 ? 0 : xt * 2 + W * pt,
54
+ bottom: r ? l + 8 : U,
55
+ right: C ? 0 : U
56
56
  };
57
57
  }
58
58
  function Wt(a, t, i) {
@@ -66,14 +66,14 @@ function It(a, t) {
66
66
  return [i, s];
67
67
  }
68
68
  function Lt(a, t, i, s) {
69
- const e = i.find((f) => f.type === "dots"), o = i.find((f) => f.type === "curve");
69
+ const e = i.find((g) => g.type === "dots"), o = i.find((g) => g.type === "curve");
70
70
  return {
71
- dotShape: Y(a, t, (e == null ? void 0 : e.aes.dotShape) ?? A.shape, "dotShape"),
72
- dotColor: Y(a, t, (e == null ? void 0 : e.aes.dotFill) ?? A.color, "dotFill"),
73
- dotSize: Y(a, t, (e == null ? void 0 : e.aes.dotSize) ?? A.size, "dotSize"),
74
- lineShape: Y(a, t, (o == null ? void 0 : o.aes.lineShape) ?? "solid", "lineShape"),
75
- lineColor: Y(a, t, (o == null ? void 0 : o.aes.lineColor) ?? et, "lineColor"),
76
- trendColor: Y(a, t, (s == null ? void 0 : s.color) ?? A.color, "fillColor")
71
+ dotShape: D(a, t, (e == null ? void 0 : e.aes.dotShape) ?? Y.shape, "dotShape"),
72
+ dotColor: D(a, t, (e == null ? void 0 : e.aes.dotFill) ?? Y.color, "dotFill"),
73
+ dotSize: D(a, t, (e == null ? void 0 : e.aes.dotSize) ?? Y.size, "dotSize"),
74
+ lineShape: D(a, t, (o == null ? void 0 : o.aes.lineShape) ?? "solid", "lineShape"),
75
+ lineColor: D(a, t, (o == null ? void 0 : o.aes.lineColor) ?? et, "lineColor"),
76
+ trendColor: D(a, t, (s == null ? void 0 : s.color) ?? Y.color, "fillColor")
77
77
  };
78
78
  }
79
79
  const Rt = Math.cos(Math.PI / 4), _t = 5;
@@ -82,18 +82,18 @@ function it(a, t) {
82
82
  }
83
83
  class ci {
84
84
  constructor() {
85
- S(this, "reactRoot", null);
86
- S(this, "parentNode", null);
87
- S(this, "rootNode", null);
88
- S(this, "component", /* @__PURE__ */ v.jsx(v.Fragment, {}));
89
- S(this, "margins", {
90
- top: D,
91
- bottom: D,
92
- left: D,
93
- right: D
85
+ M(this, "reactRoot", null);
86
+ M(this, "parentNode", null);
87
+ M(this, "rootNode", null);
88
+ M(this, "component", /* @__PURE__ */ F.jsx(F.Fragment, {}));
89
+ M(this, "margins", {
90
+ top: H,
91
+ bottom: H,
92
+ left: H,
93
+ right: H
94
94
  });
95
- S(this, "chartsDimensions", {});
96
- S(this, "chartSizes", {
95
+ M(this, "chartsDimensions", {});
96
+ M(this, "chartSizes", {
97
97
  chartWidth: G,
98
98
  // width of single chart
99
99
  chartHeight: X,
@@ -107,13 +107,13 @@ class ci {
107
107
  totalHeight: X
108
108
  // width of all charts in charts height, plus bottom axis, plus top title
109
109
  });
110
- S(this, "columnsCount", 1);
111
- S(this, "rowsCount", 1);
112
- S(this, "scales", {
110
+ M(this, "columnsCount", 1);
111
+ M(this, "rowsCount", 1);
112
+ M(this, "scales", {
113
113
  x: { null: B().domain([0, 1]).range([0, G]) },
114
114
  y: { null: B().domain([0, 1]).range([X, 0]) }
115
115
  });
116
- S(this, "captionsSizes", {
116
+ M(this, "captionsSizes", {
117
117
  xAxisCaptionsWidth: 30,
118
118
  yAxisCaptionsWidth: 100,
119
119
  bottomAxisCaptionsWidthByRows: [],
@@ -121,13 +121,13 @@ class ci {
121
121
  bottomCaptionsTail: 0,
122
122
  leftCaptionsTail: 0
123
123
  });
124
- S(this, "facetTitles", {});
124
+ M(this, "facetTitles", {});
125
125
  // can be multiline
126
- S(this, "mainTitle", []);
126
+ M(this, "mainTitle", []);
127
127
  // can be multiline
128
- S(this, "discreteAxesLabels", { x: {}, y: {} });
128
+ M(this, "discreteAxesLabels", { x: {}, y: {} });
129
129
  // only for discrete axes, by facets, can be multiline
130
- S(this, "legend", { width: 0, height: 0, items: [] });
130
+ M(this, "legend", { width: 0, height: 0, items: [] });
131
131
  }
132
132
  clear() {
133
133
  var t;
@@ -143,30 +143,30 @@ class ci {
143
143
  this.chartSizes.chartWidth = t.width, this.chartSizes.chartHeight = t.height;
144
144
  }
145
145
  updateChartDimensions(t, i, s, e) {
146
- const { chartWidth: o, chartHeight: f } = this.chartSizes;
147
- let T = 0, x = 0;
148
- const d = Wt(t, this.rowsCount, this.columnsCount);
146
+ const { chartWidth: o, chartHeight: g } = this.chartSizes;
147
+ let f = 0, C = 0;
148
+ const c = Wt(t, this.rowsCount, this.columnsCount);
149
149
  this.chartsDimensions = t.reduce((h, n, r) => {
150
- const [g, E] = It(r, this.columnsCount), l = zt(r, t.length, this.columnsCount, this.rowsCount), m = wt(
150
+ const [T, x] = It(r, this.columnsCount), m = zt(r, t.length, this.columnsCount, this.rowsCount), p = wt(
151
151
  s,
152
152
  e,
153
153
  this.captionsSizes,
154
- d[g],
154
+ c[T],
155
155
  this.facetTitles,
156
- l,
157
- g,
158
- E,
159
- E === this.columnsCount - 1,
156
+ m,
157
+ T,
158
+ x,
159
+ x === this.columnsCount - 1,
160
160
  i
161
- ), C = o + m.left + m.right, M = f + m.top + m.bottom;
161
+ ), E = o + p.left + p.right, S = g + p.top + p.bottom;
162
162
  return h[n] = {
163
- left: T,
164
- top: x,
165
- chartEdgeSides: l,
166
- padding: m,
167
- inner: { width: o, height: f },
168
- outer: { width: C, height: M }
169
- }, T += C, E === this.columnsCount - 1 && (T = 0, x += M), h;
163
+ left: f,
164
+ top: C,
165
+ chartEdgeSides: m,
166
+ padding: p,
167
+ inner: { width: o, height: g },
168
+ outer: { width: E, height: S }
169
+ }, f += E, x === this.columnsCount - 1 && (f = 0, C += S), h;
170
170
  }, {});
171
171
  const I = Math.max(
172
172
  ...t.map((h) => this.chartsDimensions[h].outer.width + this.chartsDimensions[h].left)
@@ -175,74 +175,74 @@ class ci {
175
175
  );
176
176
  this.chartSizes.chartsWidth = I, this.chartSizes.chartsHeight = w;
177
177
  }
178
- updateViewport(t, i, s, e, o, f, T, x) {
179
- const d = t.length, I = Math.min(i.nRows ?? d, d), w = Math.min(i.nCols ?? d, d);
180
- this.columnsCount = i.nRows ? Math.ceil(d / I) : w, this.rowsCount = Math.ceil(d / this.columnsCount);
181
- let [h, n] = [1 / 0, -1 / 0], [r, g] = [1 / 0, -1 / 0];
182
- const E = t.reduce((p, c) => {
183
- const W = T[c], { minX: u, minY: b, maxX: N, maxY: z } = W;
184
- return h = Math.min(h, u), r = Math.min(r, b), n = Math.max(n, N), g = Math.max(g, z), p[c] = { minX: u, maxX: N, minY: b, maxY: z }, p;
185
- }, {}), l = {}, m = {};
186
- let C = !1, M = !1;
187
- t.forEach((p) => {
188
- let c;
189
- if (!$(s))
190
- c = y().range([0, this.chartSizes.chartWidth]).domain(o.keys ?? []).padding(0.5);
178
+ updateViewport(t, i, s, e, o, g, f, C) {
179
+ const c = t.length, I = Math.min(i.nRows ?? c, c), w = Math.min(i.nCols ?? c, c);
180
+ this.columnsCount = i.nRows ? Math.ceil(c / I) : w, this.rowsCount = Math.ceil(c / this.columnsCount);
181
+ let [h, n] = [1 / 0, -1 / 0], [r, T] = [1 / 0, -1 / 0];
182
+ const x = t.reduce((u, l) => {
183
+ const W = f[l], { minX: d, minY: N, maxX: b, maxY: z } = W;
184
+ return h = Math.min(h, d), r = Math.min(r, N), n = Math.max(n, b), T = Math.max(T, z), u[l] = { minX: d, maxX: b, minY: N, maxY: z }, u;
185
+ }, {}), m = {}, p = {};
186
+ let E = !1, S = !1;
187
+ t.forEach((u) => {
188
+ let l;
189
+ if (!q(s))
190
+ l = y().range([0, this.chartSizes.chartWidth]).domain(o.keys ?? []).padding(0.5);
191
191
  else {
192
- c = s.scale === "log" ? K() : B();
193
- const u = E[p];
194
- let b = s.lowerValue ? Number(s.lowerValue) : i.sharedX ? h : u.minX, N = s.upperValue ? Number(s.upperValue) : i.sharedX ? n : u.maxX;
192
+ l = s.scale === "log" ? K() : B();
193
+ const d = x[u];
194
+ let N = s.lowerValue ? Number(s.lowerValue) : i.sharedX ? h : d.minX, b = s.upperValue ? Number(s.upperValue) : i.sharedX ? n : d.maxX;
195
195
  if (typeof s.symmetricRange < "u") {
196
196
  const R = s.symmetricRange;
197
- if (R >= b && R <= N) {
198
- const _ = Math.max(R - b, N - R);
199
- b = R - _, N = R + _;
197
+ if (R >= N && R <= b) {
198
+ const _ = Math.max(R - N, b - R);
199
+ N = R - _, b = R + _;
200
200
  }
201
201
  }
202
- const z = [0, this.chartSizes.chartWidth], L = c.copy().domain([b, N]).range([P.LEFT, this.chartSizes.chartWidth - P.RIGHT]);
203
- c.domain([L.invert(0), L.invert(this.chartSizes.chartWidth)]).range(z).nice();
202
+ const z = [0, this.chartSizes.chartWidth], L = l.copy().domain([N, b]).range([P.LEFT, this.chartSizes.chartWidth - P.RIGHT]);
203
+ l.domain([L.invert(0), L.invert(this.chartSizes.chartWidth)]).range(z).nice();
204
204
  }
205
- const W = this.scales.x[p];
206
- l[p] = c, C = C || tt(W, c);
205
+ const W = this.scales.x[u];
206
+ m[u] = l, E = E || tt(W, l);
207
207
  });
208
- const H = t.reduce((p, c) => {
209
- const W = x ? x[c] : [];
210
- return p[c] = W.reduce(
211
- (u, b) => {
212
- const N = b.bounded ? b.xBounds : this.scales.x[c].domain(), z = b.getInterval(N[0]), L = b.getInterval(N[1]);
213
- return u.minY = Math.min(u.minY, isNaN(z.left) ? u.minY : z.left, isNaN(L.left) ? u.minY : L.left), u.maxY = Math.max(u.maxY, isNaN(z.right) ? u.maxY : z.right, isNaN(L.right) ? u.maxY : L.right), u;
208
+ const A = t.reduce((u, l) => {
209
+ const W = C ? C[l] : [];
210
+ return u[l] = W.reduce(
211
+ (d, N) => {
212
+ const b = N.bounded ? N.xBounds : this.scales.x[l].domain(), z = N.getInterval(b[0]), L = N.getInterval(b[1]);
213
+ return d.minY = Math.min(d.minY, isNaN(z.left) ? d.minY : z.left, isNaN(L.left) ? d.minY : L.left), d.maxY = Math.max(d.maxY, isNaN(z.right) ? d.maxY : z.right, isNaN(L.right) ? d.maxY : L.right), d;
214
214
  },
215
215
  { minY: 1 / 0, maxY: -1 / 0 }
216
- ), r = Math.min(r, p[c].minY), g = Math.max(g, p[c].maxY), p;
216
+ ), r = Math.min(r, u[l].minY), T = Math.max(T, u[l].maxY), u;
217
217
  }, {});
218
- t.forEach((p) => {
219
- let c;
220
- if (!$(e))
221
- c = y().range([this.chartSizes.chartHeight, 0]).domain(f.keys ?? []).padding(0.5);
218
+ t.forEach((u) => {
219
+ let l;
220
+ if (!q(e))
221
+ l = y().range([this.chartSizes.chartHeight, 0]).domain(g.keys ?? []).padding(0.5);
222
222
  else {
223
- c = e.scale === "log" ? K() : B();
224
- const u = E[p], b = H[p];
225
- let N = e.lowerValue ? Number(e.lowerValue) : i.sharedY ? r : Math.min(u.minY, b.minY), z = e.upperValue ? Number(e.upperValue) : i.sharedY ? g : Math.max(u.maxY, b.maxY);
223
+ l = e.scale === "log" ? K() : B();
224
+ const d = x[u], N = A[u];
225
+ let b = e.lowerValue ? Number(e.lowerValue) : i.sharedY ? r : Math.min(d.minY, N.minY), z = e.upperValue ? Number(e.upperValue) : i.sharedY ? T : Math.max(d.maxY, N.maxY);
226
226
  if (typeof e.symmetricRange < "u") {
227
227
  const _ = e.symmetricRange;
228
- if (_ >= N && _ <= z) {
229
- const j = Math.max(_ - N, z - _);
230
- N = _ - j, z = _ + j;
228
+ if (_ >= b && _ <= z) {
229
+ const j = Math.max(_ - b, z - _);
230
+ b = _ - j, z = _ + j;
231
231
  }
232
232
  }
233
- const L = [this.chartSizes.chartHeight, 0], R = c.copy().domain([N, z]).range([this.chartSizes.chartHeight - P.BOTTOM, P.TOP]);
234
- c.domain([R.invert(this.chartSizes.chartHeight), R.invert(0)]).range(L).nice();
233
+ const L = [this.chartSizes.chartHeight, 0], R = l.copy().domain([b, z]).range([this.chartSizes.chartHeight - P.BOTTOM, P.TOP]);
234
+ l.domain([R.invert(this.chartSizes.chartHeight), R.invert(0)]).range(L).nice();
235
235
  }
236
- const W = this.scales.y[p];
237
- m[p] = c, M = M || tt(W, c);
238
- }), C && (this.scales.x = l), M && (this.scales.y = m);
236
+ const W = this.scales.y[u];
237
+ p[u] = l, S = S || tt(W, l);
238
+ }), E && (this.scales.x = m), S && (this.scales.y = p);
239
239
  }
240
240
  updateCaptionsSize(t, i, s, e) {
241
- const o = new Tt("600 14px Manrope");
242
- function f(n) {
241
+ const o = new Ct("600 14px Manrope");
242
+ function g(n) {
243
243
  return Math.max(...n.map((r) => o.getTextWidth(r)));
244
244
  }
245
- let T = 0, x = 0, d = [], I = [], w = 0, h = 0;
245
+ let f = 0, C = 0, c = [], I = [], w = 0, h = 0;
246
246
  if (i.scale === "discrete") {
247
247
  const n = k(
248
248
  t,
@@ -253,7 +253,7 @@ class ci {
253
253
  "vertical",
254
254
  this.scales.x
255
255
  );
256
- T = n.xTail, d = n.axisCaptionsWidthByRows;
256
+ f = n.xTail, c = n.axisCaptionsWidthByRows;
257
257
  } else
258
258
  w = 20;
259
259
  if (s.scale === "discrete") {
@@ -266,19 +266,19 @@ class ci {
266
266
  "horizontal",
267
267
  this.scales.y
268
268
  );
269
- x = n.yTail, I = n.axisCaptionsWidthByColumns;
269
+ C = n.yTail, I = n.axisCaptionsWidthByColumns;
270
270
  } else
271
271
  Object.values(this.scales.y).forEach((n) => {
272
- const { ticks: r, format: g } = xt(n, e);
273
- h = Math.max(h, f(r.map(g)));
272
+ const { ticks: r, format: T } = St(n, e);
273
+ h = Math.max(h, g(r.map(T)));
274
274
  });
275
275
  this.captionsSizes = {
276
276
  xAxisCaptionsWidth: i.hiddenLabels ? 0 : it(w, i),
277
277
  yAxisCaptionsWidth: s.hiddenLabels ? 0 : it(h, s),
278
- bottomAxisCaptionsWidthByRows: d,
278
+ bottomAxisCaptionsWidthByRows: c,
279
279
  leftAxisCaptionsWidthByColumns: I,
280
- bottomCaptionsTail: T,
281
- leftCaptionsTail: x
280
+ bottomCaptionsTail: f,
281
+ leftCaptionsTail: C
282
282
  };
283
283
  }
284
284
  createMainTitle(t, i) {
@@ -315,10 +315,10 @@ class ci {
315
315
  updateMargins(t) {
316
316
  const i = rt * this.mainTitle.length, s = i > 0 ? i + dt * 2 : 0, e = this.chartsDimensions[t[0]], o = this.chartsDimensions[t[t.length - 1]];
317
317
  this.margins = {
318
- top: Math.max(s, D),
319
- bottom: Math.max(D, this.captionsSizes.leftCaptionsTail - o.padding.bottom),
320
- left: Math.max(D, this.captionsSizes.bottomCaptionsTail - e.padding.left),
321
- right: this.legend.width + D
318
+ top: Math.max(s, H),
319
+ bottom: Math.max(H, this.captionsSizes.leftCaptionsTail - o.padding.bottom),
320
+ left: Math.max(H, this.captionsSizes.bottomCaptionsTail - e.padding.left),
321
+ right: this.legend.width + H
322
322
  }, 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;
323
323
  }
324
324
  updateLegendSize(t, i, s, e) {
@@ -326,10 +326,10 @@ class ci {
326
326
  this.legend = { width: 0, height: 0, items: [] };
327
327
  return;
328
328
  }
329
- const o = [], f = { width: 0, height: 0, left: 0, top: 0 }, T = Math.min(
329
+ const o = [], g = { width: 0, height: 0, left: 0, top: 0 }, f = Math.min(
330
330
  Math.max(this.chartSizes.chartHeight, lt),
331
331
  ct
332
- ), x = Math.max(this.chartSizes.chartHeight, T);
332
+ ), C = Math.max(this.chartSizes.chartHeight, f);
333
333
  if (s.forEach((h) => {
334
334
  const n = i[h.value];
335
335
  if (n.usedAes.length === 0 || !n.aesMap)
@@ -339,39 +339,36 @@ class ci {
339
339
  return;
340
340
  }
341
341
  const r = {};
342
- n.values.forEach((l) => {
343
- r[l] || (r[l] = { ...A }), n.usedAes.forEach((m) => {
344
- (m === "dotFill" || m === "lineColor") && (r[l].color = n.aesMap(l, m) ?? et), m === "dotShape" && (r[l].shape = n.aesMap(l, m) ?? "21"), m === "dotSize" && (r[l].size = n.aesMap(l, m) ?? 3);
342
+ n.values.forEach((m) => {
343
+ r[m] || (r[m] = { ...Y }), n.usedAes.forEach((p) => {
344
+ (p === "dotFill" || p === "lineColor") && (r[m].color = n.aesMap(m, p) ?? et), p === "dotShape" && (r[m].shape = n.aesMap(m, p) ?? "21"), p === "dotSize" && (r[m].size = n.aesMap(m, p) ?? 3);
345
345
  });
346
346
  });
347
- const g = h.label ?? h.value, E = St().domain(n.values).range(n.values.map((l) => r[l])).unknown(A);
348
- o.push({ ...f, id: h.value, type: "dots", title: g, scale: E, values: n.values, labels: n.labels });
347
+ const T = h.label ?? h.value, x = Nt().domain(n.values).range(n.values.map((m) => r[m])).unknown(Y);
348
+ o.push({ ...g, id: h.value, type: "dots", title: T, scale: x, values: n.values, labels: n.labels });
349
349
  }), e.forEach((h) => {
350
- if (h.type === "dots" && q(h.aes.dotFill)) {
351
- const { domain: n, range: r, columnName: g, type: E = "linear" } = h.aes.dotFill, l = g.label ?? g.value, m = gt(r, n, "linear"), C = (E === "log" ? bt() : B()).domain(n).range([T, 0]), M = ft(C, n);
352
- o.push({ ...f, id: "dotFill", type: "continuous", title: l, scale: m, tickPositionScale: C, values: M });
353
- }
354
- if (h.type === "dots" && q(h.aes.dotSize)) {
355
- const { columnName: n, domain: r, range: g } = h.aes.dotSize, E = n.label ?? n.value, l = Nt(r, g), m = l.ticks(3), C = l.tickFormat(3), M = m.reduce((H, p) => (H[String(p)] = C(p), H), {});
356
- o.push({ ...f, id: n.value, type: "size", title: E, scale: l, values: m, labels: M });
350
+ if (h.type === "dots" && Q(h.aes.dotFill)) {
351
+ const { domain: n, range: r, columnName: T, type: x = "linear" } = h.aes.dotFill, m = T.label ?? T.value, p = ft(r, n, "linear"), E = (x === "log" ? bt() : B()).domain(n).range([f, 0]), S = Tt(E, n);
352
+ o.push({ ...g, id: "dotFill", type: "continuous", title: m, scale: p, tickPositionScale: E, values: S });
357
353
  }
354
+ h.type === "dots" && Q(h.aes.dotSize) && o.push(gt(h.aes.dotSize));
358
355
  }), !o.length) {
359
356
  this.legend = { width: 0, height: 0, items: [] };
360
357
  return;
361
358
  }
362
- const d = ut(o, x, T), w = d.reduce((h, n) => Math.max(h, n.left + n.width), 0) + Et;
359
+ const c = ut(o, C, f), w = c.reduce((h, n) => Math.max(h, n.left + n.width), 0) + Mt;
363
360
  this.legend = {
364
361
  width: w,
365
- height: x,
366
- items: d
362
+ height: C,
363
+ items: c
367
364
  };
368
365
  }
369
- render(t, i, s, e, o, f, T, x, d, I, w, h, n, r, g, E, l, m) {
370
- var u;
371
- const { xAxis: C, yAxis: M, size: H, title: p, legend: c } = s;
372
- this.updateChartSizes(H), this.updateViewport(o, e, C, M, E, l, T, x), this.createAxisLabels(o, C, M, E, l), this.updateCaptionsSize(o, C, M, I.y), this.createFacetTitles(o, f), this.updateChartDimensions(o, e, C, M), this.updateLegendSize(c, w, n, r), this.createMainTitle(o, p), this.updateMargins(o);
373
- const W = /* @__PURE__ */ v.jsx(ht, { dataFrame: t, children: /* @__PURE__ */ v.jsx(
374
- Ct,
366
+ render(t, i, s, e, o, g, f, C, c, I, w, h, n, r, T, x, m, p) {
367
+ var d;
368
+ const { xAxis: E, yAxis: S, size: A, title: u, legend: l } = s;
369
+ this.updateChartSizes(A), this.updateViewport(o, e, E, S, x, m, f, C), this.createAxisLabels(o, E, S, x, m), this.updateCaptionsSize(o, E, S, I.y), this.createFacetTitles(o, g), this.updateChartDimensions(o, e, E, S), this.updateLegendSize(l, w, n, r), this.createMainTitle(o, u), this.updateMargins(o);
370
+ const W = /* @__PURE__ */ F.jsx(ht, { dataFrame: t, children: /* @__PURE__ */ F.jsx(
371
+ Et,
375
372
  {
376
373
  settingsId: i,
377
374
  chartSettings: s,
@@ -380,27 +377,27 @@ class ci {
380
377
  chartSizes: this.chartSizes,
381
378
  chartsDimensions: this.chartsDimensions,
382
379
  scales: this.scales,
383
- groupedDots: T,
384
- trendsData: x,
380
+ groupedDots: f,
381
+ trendsData: C,
385
382
  legendData: this.legend,
386
383
  columnsCount: this.columnsCount,
387
384
  margins: this.margins,
388
- keyColumn: d,
385
+ keyColumn: c,
389
386
  mainTitle: this.mainTitle,
390
387
  facetTitles: this.facetTitles,
391
388
  captionsSizes: this.captionsSizes,
392
389
  onlyPositive: I,
393
390
  layersData: h,
394
- aesGetters: Lt(t, w, r, g),
395
- onTooltipHintSwitch: m,
391
+ aesGetters: Lt(t, w, r, T),
392
+ onTooltipHintSwitch: p,
396
393
  discreteAxesLabels: this.discreteAxesLabels
397
394
  }
398
395
  ) });
399
- this.component = W, (u = this.reactRoot) == null || u.render(W);
396
+ this.component = W, (d = this.reactRoot) == null || d.render(W);
400
397
  }
401
398
  renderError(t) {
402
399
  var i;
403
- (i = this.reactRoot) == null || i.render(/* @__PURE__ */ v.jsx(at, { message: t }));
400
+ (i = this.reactRoot) == null || i.render(/* @__PURE__ */ F.jsx(at, { message: t }));
404
401
  }
405
402
  }
406
403
  export {