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