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