@milaboratories/graph-maker 1.1.136 → 1.1.137
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 +19 -17
- 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 +144 -122
- package/dist/GraphMaker/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.js +72 -72
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js +9 -9
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +246 -228
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Captions/GroupCaptions.js +46 -37
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Captions/GroupCaptions.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +63 -61
- 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 +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Dendrograms.js +57 -51
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Dendrograms.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getDendrograms.js +33 -33
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getDendrograms.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +20 -20
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js +89 -54
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateChartSideElementSizes.js +19 -19
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateChartSideElementSizes.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +181 -168
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +5 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/Lasso.js +144 -120
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/Lasso.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +35 -35
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { getClusters as
|
|
1
|
+
import { getClusters as m } from "./getClusters.js";
|
|
2
2
|
import d from "../node_modules/d3-hierarchy/src/hierarchy/index.js";
|
|
3
|
-
function
|
|
4
|
-
const { facetKeys:
|
|
5
|
-
if (t &&
|
|
3
|
+
function v(s, t, n, G) {
|
|
4
|
+
const { facetKeys: K, xGroupKeys: x, yGroupKeys: B } = s.meta, f = {};
|
|
5
|
+
if (t && G.sharedX)
|
|
6
6
|
throw Error("Dendrogram on X axis is not available with shared by facets X axis");
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, o =
|
|
7
|
+
return K.forEach((a) => {
|
|
8
|
+
const u = {
|
|
9
|
+
hierarchyByGroupX: {},
|
|
10
|
+
hierarchyByGroupY: {}
|
|
11
|
+
}, o = s.facets[a];
|
|
12
12
|
if (t) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
return ((
|
|
13
|
+
const y = [];
|
|
14
|
+
x.forEach((r) => {
|
|
15
|
+
const i = o.xKeysByGroups[r], l = o.yKeys, e = m(
|
|
16
|
+
i,
|
|
17
|
+
i.map((p) => l.map((h) => {
|
|
18
|
+
var c;
|
|
19
|
+
return ((c = o.cells[p][h]) == null ? void 0 : c.normalizedValue) ?? t.fillNA;
|
|
20
20
|
})),
|
|
21
21
|
t.distance,
|
|
22
22
|
t.linkage
|
|
23
23
|
);
|
|
24
|
-
|
|
25
|
-
}),
|
|
24
|
+
s.facets[a].xKeysByGroups[r] = e.keys, y.push(...e.keys), u.hierarchyByGroupX[r] = d(e);
|
|
25
|
+
}), s.facets[a].xKeys = y;
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
return ((
|
|
27
|
+
if (n) {
|
|
28
|
+
const y = [];
|
|
29
|
+
B.forEach((r) => {
|
|
30
|
+
const i = o.yKeysByGroups[r], l = o.xKeys, e = m(
|
|
31
|
+
i,
|
|
32
|
+
i.map((p) => l.map((h) => {
|
|
33
|
+
var c;
|
|
34
|
+
return ((c = o.cells[h][p]) == null ? void 0 : c.normalizedValue) ?? n.fillNA;
|
|
35
35
|
})),
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
n.distance,
|
|
37
|
+
n.linkage
|
|
38
38
|
);
|
|
39
|
-
|
|
40
|
-
}),
|
|
39
|
+
s.facets[a].yKeysByGroups[r] = e.keys, y.push(...e.keys), u.hierarchyByGroupY[r] = d(e);
|
|
40
|
+
}), s.facets[a].yKeys = y;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
}),
|
|
42
|
+
f[a] = u;
|
|
43
|
+
}), f;
|
|
44
44
|
}
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
v as getDendrograms
|
|
47
47
|
};
|
|
48
48
|
//# sourceMappingURL=getDendrograms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDendrograms.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/getDendrograms.ts"],"sourcesContent":["import type {Cluster} from './components/types';\nimport type {GroupedCellsData} from './getCells';\nimport type {HeatmapSettingsImpl} from './HeatmapSettingsImpl';\nimport {getClusters} from './getClusters';\nimport type {HierarchyNode} from 'd3-hierarchy';\nimport {hierarchy} from 'd3-hierarchy';\n\nexport type DendrogramsData = Record<string, {\n
|
|
1
|
+
{"version":3,"file":"getDendrograms.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/getDendrograms.ts"],"sourcesContent":["import type {Cluster} from './components/types';\nimport type {GroupedCellsData} from './getCells';\nimport type {HeatmapSettingsImpl} from './HeatmapSettingsImpl';\nimport {getClusters} from './getClusters';\nimport type {HierarchyNode} from 'd3-hierarchy';\nimport {hierarchy} from 'd3-hierarchy';\n\nexport type DendrogramsData = Record<string, {\n hierarchyByGroupX: Record<string, HierarchyNode<Cluster>>;\n hierarchyByGroupY: Record<string, HierarchyNode<Cluster>>;\n}>\n\nexport function getDendrograms(\n groupedCellsData: GroupedCellsData,\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n facetSettings: HeatmapSettingsImpl['facetSettings']\n): DendrogramsData {\n const {facetKeys, xGroupKeys, yGroupKeys} = groupedCellsData.meta;\n const result:DendrogramsData = {};\n\n if (dendrogramX && facetSettings.sharedX) {\n throw Error('Dendrogram on X axis is not available with shared by facets X axis');\n }\n\n facetKeys.forEach(facetKey => {\n const facetResult: DendrogramsData[string] = {\n hierarchyByGroupX: {},\n hierarchyByGroupY: {},\n };\n const cellsGroup = groupedCellsData.facets[facetKey];\n if (dendrogramX) {\n const updatedXKeys:string[] = [];\n xGroupKeys.forEach(xGroupKey => {\n const xKeys = cellsGroup.xKeysByGroups[xGroupKey];\n const yKeys = cellsGroup.yKeys;\n const rootCluster = getClusters(\n xKeys,\n xKeys.map(x => yKeys.map(y => (cellsGroup.cells[x][y]?.normalizedValue ?? dendrogramX.fillNA) as number)),\n dendrogramX.distance,\n dendrogramX.linkage\n );\n //set sorted group keys\n groupedCellsData.facets[facetKey].xKeysByGroups[xGroupKey] = rootCluster.keys;\n updatedXKeys.push(...rootCluster.keys);\n facetResult.hierarchyByGroupX[xGroupKey] = hierarchy(rootCluster);\n });\n // set sorted group keys of all groups\n groupedCellsData.facets[facetKey].xKeys = updatedXKeys;\n }\n if (dendrogramY) {\n const updatedYKeys:string[] = [];\n yGroupKeys.forEach(yGroupKey => {\n const yKeys = cellsGroup.yKeysByGroups[yGroupKey];\n const xKeys = cellsGroup.xKeys;\n const rootCluster = getClusters(\n yKeys,\n yKeys.map(y => xKeys.map(x => (cellsGroup.cells[x][y]?.normalizedValue ?? dendrogramY.fillNA) as number)),\n dendrogramY.distance,\n dendrogramY.linkage\n );\n //set sorted group keys\n groupedCellsData.facets[facetKey].yKeysByGroups[yGroupKey] = rootCluster.keys;\n updatedYKeys.push(...rootCluster.keys);\n facetResult.hierarchyByGroupY[yGroupKey] = hierarchy(rootCluster);\n });\n // set sorted group keys of all groups\n groupedCellsData.facets[facetKey].yKeys = updatedYKeys;\n }\n result[facetKey] = facetResult;\n });\n\n return result;\n}\n"],"names":["getDendrograms","groupedCellsData","dendrogramX","dendrogramY","facetSettings","facetKeys","xGroupKeys","yGroupKeys","result","facetKey","facetResult","cellsGroup","updatedXKeys","xGroupKey","xKeys","yKeys","rootCluster","getClusters","x","y","_a","hierarchy","updatedYKeys","yGroupKey"],"mappings":";;AAYO,SAASA,EACZC,GACAC,GACAC,GACAC,GACe;AACf,QAAM,EAAC,WAAAC,GAAW,YAAAC,GAAY,YAAAC,MAAcN,EAAiB,MACvDO,IAAyB,CAAA;AAE/B,MAAIN,KAAeE,EAAc;AAC7B,UAAM,MAAM,oEAAoE;AAGpF,SAAAC,EAAU,QAAQ,CAAAI,MAAY;AAC1B,UAAMC,IAAuC;AAAA,MACzC,mBAAmB,CAAA;AAAA,MACnB,mBAAmB,CAAA;AAAA,IAAA,GAEjBC,IAAaV,EAAiB,OAAOQ,CAAQ;AACnD,QAAIP,GAAa;AACb,YAAMU,IAAwB,CAAA;AAC9BN,MAAAA,EAAW,QAAQ,CAAAO,MAAa;AAC5B,cAAMC,IAAQH,EAAW,cAAcE,CAAS,GAC1CE,IAAQJ,EAAW,OACnBK,IAAcC;AAAAA,UAChBH;AAAAA,UACAA,EAAM,IAAI,CAAAI,MAAKH,EAAM,IAAI,CAAAI,MAAA;;AAAM,qBAAAC,IAAAT,EAAW,MAAMO,CAAC,EAAEC,CAAC,MAArB,OAAA,SAAAC,EAAwB,oBAAmBlB,EAAY;AAAA,UAAA,CAAiB,CAAC;AAAA,UACxGA,EAAY;AAAA,UACZA,EAAY;AAAA,QAAA;AAGhBD,QAAAA,EAAiB,OAAOQ,CAAQ,EAAE,cAAcI,CAAS,IAAIG,EAAY,MACzEJ,EAAa,KAAK,GAAGI,EAAY,IAAI,GACrCN,EAAY,kBAAkBG,CAAS,IAAIQ,EAAUL,CAAW;AAAA,MACpE,CAAC,GAEDf,EAAiB,OAAOQ,CAAQ,EAAE,QAAQG;AAAAA,IAC9C;AACA,QAAIT,GAAa;AACb,YAAMmB,IAAwB,CAAA;AAC9Bf,MAAAA,EAAW,QAAQ,CAAAgB,MAAa;AAC5B,cAAMR,IAAQJ,EAAW,cAAcY,CAAS,GAC1CT,IAAQH,EAAW,OACnBK,IAAcC;AAAAA,UAChBF;AAAAA,UACAA,EAAM,IAAI,CAAAI,MAAKL,EAAM,IAAI,CAAAI,MAAA;;AAAM,qBAAAE,IAAAT,EAAW,MAAMO,CAAC,EAAEC,CAAC,MAArB,OAAA,SAAAC,EAAwB,oBAAmBjB,EAAY;AAAA,UAAA,CAAiB,CAAC;AAAA,UACxGA,EAAY;AAAA,UACZA,EAAY;AAAA,QAAA;AAGhBF,QAAAA,EAAiB,OAAOQ,CAAQ,EAAE,cAAcc,CAAS,IAAIP,EAAY,MACzEM,EAAa,KAAK,GAAGN,EAAY,IAAI,GACrCN,EAAY,kBAAkBa,CAAS,IAAIF,EAAUL,CAAW;AAAA,MACpE,CAAC,GAEDf,EAAiB,OAAOQ,CAAQ,EAAE,QAAQa;AAAAA,IAC9C;AACAd,IAAAA,EAAOC,CAAQ,IAAIC;AAAAA,EACvB,CAAC,GAEMF;AACX;","x_google_ignoreList":[0]}
|
|
@@ -3,13 +3,13 @@ import { getCells as N } from "./getCells.js";
|
|
|
3
3
|
import { getDendrograms as q } from "./getDendrograms.js";
|
|
4
4
|
import { isColumnName as y } from "../utils/index.js";
|
|
5
5
|
import { renderToString as I } from "../node_modules/react-dom/server.browser.js";
|
|
6
|
-
import
|
|
7
|
-
import { HeatmapSettingsImpl as
|
|
8
|
-
var
|
|
6
|
+
import P from "./ChartRenderer.js";
|
|
7
|
+
import { HeatmapSettingsImpl as b } from "./HeatmapSettingsImpl.js";
|
|
8
|
+
var $ = Object.defineProperty, F = (d, t, e) => t in d ? $(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, f = (d, t, e) => F(d, typeof t != "symbol" ? t + "" : t, e);
|
|
9
9
|
class tt extends E {
|
|
10
10
|
constructor(t, e, a) {
|
|
11
|
-
super(t, e), f(this, "settings"), f(this, "chartRenderer", new
|
|
12
|
-
}), f(this, "calculatedData", null), this.settings = new
|
|
11
|
+
super(t, e), f(this, "settings"), f(this, "chartRenderer", new P()), f(this, "onTooltipHintSwitch", () => {
|
|
12
|
+
}), f(this, "calculatedData", null), this.settings = new b(e), a && (this.onTooltipHintSwitch = a[0]);
|
|
13
13
|
}
|
|
14
14
|
mount(t) {
|
|
15
15
|
try {
|
|
@@ -24,7 +24,7 @@ class tt extends E {
|
|
|
24
24
|
updateSettingsAndData(t, e) {
|
|
25
25
|
try {
|
|
26
26
|
const a = this.settings, r = this.data;
|
|
27
|
-
this.settings = new
|
|
27
|
+
this.settings = new b(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(r, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
|
|
28
28
|
} catch (a) {
|
|
29
29
|
a instanceof Error && this.chartRenderer.renderError(a.message);
|
|
30
30
|
}
|
|
@@ -41,28 +41,28 @@ class tt extends E {
|
|
|
41
41
|
xColumn: D,
|
|
42
42
|
yColumn: S,
|
|
43
43
|
valueColumn: A,
|
|
44
|
-
xGroupBy:
|
|
45
|
-
yGroupBy:
|
|
44
|
+
xGroupBy: w,
|
|
45
|
+
yGroupBy: x,
|
|
46
46
|
facetBy: j,
|
|
47
|
-
annotations:
|
|
48
|
-
chartSettings:
|
|
47
|
+
annotations: R,
|
|
48
|
+
chartSettings: T,
|
|
49
49
|
facetSettings: B,
|
|
50
50
|
dendrogramX: _,
|
|
51
|
-
dendrogramY:
|
|
51
|
+
dendrogramY: X,
|
|
52
52
|
normalization: C,
|
|
53
|
-
NAValueAs:
|
|
54
|
-
} = e,
|
|
53
|
+
NAValueAs: k
|
|
54
|
+
} = e, G = Object.values(((a = t.dendrogramX) == null ? void 0 : a.aes) || {}).filter(
|
|
55
55
|
y
|
|
56
|
-
),
|
|
56
|
+
), z = Object.values((_ == null ? void 0 : _.aes) || {}).filter(y), H = Object.values(((r = t.dendrogramY) == null ? void 0 : r.aes) || {}).filter(
|
|
57
57
|
y
|
|
58
|
-
), O = Object.values((
|
|
59
|
-
function h(m,
|
|
60
|
-
return m.length !==
|
|
58
|
+
), O = Object.values((X == null ? void 0 : X.aes) || {}).filter(y);
|
|
59
|
+
function h(m, Y) {
|
|
60
|
+
return m.length !== Y.length || m.some((U, V) => U.value !== Y[V].value);
|
|
61
61
|
}
|
|
62
|
-
return t.xColumn.value !== D.value || t.yColumn.value !== S.value || t.valueColumn.value !== A.value || h(t.xGroupBy,
|
|
62
|
+
return t.xColumn.value !== D.value || t.yColumn.value !== S.value || t.valueColumn.value !== A.value || h(t.xGroupBy, w) || h(t.yGroupBy, x) || h(t.facetBy, j) || h(
|
|
63
63
|
t.annotations.map((m) => m.valueColumn),
|
|
64
|
-
|
|
65
|
-
) || h(
|
|
64
|
+
R.map((m) => m.valueColumn)
|
|
65
|
+
) || h(G, z) || h(H, O) || (e.dendrogramX || t.dendrogramX) && (((n = t.dendrogramX) == null ? void 0 : n.distance) !== ((i = e.dendrogramX) == null ? void 0 : i.distance) || ((l = t.dendrogramX) == null ? void 0 : l.linkage) !== ((o = e.dendrogramX) == null ? void 0 : o.linkage)) || (e.dendrogramY || t.dendrogramY) && (((u = t.dendrogramY) == null ? void 0 : u.distance) !== ((s = e.dendrogramY) == null ? void 0 : s.distance) || ((c = t.dendrogramY) == null ? void 0 : c.linkage) !== ((p = e.dendrogramY) == null ? void 0 : p.linkage)) || t.chartSettings.valueType !== T.valueType || t.facetSettings.sharedX !== B.sharedX || t.facetSettings.sharedY !== B.sharedY || ((v = t.normalization) == null ? void 0 : v.method) !== (C == null ? void 0 : C.method) || ((g = t.normalization) == null ? void 0 : g.direction) !== (C == null ? void 0 : C.direction) || t.NAValueAs !== k;
|
|
66
66
|
}
|
|
67
67
|
_needUpdateCalculatedDataByData(t, e) {
|
|
68
68
|
const a = Object.keys(t.data), r = Object.keys(e.data);
|
package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js
CHANGED
|
@@ -1,66 +1,101 @@
|
|
|
1
|
-
import { MIN_STEP_FOR_VISIBLE_LABELS as
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
let l = 0
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { MIN_STEP_FOR_VISIBLE_LABELS as I } from "../constants.js";
|
|
2
|
+
const d = Math.cos(Math.PI / 4);
|
|
3
|
+
function E(e, y, n, x, h, c, s, M, B, K) {
|
|
4
|
+
const p = c[e], T = p > I;
|
|
5
|
+
let l = 0;
|
|
6
|
+
return y.forEach((f) => {
|
|
7
|
+
const i = h(e, f);
|
|
8
|
+
if (i.length === 0)
|
|
9
|
+
return 0;
|
|
10
|
+
const a = i.length * p / 2, o = M ? K.getTextWidth(n[f]) * d - a - s(i[0]) : 0, G = B && T ? y.reduce((L, u) => {
|
|
11
|
+
const b = x[u];
|
|
12
|
+
return Math.max(L, K.getTextWidth(b) * d - p / 2 - s(u));
|
|
13
|
+
}, 0) : 0;
|
|
14
|
+
l = Math.max(l, o, G);
|
|
15
|
+
}), l;
|
|
16
|
+
}
|
|
17
|
+
function g(e, y, n, x, h, c) {
|
|
18
|
+
const { facetKeys: s, xGroupKeys: M, yGroupKeys: B, xKeysByGroups: K, yKeysByGroups: p, xLabels: T, yLabels: l, xGroupLabels: f, yGroupLabels: i } = h.meta;
|
|
19
|
+
let a = 0, o = 0;
|
|
20
|
+
const G = e.xGroupLabels === 45, L = e.xAxisLabels === 45;
|
|
21
|
+
if (G || L)
|
|
22
|
+
if (!y.sharedX)
|
|
23
|
+
s.forEach((t) => {
|
|
24
|
+
a = Math.max(
|
|
25
|
+
E(
|
|
26
|
+
t,
|
|
27
|
+
M,
|
|
28
|
+
f,
|
|
29
|
+
T,
|
|
30
|
+
(m, r) => h.facets[m].xKeysByGroups[r],
|
|
31
|
+
x.x,
|
|
32
|
+
n.x[t],
|
|
33
|
+
G,
|
|
34
|
+
L,
|
|
35
|
+
c
|
|
36
|
+
),
|
|
37
|
+
a
|
|
20
38
|
);
|
|
21
39
|
});
|
|
22
40
|
else {
|
|
23
|
-
const t =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
const t = s[0];
|
|
42
|
+
a = Math.max(
|
|
43
|
+
E(
|
|
44
|
+
t,
|
|
45
|
+
M,
|
|
46
|
+
f,
|
|
47
|
+
T,
|
|
48
|
+
(m, r) => K[r],
|
|
49
|
+
x.x,
|
|
50
|
+
n.x[t],
|
|
51
|
+
G,
|
|
52
|
+
L,
|
|
53
|
+
c
|
|
54
|
+
),
|
|
55
|
+
a
|
|
56
|
+
);
|
|
32
57
|
}
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
if (!
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
const u = e.yGroupLabels === 45, b = e.yAxisLabels === 45;
|
|
59
|
+
if (u || b)
|
|
60
|
+
if (!y.sharedY)
|
|
61
|
+
s.forEach((t) => {
|
|
62
|
+
o = Math.max(
|
|
63
|
+
E(
|
|
64
|
+
t,
|
|
65
|
+
B,
|
|
66
|
+
i,
|
|
67
|
+
l,
|
|
68
|
+
(m, r) => h.facets[m].yKeysByGroups[r],
|
|
69
|
+
x.y,
|
|
70
|
+
n.y[t],
|
|
71
|
+
u,
|
|
72
|
+
b,
|
|
73
|
+
c
|
|
74
|
+
),
|
|
75
|
+
o
|
|
48
76
|
);
|
|
49
77
|
});
|
|
50
78
|
else {
|
|
51
|
-
const t =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
const t = s[0];
|
|
80
|
+
o = Math.max(
|
|
81
|
+
E(
|
|
82
|
+
t,
|
|
83
|
+
B,
|
|
84
|
+
i,
|
|
85
|
+
l,
|
|
86
|
+
(m, r) => p[r],
|
|
87
|
+
x.y,
|
|
88
|
+
n.y[t],
|
|
89
|
+
u,
|
|
90
|
+
b,
|
|
91
|
+
c
|
|
92
|
+
),
|
|
93
|
+
o
|
|
94
|
+
);
|
|
60
95
|
}
|
|
61
|
-
return { xCaptionTail:
|
|
96
|
+
return { xCaptionTail: a, yCaptionTail: o };
|
|
62
97
|
}
|
|
63
98
|
export {
|
|
64
|
-
|
|
99
|
+
g as calculateCaptionTails
|
|
65
100
|
};
|
|
66
101
|
//# sourceMappingURL=calculateCaptionTails.js.map
|
package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateCaptionTails.ts"],"sourcesContent":["import type {LabelAngles} from '../components/types';\nimport {MIN_STEP_FOR_VISIBLE_LABELS} from '../constants';\nimport type {GroupedCellsData} from '../getCells';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\nimport type {TextMeasurer} from '../../utils/TextMeasurer';\
|
|
1
|
+
{"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateCaptionTails.ts"],"sourcesContent":["import type {ChartsScales} from '../components/types';\nimport type {LabelAngles} from '../components/types';\nimport {MIN_STEP_FOR_VISIBLE_LABELS} from '../constants';\nimport type {GroupedCellsData} from '../getCells';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\nimport type {TextMeasurer} from '../../utils/TextMeasurer';\n\nconst COS_PI_4 = Math.cos(Math.PI / 4);\nfunction getTailByFacetKey (\n facetKey: string,\n groupKeys: string[],\n groupLabels: Record<string, string>,\n valueLabels: Record<string, string>,\n getKeysInGroup: (facetKey:string, groupKey:string) => string[],\n steps: Record<string, number>,\n scale: (v:string) => number,\n groupTitleInclined: boolean,\n labelTitleInclined: boolean,\n textMeasurer: TextMeasurer\n): number {\n const step = steps[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n\n let maxTail = 0;\n groupKeys.forEach((groupKey) => {\n const keysInGroup = getKeysInGroup(facetKey, groupKey);\n if (keysInGroup.length === 0) {\n return 0;\n }\n const groupHalfWidth = (keysInGroup.length * step) / 2;\n const groupTail = groupTitleInclined\n ? textMeasurer.getTextWidth(groupLabels[groupKey]) * COS_PI_4 - groupHalfWidth - scale(keysInGroup[0])\n : 0;\n const labelTail = labelTitleInclined && labelsVisible\n ? groupKeys.reduce((res, key) => {\n const label = valueLabels[key];\n return Math.max(res, textMeasurer.getTextWidth(label) * COS_PI_4 - step / 2 - scale(key));\n }, 0)\n : 0;\n maxTail = Math.max(maxTail, groupTail, labelTail);\n });\n return maxTail;\n}\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n facetSettings: HeatmapSettingsImpl['facetSettings'],\n scales: ChartsScales,\n steps: {\n x: Record<string, number>;\n y: Record<string, number>;\n },\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {facetKeys, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, xLabels, yLabels, xGroupLabels, yGroupLabels} = groupedCells.meta;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xGroupTitleInclined = labelAngles.xGroupLabels === 45;\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xGroupTitleInclined || xLabelsInclined) {\n if (!facetSettings.sharedX) {\n facetKeys.forEach(facetKey => {\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n }\n }\n const yGroupTitleInclined = labelAngles.yGroupLabels === 45;\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yGroupTitleInclined || yLabelsInclined) {\n if (!facetSettings.sharedY) {\n facetKeys.forEach(facetKey => {\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["COS_PI_4","getTailByFacetKey","facetKey","groupKeys","groupLabels","valueLabels","getKeysInGroup","steps","scale","groupTitleInclined","labelTitleInclined","textMeasurer","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","maxTail","groupKey","keysInGroup","groupHalfWidth","groupTail","labelTail","res","key","label","calculateCaptionTails","labelAngles","facetSettings","scales","groupedCells","facetKeys","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","xLabels","yLabels","xGroupLabels","yGroupLabels","xCaptionTail","yCaptionTail","xGroupTitleInclined","xLabelsInclined","yGroupTitleInclined","yLabelsInclined"],"mappings":";AAOA,MAAMA,IAAW,KAAK,IAAI,KAAK,KAAK,CAAC;AACrC,SAASC,EACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACM;AACN,QAAMC,IAAOL,EAAML,CAAQ,GACrBW,IAAgBD,IAAOE;AAE7B,MAAIC,IAAU;AACd,SAAAZ,EAAU,QAAQ,CAACa,MAAa;AAC5B,UAAMC,IAAcX,EAAeJ,GAAUc,CAAQ;AACrD,QAAIC,EAAY,WAAW;AACvB,aAAO;AAEX,UAAMC,IAAkBD,EAAY,SAASL,IAAQ,GAC/CO,IAAYV,IACZE,EAAa,aAAaP,EAAYY,CAAQ,CAAC,IAAIhB,IAAWkB,IAAiBV,EAAMS,EAAY,CAAC,CAAC,IACnG,GACAG,IAAYV,KAAsBG,IAClCV,EAAU,OAAO,CAACkB,GAAKC,MAAQ;AAC7B,YAAMC,IAAQlB,EAAYiB,CAAG;AAC7B,aAAO,KAAK,IAAID,GAAKV,EAAa,aAAaY,CAAK,IAAIvB,IAAWY,IAAO,IAAIJ,EAAMc,CAAG,CAAC;AAAA,IAC5F,GAAG,CAAC,IACF;AACNP,QAAU,KAAK,IAAIA,GAASI,GAAWC,CAAS;AAAA,EACpD,CAAC,GACML;AACX;AACO,SAASS,EACZC,GACAC,GACAC,GACApB,GAIAqB,GACAjB,GAC4C;AAC5C,QAAM,EAAC,WAAAkB,GAAW,YAAAC,GAAY,YAAAC,GAAY,eAAAC,GAAe,eA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a,OAAO1B,CAAQ,EAAE,cAAcc,CAAQ;AAAA,YAC1FT,EAAM;AAAA,YACNoB,EAAO,EAAEzB,CAAQ;AAAA,YACjBwC;AAAAA,YACAC;AAAAA,YACAhC;AAAAA,UAAA;AAAA,UAEJ4B;AAAAA,QAAA;AAAA,MAER,CAAC;AAAA,SACE;AACH,YAAMrC,IAAW2B,EAAU,CAAC;AAC5BU,MAAAA,IAAe,KAAK;AAAA,QAChBtC;AAAAA,UACIC;AAAAA,UACA6B;AAAAA,UACAM;AAAAA,UACAF;AAAAA,UACA,CAACjC,GAAiBc,MAAoBiB,EAAcjB,CAAQ;AAAA,UAC5DT,EAAM;AAAA,UACNoB,EAAO,EAAEzB,CAAQ;AAAA,UACjBwC;AAAAA,UACAC;AAAAA,UACAhC;AAAAA,QAAA;AAAA,QAEJ4B;AAAAA,MAAA;AAAA,IAER;AAEJ,SAAO,EAAC,cAAAD,GAAc,cAAAC,EAAAA;AAC1B;","x_google_ignoreList":[0]}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { DEFAULT_TICKS_SIZE as
|
|
2
|
-
function V(i, o, l,
|
|
3
|
-
const
|
|
1
|
+
import { DEFAULT_TICKS_SIZE as m, TITLE_LINE as S, MIN_STEP_FOR_VISIBLE_LABELS as w, TICK_OFFSET as a, FACET_TITLE_LINE as K, ANNOTATION_WIDTH as r, ANNOTATIONS_OFFSET as u } from "../constants.js";
|
|
2
|
+
function V(i, o, l, F, n, s, e, g, d, O, P, C, z, G) {
|
|
3
|
+
const v = C.length > 1 && (!d || e.includes(o.groupingPosition)), h = !d || e.includes(o.position), k = P.length > 1 && (!g || e.includes(i.groupingPosition)), T = !g || e.includes(i.position), y = O.length > 1, p = F.filter((t) => e.includes(t.position) || !g && ["left", "right"].includes(t.position) || !d && ["top", "bottom"].includes(t.position)), x = p.filter((t) => t.position === "left").length, I = p.filter((t) => t.position === "right").length, c = p.filter((t) => t.position === "top").length, E = p.filter((t) => t.position === "bottom").length, B = i.showTicks ? m : 0, D = o.showTicks ? m : 0, _ = T && i.showTitle ? S : 0, f = h && o.showTitle ? S : 0, L = T && i.showAxisLabels && z > w ? l.xAxisCaptions + B + a : 0, b = h && o.showAxisLabels && G > w ? l.yAxisCaptions + D + a : 0, A = k && i.showGroupLabels ? l.xGroupCaptions + a : 0, N = v && o.showGroupLabels ? l.yGroupCaptions + a : 0;
|
|
4
4
|
return {
|
|
5
5
|
left: {
|
|
6
6
|
dendro: !(s != null && s.hidden) && (s == null ? void 0 : s.position) === "left" ? s.size : 0,
|
|
7
|
-
axisTitle: o.position === "left" ?
|
|
8
|
-
groups: o.groupingPosition === "left" ?
|
|
9
|
-
axis: o.position === "left" ?
|
|
10
|
-
annotations:
|
|
7
|
+
axisTitle: o.position === "left" ? f : 0,
|
|
8
|
+
groups: o.groupingPosition === "left" ? N : 0,
|
|
9
|
+
axis: o.position === "left" ? b : 0,
|
|
10
|
+
annotations: x * r + (x && u)
|
|
11
11
|
},
|
|
12
12
|
right: {
|
|
13
13
|
dendro: !(s != null && s.hidden) && (s == null ? void 0 : s.position) === "right" ? s.size : 0,
|
|
14
|
-
axisTitle: o.position === "right" ?
|
|
15
|
-
groups: o.groupingPosition === "right" ?
|
|
16
|
-
axis: o.position === "right" ?
|
|
17
|
-
annotations:
|
|
14
|
+
axisTitle: o.position === "right" ? f : 0,
|
|
15
|
+
groups: o.groupingPosition === "right" ? N : 0,
|
|
16
|
+
axis: o.position === "right" ? b : 0,
|
|
17
|
+
annotations: I * r + (I && u)
|
|
18
18
|
},
|
|
19
19
|
top: {
|
|
20
20
|
facetTitle: y ? K : 0,
|
|
21
21
|
dendro: !(n != null && n.hidden) && (n == null ? void 0 : n.position) === "top" ? n.size : 0,
|
|
22
|
-
axisTitle: i.position === "top" ?
|
|
23
|
-
groups: i.groupingPosition === "top" ?
|
|
24
|
-
axis: i.position === "top" ?
|
|
25
|
-
annotations:
|
|
22
|
+
axisTitle: i.position === "top" ? _ : 0,
|
|
23
|
+
groups: i.groupingPosition === "top" ? A : 0,
|
|
24
|
+
axis: i.position === "top" ? L : 0,
|
|
25
|
+
annotations: c * r + (c && u)
|
|
26
26
|
},
|
|
27
27
|
bottom: {
|
|
28
28
|
dendro: !(n != null && n.hidden) && (n == null ? void 0 : n.position) === "bottom" ? n.size : 0,
|
|
29
|
-
axisTitle: i.position === "bottom" ?
|
|
30
|
-
groups: i.groupingPosition === "bottom" ?
|
|
31
|
-
axis: i.position === "bottom" ?
|
|
32
|
-
annotations:
|
|
29
|
+
axisTitle: i.position === "bottom" ? _ : 0,
|
|
30
|
+
groups: i.groupingPosition === "bottom" ? A : 0,
|
|
31
|
+
axis: i.position === "bottom" ? L : 0,
|
|
32
|
+
annotations: E * r + (E && u)
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateChartSideElementSizes.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateChartSideElementSizes.ts"],"sourcesContent":["import {\n ANNOTATION_WIDTH,\n ANNOTATIONS_OFFSET,\n DEFAULT_TICKS_SIZE,\n FACET_TITLE_LINE,\n MIN_STEP_FOR_VISIBLE_LABELS,\n TICK_OFFSET,\n TITLE_LINE,\n} from '../constants';\nimport type {CaptionsSizes} from '../components/types';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\n\nexport function calculateChartSideElementSizes(\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n chartSides: ('left' | 'right' | 'top' | 'bottom')[],\n sharedX: boolean,\n sharedY: boolean,\n facetKeys: string[],\n xGroupKeys: string[],\n yGroupKeys: string[],\n stepX: number,\n stepY: number\n): Record<string, Record<string, number>> {\n const hasGroupingY = yGroupKeys.length > 1 && (!sharedY || chartSides.includes(yAxis.groupingPosition));\n const hasAxisY = !sharedY || chartSides.includes(yAxis.position);\n const hasGroupingX = xGroupKeys.length > 1 && (!sharedX || chartSides.includes(xAxis.groupingPosition));\n const hasAxisX = !sharedX || chartSides.includes(xAxis.position);\n const hasChartTitle = facetKeys.length > 1;\n const usedAnnotations = annotations.filter(item => {\n return (\n chartSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotationsCount = usedAnnotations.filter(item => item.position === 'left').length;\n const rightAnnotationsCount = usedAnnotations.filter(item => item.position === 'right').length;\n const topAnnotationsCount = usedAnnotations.filter(item => item.position === 'top').length;\n const bottomAnnotationsCount = usedAnnotations.filter(item => item.position === 'bottom').length;\n\n const tickSizeX = xAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const tickSizeY = yAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const axisTitleX = hasAxisX && xAxis.showTitle ? TITLE_LINE : 0;\n const axisTitleY = hasAxisY && yAxis.showTitle ? TITLE_LINE : 0;\n\n const axisX =\n hasAxisX && xAxis.showAxisLabels && stepX > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.xAxisCaptions + tickSizeX + TICK_OFFSET\n : 0;\n const axisY =\n hasAxisY && yAxis.showAxisLabels && stepY > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.yAxisCaptions + tickSizeY + TICK_OFFSET\n : 0;\n // can be rotated, then labels max width\n const groupX = hasGroupingX && xAxis.showGroupLabels ? captionsSizes.xGroupCaptions : 0;\n const groupY = hasGroupingY && yAxis.showGroupLabels ? captionsSizes.yGroupCaptions : 0;\n\n return {\n left: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'left' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'left' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'left' ? groupY : 0,\n axis: yAxis.position === 'left' ? axisY : 0,\n annotations: leftAnnotationsCount * ANNOTATION_WIDTH + (leftAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n right: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'right' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'right' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'right' ? groupY : 0,\n axis: yAxis.position === 'right' ? axisY : 0,\n annotations: rightAnnotationsCount * ANNOTATION_WIDTH + (rightAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n top: {\n facetTitle: hasChartTitle ? FACET_TITLE_LINE : 0,\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'top' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'top' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'top' ? groupX : 0,\n axis: xAxis.position === 'top' ? axisX : 0,\n annotations: topAnnotationsCount * ANNOTATION_WIDTH + (topAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n bottom: {\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'bottom' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'bottom' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'bottom' ? groupX : 0,\n axis: xAxis.position === 'bottom' ? axisX : 0,\n annotations: bottomAnnotationsCount * ANNOTATION_WIDTH + (bottomAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n };\n}\n"],"names":["calculateChartSideElementSizes","xAxis","yAxis","captionsSizes","annotations","dendrogramX","dendrogramY","chartSides","sharedX","sharedY","facetKeys","xGroupKeys","yGroupKeys","stepX","stepY","hasGroupingY","hasAxisY","hasGroupingX","hasAxisX","hasChartTitle","usedAnnotations","item","leftAnnotationsCount","
|
|
1
|
+
{"version":3,"file":"calculateChartSideElementSizes.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateChartSideElementSizes.ts"],"sourcesContent":["import {\n ANNOTATION_WIDTH,\n ANNOTATIONS_OFFSET,\n DEFAULT_TICKS_SIZE,\n FACET_TITLE_LINE,\n MIN_STEP_FOR_VISIBLE_LABELS,\n TICK_OFFSET,\n TITLE_LINE,\n} from '../constants';\nimport type {CaptionsSizes} from '../components/types';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\n\nexport function calculateChartSideElementSizes(\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n chartSides: ('left' | 'right' | 'top' | 'bottom')[],\n sharedX: boolean,\n sharedY: boolean,\n facetKeys: string[],\n xGroupKeys: string[],\n yGroupKeys: string[],\n stepX: number,\n stepY: number\n): Record<string, Record<string, number>> {\n const hasGroupingY = yGroupKeys.length > 1 && (!sharedY || chartSides.includes(yAxis.groupingPosition));\n const hasAxisY = !sharedY || chartSides.includes(yAxis.position);\n const hasGroupingX = xGroupKeys.length > 1 && (!sharedX || chartSides.includes(xAxis.groupingPosition));\n const hasAxisX = !sharedX || chartSides.includes(xAxis.position);\n const hasChartTitle = facetKeys.length > 1;\n const usedAnnotations = annotations.filter(item => {\n return (\n chartSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotationsCount = usedAnnotations.filter(item => item.position === 'left').length;\n const rightAnnotationsCount = usedAnnotations.filter(item => item.position === 'right').length;\n const topAnnotationsCount = usedAnnotations.filter(item => item.position === 'top').length;\n const bottomAnnotationsCount = usedAnnotations.filter(item => item.position === 'bottom').length;\n\n const tickSizeX = xAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const tickSizeY = yAxis.showTicks ? DEFAULT_TICKS_SIZE : 0;\n const axisTitleX = hasAxisX && xAxis.showTitle ? TITLE_LINE : 0;\n const axisTitleY = hasAxisY && yAxis.showTitle ? TITLE_LINE : 0;\n\n const axisX =\n hasAxisX && xAxis.showAxisLabels && stepX > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.xAxisCaptions + tickSizeX + TICK_OFFSET\n : 0;\n const axisY =\n hasAxisY && yAxis.showAxisLabels && stepY > MIN_STEP_FOR_VISIBLE_LABELS\n ? captionsSizes.yAxisCaptions + tickSizeY + TICK_OFFSET\n : 0;\n // can be rotated, then labels max width\n const groupX = hasGroupingX && xAxis.showGroupLabels ? captionsSizes.xGroupCaptions + TICK_OFFSET : 0;\n const groupY = hasGroupingY && yAxis.showGroupLabels ? captionsSizes.yGroupCaptions + TICK_OFFSET : 0;\n\n return {\n left: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'left' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'left' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'left' ? groupY : 0,\n axis: yAxis.position === 'left' ? axisY : 0,\n annotations: leftAnnotationsCount * ANNOTATION_WIDTH + (leftAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n right: {\n dendro: !dendrogramY?.hidden && dendrogramY?.position === 'right' ? dendrogramY.size : 0,\n axisTitle: yAxis.position === 'right' ? axisTitleY : 0,\n groups: yAxis.groupingPosition === 'right' ? groupY : 0,\n axis: yAxis.position === 'right' ? axisY : 0,\n annotations: rightAnnotationsCount * ANNOTATION_WIDTH + (rightAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n top: {\n facetTitle: hasChartTitle ? FACET_TITLE_LINE : 0,\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'top' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'top' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'top' ? groupX : 0,\n axis: xAxis.position === 'top' ? axisX : 0,\n annotations: topAnnotationsCount * ANNOTATION_WIDTH + (topAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n bottom: {\n dendro: !dendrogramX?.hidden && dendrogramX?.position === 'bottom' ? dendrogramX.size : 0,\n axisTitle: xAxis.position === 'bottom' ? axisTitleX : 0,\n groups: xAxis.groupingPosition === 'bottom' ? groupX : 0,\n axis: xAxis.position === 'bottom' ? axisX : 0,\n annotations: bottomAnnotationsCount * ANNOTATION_WIDTH + (bottomAnnotationsCount && ANNOTATIONS_OFFSET),\n },\n };\n}\n"],"names":["calculateChartSideElementSizes","xAxis","yAxis","captionsSizes","annotations","dendrogramX","dendrogramY","chartSides","sharedX","sharedY","facetKeys","xGroupKeys","yGroupKeys","stepX","stepY","hasGroupingY","hasAxisY","hasGroupingX","hasAxisX","hasChartTitle","usedAnnotations","item","leftAnnotationsCount","n","rightAnnotationsCount","topAnnotationsCount","bottomAnnotationsCount","tickSizeX","DEFAULT_TICKS_SIZE","tickSizeY","axisTitleX","TITLE_LINE","axisTitleY","axisX","MIN_STEP_FOR_VISIBLE_LABELS","TICK_OFFSET","axisY","groupX","groupY","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET","FACET_TITLE_LINE"],"mappings":";AAYO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACsC;AACtC,QAAMC,IAAeH,EAAW,SAAS,MAAM,CAACH,KAAWF,EAAW,SAASL,EAAM,gBAAgB,IAC/Fc,IAAW,CAACP,KAAWF,EAAW,SAASL,EAAM,QAAQ,GACzDe,IAAeN,EAAW,SAAS,MAAM,CAACH,KAAWD,EAAW,SAASN,EAAM,gBAAgB,IAC/FiB,IAAW,CAACV,KAAWD,EAAW,SAASN,EAAM,QAAQ,GACzDkB,IAAgBT,EAAU,SAAS,GACnCU,IAAkBhB,EAAY,OAAO,CAAAiB,MAEnCd,EAAW,SAASc,EAAK,QAAQ,KAChC,CAACb,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASa,EAAK,QAAQ,KACpD,CAACZ,KAAW,CAAC,OAAO,QAA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