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