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