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