@milaboratories/miplots4 1.0.171 → 1.0.172
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 +143 -146
- package/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/dendro/ChartRenderer.js +175 -174
- package/dist/dendro/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +149 -152
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +152 -155
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/utils/arrangeLegendParts.js +35 -35
- package/dist/utils/arrangeLegendParts.js.map +1 -1
- package/dist/utils/getContinuousLegendTicks.js +5 -8
- package/dist/utils/getContinuousLegendTicks.js.map +1 -1
- package/dist/utils/getSizeLegendItem.d.ts +3 -0
- package/dist/utils/getSizeLegendItem.js +15 -0
- package/dist/utils/getSizeLegendItem.js.map +1 -0
- package/dist/utils/numberFormat.d.ts +1 -0
- package/dist/utils/numberFormat.js +9 -4
- package/dist/utils/numberFormat.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,99 +1,100 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { j as
|
|
5
|
-
import { c as
|
|
6
|
-
import { Error as
|
|
7
|
-
import { BLACK as
|
|
8
|
-
import { DEFAULT_DOT_AES as
|
|
9
|
-
import { isCategoricalAes as
|
|
1
|
+
var q = Object.defineProperty;
|
|
2
|
+
var k = (n, t, e) => t in n ? q(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var L = (n, t, e) => k(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { j as O } from "../_virtual/jsx-runtime.js";
|
|
5
|
+
import { c as J } from "../_virtual/client.js";
|
|
6
|
+
import { Error as Q } from "../common/Error.js";
|
|
7
|
+
import { BLACK as V } from "../constants.js";
|
|
8
|
+
import { DEFAULT_DOT_AES as Y, LEGEND_OFFSET as Z } from "../scatterplot/constants.js";
|
|
9
|
+
import { isCategoricalAes as U, isContinuousAes as X } from "../types/common.js";
|
|
10
10
|
import "../types/discrete.js";
|
|
11
11
|
import "../types/scatterplot.js";
|
|
12
12
|
import "../types/heatmap.js";
|
|
13
13
|
import "../types/dendro.js";
|
|
14
14
|
import "../types/histogram.js";
|
|
15
15
|
import "../types/bubble.js";
|
|
16
|
-
import { getContinuousLegendTicks as
|
|
17
|
-
import { getContinuousLegendWidth as
|
|
18
|
-
import { TextMeasurer as
|
|
19
|
-
import { Chart as
|
|
20
|
-
import { MARGIN as
|
|
21
|
-
import { updateLinksHeight as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
import { getContinuousLegendTicks as $ } from "../utils/getContinuousLegendTicks.js";
|
|
17
|
+
import { getContinuousLegendWidth as D, getDiscreteLegendWidth as tt } from "../utils/getLegendWidth.js";
|
|
18
|
+
import { TextMeasurer as B } from "../utils/TextMeasurer/TextMeasurer.js";
|
|
19
|
+
import { Chart as et } from "./components/Chart.js";
|
|
20
|
+
import { MARGIN as M, HEIGHT as j, WIDTH as K, MAX_HEATMAP_WIDTH as it, COLOR_NULL as y, MAX_LEGEND_HEIGHT as st, HEATMAP_LEFT_OFFSET as P } from "./constants.js";
|
|
21
|
+
import { updateLinksHeight as ot, updateNodesHorizontalPosition as rt } from "./getHierarchyData.js";
|
|
22
|
+
import { getSizeLegendItem as ht } from "../utils/getSizeLegendItem.js";
|
|
23
|
+
import N from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
|
|
24
|
+
import nt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
|
|
25
|
+
import at from "../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/cluster.js";
|
|
26
|
+
import { sqrt as lt } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/pow.js";
|
|
27
|
+
function R(n, t) {
|
|
28
|
+
if (U(t))
|
|
28
29
|
return (e) => t.valuesMap[String(n.getColumnValue(t.columnName.value, e))];
|
|
29
|
-
if (
|
|
30
|
-
const { domain: e, range: s } = t, c =
|
|
31
|
-
return (
|
|
32
|
-
const o = c(Number(n.getColumnValue(t.columnName.value,
|
|
30
|
+
if (X(t)) {
|
|
31
|
+
const { domain: e, range: s } = t, c = lt().domain(e).range(s);
|
|
32
|
+
return (a) => {
|
|
33
|
+
const o = c(Number(n.getColumnValue(t.columnName.value, a)));
|
|
33
34
|
return Math.max(1, o);
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
return (e) => t;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function ct(n, t) {
|
|
39
40
|
return {
|
|
40
|
-
nodeShape:
|
|
41
|
-
nodeColor:
|
|
42
|
-
nodeSize:
|
|
43
|
-
lineShape:
|
|
44
|
-
lineColor:
|
|
41
|
+
nodeShape: R(n, t.nodeShape),
|
|
42
|
+
nodeColor: R(n, t.nodeColor),
|
|
43
|
+
nodeSize: R(n, t.nodeSize),
|
|
44
|
+
lineShape: R(n, t.lineShape),
|
|
45
|
+
lineColor: R(n, t.lineColor)
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
+
const pt = (n, t) => {
|
|
48
49
|
const e = Math.min(...t), s = Math.max(...t);
|
|
49
50
|
if (e === s) {
|
|
50
51
|
const o = n % 2 === 0 ? [] : [e];
|
|
51
|
-
for (let
|
|
52
|
-
o.push(e +
|
|
52
|
+
for (let d = 1; d < n / 2 + 1; d++)
|
|
53
|
+
o.push(e + d), o.unshift(e - d);
|
|
53
54
|
return o;
|
|
54
55
|
}
|
|
55
56
|
if (n < 2)
|
|
56
57
|
return [e, s];
|
|
57
|
-
const c = (s - e) / (n - 1),
|
|
58
|
+
const c = (s - e) / (n - 1), a = [];
|
|
58
59
|
for (let o = 0; o < n - 1; o++)
|
|
59
|
-
|
|
60
|
-
return
|
|
60
|
+
a.push(e + c * o);
|
|
61
|
+
return a.push(s), a;
|
|
61
62
|
};
|
|
62
|
-
function
|
|
63
|
+
function dt(n, t = 1, e, s) {
|
|
63
64
|
const c = (n < 16 ? 40 : n < 49 ? 32 : 24) * t;
|
|
64
65
|
return Math.max(Math.min(c, s ?? 1 / 0), e ?? -1 / 0);
|
|
65
66
|
}
|
|
66
|
-
class
|
|
67
|
+
class It {
|
|
67
68
|
constructor() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
treeWidth:
|
|
74
|
-
treeHeight:
|
|
69
|
+
L(this, "component", /* @__PURE__ */ O.jsx(O.Fragment, {}));
|
|
70
|
+
L(this, "reactRoot", null);
|
|
71
|
+
L(this, "parentNode", null);
|
|
72
|
+
L(this, "rootNode", null);
|
|
73
|
+
L(this, "chartSizes", {
|
|
74
|
+
treeWidth: K,
|
|
75
|
+
treeHeight: j,
|
|
75
76
|
heatmapWidth: 0,
|
|
76
77
|
heatmapHeight: 0,
|
|
77
|
-
totalWidth:
|
|
78
|
-
totalHeight:
|
|
78
|
+
totalWidth: K + K + M.LEFT + M.RIGHT,
|
|
79
|
+
totalHeight: j + M.TOP + M.BOTTOM,
|
|
79
80
|
labelsOffset: 0,
|
|
80
|
-
marginLeft:
|
|
81
|
-
marginRight:
|
|
82
|
-
marginTop:
|
|
83
|
-
marginBottom:
|
|
81
|
+
marginLeft: M.LEFT,
|
|
82
|
+
marginRight: M.RIGHT,
|
|
83
|
+
marginTop: M.TOP,
|
|
84
|
+
marginBottom: M.BOTTOM
|
|
84
85
|
});
|
|
85
|
-
|
|
86
|
+
L(this, "legend", { width: 0, height: 0, items: [] });
|
|
86
87
|
// heatmap scales and step
|
|
87
|
-
|
|
88
|
-
x:
|
|
89
|
-
y:
|
|
88
|
+
L(this, "heatmapScales", {
|
|
89
|
+
x: N().domain(["null"]).range([1]),
|
|
90
|
+
y: N().domain(["null"]).range([1])
|
|
90
91
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
scale:
|
|
92
|
+
L(this, "heatmapStep", { x: 0, y: 0 });
|
|
93
|
+
L(this, "heatmapColorScale", {
|
|
94
|
+
scale: N([]),
|
|
94
95
|
getter: () => "white"
|
|
95
96
|
});
|
|
96
|
-
|
|
97
|
+
L(this, "heatmapLabels", []);
|
|
97
98
|
}
|
|
98
99
|
clear() {
|
|
99
100
|
var t;
|
|
@@ -103,30 +104,30 @@ class Ft {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
init(t) {
|
|
106
|
-
this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot =
|
|
107
|
+
this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = J.createRoot(this.rootNode));
|
|
107
108
|
}
|
|
108
109
|
updateHeatmapScales(t, e, s) {
|
|
109
110
|
if (t === null) {
|
|
110
111
|
this.chartSizes.heatmapWidth = 0;
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
|
-
const { xKeysByGroups: c, xGroupKeys:
|
|
114
|
+
const { xKeysByGroups: c, xGroupKeys: a, xKeys: o, yKeys: d } = t, g = 5, S = a.map((i) => c[i].length), w = S.reduce((i, r) => i + r, 0), W = this.chartSizes.treeHeight / d.length, b = Math.min(
|
|
114
115
|
Math.max(
|
|
115
|
-
(
|
|
116
|
+
(it - (S.filter((i) => i > 0).length - 1) * g) / w,
|
|
116
117
|
s.minCellWidth
|
|
117
118
|
),
|
|
118
119
|
s.maxCellWidth
|
|
119
|
-
),
|
|
120
|
+
), v = [];
|
|
120
121
|
let C = 0;
|
|
121
|
-
|
|
122
|
+
a.forEach((i) => {
|
|
122
123
|
const r = c[i];
|
|
123
124
|
r.forEach(() => {
|
|
124
|
-
|
|
125
|
-
}), r.length > 0 && (C +=
|
|
126
|
-
}), this.heatmapScales.x =
|
|
127
|
-
const { colorsList:
|
|
128
|
-
if (e.valueType === "continuous" &&
|
|
129
|
-
const i =
|
|
125
|
+
v.push(C), C += b;
|
|
126
|
+
}), r.length > 0 && (C += g);
|
|
127
|
+
}), this.heatmapScales.x = N().domain(o).range(v), this.heatmapScales.y = N().domain(d).range(d.map((i, r) => r * W)), this.heatmapStep.x = b, this.heatmapStep.y = W;
|
|
128
|
+
const { colorsList: f, colorsMap: x } = e.aes;
|
|
129
|
+
if (e.valueType === "continuous" && f) {
|
|
130
|
+
const i = nt().domain(pt(f.length, t.meta.valueExtent)).range(f);
|
|
130
131
|
this.heatmapColorScale = {
|
|
131
132
|
scale: i,
|
|
132
133
|
getter: (r) => i(r)
|
|
@@ -135,26 +136,26 @@ class Ft {
|
|
|
135
136
|
if (e.valueType === "discrete" && x) {
|
|
136
137
|
const i = Object.keys(x).filter((r) => t.meta.uniqueValues.has(r));
|
|
137
138
|
this.heatmapColorScale = {
|
|
138
|
-
scale:
|
|
139
|
+
scale: N(
|
|
139
140
|
i,
|
|
140
141
|
i.map((r) => x[r])
|
|
141
|
-
).unknown(
|
|
142
|
-
getter: (r) => r ? x[r] ??
|
|
142
|
+
).unknown(y),
|
|
143
|
+
getter: (r) => r ? x[r] ?? y : y
|
|
143
144
|
};
|
|
144
145
|
}
|
|
145
|
-
if (e.valueType === "stringSource" &&
|
|
146
|
-
const i = [...t.meta.uniqueValues], r =
|
|
146
|
+
if (e.valueType === "stringSource" && f) {
|
|
147
|
+
const i = [...t.meta.uniqueValues], r = N(
|
|
147
148
|
i,
|
|
148
|
-
i.map((z, H) =>
|
|
149
|
-
).unknown(
|
|
149
|
+
i.map((z, H) => f[H % f.length])
|
|
150
|
+
).unknown(y);
|
|
150
151
|
this.heatmapColorScale = {
|
|
151
152
|
scale: r,
|
|
152
|
-
getter: (z) => z ? r(z) :
|
|
153
|
+
getter: (z) => z ? r(z) : y
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
156
|
this.chartSizes.heatmapWidth = this.heatmapScales.x(t.xKeys[t.xKeys.length - 1]) + this.heatmapStep.x;
|
|
156
157
|
}
|
|
157
|
-
updateLegendSize(t, e, s, c,
|
|
158
|
+
updateLegendSize(t, e, s, c, a, o) {
|
|
158
159
|
if (!t.show) {
|
|
159
160
|
this.legend = {
|
|
160
161
|
width: 0,
|
|
@@ -163,157 +164,157 @@ class Ft {
|
|
|
163
164
|
};
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
167
|
+
const d = new B("600 14px Arial"), g = 16, S = 48, w = 20, W = 24;
|
|
168
|
+
function b(l, h) {
|
|
168
169
|
return Math.max(
|
|
169
|
-
...
|
|
170
|
-
|
|
170
|
+
...l.map((p) => d.getTextWidth(String(p)) + w),
|
|
171
|
+
d.getTextWidth(h)
|
|
171
172
|
);
|
|
172
173
|
}
|
|
173
|
-
const
|
|
174
|
-
[s.nodeColor, s.nodeShape, s.lineColor].filter(
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
174
|
+
const v = [];
|
|
175
|
+
[s.nodeColor, s.nodeShape, s.lineColor].filter(U).map((l) => l.columnName).forEach((l) => {
|
|
176
|
+
const h = e[l.value];
|
|
177
|
+
if (h.usedAes.length === 0 || !h.aesMap)
|
|
177
178
|
return;
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
var
|
|
182
|
-
(
|
|
179
|
+
const p = l.label ?? l.value, E = h.values, T = {};
|
|
180
|
+
E.forEach((m) => {
|
|
181
|
+
T[m] || (T[m] = { ...Y }), h.usedAes.forEach((u) => {
|
|
182
|
+
var A, _, G;
|
|
183
|
+
(u === "dotFill" || u === "lineColor") && (T[m].color = ((A = h.aesMap[m]) == null ? void 0 : A[u]) ?? V), u === "dotShape" && (T[m].shape = ((_ = h.aesMap[m]) == null ? void 0 : _[u]) ?? "21"), u === "dotSize" && (T[m].size = ((G = h.aesMap[m]) == null ? void 0 : G[u]) ?? 3);
|
|
183
184
|
});
|
|
184
|
-
}),
|
|
185
|
-
columnKey:
|
|
186
|
-
data:
|
|
187
|
-
values:
|
|
188
|
-
labels:
|
|
185
|
+
}), v.push({
|
|
186
|
+
columnKey: p,
|
|
187
|
+
data: T,
|
|
188
|
+
values: h.values,
|
|
189
|
+
labels: h.labels
|
|
189
190
|
});
|
|
190
191
|
});
|
|
191
|
-
const
|
|
192
|
-
let x = 0, i = 0, r = 0, z = Math.min(this.chartSizes.treeHeight,
|
|
193
|
-
if (c &&
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
const
|
|
192
|
+
const f = [];
|
|
193
|
+
let x = 0, i = 0, r = 0, z = Math.min(this.chartSizes.treeHeight, st);
|
|
194
|
+
if (c && a) {
|
|
195
|
+
const l = o.valueType, h = c.label ?? c.value;
|
|
196
|
+
if (l === "continuous") {
|
|
197
|
+
const p = this.heatmapColorScale.scale, E = $(p, a.meta.valueExtent, 4), m = {
|
|
197
198
|
id: "heatmapValue",
|
|
198
199
|
type: "continuous",
|
|
199
|
-
width:
|
|
200
|
+
width: D(E, h),
|
|
200
201
|
height: z,
|
|
201
202
|
left: 0,
|
|
202
203
|
top: 0,
|
|
203
|
-
title:
|
|
204
|
-
scale:
|
|
205
|
-
values:
|
|
204
|
+
title: h,
|
|
205
|
+
scale: p,
|
|
206
|
+
values: E,
|
|
206
207
|
labels: {}
|
|
207
208
|
};
|
|
208
|
-
|
|
209
|
+
f.push(m), i = m.height + S, x = m.width;
|
|
209
210
|
} else {
|
|
210
|
-
const
|
|
211
|
+
const p = this.heatmapColorScale.scale, E = tt(p, h), T = p.domain(), m = T.length * g, u = {
|
|
211
212
|
id: "heatmapValue",
|
|
212
213
|
type: "discrete",
|
|
213
|
-
width:
|
|
214
|
-
height:
|
|
214
|
+
width: E,
|
|
215
|
+
height: m,
|
|
215
216
|
left: 0,
|
|
216
217
|
top: 0,
|
|
217
|
-
title:
|
|
218
|
-
scale:
|
|
219
|
-
values:
|
|
218
|
+
title: h,
|
|
219
|
+
scale: p,
|
|
220
|
+
values: T,
|
|
220
221
|
labels: {}
|
|
221
222
|
};
|
|
222
|
-
|
|
223
|
+
f.push(u), i = u.height + S, x = u.width;
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
|
-
if (
|
|
226
|
-
i > z && (i = 0, r += x +
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
),
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
}),
|
|
235
|
-
i > z && (i = 0, r += x +
|
|
236
|
-
const
|
|
237
|
-
l.map((
|
|
238
|
-
|
|
239
|
-
),
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
226
|
+
if (v.map(({ columnKey: l, labels: h, values: p, data: E }) => {
|
|
227
|
+
i > z && (i = 0, r += x + W);
|
|
228
|
+
const T = l, m = b(
|
|
229
|
+
p.map((F) => h[F]),
|
|
230
|
+
T
|
|
231
|
+
), u = p.length * g;
|
|
232
|
+
u > z && (z = u);
|
|
233
|
+
const A = N().domain(p).range(p.map((F) => E[F])), _ = r, G = i;
|
|
234
|
+
f.push({ id: l, type: "nodes", width: m, height: u, left: _, top: G, title: T, scale: A, values: p, labels: h }), x = m, i += u + S;
|
|
235
|
+
}), X(s.nodeSize)) {
|
|
236
|
+
i > z && (i = 0, r += x + W);
|
|
237
|
+
const l = ht(s.nodeSize), h = b(
|
|
238
|
+
l.values.map((m) => l.labels[m]),
|
|
239
|
+
l.title
|
|
240
|
+
), p = (l.scale(Math.max(...l.values)) * 2 + 4) * l.values.length;
|
|
241
|
+
p > z && (z = p);
|
|
242
|
+
const E = r, T = i;
|
|
243
|
+
f.push({ ...l, width: h, height: p, left: E, top: T }), x = h, i += p + S;
|
|
243
244
|
}
|
|
244
|
-
const H = r + x + 2 *
|
|
245
|
+
const H = r + x + 2 * Z, I = z;
|
|
245
246
|
this.legend = {
|
|
246
247
|
width: H,
|
|
247
|
-
height:
|
|
248
|
-
items:
|
|
248
|
+
height: I,
|
|
249
|
+
items: f
|
|
249
250
|
};
|
|
250
251
|
}
|
|
251
252
|
updateChartSizes(t, e, s) {
|
|
252
253
|
const c = s.leaves().length;
|
|
253
254
|
this.chartSizes.treeWidth = e ? t.width / 2 : t.width;
|
|
254
|
-
const
|
|
255
|
-
this.chartSizes.treeHeight =
|
|
255
|
+
const a = dt(c, t.scale, t.minCellHeight, t.maxCellHeight) * c;
|
|
256
|
+
this.chartSizes.treeHeight = a, this.chartSizes.heatmapHeight = a, this.chartSizes.marginLeft = t.marginLeft, this.chartSizes.marginRight = t.marginRight, this.chartSizes.marginBottom = t.marginBottom, this.chartSizes.marginTop = t.marginTop;
|
|
256
257
|
}
|
|
257
258
|
updateTotalSizes(t) {
|
|
258
|
-
this.chartSizes.totalWidth = this.chartSizes.treeWidth + this.chartSizes.heatmapWidth + this.legend.width + this.chartSizes.marginLeft + this.chartSizes.marginRight, t && (this.chartSizes.totalWidth +=
|
|
259
|
+
this.chartSizes.totalWidth = this.chartSizes.treeWidth + this.chartSizes.heatmapWidth + this.legend.width + this.chartSizes.marginLeft + this.chartSizes.marginRight, t && (this.chartSizes.totalWidth += P), this.legend.width > 0 && (this.chartSizes.totalWidth += P), this.chartSizes.totalHeight = Math.max(this.chartSizes.treeHeight, this.legend.height) + this.chartSizes.marginTop + this.chartSizes.marginBottom;
|
|
259
260
|
}
|
|
260
261
|
prepareTableLabels(t) {
|
|
261
|
-
const e = new
|
|
262
|
+
const e = new B("bold 14px Arial"), s = "…";
|
|
262
263
|
if (this.heatmapStep.x < 12 || !t) {
|
|
263
264
|
this.heatmapLabels = [];
|
|
264
265
|
return;
|
|
265
266
|
}
|
|
266
267
|
const c = this.heatmapStep.x - 4;
|
|
267
|
-
this.heatmapLabels = t.xKeys.map((
|
|
268
|
-
const o = t.meta.xLabels[
|
|
269
|
-
let
|
|
270
|
-
if (
|
|
268
|
+
this.heatmapLabels = t.xKeys.map((a) => {
|
|
269
|
+
const o = t.meta.xLabels[a];
|
|
270
|
+
let d = e.getTextWidth(o);
|
|
271
|
+
if (d < c)
|
|
271
272
|
return o;
|
|
272
|
-
let
|
|
273
|
-
for (;
|
|
274
|
-
|
|
275
|
-
return
|
|
273
|
+
let g = o, S = g == null ? void 0 : g.length;
|
|
274
|
+
for (; d > c && S > 0; )
|
|
275
|
+
S--, g = (o == null ? void 0 : o.substring(0, S)) + s, d = e.getTextWidth(g);
|
|
276
|
+
return S > 0 ? g : "";
|
|
276
277
|
});
|
|
277
278
|
}
|
|
278
279
|
addLabelsWidthToTreeArea(t, e) {
|
|
279
280
|
if (!e)
|
|
280
281
|
return;
|
|
281
|
-
const s = t.leaves(), c = new
|
|
282
|
-
let
|
|
282
|
+
const s = t.leaves(), c = new B("bold 14px Manrope");
|
|
283
|
+
let a = 0;
|
|
283
284
|
s.forEach((o) => {
|
|
284
285
|
if (!o.data.label)
|
|
285
286
|
return;
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
}), this.chartSizes.treeWidth +=
|
|
287
|
+
const d = c.getTextWidth(o.data.label), g = o.y + d - this.chartSizes.treeWidth + 8;
|
|
288
|
+
g > a && (a = g);
|
|
289
|
+
}), this.chartSizes.treeWidth += a;
|
|
289
290
|
}
|
|
290
|
-
render(t, e, s, c,
|
|
291
|
-
var
|
|
292
|
-
this.updateChartSizes(e.size, C, s), this.updateHeatmapScales(C,
|
|
293
|
-
const z =
|
|
294
|
-
|
|
291
|
+
render(t, e, s, c, a, o, d, g, S, w, W, b, v, C, f, x, i, r) {
|
|
292
|
+
var h;
|
|
293
|
+
this.updateChartSizes(e.size, C, s), this.updateHeatmapScales(C, f, e.size), this.updateLegendSize(e.legend, x, W, v, C, f), this.prepareTableLabels(C);
|
|
294
|
+
const z = a === "top" ? [this.chartSizes.treeWidth, this.chartSizes.treeHeight] : [this.chartSizes.treeHeight, this.chartSizes.treeWidth];
|
|
295
|
+
at().size(z).separation(() => 1)(s);
|
|
295
296
|
const H = s;
|
|
296
|
-
|
|
297
|
+
ot(
|
|
297
298
|
H,
|
|
298
|
-
|
|
299
|
+
a === "top" ? this.chartSizes.treeHeight : this.chartSizes.treeWidth,
|
|
299
300
|
i === "alignLeavesToLine"
|
|
300
|
-
),
|
|
301
|
-
const
|
|
302
|
-
|
|
301
|
+
), rt(H), this.addLabelsWidthToTreeArea(H, S), this.updateTotalSizes(C);
|
|
302
|
+
const I = ct(t, W), l = /* @__PURE__ */ O.jsx(
|
|
303
|
+
et,
|
|
303
304
|
{
|
|
304
305
|
chartSizes: this.chartSizes,
|
|
305
306
|
chartSettings: e,
|
|
306
307
|
nodes: H.descendants(),
|
|
307
308
|
links: H.links(),
|
|
308
309
|
connectionType: c,
|
|
309
|
-
rootPosition:
|
|
310
|
+
rootPosition: a,
|
|
310
311
|
edgeInheritance: o,
|
|
311
|
-
showNodes:
|
|
312
|
-
showEdges:
|
|
313
|
-
showLeavesLabels:
|
|
314
|
-
showNodesLabels:
|
|
315
|
-
aesGetters:
|
|
316
|
-
labels:
|
|
312
|
+
showNodes: d,
|
|
313
|
+
showEdges: g,
|
|
314
|
+
showLeavesLabels: S,
|
|
315
|
+
showNodesLabels: w,
|
|
316
|
+
aesGetters: I,
|
|
317
|
+
labels: b,
|
|
317
318
|
heatmapData: C,
|
|
318
319
|
heatmapScales: this.heatmapScales,
|
|
319
320
|
heatmapStep: this.heatmapStep,
|
|
@@ -323,14 +324,14 @@ class Ft {
|
|
|
323
324
|
onClick: r
|
|
324
325
|
}
|
|
325
326
|
);
|
|
326
|
-
this.component =
|
|
327
|
+
this.component = l, (h = this.reactRoot) == null || h.render(l);
|
|
327
328
|
}
|
|
328
329
|
renderError(t) {
|
|
329
330
|
var e;
|
|
330
|
-
(e = this.reactRoot) == null || e.render(/* @__PURE__ */
|
|
331
|
+
(e = this.reactRoot) == null || e.render(/* @__PURE__ */ O.jsx(Q, { message: t }));
|
|
331
332
|
}
|
|
332
333
|
}
|
|
333
334
|
export {
|
|
334
|
-
|
|
335
|
+
It as default
|
|
335
336
|
};
|
|
336
337
|
//# sourceMappingURL=ChartRenderer.js.map
|