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