@milaboratories/miplots4 1.0.158 → 1.0.160
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/heatmap/ChartRenderer.d.ts +1 -1
- package/dist/heatmap/ChartRenderer.js +156 -156
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +5 -5
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/getDendrograms.d.ts +1 -1
- package/dist/heatmap/getDendrograms.js +36 -42
- package/dist/heatmap/getDendrograms.js.map +1 -1
- package/dist/heatmap/index.js +81 -77
- package/dist/heatmap/index.js.map +1 -1
- package/dist/scatterplot-umap/index.js +15 -15
- package/dist/scatterplot-umap/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -36,7 +36,7 @@ declare class ChartRenderer {
|
|
|
36
36
|
updateLegendSize(valueType: HeatmapSettingsImpl['chartSettings']['valueType'], legend: HeatmapSettingsImpl['chartSettings']['legend'], annotations: HeatmapSettingsImpl['annotations'], columnValue: ColumnName, valueExtent: [number, number]): void;
|
|
37
37
|
updateCaptionsSize(groupedCells: GroupedCellsHeatmap, xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], facetSettings: HeatmapSettingsImpl['facetSettings']): void;
|
|
38
38
|
updateChartDimensions(size: HeatmapSettingsImpl['chartSettings']['size'], facetKeys: string[], xGroupKeys: string[], yGroupKeys: string[], facetSettings: HeatmapSettingsImpl['facetSettings'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY']): void;
|
|
39
|
-
updateChartsSizes(size: HeatmapSettingsImpl['chartSettings']['size'],
|
|
39
|
+
updateChartsSizes(size: HeatmapSettingsImpl['chartSettings']['size'], groupedCells: GroupedCellsHeatmap, groupGap: number): void;
|
|
40
40
|
updateScales(facetKeys: string[], groupedCells: GroupedCellsHeatmap, groupGap: number, facetSettings: HeatmapSettingsImpl['facetSettings'], size: HeatmapSettingsImpl['chartSettings']['size'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], customOrder: {
|
|
41
41
|
x: boolean;
|
|
42
42
|
y: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var ot = Object.defineProperty;
|
|
2
|
-
var it = (
|
|
3
|
-
var C = (
|
|
2
|
+
var it = (d, e, t) => e in d ? ot(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
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
6
|
import { c as rt } from "../_virtual/client.js";
|
|
@@ -23,48 +23,48 @@ import D from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/li
|
|
|
23
23
|
import Gt 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 Et = Math.cos(Math.PI / 4), At = 5;
|
|
26
|
-
function tt(
|
|
27
|
-
function
|
|
28
|
-
|
|
26
|
+
function tt(d, e, t) {
|
|
27
|
+
function s(a) {
|
|
28
|
+
a[t] = e(a.data.height), a.children && a.children.forEach(s);
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
s(d);
|
|
31
31
|
}
|
|
32
|
-
function st(
|
|
33
|
-
function
|
|
34
|
-
i[
|
|
32
|
+
function st(d, e, t, s = t) {
|
|
33
|
+
function a(i) {
|
|
34
|
+
i[s] = i[t] + e, i.children && i.children.forEach(a);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
a(d);
|
|
37
37
|
}
|
|
38
|
-
const Tt = (
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
for (let
|
|
43
|
-
|
|
44
|
-
return
|
|
38
|
+
const Tt = (d, e) => {
|
|
39
|
+
const t = Math.min(...e), s = Math.max(...e);
|
|
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;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
47
|
-
return [
|
|
48
|
-
const
|
|
49
|
-
for (let
|
|
50
|
-
i.push(
|
|
51
|
-
return i.push(
|
|
46
|
+
if (d < 2)
|
|
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);
|
|
51
|
+
return i.push(s), i;
|
|
52
52
|
};
|
|
53
|
-
function et(
|
|
54
|
-
let
|
|
55
|
-
return
|
|
53
|
+
function et(d, e, t) {
|
|
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);
|
|
56
56
|
}
|
|
57
|
-
function P(
|
|
58
|
-
let
|
|
59
|
-
for (const
|
|
60
|
-
if (e[
|
|
61
|
-
const i =
|
|
62
|
-
i >
|
|
57
|
+
function P(d, e, t) {
|
|
58
|
+
let s = 0;
|
|
59
|
+
for (const a of d) {
|
|
60
|
+
if (e[a] === void 0) continue;
|
|
61
|
+
const i = t.getTextWidth(e[a]);
|
|
62
|
+
i > s && (s = i);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return s;
|
|
65
65
|
}
|
|
66
|
-
function K(
|
|
67
|
-
return e === 90 ?
|
|
66
|
+
function K(d, e) {
|
|
67
|
+
return e === 90 ? d : e === 45 ? d * Et + (d > 0 ? 2 * At : 0) : V;
|
|
68
68
|
}
|
|
69
69
|
class Jt {
|
|
70
70
|
constructor() {
|
|
@@ -128,31 +128,31 @@ class Jt {
|
|
|
128
128
|
clear() {
|
|
129
129
|
var e;
|
|
130
130
|
this.parentNode && this.rootNode && ((e = this.parentNode) == null || e.removeChild(this.rootNode), this.parentNode = null, this.rootNode = null), setTimeout(() => {
|
|
131
|
-
var
|
|
132
|
-
(
|
|
131
|
+
var t;
|
|
132
|
+
(t = this.reactRoot) == null || t.unmount(), this.reactRoot = null;
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
init(e) {
|
|
136
136
|
this.parentNode === null && (this.parentNode = e, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = rt.createRoot(this.rootNode));
|
|
137
137
|
}
|
|
138
|
-
updateMargins(e,
|
|
138
|
+
updateMargins(e, t) {
|
|
139
139
|
this.margins = {
|
|
140
|
-
top: e.show ? ct + lt * 2 :
|
|
141
|
-
bottom:
|
|
142
|
-
left:
|
|
143
|
-
right: this.legend.width +
|
|
140
|
+
top: e.show ? ct + lt * 2 : t.outerOffset,
|
|
141
|
+
bottom: t.outerOffset,
|
|
142
|
+
left: t.outerOffset,
|
|
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,
|
|
147
|
-
if (!
|
|
146
|
+
updateLegendSize(e, t, s, a, i) {
|
|
147
|
+
if (!t.show) {
|
|
148
148
|
this.legend = { width: 0, height: 0, items: [] };
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
const
|
|
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), {});
|
|
152
152
|
if (e === "continuous") {
|
|
153
|
-
const h = this.colorScale, c = Q(h, i), o = D([c[0], c[c.length - 1]], [
|
|
154
|
-
|
|
155
|
-
...
|
|
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
156
|
type: "continuous",
|
|
157
157
|
id: "heatmapValue",
|
|
158
158
|
scale: h,
|
|
@@ -161,41 +161,41 @@ class Jt {
|
|
|
161
161
|
tickPositionScale: o
|
|
162
162
|
});
|
|
163
163
|
} else if (e === "discrete") {
|
|
164
|
-
const h = this.colorScale, c =
|
|
165
|
-
|
|
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 });
|
|
166
166
|
}
|
|
167
|
-
if (
|
|
167
|
+
if (s.forEach((h) => {
|
|
168
168
|
const c = h.valueColumn.label ?? h.valueColumn.value;
|
|
169
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]], [
|
|
171
|
-
|
|
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 });
|
|
172
172
|
}
|
|
173
173
|
if (h.type === "discrete") {
|
|
174
174
|
const o = this.annotationColorScales[h.id].scale, l = o.domain(), x = f(l);
|
|
175
|
-
|
|
175
|
+
r.push({ ...u, type: "discreteColor", id: h.id, title: c, scale: o, values: l, labels: x });
|
|
176
176
|
}
|
|
177
|
-
}), !
|
|
177
|
+
}), !r.length) {
|
|
178
178
|
this.legend = { width: 0, height: 0, items: [] };
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const p = ut(r, this.chartSizes.chartHeight), m = p[p.length - 1], b = m.left + m.width + gt;
|
|
182
182
|
this.legend = {
|
|
183
183
|
width: b,
|
|
184
|
-
height:
|
|
185
|
-
items:
|
|
184
|
+
height: n,
|
|
185
|
+
items: p
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
-
updateCaptionsSize(e,
|
|
189
|
-
const i = new dt("bold 16px Manrope"), { xGroupKeys:
|
|
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;
|
|
190
190
|
this.labelAngles = {
|
|
191
|
-
xAxisLabels:
|
|
192
|
-
yAxisLabels:
|
|
193
|
-
xGroupLabels:
|
|
194
|
-
yGroupLabels:
|
|
191
|
+
xAxisLabels: t.axisLabelsAngle,
|
|
192
|
+
yAxisLabels: s.axisLabelsAngle,
|
|
193
|
+
xGroupLabels: t.groupLabelsAngle,
|
|
194
|
+
yGroupLabels: s.groupLabelsAngle
|
|
195
195
|
};
|
|
196
|
-
const c =
|
|
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(
|
|
197
197
|
this.labelAngles,
|
|
198
|
-
|
|
198
|
+
a,
|
|
199
199
|
this.scales,
|
|
200
200
|
this.step,
|
|
201
201
|
e,
|
|
@@ -210,29 +210,29 @@ class Jt {
|
|
|
210
210
|
yAxisCaptions: K(o, this.labelAngles.yAxisLabels)
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
updateChartDimensions(e,
|
|
214
|
-
const
|
|
215
|
-
this.columnsCount = i.nRows ? Math.ceil(
|
|
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
216
|
const { sharedX: c, sharedY: o } = i;
|
|
217
217
|
this.chartsDimensions = {};
|
|
218
218
|
let l = 0, x = 0;
|
|
219
|
-
|
|
220
|
-
const L = g % this.columnsCount + 1, y = pt(g,
|
|
219
|
+
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,
|
|
221
222
|
r,
|
|
222
|
-
a,
|
|
223
223
|
this.captionsSizes,
|
|
224
|
-
|
|
224
|
+
u,
|
|
225
225
|
f,
|
|
226
|
-
|
|
226
|
+
p,
|
|
227
227
|
y,
|
|
228
228
|
c,
|
|
229
229
|
o,
|
|
230
|
-
s,
|
|
231
230
|
t,
|
|
232
|
-
|
|
231
|
+
s,
|
|
232
|
+
a,
|
|
233
233
|
z,
|
|
234
234
|
w
|
|
235
|
-
), N = bt(
|
|
235
|
+
), N = bt(u, y, c, o);
|
|
236
236
|
function H(R) {
|
|
237
237
|
return Math.max(
|
|
238
238
|
xt[R].reduce((k, j) => k + v[R][j], 0),
|
|
@@ -258,162 +258,162 @@ class Jt {
|
|
|
258
258
|
chartEdgeSides: y
|
|
259
259
|
}, l += W, L === this.columnsCount && (l = 0, x += _);
|
|
260
260
|
});
|
|
261
|
-
const E =
|
|
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
262
|
this.chartSizes.chartsWidth = E, this.chartSizes.chartsHeight = M;
|
|
263
263
|
}
|
|
264
|
-
updateChartsSizes(e,
|
|
265
|
-
const { width:
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
268
|
-
this.chartSizes.chartWidth =
|
|
264
|
+
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);
|
|
269
269
|
} else
|
|
270
|
-
this.chartSizes.chartWidth =
|
|
271
|
-
if (
|
|
272
|
-
const
|
|
273
|
-
this.chartSizes.chartHeight =
|
|
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);
|
|
274
274
|
} else
|
|
275
|
-
this.chartSizes.chartHeight =
|
|
275
|
+
this.chartSizes.chartHeight = i;
|
|
276
276
|
}
|
|
277
277
|
// update scales for cell positions, x and y for each facet
|
|
278
|
-
updateScales(e,
|
|
279
|
-
const { width:
|
|
280
|
-
(y, z) =>
|
|
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
281
|
), S = (g, L = {}) => g.sort(
|
|
282
|
-
(y, z) =>
|
|
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 })
|
|
283
283
|
);
|
|
284
284
|
e.forEach((g) => {
|
|
285
|
-
const L = l[g], y =
|
|
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 = [];
|
|
286
286
|
let k = [], j = 0;
|
|
287
287
|
y.forEach((G) => {
|
|
288
|
-
const T =
|
|
288
|
+
const T = u || p.x ? w[G] : M(w[G], o.xLabels);
|
|
289
289
|
k = k.concat(T), T.forEach(() => {
|
|
290
290
|
R.push(j), j += W;
|
|
291
|
-
}), T.length > 0 && (j +=
|
|
291
|
+
}), T.length > 0 && (j += s);
|
|
292
292
|
});
|
|
293
293
|
const J = [];
|
|
294
|
-
let
|
|
294
|
+
let U = [], X = 0;
|
|
295
295
|
z.forEach((G) => {
|
|
296
|
-
const T = f ||
|
|
297
|
-
|
|
298
|
-
J.push(
|
|
299
|
-
}), T.length > 0 && (
|
|
300
|
-
}), this.scales.x[g] = I().domain(k).range(R), this.scales.y[g] = I().domain(
|
|
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] = _;
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
-
updateAesScale(e,
|
|
303
|
+
updateAesScale(e, t, s, a, i, n, r) {
|
|
304
304
|
if (e === "continuous")
|
|
305
|
-
|
|
306
|
-
else if (
|
|
307
|
-
const
|
|
308
|
-
this.colorScale = I().domain(
|
|
309
|
-
} else
|
|
310
|
-
const { xDataByKeys:
|
|
311
|
-
|
|
312
|
-
const { colors:
|
|
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));
|
|
306
|
+
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
313
|
if (b === "discrete") {
|
|
314
314
|
const l = nt.uniq(Object.values(o).map(String)).sort();
|
|
315
|
-
this.annotationColorScales[
|
|
315
|
+
this.annotationColorScales[p.id] = {
|
|
316
316
|
type: "discrete",
|
|
317
|
-
scale: Ct(
|
|
317
|
+
scale: Ct(m, l)
|
|
318
318
|
};
|
|
319
319
|
} else {
|
|
320
320
|
const l = Object.values(o).map(Number);
|
|
321
321
|
if (!l.length)
|
|
322
322
|
return;
|
|
323
323
|
const [x = l[0], E = l[0]] = Gt(l);
|
|
324
|
-
this.annotationColorScales[
|
|
324
|
+
this.annotationColorScales[p.id] = {
|
|
325
325
|
type: "continuous",
|
|
326
|
-
scale: Lt(
|
|
326
|
+
scale: Lt(m, x, E, 0, 0.5, 1)
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
updateDendrogram(e,
|
|
332
|
-
e.forEach((
|
|
333
|
-
this.dendrograms[
|
|
334
|
-
const { xKeysByGroups: f, yKeysByGroups:
|
|
335
|
-
if (
|
|
336
|
-
const { hierarchyByGroupX:
|
|
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) => {
|
|
337
337
|
var o;
|
|
338
|
-
return Math.max(h, (o =
|
|
338
|
+
return Math.max(h, (o = m[c]) == null ? void 0 : o.data.height);
|
|
339
339
|
}, 0);
|
|
340
|
-
this.dendrograms[
|
|
341
|
-
const o =
|
|
342
|
-
$().separation(() => 1).size([l.length * this.step.x[
|
|
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
343
|
o
|
|
344
344
|
);
|
|
345
|
-
const x = o, E = D().domain(
|
|
346
|
-
return tt(x, E, "y"), st(x, this.scales.x[
|
|
347
|
-
}, {}), this.dendrograms[
|
|
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
348
|
}
|
|
349
|
-
if (
|
|
350
|
-
const { hierarchyByGroupY:
|
|
349
|
+
if (r) {
|
|
350
|
+
const { hierarchyByGroupY: m } = i[u], b = s.reduce((h, c) => {
|
|
351
351
|
var o;
|
|
352
|
-
return Math.max(h, (o =
|
|
352
|
+
return Math.max(h, (o = m[c]) == null ? void 0 : o.data.height);
|
|
353
353
|
}, 0);
|
|
354
|
-
this.dendrograms[
|
|
355
|
-
const o =
|
|
356
|
-
$().separation(() => 1).size([l.length * this.step.y[
|
|
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
357
|
o
|
|
358
358
|
);
|
|
359
|
-
const x = o, E = D().domain(
|
|
360
|
-
return st(x, this.scales.y[
|
|
361
|
-
}, {}), this.dendrograms[
|
|
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
362
|
}
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
updateDendrogramAesScales(e) {
|
|
366
366
|
if (!e)
|
|
367
367
|
return;
|
|
368
|
-
const
|
|
369
|
-
this.dendrogramAesScales =
|
|
370
|
-
const i = e[
|
|
371
|
-
return
|
|
372
|
-
|
|
368
|
+
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) => ({
|
|
373
373
|
...Z,
|
|
374
|
-
...i[
|
|
374
|
+
...i[r]
|
|
375
375
|
}))
|
|
376
|
-
).unknown(Z),
|
|
376
|
+
).unknown(Z), s;
|
|
377
377
|
}, {});
|
|
378
378
|
}
|
|
379
|
-
render(e,
|
|
379
|
+
render(e, t, s, a, i, n, r, u, f, p, m, b, h, c, o, l, x) {
|
|
380
380
|
var B;
|
|
381
|
-
const { meta: E, facets: M } =
|
|
382
|
-
this.updateChartsSizes(N, n,
|
|
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(
|
|
383
383
|
N,
|
|
384
384
|
S,
|
|
385
385
|
g,
|
|
386
386
|
L,
|
|
387
|
-
|
|
387
|
+
a,
|
|
388
388
|
z,
|
|
389
389
|
w,
|
|
390
|
-
|
|
390
|
+
r,
|
|
391
391
|
f,
|
|
392
|
-
|
|
393
|
-
), this.updateLegendSize(H,
|
|
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);
|
|
394
394
|
const A = /* @__PURE__ */ O.jsx(ht, { dataFrame: e, children: /* @__PURE__ */ O.jsx(
|
|
395
395
|
mt,
|
|
396
396
|
{
|
|
397
397
|
aes: i,
|
|
398
|
-
annotations:
|
|
398
|
+
annotations: r,
|
|
399
399
|
annotationColorScales: this.annotationColorScales,
|
|
400
400
|
captionsSizes: this.captionsSizes,
|
|
401
401
|
cellsMeta: E,
|
|
402
402
|
columnsCount: this.columnsCount,
|
|
403
403
|
chartsDimensions: this.chartsDimensions,
|
|
404
|
-
chartSettings:
|
|
404
|
+
chartSettings: s,
|
|
405
405
|
chartSizes: this.chartSizes,
|
|
406
406
|
colorScale: this.colorScale,
|
|
407
407
|
dendrogramAesScales: this.dendrogramAesScales,
|
|
408
408
|
dendrograms: this.dendrograms,
|
|
409
409
|
facetKeys: S,
|
|
410
|
-
facetSettings:
|
|
410
|
+
facetSettings: a,
|
|
411
411
|
groupedCells: M,
|
|
412
412
|
labelAngles: this.labelAngles,
|
|
413
413
|
legend: this.legend,
|
|
414
414
|
margins: this.margins,
|
|
415
415
|
scales: this.scales,
|
|
416
|
-
settingsId:
|
|
416
|
+
settingsId: t,
|
|
417
417
|
step: this.step,
|
|
418
418
|
xGroupKeys: g,
|
|
419
419
|
yGroupKeys: L,
|
|
@@ -424,8 +424,8 @@ class Jt {
|
|
|
424
424
|
this.component = A, (B = this.reactRoot) == null || B.render(A);
|
|
425
425
|
}
|
|
426
426
|
renderError(e) {
|
|
427
|
-
var
|
|
428
|
-
(
|
|
427
|
+
var t;
|
|
428
|
+
(t = this.reactRoot) == null || t.render(/* @__PURE__ */ O.jsx(at, { message: e }));
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
export {
|