@milaboratories/miplots4 1.0.160 → 1.0.162

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 (32) hide show
  1. package/dist/DataFrame.d.ts +3 -3
  2. package/dist/DataFrame.js +3 -3
  3. package/dist/DataFrame.js.map +1 -1
  4. package/dist/_virtual/index10.js +2 -5
  5. package/dist/_virtual/index10.js.map +1 -1
  6. package/dist/_virtual/index5.js +5 -2
  7. package/dist/_virtual/index5.js.map +1 -1
  8. package/dist/_virtual/index6.js +4 -4
  9. package/dist/_virtual/index7.js +1 -1
  10. package/dist/_virtual/index8.js +4 -4
  11. package/dist/_virtual/index9.js +3 -3
  12. package/dist/bubble/ChartRenderer.js +55 -55
  13. package/dist/bubble/ChartRenderer.js.map +1 -1
  14. package/dist/constants.d.ts +2 -0
  15. package/dist/constants.js +9 -7
  16. package/dist/constants.js.map +1 -1
  17. package/dist/discrete/layers/stackedBar.js.map +1 -1
  18. package/dist/discrete/layers/stats/pValueCalculation.js +5 -5
  19. package/dist/heatmap/ChartRenderer.js +184 -181
  20. package/dist/heatmap/ChartRenderer.js.map +1 -1
  21. package/dist/heatmap/components/Captions/AxisCaptions.js +34 -34
  22. package/dist/heatmap/components/Captions/AxisCaptions.js.map +1 -1
  23. package/dist/heatmap/utils/calculateChartSideElementSizes.js +23 -23
  24. package/dist/heatmap/utils/calculateChartSideElementSizes.js.map +1 -1
  25. package/dist/node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/index.js +1 -1
  26. package/dist/scatterplot/ChartRenderer.js +179 -176
  27. package/dist/scatterplot/ChartRenderer.js.map +1 -1
  28. package/dist/scatterplot/dots.js +20 -20
  29. package/dist/scatterplot/dots.js.map +1 -1
  30. package/dist/scatterplot-umap/ChartRenderer.js +168 -165
  31. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  32. package/package.json +1 -1
@@ -3,70 +3,70 @@ var it = (d, e, t) => e in d ? ot(d, e, { enumerable: !0, configurable: !0, writ
3
3
  var C = (d, e, t) => it(d, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { j as O } from "../_virtual/jsx-runtime.js";
5
5
  import nt from "../_virtual/lodash.js";
6
- import { c as rt } from "../_virtual/client.js";
7
- import { Error as at } from "../common/Error.js";
6
+ import { c as at } from "../_virtual/client.js";
7
+ import { Error as rt } from "../common/Error.js";
8
8
  import { DataFrameProvider as ht } from "../common/useDataFrame.js";
9
- import { DEFAULT_HEIGHT as Y, DEFAULT_WIDTH as q, TITLE_LINE_HEIGHT as ct, TITLE_MARGIN as lt } from "../constants.js";
10
- import { arrangeLegendParts as ut } from "../utils/arrangeLegendParts.js";
11
- import { getChartEdgeSides as pt } from "../utils/getChartEdgeSides.js";
9
+ import { DEFAULT_HEIGHT as Y, DEFAULT_WIDTH as q, TITLE_LINE_HEIGHT as ct, TITLE_MARGIN as lt, MIN_LEGEND_GRADIENT_HEIGHT as ut, MAX_LEGEND_GRADIENT_HEIGHT as pt } from "../constants.js";
10
+ import { arrangeLegendParts as dt } from "../utils/arrangeLegendParts.js";
11
+ import { getChartEdgeSides as mt } from "../utils/getChartEdgeSides.js";
12
12
  import { getContinuousLegendTicks as Q } from "../utils/getContinuousLegendTicks.js";
13
- import { TextMeasurer as dt } from "../utils/TextMeasurer/TextMeasurer.js";
14
- import { ChartsGroup as mt } from "./components/ChartsGroup.js";
15
- import { MIN_MARGIN as F, TITLE_LINE as V, LEGEND_OFFSET as gt, DEFAULT_AES as Z, CHART_SIDE_ELEMENTS as xt } from "./constants.js";
16
- import { calculateChartSideElementSizes as ft } from "./utils/calculateChartSideElementSizes.js";
17
- import { calculateSideElementsBBoxes as St } from "./utils/calculateSideElementsBBoxes.js";
18
- import { createDiscreteColorScale as yt, createDiscreteRoundColorScale as Ct, createContinuousColorScale as Lt } from "./utils/createColorScales.js";
13
+ import { TextMeasurer as gt } from "../utils/TextMeasurer/TextMeasurer.js";
14
+ import { ChartsGroup as xt } from "./components/ChartsGroup.js";
15
+ import { MIN_MARGIN as F, TITLE_LINE as V, LEGEND_OFFSET as ft, DEFAULT_AES as Z, CHART_SIDE_ELEMENTS as St } from "./constants.js";
16
+ import { calculateChartSideElementSizes as yt } from "./utils/calculateChartSideElementSizes.js";
17
+ import { calculateSideElementsBBoxes as Ct } from "./utils/calculateSideElementsBBoxes.js";
18
+ import { createDiscreteColorScale as Lt, createDiscreteRoundColorScale as Gt, createContinuousColorScale as Et } from "./utils/createColorScales.js";
19
19
  import { calculateAnnotationTitleSizes as bt } from "./utils/calculateAnnotationTitleSizes.js";
20
20
  import { calculateCaptionTails as zt } from "./utils/calculateCaptionTails.js";
21
- import I from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
22
- import D from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
23
- import Gt from "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/extent.js";
21
+ import _ from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
22
+ import I from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
23
+ import At from "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/extent.js";
24
24
  import $ from "../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/cluster.js";
25
- const Et = Math.cos(Math.PI / 4), At = 5;
25
+ const Tt = Math.cos(Math.PI / 4), Ht = 5;
26
26
  function tt(d, e, t) {
27
- function s(a) {
28
- a[t] = e(a.data.height), a.children && a.children.forEach(s);
27
+ function s(r) {
28
+ r[t] = e(r.data.height), r.children && r.children.forEach(s);
29
29
  }
30
30
  s(d);
31
31
  }
32
32
  function st(d, e, t, s = t) {
33
- function a(i) {
34
- i[s] = i[t] + e, i.children && i.children.forEach(a);
33
+ function r(i) {
34
+ i[s] = i[t] + e, i.children && i.children.forEach(r);
35
35
  }
36
- a(d);
36
+ r(d);
37
37
  }
38
- const Tt = (d, e) => {
38
+ const Mt = (d, e) => {
39
39
  const t = Math.min(...e), s = Math.max(...e);
40
40
  if (t === s) {
41
- const n = d % 2 === 0 ? [] : [t];
42
- for (let r = 1; r < d / 2 + 1; r++)
43
- n.push(t + r), n.unshift(t - r);
44
- return n;
41
+ const a = d % 2 === 0 ? [] : [t];
42
+ for (let l = 1; l < d / 2 + 1; l++)
43
+ a.push(t + l), a.unshift(t - l);
44
+ return a;
45
45
  }
46
46
  if (d < 2)
47
47
  return [t, s];
48
- const a = (s - t) / (d - 1), i = [];
49
- for (let n = 0; n < d - 1; n++)
50
- i.push(t + a * n);
48
+ const r = (s - t) / (d - 1), i = [];
49
+ for (let a = 0; a < d - 1; a++)
50
+ i.push(t + r * a);
51
51
  return i.push(s), i;
52
52
  };
53
53
  function et(d, e, t) {
54
54
  let s = t;
55
- return d && (d.colorRange && (s = d.colorRange), d.method === "standardScaling" && (s = [-2, 2]), d.method === "meanNormalization" && (s = [-0.75, 0.75])), Tt(e, s);
55
+ return d && (d.colorRange && (s = d.colorRange), d.method === "standardScaling" && (s = [-2, 2]), d.method === "meanNormalization" && (s = [-0.75, 0.75])), Mt(e, s);
56
56
  }
57
57
  function P(d, e, t) {
58
58
  let s = 0;
59
- for (const a of d) {
60
- if (e[a] === void 0) continue;
61
- const i = t.getTextWidth(e[a]);
59
+ for (const r of d) {
60
+ if (e[r] === void 0) continue;
61
+ const i = t.getTextWidth(e[r]);
62
62
  i > s && (s = i);
63
63
  }
64
64
  return s;
65
65
  }
66
66
  function K(d, e) {
67
- return e === 90 ? d : e === 45 ? d * Et + (d > 0 ? 2 * At : 0) : V;
67
+ return e === 90 ? d : e === 45 ? d * Tt + (d > 0 ? 2 * Ht : 0) : V;
68
68
  }
69
- class Jt {
69
+ class Zt {
70
70
  constructor() {
71
71
  C(this, "reactRoot", null);
72
72
  C(this, "parentNode", null);
@@ -111,11 +111,11 @@ class Jt {
111
111
  C(this, "rowsCount", 1);
112
112
  C(this, "scales", {
113
113
  // scales grouped by facet
114
- x: { null: I().domain(["null"]).range([1]) },
115
- y: { null: I().domain(["null"]).range([1]) }
114
+ x: { null: _().domain(["null"]).range([1]) },
115
+ y: { null: _().domain(["null"]).range([1]) }
116
116
  });
117
117
  C(this, "step", { x: {}, y: {} });
118
- C(this, "colorScale", D().domain([0, 1]).range(["white", "black"]));
118
+ C(this, "colorScale", I().domain([0, 1]).range(["white", "black"]));
119
119
  C(this, "annotationColorScales", {});
120
120
  C(this, "dendrogramAesScales", {});
121
121
  C(this, "legend", {
@@ -133,7 +133,7 @@ class Jt {
133
133
  });
134
134
  }
135
135
  init(e) {
136
- this.parentNode === null && (this.parentNode = e, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = rt.createRoot(this.rootNode));
136
+ this.parentNode === null && (this.parentNode = e, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = at.createRoot(this.rootNode));
137
137
  }
138
138
  updateMargins(e, t) {
139
139
  this.margins = {
@@ -143,99 +143,102 @@ class Jt {
143
143
  right: this.legend.width + t.outerOffset
144
144
  }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartsHeight + this.margins.bottom, this.legend.height);
145
145
  }
146
- updateLegendSize(e, t, s, a, i) {
146
+ updateLegendSize(e, t, s, r, i) {
147
147
  if (!t.show) {
148
148
  this.legend = { width: 0, height: 0, items: [] };
149
149
  return;
150
150
  }
151
- const n = this.chartSizes.chartHeight, r = [], u = { width: 0, height: 0, left: 0, top: 0 }, f = (h) => h.reduce((c, o) => (c[o] = String(o), c), {});
151
+ const a = Math.min(
152
+ Math.max(this.chartSizes.chartHeight, ut),
153
+ pt
154
+ ), l = Math.max(this.chartSizes.chartHeight, a), c = [], x = { width: 0, height: 0, left: 0, top: 0 }, m = (n) => n.reduce((o, h) => (o[h] = String(h), o), {});
152
155
  if (e === "continuous") {
153
- const h = this.colorScale, c = Q(h, i), o = D([c[0], c[c.length - 1]], [n, 0]), l = a.label ?? a.value;
154
- r.push({
155
- ...u,
156
+ const n = this.colorScale, o = Q(n, i), h = I([o[0], o[o.length - 1]], [a, 0]), u = r.label ?? r.value;
157
+ c.push({
158
+ ...x,
156
159
  type: "continuous",
157
160
  id: "heatmapValue",
158
- scale: h,
159
- values: c,
160
- title: l,
161
- tickPositionScale: o
161
+ scale: n,
162
+ values: o,
163
+ title: u,
164
+ tickPositionScale: h
162
165
  });
163
166
  } else if (e === "discrete") {
164
- const h = this.colorScale, c = a.label ?? a.value, o = h.domain(), l = f(o);
165
- r.push({ ...u, type: "discreteColor", id: "heatmapValue", title: c, scale: h, values: o, labels: l });
167
+ const n = this.colorScale, o = r.label ?? r.value, h = n.domain(), u = m(h);
168
+ c.push({ ...x, type: "discreteColor", id: "heatmapValue", title: o, scale: n, values: h, labels: u });
166
169
  }
167
- if (s.forEach((h) => {
168
- const c = h.valueColumn.label ?? h.valueColumn.value;
169
- if (h.type === "continuous") {
170
- const o = this.annotationColorScales[h.id].scale, l = Q(o, i), x = D([l[0], l[l.length - 1]], [n, 0]);
171
- r.push({ ...u, type: "continuous", id: h.id, tickPositionScale: x, title: c, scale: o, values: l });
170
+ if (s.forEach((n) => {
171
+ const o = n.valueColumn.label ?? n.valueColumn.value;
172
+ if (n.type === "continuous") {
173
+ const h = this.annotationColorScales[n.id].scale, u = Q(h, i), G = I([u[0], u[u.length - 1]], [a, 0]);
174
+ c.push({ ...x, type: "continuous", id: n.id, tickPositionScale: G, title: o, scale: h, values: u });
172
175
  }
173
- if (h.type === "discrete") {
174
- const o = this.annotationColorScales[h.id].scale, l = o.domain(), x = f(l);
175
- r.push({ ...u, type: "discreteColor", id: h.id, title: c, scale: o, values: l, labels: x });
176
+ if (n.type === "discrete") {
177
+ const h = this.annotationColorScales[n.id].scale, u = h.domain(), G = m(u);
178
+ c.push({ ...x, type: "discreteColor", id: n.id, title: o, scale: h, values: u, labels: G });
176
179
  }
177
- }), !r.length) {
180
+ }), !c.length) {
178
181
  this.legend = { width: 0, height: 0, items: [] };
179
182
  return;
180
183
  }
181
- const p = ut(r, this.chartSizes.chartHeight), m = p[p.length - 1], b = m.left + m.width + gt;
184
+ const p = dt(c, this.chartSizes.chartHeight, a), L = p[p.length - 1], f = L.left + L.width + ft;
182
185
  this.legend = {
183
- width: b,
184
- height: n,
186
+ width: f,
187
+ height: l,
185
188
  items: p
186
189
  };
187
190
  }
188
- updateCaptionsSize(e, t, s, a) {
189
- const i = new dt("bold 16px Manrope"), { xGroupKeys: n, yGroupKeys: r, xGroupLabels: u, yGroupLabels: f, xKeysByGroups: p, yKeysByGroups: m, xLabels: b, yLabels: h } = e.meta;
191
+ updateCaptionsSize(e, t, s, r) {
192
+ const i = new gt("bold 16px Manrope"), { xGroupKeys: a, yGroupKeys: l, xGroupLabels: c, yGroupLabels: x, xKeysByGroups: m, yKeysByGroups: p, xLabels: L, yLabels: f } = e.meta;
190
193
  this.labelAngles = {
191
194
  xAxisLabels: t.axisLabelsAngle,
192
195
  yAxisLabels: s.axisLabelsAngle,
193
196
  xGroupLabels: t.groupLabelsAngle,
194
197
  yGroupLabels: s.groupLabelsAngle
195
198
  };
196
- const c = n.reduce((S, g) => Math.max(S, P(p[g], b, i)), 0), o = r.reduce((S, g) => Math.max(S, P(m[g], h, i)), 0), l = P(n, u, i), x = P(r, f, i), { xCaptionTail: E, yCaptionTail: M } = zt(
199
+ const n = a.reduce((S, g) => Math.max(S, P(m[g], L, i)), 0), o = l.reduce((S, g) => Math.max(S, P(p[g], f, i)), 0), h = P(a, c, i), u = P(l, x, i), { xCaptionTail: G, yCaptionTail: M } = zt(
197
200
  this.labelAngles,
198
- a,
201
+ r,
199
202
  this.scales,
200
203
  this.step,
201
204
  e,
202
205
  i
203
206
  );
204
207
  this.captionsSizes = {
205
- xCaptionTail: E,
208
+ xCaptionTail: G,
206
209
  yCaptionTail: M,
207
- xGroupCaptions: K(l, this.labelAngles.xGroupLabels),
208
- yGroupCaptions: K(x, this.labelAngles.yGroupLabels),
209
- xAxisCaptions: K(c, this.labelAngles.xAxisLabels),
210
+ xGroupCaptions: K(h, this.labelAngles.xGroupLabels),
211
+ yGroupCaptions: K(u, this.labelAngles.yGroupLabels),
212
+ xAxisCaptions: K(n, this.labelAngles.xAxisLabels),
210
213
  yAxisCaptions: K(o, this.labelAngles.yAxisLabels)
211
214
  };
212
215
  }
213
- updateChartDimensions(e, t, s, a, i, n, r, u, f, p) {
214
- const m = t.length, b = Math.min(i.nRows ?? m, m), h = Math.min(i.nCols ?? m, m);
215
- this.columnsCount = i.nRows ? Math.ceil(m / b) : h, this.rowsCount = Math.ceil(m / this.columnsCount);
216
- const { sharedX: c, sharedY: o } = i;
216
+ updateChartDimensions(e, t, s, r, i, a, l, c, x, m) {
217
+ const p = t.length, L = Math.min(i.nRows ?? p, p), f = Math.min(i.nCols ?? p, p);
218
+ this.columnsCount = i.nRows ? Math.ceil(p / L) : f, this.rowsCount = Math.ceil(p / this.columnsCount);
219
+ const { sharedX: n, sharedY: o } = i;
217
220
  this.chartsDimensions = {};
218
- let l = 0, x = 0;
221
+ let h = 0, u = 0;
219
222
  t.forEach((S, g) => {
220
- const L = g % this.columnsCount + 1, y = pt(g, t.length, this.columnsCount, this.rowsCount), z = this.step.x[S], w = this.step.y[S], v = ft(
221
- n,
222
- r,
223
+ const E = g % this.columnsCount + 1, y = mt(g, t.length, this.columnsCount, this.rowsCount), b = this.step.x[S], w = this.step.y[S], D = yt(
224
+ a,
225
+ l,
223
226
  this.captionsSizes,
224
- u,
225
- f,
226
- p,
227
- y,
228
227
  c,
228
+ x,
229
+ m,
230
+ y,
231
+ n,
229
232
  o,
230
233
  t,
231
234
  s,
232
- a,
233
- z,
235
+ r,
236
+ b,
234
237
  w
235
- ), N = bt(u, y, c, o);
238
+ ), N = bt(c, y, n, o);
236
239
  function H(R) {
237
240
  return Math.max(
238
- xt[R].reduce((k, j) => k + v[R][j], 0),
241
+ St[R].reduce((k, j) => k + D[R][j], 0),
239
242
  N[R],
240
243
  e.innerOffset
241
244
  );
@@ -247,118 +250,118 @@ class Jt {
247
250
  bottom: H("bottom")
248
251
  };
249
252
  A.left < this.captionsSizes.xCaptionTail && (A.left = this.captionsSizes.xCaptionTail), A.bottom < this.captionsSizes.yCaptionTail && (A.bottom = this.captionsSizes.yCaptionTail);
250
- const B = St(v, this.chartSizes.chartWidth, this.chartSizes.chartHeight), W = this.chartSizes.chartWidth + A.left + A.right, _ = this.chartSizes.chartHeight + A.top + A.bottom;
253
+ const v = Ct(D, this.chartSizes.chartWidth, this.chartSizes.chartHeight), B = this.chartSizes.chartWidth + A.left + A.right, W = this.chartSizes.chartHeight + A.top + A.bottom;
251
254
  this.chartsDimensions[S] = {
252
- left: l,
253
- top: x,
255
+ left: h,
256
+ top: u,
254
257
  inner: { width: this.chartSizes.chartWidth, height: this.chartSizes.chartHeight },
255
- outer: { width: W, height: _ },
258
+ outer: { width: B, height: W },
256
259
  padding: A,
257
- sideElementBBoxes: B,
260
+ sideElementBBoxes: v,
258
261
  chartEdgeSides: y
259
- }, l += W, L === this.columnsCount && (l = 0, x += _);
262
+ }, h += B, E === this.columnsCount && (h = 0, u += W);
260
263
  });
261
- const E = t.slice(0, this.columnsCount).reduce((S, g) => S + this.chartsDimensions[g].outer.width, 0), M = t.filter((S, g) => g % this.columnsCount === 0).reduce((S, g) => S + this.chartsDimensions[g].outer.height, 0);
262
- this.chartSizes.chartsWidth = E, this.chartSizes.chartsHeight = M;
264
+ const G = t.slice(0, this.columnsCount).reduce((S, g) => S + this.chartsDimensions[g].outer.width, 0), M = t.filter((S, g) => g % this.columnsCount === 0).reduce((S, g) => S + this.chartsDimensions[g].outer.height, 0);
265
+ this.chartSizes.chartsWidth = G, this.chartSizes.chartsHeight = M;
263
266
  }
264
267
  updateChartsSizes(e, t, s) {
265
- const { width: a, height: i, cellWidth: n, cellHeight: r } = e, u = t.meta.facetKeys[0];
266
- if (n && u) {
267
- const f = t.facets[u].xKeys.length, p = t.meta.xGroupKeys.length;
268
- this.chartSizes.chartWidth = f * n + s * (p - 1);
268
+ const { width: r, height: i, cellWidth: a, cellHeight: l } = e, c = t.meta.facetKeys[0];
269
+ if (a && c) {
270
+ const x = t.facets[c].xKeys.length, m = t.meta.xGroupKeys.length;
271
+ this.chartSizes.chartWidth = x * a + s * (m - 1);
269
272
  } else
270
- this.chartSizes.chartWidth = a;
271
- if (r && u) {
272
- const f = t.facets[u].yKeys.length, p = t.meta.yGroupKeys.length;
273
- this.chartSizes.chartHeight = f * r + s * (p - 1);
273
+ this.chartSizes.chartWidth = r;
274
+ if (l && c) {
275
+ const x = t.facets[c].yKeys.length, m = t.meta.yGroupKeys.length;
276
+ this.chartSizes.chartHeight = x * l + s * (m - 1);
274
277
  } else
275
278
  this.chartSizes.chartHeight = i;
276
279
  }
277
280
  // update scales for cell positions, x and y for each facet
278
- updateScales(e, t, s, a, i, n, r, u, f, p) {
279
- const { width: m, height: b, cellWidth: h, cellHeight: c } = i, { meta: o, facets: l } = t, { sharedX: x, sharedY: E } = a, M = (g, L = {}) => g.sort(
280
- (y, z) => n.sorting === "asc" ? (L[y] ?? y).localeCompare(L[z] ?? z, "en", { numeric: !0 }) : (L[z] ?? z).localeCompare(L[y] ?? y, "en", { numeric: !0 })
281
- ), S = (g, L = {}) => g.sort(
282
- (y, z) => r.sorting === "asc" ? (L[y] ?? y).localeCompare(L[z] ?? z, "en", { numeric: !0 }) : (L[z] ?? z).localeCompare(L[y] ?? y, "en", { numeric: !0 })
281
+ updateScales(e, t, s, r, i, a, l, c, x, m) {
282
+ const { width: p, height: L, cellWidth: f, cellHeight: n } = i, { meta: o, facets: h } = t, { sharedX: u, sharedY: G } = r, M = (g, E = {}) => g.sort(
283
+ (y, b) => a.sorting === "asc" ? (E[y] ?? y).localeCompare(E[b] ?? b, "en", { numeric: !0 }) : (E[b] ?? b).localeCompare(E[y] ?? y, "en", { numeric: !0 })
284
+ ), S = (g, E = {}) => g.sort(
285
+ (y, b) => l.sorting === "asc" ? (E[y] ?? y).localeCompare(E[b] ?? b, "en", { numeric: !0 }) : (E[b] ?? b).localeCompare(E[y] ?? y, "en", { numeric: !0 })
283
286
  );
284
287
  e.forEach((g) => {
285
- const L = l[g], y = p.xGroup ? o.xGroupKeys : M(o.xGroupKeys), z = p.yGroup ? o.yGroupKeys : S(o.yGroupKeys), { xKeysByGroups: w } = x ? o : L, { yKeysByGroups: v } = E ? o : L, N = y.map((G) => w[G].length), H = z.map((G) => v[G].length), A = N.reduce((G, T) => G + T, 0), B = H.reduce((G, T) => G + T, 0), W = h || (m - (N.filter((G) => G > 0).length - 1) * s) / A, _ = c || (b - (H.filter((G) => G > 0).length - 1) * s) / B, R = [];
288
+ const E = h[g], y = m.xGroup ? o.xGroupKeys : M(o.xGroupKeys), b = m.yGroup ? o.yGroupKeys : S(o.yGroupKeys), { xKeysByGroups: w } = u ? o : E, { yKeysByGroups: D } = G ? o : E, N = y.map((z) => w[z].length), H = b.map((z) => D[z].length), A = N.reduce((z, T) => z + T, 0), v = H.reduce((z, T) => z + T, 0), B = f || (p - (N.filter((z) => z > 0).length - 1) * s) / A, W = n || (L - (H.filter((z) => z > 0).length - 1) * s) / v, R = [];
286
289
  let k = [], j = 0;
287
- y.forEach((G) => {
288
- const T = u || p.x ? w[G] : M(w[G], o.xLabels);
290
+ y.forEach((z) => {
291
+ const T = c || m.x ? w[z] : M(w[z], o.xLabels);
289
292
  k = k.concat(T), T.forEach(() => {
290
- R.push(j), j += W;
293
+ R.push(j), j += B;
291
294
  }), T.length > 0 && (j += s);
292
295
  });
293
296
  const J = [];
294
- let U = [], X = 0;
295
- z.forEach((G) => {
296
- const T = f || p.y ? v[G] : S(v[G], o.yLabels);
297
- U = U.concat(T), T.forEach(() => {
298
- J.push(X), X += _;
299
- }), T.length > 0 && (X += s);
300
- }), this.scales.x[g] = I().domain(k).range(R), this.scales.y[g] = I().domain(U).range(J), this.step.x[g] = W, this.step.y[g] = _;
297
+ let X = [], U = 0;
298
+ b.forEach((z) => {
299
+ const T = x || m.y ? D[z] : S(D[z], o.yLabels);
300
+ X = X.concat(T), T.forEach(() => {
301
+ J.push(U), U += W;
302
+ }), T.length > 0 && (U += s);
303
+ }), this.scales.x[g] = _().domain(k).range(R), this.scales.y[g] = _().domain(X).range(J), this.step.x[g] = B, this.step.y[g] = W;
301
304
  });
302
305
  }
303
- updateAesScale(e, t, s, a, i, n, r) {
306
+ updateAesScale(e, t, s, r, i, a, l) {
304
307
  if (e === "continuous")
305
- s.valueColors ? this.colorScale = D().domain(s.valuesByColors ?? et(r, s.valueColors.length, t)).range(s.valueColors) : s.colorsList && (this.colorScale = D().domain(et(r, s.colorsList.length, t)).range(s.colorsList));
308
+ s.valueColors ? this.colorScale = I().domain(s.valuesByColors ?? et(l, s.valueColors.length, t)).range(s.valueColors) : s.colorsList && (this.colorScale = I().domain(et(l, s.colorsList.length, t)).range(s.colorsList));
306
309
  else if (s.colorsMap) {
307
- const p = Object.entries(s.colorsMap);
308
- this.colorScale = I().domain(p.map((m) => m[0])).range(p.map((m) => m[1])).unknown("#ccc");
309
- } else s.colorsList && (this.colorScale = yt(s.colorsList, n.map(String)));
310
- const { xDataByKeys: u, yDataByKeys: f } = i.meta;
311
- a.forEach((p) => {
312
- const { colors: m, type: b, axis: h, valueColumn: c } = p, o = (h === "x" ? u : f)[c.valueLabels ?? c.value];
313
- if (b === "discrete") {
314
- const l = nt.uniq(Object.values(o).map(String)).sort();
315
- this.annotationColorScales[p.id] = {
310
+ const m = Object.entries(s.colorsMap);
311
+ this.colorScale = _().domain(m.map((p) => p[0])).range(m.map((p) => p[1])).unknown("#ccc");
312
+ } else s.colorsList && (this.colorScale = Lt(s.colorsList, a.map(String)));
313
+ const { xDataByKeys: c, yDataByKeys: x } = i.meta;
314
+ r.forEach((m) => {
315
+ const { colors: p, type: L, axis: f, valueColumn: n } = m, o = (f === "x" ? c : x)[n.valueLabels ?? n.value];
316
+ if (L === "discrete") {
317
+ const h = nt.uniq(Object.values(o).map(String)).sort();
318
+ this.annotationColorScales[m.id] = {
316
319
  type: "discrete",
317
- scale: Ct(m, l)
320
+ scale: Gt(p, h)
318
321
  };
319
322
  } else {
320
- const l = Object.values(o).map(Number);
321
- if (!l.length)
323
+ const h = Object.values(o).map(Number);
324
+ if (!h.length)
322
325
  return;
323
- const [x = l[0], E = l[0]] = Gt(l);
324
- this.annotationColorScales[p.id] = {
326
+ const [u = h[0], G = h[0]] = At(h);
327
+ this.annotationColorScales[m.id] = {
325
328
  type: "continuous",
326
- scale: Lt(m, x, E, 0, 0.5, 1)
329
+ scale: Et(p, u, G, 0, 0.5, 1)
327
330
  };
328
331
  }
329
332
  });
330
333
  }
331
- updateDendrogram(e, t, s, a, i, n, r) {
332
- e.forEach((u) => {
333
- this.dendrograms[u] = { x: { treesByGroupKey: {}, data: n }, y: { treesByGroupKey: {}, data: r } };
334
- const { xKeysByGroups: f, yKeysByGroups: p } = a[u];
335
- if (n) {
336
- const { hierarchyByGroupX: m } = i[u], b = t.reduce((h, c) => {
334
+ updateDendrogram(e, t, s, r, i, a, l) {
335
+ e.forEach((c) => {
336
+ this.dendrograms[c] = { x: { treesByGroupKey: {}, data: a }, y: { treesByGroupKey: {}, data: l } };
337
+ const { xKeysByGroups: x, yKeysByGroups: m } = r[c];
338
+ if (a) {
339
+ const { hierarchyByGroupX: p } = i[c], L = t.reduce((f, n) => {
337
340
  var o;
338
- return Math.max(h, (o = m[c]) == null ? void 0 : o.data.height);
341
+ return Math.max(f, (o = p[n]) == null ? void 0 : o.data.height);
339
342
  }, 0);
340
- this.dendrograms[u].x.treesByGroupKey = t.reduce((h, c) => {
341
- const o = m[c], l = f[c];
342
- $().separation(() => 1).size([l.length * this.step.x[u], n.size])(
343
+ this.dendrograms[c].x.treesByGroupKey = t.reduce((f, n) => {
344
+ const o = p[n], h = x[n];
345
+ $().separation(() => 1).size([h.length * this.step.x[c], a.size])(
343
346
  o
344
347
  );
345
- const x = o, E = D().domain(n.position === "top" ? [0, b] : [b, 0]).range([n.size, 0]);
346
- return tt(x, E, "y"), st(x, this.scales.x[u](l[0]), "x"), h[c] = x, h;
347
- }, {}), this.dendrograms[u].x.data = n;
348
+ const u = o, G = I().domain(a.position === "top" ? [0, L] : [L, 0]).range([a.size, 0]);
349
+ return tt(u, G, "y"), st(u, this.scales.x[c](h[0]), "x"), f[n] = u, f;
350
+ }, {}), this.dendrograms[c].x.data = a;
348
351
  }
349
- if (r) {
350
- const { hierarchyByGroupY: m } = i[u], b = s.reduce((h, c) => {
352
+ if (l) {
353
+ const { hierarchyByGroupY: p } = i[c], L = s.reduce((f, n) => {
351
354
  var o;
352
- return Math.max(h, (o = m[c]) == null ? void 0 : o.data.height);
355
+ return Math.max(f, (o = p[n]) == null ? void 0 : o.data.height);
353
356
  }, 0);
354
- this.dendrograms[u].y.treesByGroupKey = s.reduce((h, c) => {
355
- const o = m[c], l = p[c];
356
- $().separation(() => 1).size([l.length * this.step.y[u], r.size])(
357
+ this.dendrograms[c].y.treesByGroupKey = s.reduce((f, n) => {
358
+ const o = p[n], h = m[n];
359
+ $().separation(() => 1).size([h.length * this.step.y[c], l.size])(
357
360
  o
358
361
  );
359
- const x = o, E = D().domain(r.position === "left" ? [0, b] : [b, 0]).range([r.size, 0]);
360
- return st(x, this.scales.y[u](l[0]), "x", "y"), tt(x, E, "x"), h[c] = x, h;
361
- }, {}), this.dendrograms[u].y.data = r;
362
+ const u = o, G = I().domain(l.position === "left" ? [0, L] : [L, 0]).range([l.size, 0]);
363
+ return st(u, this.scales.y[c](h[0]), "x", "y"), tt(u, G, "x"), f[n] = u, f;
364
+ }, {}), this.dendrograms[c].y.data = l;
362
365
  }
363
366
  });
364
367
  }
@@ -366,39 +369,39 @@ class Jt {
366
369
  if (!e)
367
370
  return;
368
371
  const t = Object.keys(e);
369
- this.dendrogramAesScales = t.reduce((s, a) => {
370
- const i = e[a], n = Object.keys(i);
371
- return s[a] = I().domain(n).range(
372
- n.map((r) => ({
372
+ this.dendrogramAesScales = t.reduce((s, r) => {
373
+ const i = e[r], a = Object.keys(i);
374
+ return s[r] = _().domain(a).range(
375
+ a.map((l) => ({
373
376
  ...Z,
374
- ...i[r]
377
+ ...i[l]
375
378
  }))
376
379
  ).unknown(Z), s;
377
380
  }, {});
378
381
  }
379
- render(e, t, s, a, i, n, r, u, f, p, m, b, h, c, o, l, x) {
380
- var B;
381
- const { meta: E, facets: M } = n, { facetKeys: S, xGroupKeys: g, yGroupKeys: L, valueExtent: y } = E, { xAxis: z, yAxis: w, title: v, size: N, valueType: H } = s;
382
- this.updateChartsSizes(N, n, i.groupGap), this.updateAesScale(H, y.dataSource, i, r, n, h, c), this.updateScales(S, n, i.groupGap, a, N, s.xAxis, s.yAxis, f, p, l), this.updateCaptionsSize(n, z, w, a), this.updateChartDimensions(
382
+ render(e, t, s, r, i, a, l, c, x, m, p, L, f, n, o, h, u) {
383
+ var v;
384
+ const { meta: G, facets: M } = a, { facetKeys: S, xGroupKeys: g, yGroupKeys: E, valueExtent: y } = G, { xAxis: b, yAxis: w, title: D, size: N, valueType: H } = s;
385
+ this.updateChartsSizes(N, a, i.groupGap), this.updateAesScale(H, y.dataSource, i, l, a, f, n), this.updateScales(S, a, i.groupGap, r, N, s.xAxis, s.yAxis, x, m, h), this.updateCaptionsSize(a, b, w, r), this.updateChartDimensions(
383
386
  N,
384
387
  S,
385
388
  g,
386
- L,
387
- a,
388
- z,
389
- w,
389
+ E,
390
390
  r,
391
- f,
392
- p
393
- ), this.updateLegendSize(H, s.legend, r, u, y.dataSource), this.updateMargins(v, N), this.updateDendrogram(S, g, L, M, m, f, p), this.updateDendrogramAesScales(b);
391
+ b,
392
+ w,
393
+ l,
394
+ x,
395
+ m
396
+ ), this.updateLegendSize(H, s.legend, l, c, y.dataSource), this.updateMargins(D, N), this.updateDendrogram(S, g, E, M, p, x, m), this.updateDendrogramAesScales(L);
394
397
  const A = /* @__PURE__ */ O.jsx(ht, { dataFrame: e, children: /* @__PURE__ */ O.jsx(
395
- mt,
398
+ xt,
396
399
  {
397
400
  aes: i,
398
- annotations: r,
401
+ annotations: l,
399
402
  annotationColorScales: this.annotationColorScales,
400
403
  captionsSizes: this.captionsSizes,
401
- cellsMeta: E,
404
+ cellsMeta: G,
402
405
  columnsCount: this.columnsCount,
403
406
  chartsDimensions: this.chartsDimensions,
404
407
  chartSettings: s,
@@ -407,7 +410,7 @@ class Jt {
407
410
  dendrogramAesScales: this.dendrogramAesScales,
408
411
  dendrograms: this.dendrograms,
409
412
  facetKeys: S,
410
- facetSettings: a,
413
+ facetSettings: r,
411
414
  groupedCells: M,
412
415
  labelAngles: this.labelAngles,
413
416
  legend: this.legend,
@@ -416,19 +419,19 @@ class Jt {
416
419
  settingsId: t,
417
420
  step: this.step,
418
421
  xGroupKeys: g,
419
- yGroupKeys: L,
422
+ yGroupKeys: E,
420
423
  onTooltipHintSwitch: o,
421
- cellsRenderingMode: x
424
+ cellsRenderingMode: u
422
425
  }
423
426
  ) });
424
- this.component = A, (B = this.reactRoot) == null || B.render(A);
427
+ this.component = A, (v = this.reactRoot) == null || v.render(A);
425
428
  }
426
429
  renderError(e) {
427
430
  var t;
428
- (t = this.reactRoot) == null || t.render(/* @__PURE__ */ O.jsx(at, { message: e }));
431
+ (t = this.reactRoot) == null || t.render(/* @__PURE__ */ O.jsx(rt, { message: e }));
429
432
  }
430
433
  }
431
434
  export {
432
- Jt as default
435
+ Zt as default
433
436
  };
434
437
  //# sourceMappingURL=ChartRenderer.js.map