@milaboratories/miplots4 1.1.0 → 1.2.1
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/MiPlots.d.ts.map +1 -1
- package/dist/MiPlots.js +16 -14
- package/dist/MiPlots.js.map +1 -1
- package/dist/bubble/BubbleSettingsImpl.d.ts +3 -0
- package/dist/bubble/BubbleSettingsImpl.d.ts.map +1 -1
- package/dist/bubble/BubbleSettingsImpl.js +4 -1
- package/dist/bubble/BubbleSettingsImpl.js.map +1 -1
- package/dist/bubble/ChartRenderer.d.ts +2 -12
- package/dist/bubble/ChartRenderer.d.ts.map +1 -1
- package/dist/bubble/ChartRenderer.js +13 -13
- package/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/bubble/getGroupedCellsData.d.ts +1 -1
- package/dist/bubble/getGroupedCellsData.d.ts.map +1 -1
- package/dist/bubble/getGroupedCellsData.js +20 -14
- package/dist/bubble/getGroupedCellsData.js.map +1 -1
- package/dist/bubble/index.d.ts.map +1 -1
- package/dist/bubble/index.js +6 -10
- package/dist/bubble/index.js.map +1 -1
- package/dist/common/ContinuousAxis.d.ts +3 -1
- package/dist/common/ContinuousAxis.d.ts.map +1 -1
- package/dist/common/ContinuousAxis.js +8 -8
- package/dist/common/ContinuousAxis.js.map +1 -1
- package/dist/common/Legend.d.ts +12 -1
- package/dist/common/Legend.d.ts.map +1 -1
- package/dist/common/Legend.js +14 -6
- package/dist/common/Legend.js.map +1 -1
- package/dist/heatmap/ChartRenderer.d.ts +2 -12
- package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
- package/dist/heatmap/ChartRenderer.js +26 -26
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +3 -0
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +5 -2
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/fillCellsData.d.ts +6 -1
- package/dist/heatmap/fillCellsData.d.ts.map +1 -1
- package/dist/heatmap/fillCellsData.js +135 -96
- package/dist/heatmap/fillCellsData.js.map +1 -1
- package/dist/heatmap/getCells.d.ts +4 -1
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +19 -16
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +32 -34
- package/dist/heatmap/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/selection/ChartRenderer.d.ts +90 -0
- package/dist/selection/ChartRenderer.d.ts.map +1 -0
- package/dist/selection/ChartRenderer.js +254 -0
- package/dist/selection/ChartRenderer.js.map +1 -0
- package/dist/selection/SelectionSettingsImpl.d.ts +53 -0
- package/dist/selection/SelectionSettingsImpl.d.ts.map +1 -0
- package/dist/selection/SelectionSettingsImpl.js +47 -0
- package/dist/selection/SelectionSettingsImpl.js.map +1 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.d.ts +8 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.js +57 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.js.map +1 -0
- package/dist/selection/components/Chart/Bars/StackedBars.d.ts +12 -0
- package/dist/selection/components/Chart/Bars/StackedBars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars/StackedBars.js +58 -0
- package/dist/selection/components/Chart/Bars/StackedBars.js.map +1 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.d.ts +6 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.js +38 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.js.map +1 -0
- package/dist/selection/components/Chart/Bars.d.ts +10 -0
- package/dist/selection/components/Chart/Bars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars.js +48 -0
- package/dist/selection/components/Chart/Bars.js.map +1 -0
- package/dist/selection/components/Chart/ChartAxes.d.ts +7 -0
- package/dist/selection/components/Chart/ChartAxes.d.ts.map +1 -0
- package/dist/selection/components/Chart/ChartAxes.js +51 -0
- package/dist/selection/components/Chart/ChartAxes.js.map +1 -0
- package/dist/selection/components/Chart/ChartFrame.d.ts +9 -0
- package/dist/selection/components/Chart/ChartFrame.d.ts.map +1 -0
- package/dist/selection/components/Chart/ChartFrame.js +41 -0
- package/dist/selection/components/Chart/ChartFrame.js.map +1 -0
- package/dist/selection/components/Chart/Dividers.d.ts +8 -0
- package/dist/selection/components/Chart/Dividers.d.ts.map +1 -0
- package/dist/selection/components/Chart/Dividers.js +27 -0
- package/dist/selection/components/Chart/Dividers.js.map +1 -0
- package/dist/selection/components/Chart/Gridlines.d.ts +10 -0
- package/dist/selection/components/Chart/Gridlines.d.ts.map +1 -0
- package/dist/selection/components/Chart/Gridlines.js +32 -0
- package/dist/selection/components/Chart/Gridlines.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.d.ts +9 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js +36 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.d.ts +6 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.js +22 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.d.ts +10 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.js +33 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts +10 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js +65 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.d.ts +10 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.js +13 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons.d.ts +9 -0
- package/dist/selection/components/Chart/Ribbons.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons.js +58 -0
- package/dist/selection/components/Chart/Ribbons.js.map +1 -0
- package/dist/selection/components/Chart/StageCounts.d.ts +7 -0
- package/dist/selection/components/Chart/StageCounts.d.ts.map +1 -0
- package/dist/selection/components/Chart/StageCounts.js +20 -0
- package/dist/selection/components/Chart/StageCounts.js.map +1 -0
- package/dist/selection/components/Chart/types.d.ts +132 -0
- package/dist/selection/components/Chart/types.d.ts.map +1 -0
- package/dist/selection/components/Chart.d.ts +22 -0
- package/dist/selection/components/Chart.d.ts.map +1 -0
- package/dist/selection/components/Chart.js +97 -0
- package/dist/selection/components/Chart.js.map +1 -0
- package/dist/selection/components/ChartsGroup.d.ts +18 -0
- package/dist/selection/components/ChartsGroup.d.ts.map +1 -0
- package/dist/selection/components/ChartsGroup.js +181 -0
- package/dist/selection/components/ChartsGroup.js.map +1 -0
- package/dist/selection/components/FacetCell.d.ts +22 -0
- package/dist/selection/components/FacetCell.d.ts.map +1 -0
- package/dist/selection/components/FacetCell.js +18 -0
- package/dist/selection/components/FacetCell.js.map +1 -0
- package/dist/selection/components/types.d.ts +58 -0
- package/dist/selection/components/types.d.ts.map +1 -0
- package/dist/selection/constants.d.ts +25 -0
- package/dist/selection/constants.d.ts.map +1 -0
- package/dist/selection/constants.js +4 -0
- package/dist/selection/constants.js.map +1 -0
- package/dist/selection/createSelectionData.d.ts +50 -0
- package/dist/selection/createSelectionData.d.ts.map +1 -0
- package/dist/selection/createSelectionData.js +92 -0
- package/dist/selection/createSelectionData.js.map +1 -0
- package/dist/selection/index.d.ts +26 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.js +96 -0
- package/dist/selection/index.js.map +1 -0
- package/dist/selection/utils.d.ts +4 -0
- package/dist/selection/utils.d.ts.map +1 -0
- package/dist/selection/utils.js +13 -0
- package/dist/selection/utils.js.map +1 -0
- package/dist/types/bubble.d.ts +131 -0
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/bubble.js +3 -0
- package/dist/types/bubble.js.map +1 -1
- package/dist/types/common.d.ts +38 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +1 -0
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +103 -0
- package/dist/types/dendro.d.ts.map +1 -1
- package/dist/types/discrete.d.ts +167 -0
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/heatmap.d.ts +248 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +3 -0
- package/dist/types/heatmap.js.map +1 -1
- package/dist/types/histogram.d.ts +22 -0
- package/dist/types/histogram.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/scatterplot-umap.d.ts +188 -0
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot.d.ts +270 -0
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/types/selection.d.ts +452 -0
- package/dist/types/selection.d.ts.map +1 -0
- package/dist/types/selection.js +53 -0
- package/dist/types/selection.js.map +1 -0
- package/dist/utils/intersect.d.ts +2 -0
- package/dist/utils/intersect.d.ts.map +1 -0
- package/dist/utils/intersect.js +8 -0
- package/dist/utils/intersect.js.map +1 -0
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { exhaustive as e } from "../utils/index.js";
|
|
|
2
2
|
import { getFacetStringKey as t } from "../discrete/utils/getFacetStringKey.js";
|
|
3
3
|
import { getFacetLabels as n } from "../discrete/utils/getFacetLabels.js";
|
|
4
4
|
import { getFacetOrGroupKey as r } from "../utils/getFacetOrGroupKey.js";
|
|
5
|
-
import i from "
|
|
5
|
+
import { intersect as i } from "../utils/intersect.js";
|
|
6
6
|
import { deviation as a, extent as o, mean as s, quantileSorted as c, sum as l } from "d3-array";
|
|
7
7
|
function u(e) {
|
|
8
8
|
let t = a(e), n = s(e);
|
|
@@ -40,30 +40,49 @@ function m(e) {
|
|
|
40
40
|
function h(e) {
|
|
41
41
|
if (!e.length) return [];
|
|
42
42
|
let t = [[]];
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
e.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
for (let n of e) {
|
|
44
|
+
let e = [];
|
|
45
|
+
for (let r of n) e.push(...t.map((e) => [...e, r]));
|
|
46
|
+
t = e;
|
|
47
|
+
}
|
|
48
|
+
return t;
|
|
49
|
+
}
|
|
50
|
+
var g = (e, t, n = {}) => {
|
|
51
|
+
let r = t === "asc" ? 1 : -1;
|
|
52
|
+
return e.sort((e, t) => r * (n[e] ?? e).localeCompare(n[t] ?? t, "en", { numeric: !0 }));
|
|
53
|
+
};
|
|
54
|
+
function _(e) {
|
|
55
|
+
return !!(e == null || typeof e == "number" && Number.isNaN(e));
|
|
56
|
+
}
|
|
57
|
+
function v(e, t, n) {
|
|
58
|
+
let r = _(e), i = _(t);
|
|
59
|
+
if (r && i) return 0;
|
|
60
|
+
if (r) return 1;
|
|
61
|
+
if (i) return -1;
|
|
62
|
+
let a = n === "asc" ? 1 : -1;
|
|
63
|
+
return typeof e == "number" && typeof t == "number" ? a * (e < t ? -1 : e > t ? 1 : 0) : a * String(e).localeCompare(String(t), "en", { numeric: !0 });
|
|
49
64
|
}
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
const y = (e, t, n, r) => e.sort((e, i) => {
|
|
66
|
+
for (let a of n) {
|
|
67
|
+
let n = v(r[a.value]?.[e], r[a.value]?.[i], t);
|
|
68
|
+
if (n !== 0) return n;
|
|
69
|
+
}
|
|
70
|
+
return 0;
|
|
71
|
+
});
|
|
72
|
+
function b(e, t, n, r, i) {
|
|
52
73
|
if (t.x || t.y) {
|
|
53
74
|
let a = e.meta.valueSources.reduce((e, t) => (e[t] = [Infinity, -Infinity], e), {});
|
|
54
|
-
e.meta.facetKeys
|
|
75
|
+
for (let o of e.meta.facetKeys) {
|
|
55
76
|
let { xKeys: s, yKeys: c, cells: l, xKeysByGroups: u, yKeysByGroups: d } = e.facets[o], f = t.x ? u : s.reduce((e, t) => (e[t] = [t], e), {}), h = t.y ? d : c.reduce((e, t) => (e[t] = [t], e), {}), g = Object.keys(f), _ = Object.keys(h);
|
|
56
77
|
for (let n of g) for (let r of _) {
|
|
57
78
|
let i = e.meta.valueSources.reduce((e, t) => (e[t] = [], e), {});
|
|
58
|
-
f[n]
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
});
|
|
79
|
+
for (let t of f[n]) for (let n of h[r]) {
|
|
80
|
+
for (let r of e.meta.valueSources) {
|
|
81
|
+
let e = l[t]?.[n]?.value?.[r];
|
|
82
|
+
e !== void 0 && i[r].push(e);
|
|
83
|
+
}
|
|
84
|
+
delete l[t]?.[n];
|
|
85
|
+
}
|
|
67
86
|
for (let s of e.meta.valueSources) {
|
|
68
87
|
let c = i[s];
|
|
69
88
|
if (c.length > 0) {
|
|
@@ -82,117 +101,125 @@ function _(e, t, n, r, i) {
|
|
|
82
101
|
}
|
|
83
102
|
}
|
|
84
103
|
}
|
|
85
|
-
t.x
|
|
86
|
-
n.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}), _.forEach((n) => {
|
|
99
|
-
r.forEach((r) => {
|
|
100
|
-
let a = i.find((e) => e.valueColumn.value === r || e.valueColumn.valueLabels === r);
|
|
101
|
-
if (!a) return;
|
|
104
|
+
if (t.x) for (let r of g) for (let a of n) {
|
|
105
|
+
let n = i.find((e) => e.valueColumn.value === a || e.valueColumn.valueLabels === a);
|
|
106
|
+
if (!n) continue;
|
|
107
|
+
let o = [];
|
|
108
|
+
for (let t of f[r]) o.push(e.meta.xDataByKeys[a][t]), delete e.meta.xDataByKeys[a][t];
|
|
109
|
+
let s = n.type === "continuous" ? p(t.method, o) : m(o);
|
|
110
|
+
e.meta.xDataByKeys[a][r] = s;
|
|
111
|
+
}
|
|
112
|
+
if (t.y) {
|
|
113
|
+
for (let t of r) e.meta.yDataByKeys[t] = {};
|
|
114
|
+
for (let n of _) for (let a of r) {
|
|
115
|
+
let r = i.find((e) => e.valueColumn.value === a || e.valueColumn.valueLabels === a);
|
|
116
|
+
if (!r) continue;
|
|
102
117
|
let o = [];
|
|
103
|
-
h[n].
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
for (let t of h[n]) o.push(e.meta.yDataByKeys[a][t]), delete e.meta.yDataByKeys[a][t];
|
|
119
|
+
let s = r.type === "continuous" ? p(t.method, o) : m(o);
|
|
120
|
+
e.meta.yDataByKeys[a][n] = s;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
t.x && (e.facets[o].xKeys = Object.keys(u), e.facets[o].xKeysByGroups = { null: e.facets[o].xKeys }, e.meta.xLabels = e.meta.xGroupLabels, e.meta.xGroupKeys = ["null"], e.meta.xGroupKeyValues = { null: ["null"] }), t.y && (e.facets[o].yKeys = Object.keys(d), e.facets[o].yKeysByGroups = { null: e.facets[o].yKeys }, e.meta.yLabels = e.meta.yGroupLabels, e.meta.yGroupKeys = ["null"], e.meta.yGroupKeyValues = { null: ["null"] });
|
|
124
|
+
}
|
|
125
|
+
e.meta.valueExtent = a;
|
|
111
126
|
}
|
|
112
127
|
}
|
|
113
|
-
function
|
|
128
|
+
function x(e, t) {
|
|
114
129
|
for (let n of e.meta.valueSources) e.meta.valueExtent[n][0] = Math.min(t.normalizedValue?.[n], e.meta.valueExtent[n][0]), e.meta.valueExtent[n][1] = Math.max(t.normalizedValue?.[n], e.meta.valueExtent[n][1]);
|
|
115
130
|
}
|
|
116
|
-
function
|
|
131
|
+
function S(e, t) {
|
|
117
132
|
if (Object.values(t).length) {
|
|
118
133
|
let n = e.meta.valueSources.reduce((e, n) => (t[n] && (e[n] = [Infinity, -Infinity]), e), {});
|
|
119
|
-
e.meta.facetKeys
|
|
134
|
+
for (let r of e.meta.facetKeys) {
|
|
120
135
|
let { xKeys: i, yKeys: a, cells: o } = e.facets[r];
|
|
121
136
|
for (let r of e.meta.valueSources) {
|
|
122
137
|
let e = t[r];
|
|
123
138
|
if (!e) continue;
|
|
124
139
|
let s = e.direction === "row" ? i : a, c = e.direction === "row" ? a : i, l = e.direction === "row" ? (e, t) => o[e]?.[t] : (e, t) => o[t]?.[e];
|
|
125
|
-
|
|
140
|
+
for (let t of c) {
|
|
126
141
|
let i = [];
|
|
127
|
-
|
|
142
|
+
for (let e of s) {
|
|
128
143
|
let n = l(e, t)?.value?.[r];
|
|
129
144
|
n !== void 0 && i.push(n);
|
|
130
|
-
}
|
|
145
|
+
}
|
|
131
146
|
let a = f(e.method, i);
|
|
132
|
-
|
|
147
|
+
for (let e of s) {
|
|
133
148
|
let i = l(e, t);
|
|
134
149
|
i !== void 0 && (i.normalizedValue[r] = a(i.value?.[r]), n[r][0] = Math.min(i.normalizedValue?.[r], n[r][0]), n[r][1] = Math.max(i.normalizedValue?.[r], n[r][1]));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
137
152
|
}
|
|
138
|
-
}
|
|
153
|
+
}
|
|
154
|
+
e.meta.valueExtent = {
|
|
139
155
|
...e.meta.valueExtent,
|
|
140
156
|
valueExtent: n
|
|
141
157
|
};
|
|
142
158
|
}
|
|
143
159
|
}
|
|
144
|
-
function
|
|
145
|
-
let
|
|
146
|
-
f?.order?.length && (
|
|
147
|
-
let
|
|
148
|
-
e.meta.facetKeys =
|
|
149
|
-
let
|
|
150
|
-
e.meta.facetKeyValues =
|
|
151
|
-
let
|
|
152
|
-
...H,
|
|
160
|
+
function C(e, { data: a, xColumn: o, yColumn: s, valueColumns: c, facetBy: l, xGroupBy: u, yGroupBy: d, facetSettings: f, annotations: p, dendrogramX: m, dendrogramY: _, normalizationBySource: v, NAValueAs: C, transformBySource: w, keysOrder: T, xAxis: E, yAxis: D, xSortBy: O, ySortBy: k, aggregation: A, showEmptyRows: j = !1, showEmptyColumns: M = !1 }) {
|
|
161
|
+
let N = l.length ? l.map((e) => T[e.value] ?? a.getColumnCategories(e.value)) : [["null"]], ee = u.length ? u.map((e) => T[e.value] ?? a.getColumnCategories(e.value)) : [["null"]], te = d.length ? d.map((e) => T[e.value] ?? a.getColumnCategories(e.value)) : [["null"]], P = h(N), F = h(ee), I = h(te);
|
|
162
|
+
f?.order?.length && (P = P.filter((e) => f.order?.includes(t(e))));
|
|
163
|
+
let L = P.map(r), R = new Set(L), z = F.map(r), B = I.map(r);
|
|
164
|
+
e.meta.facetKeys = L, e.meta.xGroupKeys = z, e.meta.yGroupKeys = B;
|
|
165
|
+
let V = n(a, l, L, P);
|
|
166
|
+
e.meta.facetKeyValues = L.reduce((e, t) => (e[t] = V[t], e), {}), e.meta.xGroupKeyValues = z.reduce((e, t, n) => (e[t] = F[n], e), {}), e.meta.yGroupKeyValues = B.reduce((e, t, n) => (e[t] = I[n], e), {});
|
|
167
|
+
let H = o.valueLabels ?? o.value, U = s.valueLabels ?? s.value, W = p.filter((e) => e.axis === "x").map((e) => e.valueColumn.valueLabels ?? e.valueColumn.value), G = p.filter((e) => e.axis === "y").map((e) => e.valueColumn.valueLabels ?? e.valueColumn.value), K = Object.values(m ?? {}).map((e) => e.value), q = Object.values(_ ?? {}).map((e) => e.value), J = (O ?? []).map((e) => e.value), Y = (k ?? []).map((e) => e.value), X = [...new Set([
|
|
153
168
|
...W,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
169
|
+
...K,
|
|
170
|
+
...J,
|
|
171
|
+
H
|
|
172
|
+
])], Z = [...new Set([
|
|
157
173
|
...G,
|
|
158
|
-
|
|
159
|
-
|
|
174
|
+
...q,
|
|
175
|
+
...Y,
|
|
176
|
+
U
|
|
177
|
+
])];
|
|
160
178
|
for (let t = 0; t < a.rowsCount; t++) {
|
|
161
179
|
let n = r(l.map((e) => a.getColumnValue(e.value, t)));
|
|
162
|
-
if (!
|
|
180
|
+
if (!R.has(n)) continue;
|
|
163
181
|
let i = r(u.map((e) => a.getColumnValue(e.value, t))), f = r(d.map((e) => a.getColumnValue(e.value, t))), p = u.map((e) => a.getColumnValue(e.valueLabels ?? e.value, t)).join(", "), m = d.map((e) => a.getColumnValue(e.valueLabels ?? e.value, t)).join(", ");
|
|
164
182
|
e.meta.xGroupLabels[i] = p, e.meta.yGroupLabels[f] = m;
|
|
165
|
-
let h = String(a.getColumnValue(o.value, t)), g = String(a.getColumnValue(s.value, t)), _ = e.meta.valueSources.reduce((e, n) =>
|
|
183
|
+
let h = String(a.getColumnValue(o.value, t)), g = String(a.getColumnValue(s.value, t)), _ = e.meta.valueSources.reduce((e, n) => {
|
|
184
|
+
let r = a.getColumnValue(c[n].value, t) ?? C;
|
|
185
|
+
if (w?.[n] === "log" && typeof r == "number") {
|
|
186
|
+
let e = Math.log10(r);
|
|
187
|
+
r = Number.isFinite(e) ? e : null;
|
|
188
|
+
}
|
|
189
|
+
return e[n] = r, e;
|
|
190
|
+
}, {});
|
|
166
191
|
if (h === "null" || g === "null") continue;
|
|
167
|
-
let
|
|
168
|
-
if (!(
|
|
192
|
+
let v = Object.values(_).every((e) => e === null);
|
|
193
|
+
if (!(v && !j && !M)) {
|
|
169
194
|
if (e.facets[n] || (e.facets[n] = {
|
|
170
195
|
xKeys: [],
|
|
171
196
|
yKeys: [],
|
|
172
197
|
xKeysByGroups: {},
|
|
173
198
|
yKeysByGroups: {},
|
|
174
199
|
cells: {}
|
|
175
|
-
}), e.facets[n].xKeysByGroups[i] || (e.facets[n].xKeysByGroups[i] = []), e.facets[n].yKeysByGroups[f] || (e.facets[n].yKeysByGroups[f] = []), !
|
|
200
|
+
}), e.facets[n].xKeysByGroups[i] || (e.facets[n].xKeysByGroups[i] = []), e.facets[n].yKeysByGroups[f] || (e.facets[n].yKeysByGroups[f] = []), !v || M) {
|
|
176
201
|
e.facets[n].xKeys.push(h), e.facets[n].xKeysByGroups[i].push(h);
|
|
177
|
-
let r = a.getColumnValue(
|
|
202
|
+
let r = a.getColumnValue(H, t);
|
|
178
203
|
if (e.meta.xLabels[h] && String(r) !== e.meta.xLabels[h]) throw Error(`More than 1 x-label value for x=${h}`);
|
|
179
|
-
e.meta.xLabels[h] = String(r)
|
|
204
|
+
e.meta.xLabels[h] = String(r);
|
|
205
|
+
for (let n of X) {
|
|
180
206
|
let r = e.meta.xDataByKeys[n] !== void 0, i = r && e.meta.xDataByKeys[n][h] !== void 0;
|
|
181
207
|
if (r || (e.meta.xDataByKeys[n] = {}), i && e.meta.xDataByKeys[n][h] !== a.getColumnValue(n, t)) throw Error(`More than 1 value for x = ${h} and column = ${n}`);
|
|
182
208
|
i || (e.meta.xDataByKeys[n][h] = a.getColumnValue(n, t));
|
|
183
|
-
}
|
|
209
|
+
}
|
|
184
210
|
}
|
|
185
|
-
if (!
|
|
211
|
+
if (!v || j) {
|
|
186
212
|
e.facets[n].yKeys.push(g), e.facets[n].yKeysByGroups[f].push(g);
|
|
187
|
-
let r = a.getColumnValue(
|
|
213
|
+
let r = a.getColumnValue(U, t);
|
|
188
214
|
if (e.meta.yLabels[g] && String(r) !== e.meta.yLabels[g]) throw Error(`More than 1 y-label value for y=${g}`);
|
|
189
|
-
e.meta.yLabels[g] = String(r)
|
|
215
|
+
e.meta.yLabels[g] = String(r);
|
|
216
|
+
for (let n of Z) {
|
|
190
217
|
let r = e.meta.yDataByKeys[n] !== void 0, i = r && e.meta.yDataByKeys[n][g] !== void 0;
|
|
191
218
|
if (r || (e.meta.yDataByKeys[n] = {}), i && e.meta.yDataByKeys[n][g] !== a.getColumnValue(n, t)) throw Error(`More than 1 value for y = ${g} and column = ${n}`);
|
|
192
219
|
i || (e.meta.yDataByKeys[n][g] = a.getColumnValue(n, t));
|
|
193
|
-
}
|
|
220
|
+
}
|
|
194
221
|
}
|
|
195
|
-
if (!
|
|
222
|
+
if (!v) {
|
|
196
223
|
e.facets[n].cells[h] || (e.facets[n].cells[h] = {});
|
|
197
224
|
for (let t of e.meta.valueSources) if (e.facets[n].cells[h][g] && e.facets[n].cells[h][g].value[t] !== _[t]) throw Error(`More than 1 value for x=${h}, y=${g}`);
|
|
198
225
|
e.facets[n].cells[h][g] = {
|
|
@@ -203,27 +230,39 @@ function b(e, { data: a, xColumn: o, yColumn: s, valueColumns: c, facetBy: l, xG
|
|
|
203
230
|
y: g,
|
|
204
231
|
value: _,
|
|
205
232
|
normalizedValue: _
|
|
206
|
-
},
|
|
233
|
+
}, x(e, e.facets[n].cells[h][g]);
|
|
207
234
|
}
|
|
208
235
|
}
|
|
209
236
|
}
|
|
210
|
-
e.meta.facetKeys = e.meta.facetKeys.filter((t) => e.facets[t])
|
|
211
|
-
|
|
212
|
-
n
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
237
|
+
e.meta.facetKeys = e.meta.facetKeys.filter((t) => e.facets[t]);
|
|
238
|
+
for (let t of e.meta.facetKeys) {
|
|
239
|
+
let n = e.facets[t], r = [...new Set(n.xKeys)], a = [...new Set(n.yKeys)];
|
|
240
|
+
n.xKeys = T[o.value] ? i(T[o.value], r) : r, n.yKeys = T[s.value] ? i(T[s.value], a) : a;
|
|
241
|
+
for (let r of z) e.facets[t].xKeysByGroups[r] = i(n.xKeys, e.facets[t].xKeysByGroups[r]);
|
|
242
|
+
for (let r of B) e.facets[t].yKeysByGroups[r] = i(n.yKeys, e.facets[t].yKeysByGroups[r]);
|
|
243
|
+
}
|
|
244
|
+
b(e, A, X, Z, p), S(e, v);
|
|
245
|
+
let ne = u.some((e) => T[e.value]?.length > 0), re = d.some((e) => T[e.value]?.length > 0);
|
|
246
|
+
ne || (e.meta.xGroupKeys = g([...e.meta.xGroupKeys], E.sorting, e.meta.xGroupLabels)), re || (e.meta.yGroupKeys = g([...e.meta.yGroupKeys], D.sorting, e.meta.yGroupLabels));
|
|
247
|
+
let Q = !m && !A.x && O?.length ? O : null;
|
|
248
|
+
e.meta.xKeysByGroups = e.meta.xGroupKeys.reduce((t, n) => {
|
|
249
|
+
let r = [...new Set(e.meta.facetKeys.flatMap((t) => e.facets[t].xKeysByGroups[n]))], a = Q ? y(r, E.sorting, Q, e.meta.xDataByKeys) : g(r, E.sorting, e.meta.xLabels);
|
|
250
|
+
return t[n] = T[o.value] ? i(T[o.value], a) : a, t;
|
|
251
|
+
}, {}), e.meta.xKeys = e.meta.xGroupKeys.reduce((t, n) => (t = t.concat(e.meta.xKeysByGroups[n]), t), []);
|
|
252
|
+
let $ = !_ && !A.y && k?.length ? k : null;
|
|
253
|
+
e.meta.yKeysByGroups = e.meta.yGroupKeys.reduce((t, n) => {
|
|
254
|
+
let r = [...new Set(e.meta.facetKeys.flatMap((t) => e.facets[t].yKeysByGroups[n]))], a = $ ? y(r, D.sorting, $, e.meta.yDataByKeys) : g(r, D.sorting, e.meta.yLabels);
|
|
255
|
+
return t[n] = T[s.value] ? i(T[s.value], a) : a, t;
|
|
223
256
|
}, {}), e.meta.yKeys = e.meta.yGroupKeys.reduce((t, n) => (t = t.concat(e.meta.yKeysByGroups[n]), t), []);
|
|
257
|
+
for (let t of e.meta.facetKeys) {
|
|
258
|
+
for (let n of e.meta.xGroupKeys) e.facets[t].xKeysByGroups[n] = i(e.meta.xKeysByGroups[n], e.facets[t].xKeysByGroups[n] ?? []);
|
|
259
|
+
e.facets[t].xKeys = e.meta.xGroupKeys.flatMap((n) => e.facets[t].xKeysByGroups[n] ?? []);
|
|
260
|
+
for (let n of e.meta.yGroupKeys) e.facets[t].yKeysByGroups[n] = i(e.meta.yKeysByGroups[n], e.facets[t].yKeysByGroups[n] ?? []);
|
|
261
|
+
e.facets[t].yKeys = e.meta.yGroupKeys.flatMap((n) => e.facets[t].yKeysByGroups[n] ?? []);
|
|
262
|
+
}
|
|
224
263
|
for (let t of e.meta.valueSources) e.meta.valueExtent[t][0] === Infinity && (e.meta.valueExtent[t][0] = 0), e.meta.valueExtent[t][1] === -Infinity && (e.meta.valueExtent[t][1] = 0);
|
|
225
264
|
return e.meta.xLabels.null = o.nullValueLabel ?? "NA", e.meta.yLabels.null = s.nullValueLabel ?? "NA", e.meta.xGroupLabels.null = u.map((e) => e.nullValueLabel ?? "NA").join(", "), e.meta.yGroupLabels.null = d.map((e) => e.nullValueLabel ?? "NA").join(", "), e;
|
|
226
265
|
}
|
|
227
|
-
export {
|
|
266
|
+
export { C as fillCellsData };
|
|
228
267
|
|
|
229
268
|
//# sourceMappingURL=fillCellsData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fillCellsData.js","names":[],"sources":["../../src/heatmap/fillCellsData.ts"],"sourcesContent":["import { deviation, extent, mean, quantileSorted, sum } from 'd3-array';\nimport lodash from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { AggregationMethod, ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { exhaustive } from '../utils';\nimport { getFacetOrGroupKey } from '../utils/getFacetOrGroupKey';\nimport type { BubbleSettingsImpl } from '../bubble/BubbleSettingsImpl';\nimport { getFacetLabels } from '../discrete/utils/getFacetLabels';\nimport { getFacetStringKey } from '../discrete/utils/getFacetStringKey';\n\nexport type Cell<T extends string> = {\n isCell: true;\n idx: number;\n id: string;\n value: Record<T, DataValue>;\n normalizedValue: Record<T, DataValue>;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData<T extends string> = {\n meta: {\n valueSources: T[]; // dataSource for heatmap, color and size for bubble - main data for every cell\n\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n\n xKeys: string[];\n yKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n\n // for titles, if facet by more 1 columns title has several values separated by commas\n facetKeyValues: Record<string, string[]>;\n xGroupKeyValues: Record<string, string[]>;\n yGroupKeyValues: Record<string, string[]>;\n\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n\n valueExtent: Record<T, [number, number]>; // for color/size scales\n // data for labels, annotations and dendrograms\n xDataByKeys: Record<string, Record<string, DataValue>>;\n yDataByKeys: Record<string, Record<string, DataValue>>;\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // axis keys grouped by group keys from meta\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell<T>>>;\n }\n >;\n};\n\nfunction normalizeByStd(values: number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / stdValue;\n}\nfunction normalizeByMinMax(values: number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined || max === min) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method: NormalizationMethod, values: number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v: number) => v;\n}\n\nfunction aggregateNumeric(method: AggregationMethod, values: number[]) {\n switch (method) {\n case 'max': {\n let res = values[0];\n for (const v of values) {\n res = Math.max(res, v);\n }\n return res;\n }\n case 'min': {\n let res = values[0];\n for (const v of values) {\n res = Math.min(res, v);\n }\n return res;\n }\n case 'median': {\n const valuesSorted = values.sort((a, b) => a - b);\n return quantileSorted(valuesSorted, 0.5) as number;\n }\n case 'mean': {\n return mean(values) ?? values[0];\n }\n case 'sum': {\n return sum(values) as number;\n }\n default: exhaustive(method, `Unknown aggregation function ${method}`);\n }\n}\nfunction aggregateString(values: string[]) {\n const list = [...new Set(values)].sort();\n if (list.length > 3) {\n return [...list.slice(0, 3), '...'].join(', ');\n }\n return list.join(', ');\n}\n\n// all combinations with 1 key from each list\nfunction getKeysCombinations(keysLists: string[][]) {\n if (!keysLists.length) {\n return [];\n }\n let result: string[][] = [[]];\n keysLists.forEach(keys => {\n const nextResult: string[][] = [];\n keys.forEach(key => {\n nextResult.push(...result.map(resultItem => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\nconst sortByLabels = (arr: string[], direction: 'asc' | 'desc', labels: Record<string, string> = {}) => {\n return arr.sort((a, b) => direction === 'asc'\n ? (labels[a] ?? a).localeCompare((labels[b] ?? b), 'en', { numeric: true })\n : (labels[b] ?? b).localeCompare((labels[a] ?? a), 'en', { numeric: true })\n );\n};\nfunction applyAggregation<T extends string>(\n result: GroupedCellsData<T>,\n aggregation: HeatmapSettingsImpl['aggregation'],\n additionalDataColumnsX: string[],\n additionalDataColumnsY: string[],\n annotations: HeatmapSettingsImpl['annotations']\n) {\n if (aggregation.x || aggregation.y) {\n const valueExtent: GroupedCellsData<T>['meta']['valueExtent'] = result.meta.valueSources.reduce((r, key) => {\n r[key] = [Infinity, -Infinity] as [number, number];\n return r;\n }, {} as GroupedCellsData<T>['meta']['valueExtent']);\n result.meta.facetKeys.forEach(facetKey => {\n const { xKeys, yKeys, cells, xKeysByGroups, yKeysByGroups } = result.facets[facetKey];\n const xGroups = aggregation.x ? xKeysByGroups : xKeys.reduce((res, xKey) => { res[xKey] = [xKey]; return res; }, {} as Record<string, string[]>);\n const yGroups = aggregation.y ? yKeysByGroups : yKeys.reduce((res, yKey) => { res[yKey] = [yKey]; return res; }, {} as Record<string, string[]>);\n const xNewKeys = Object.keys(xGroups);\n const yNewKeys = Object.keys(yGroups);\n\n for (const xGroupKey of xNewKeys) {\n for (const yGroupKey of yNewKeys) {\n // collect values for aggregation to arrays\n const valuesBySources: Record<T, number[]> = result.meta.valueSources.reduce((r, v) => {\n r[v] = [];\n return r;\n }, {} as Record<T, number[]>);\n xGroups[xGroupKey].forEach((xKey) => {\n yGroups[yGroupKey].forEach((yKey) => {\n for (const valueSource of result.meta.valueSources) {\n const cellValue = cells[xKey]?.[yKey]?.value?.[valueSource];\n if (cellValue !== undefined) {\n valuesBySources[valueSource].push(cellValue as number);\n }\n }\n delete cells[xKey]?.[yKey];\n });\n });\n // create new cells with aggregated values\n for (const valueSource of result.meta.valueSources) {\n const values = valuesBySources[valueSource];\n if (values.length > 0) {\n const value = aggregateNumeric(aggregation.method, values);\n if (!result.facets[facetKey].cells[xGroupKey]) {\n result.facets[facetKey].cells[xGroupKey] = {};\n }\n if (!result.facets[facetKey].cells[xGroupKey][yGroupKey]) {\n result.facets[facetKey].cells[xGroupKey][yGroupKey] = {\n isCell: true,\n idx: 0,\n id: `${xGroupKey}_${yGroupKey}`,\n x: xGroupKey,\n y: yGroupKey,\n value: result.meta.valueSources.reduce((r, v) => { r[v] = null; return r; }, {} as Record<T, DataValue>),\n normalizedValue: result.meta.valueSources.reduce((r, v) => { r[v] = null; return r; }, {} as Record<T, DataValue>),\n };\n }\n const cell = result.facets[facetKey].cells[xGroupKey][yGroupKey];\n cell.value[valueSource] = value;\n cell.normalizedValue[valueSource] = value;\n\n valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource], valueExtent[valueSource][0]);\n valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource], valueExtent[valueSource][1]);\n }\n }\n }\n }\n // add aggregated values for X annotations\n if (aggregation.x) {\n xNewKeys.forEach(xGroupKey => {\n additionalDataColumnsX.forEach(columnKey => {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n return;\n }\n const values: DataValue[] = [];\n xGroups[xGroupKey].forEach((xKey) => {\n values.push(result.meta.xDataByKeys[columnKey][xKey]);\n delete result.meta.xDataByKeys[columnKey][xKey];\n });\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.xDataByKeys[columnKey][xGroupKey] = value;\n });\n });\n }\n // add aggregated values for Y annotations\n if (aggregation.y) {\n additionalDataColumnsY.forEach(columnKey => {\n result.meta.yDataByKeys[columnKey] = {};\n });\n yNewKeys.forEach(yGroupKey => {\n additionalDataColumnsY.forEach(columnKey => {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n return;\n }\n const values: DataValue[] = [];\n yGroups[yGroupKey].forEach((yKey) => {\n values.push(result.meta.yDataByKeys[columnKey][yKey]);\n delete result.meta.yDataByKeys[columnKey][yKey];\n });\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.yDataByKeys[columnKey][yGroupKey] = value;\n });\n });\n }\n // erase grouping - we aggregated by them and now there is no grouping in the chart;\n // replace axis keys with group keys - now group keys are new axis keys\n if (aggregation.x) {\n result.facets[facetKey].xKeys = Object.keys(xKeysByGroups);\n result.facets[facetKey].xKeysByGroups = { 'null': result.facets[facetKey].xKeys };\n result.meta.xLabels = result.meta.xGroupLabels;\n result.meta.xGroupKeys = ['null'];\n result.meta.xGroupKeyValues = { null: ['null'] };\n }\n if (aggregation.y) {\n result.facets[facetKey].yKeys = Object.keys(yKeysByGroups);\n result.facets[facetKey].yKeysByGroups = { 'null': result.facets[facetKey].yKeys };\n result.meta.yLabels = result.meta.yGroupLabels;\n result.meta.yGroupKeys = ['null'];\n result.meta.yGroupKeyValues = { null: ['null'] };\n }\n });\n result.meta.valueExtent = valueExtent;\n }\n}\n\nfunction updateValueExtent<T extends string>(result: GroupedCellsData<T>, cell: Cell<T>) {\n for (const valueSource of result.meta.valueSources) {\n result.meta.valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource] as number, result.meta.valueExtent[valueSource][0]);\n result.meta.valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource] as number, result.meta.valueExtent[valueSource][1]);\n }\n\n}\nfunction applyNormalization<T extends string>(\n result: GroupedCellsData<T>,\n normalizationBySources: Record<T, HeatmapSettingsImpl['normalization']>,\n) {\n if (Object.values(normalizationBySources).length) {\n const valueExtent: GroupedCellsData<T>['meta']['valueExtent'] = result.meta.valueSources.reduce((r, key) => {\n if (normalizationBySources[key]) {\n r[key] = [Infinity, -Infinity] as [number, number];\n }\n return r;\n }, {} as GroupedCellsData<T>['meta']['valueExtent']);\n result.meta.facetKeys.forEach(facetKey => {\n const { xKeys, yKeys, cells } = result.facets[facetKey];\n\n for (const valueSource of result.meta.valueSources) {\n const normalization = normalizationBySources[valueSource];\n if (!normalization) {\n continue;\n }\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter = normalization.direction === 'row'\n ? (cellKey: string, groupKey: string) => cells[cellKey]?.[groupKey]\n : (cellKey: string, groupKey: string) => cells[groupKey]?.[cellKey];\n groupKeys.forEach((groupKey) => {\n const values: number[] = [];\n cellKeys.forEach((cellKey) => {\n const v = cellGetter(cellKey, groupKey)?.value?.[valueSource];\n if (v !== undefined) {\n values.push(v as number);\n }\n });\n const normalize = getNormalizationFn(normalization.method, values);\n cellKeys.forEach((cellKey) => {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n cell.normalizedValue[valueSource] = normalize(cell.value?.[valueSource] as number);\n valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource], valueExtent[valueSource][0]);\n valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource], valueExtent[valueSource][1]);\n }\n });\n });\n }\n\n });\n result.meta.valueExtent = {...result.meta.valueExtent, valueExtent};\n }\n}\n\nexport function fillCellsData<T extends string>(\n result: GroupedCellsData<T>,\n {\n data,\n xColumn,\n yColumn,\n valueColumns,\n facetBy,\n xGroupBy,\n yGroupBy,\n facetSettings,\n annotations,\n dendrogramX,\n dendrogramY,\n normalizationBySource, // separated for color and size for example\n NAValueAs,\n keysOrder,\n xAxis,\n yAxis,\n aggregation,\n showEmptyRows = false,\n showEmptyColumns = false,\n }: {\n data: DataFrame;\n xColumn: ColumnName;\n yColumn: ColumnName;\n valueColumns: Record<string, ColumnName>;\n facetBy: ColumnName[];\n xGroupBy: ColumnName[];\n yGroupBy: ColumnName[];\n facetSettings: HeatmapSettingsImpl['facetSettings'];\n annotations: HeatmapSettingsImpl['annotations'];\n dendrogramX: HeatmapSettingsImpl['dendrogramX'];\n dendrogramY: HeatmapSettingsImpl['dendrogramY'];\n normalizationBySource: Record<T, HeatmapSettingsImpl['normalization']>;\n NAValueAs: HeatmapSettingsImpl['NAValueAs'];\n keysOrder: HeatmapSettingsImpl['keysOrder'];\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'] | BubbleSettingsImpl['chartSettings']['xAxis'];\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'] | BubbleSettingsImpl['chartSettings']['yAxis'];\n aggregation: HeatmapSettingsImpl['aggregation'];\n showEmptyRows?: boolean;\n showEmptyColumns?: boolean;\n }\n) {\n const facetKeysLists = facetBy.length\n ? facetBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n\n const xGroupKeysLists = xGroupBy.length\n ? xGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const yGroupKeysLists = yGroupBy.length\n ? yGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n let facetKeysCombinations = getKeysCombinations(facetKeysLists);\n const xGroupKeysCombinations = getKeysCombinations(xGroupKeysLists);\n const yGroupKeysCombinations = getKeysCombinations(yGroupKeysLists);\n\n if (facetSettings?.order?.length) {\n facetKeysCombinations = facetKeysCombinations.filter(keys => facetSettings.order?.includes(getFacetStringKey(keys)));\n }\n const facetKeys = facetKeysCombinations.map(getFacetOrGroupKey);\n const facetKeysSet = new Set(facetKeys);\n const xGroupKeys = xGroupKeysCombinations.map(getFacetOrGroupKey);\n const yGroupKeys = yGroupKeysCombinations.map(getFacetOrGroupKey);\n\n result.meta.facetKeys = facetKeys;\n result.meta.xGroupKeys = xGroupKeys;\n result.meta.yGroupKeys = yGroupKeys;\n\n const facetLabels = getFacetLabels(data, facetBy, facetKeys, facetKeysCombinations);\n result.meta.facetKeyValues = facetKeys.reduce((res: Record<string, string[]>, key) => {\n res[key] = facetLabels[key];\n return res;\n }, {});\n\n result.meta.xGroupKeyValues = xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {});\n result.meta.yGroupKeyValues = yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\n }, {});\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n const annotationColumnsX = annotations.filter(item => item.axis === 'x').map(item => item.valueColumn.valueLabels ?? item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.valueLabels ?? item.valueColumn.value);\n const dendrogramXColumns = Object.values(dendrogramX ?? {}).map(column => column.value);\n const dendrogramYColumns = Object.values(dendrogramY ?? {}).map(column => column.value);\n const additionalDataColumnsX = lodash.uniq([...annotationColumnsX, ...dendrogramXColumns, xLabelsSource]);\n const additionalDataColumnsY = lodash.uniq([...annotationColumnsY, ...dendrogramYColumns, yLabelsSource]);\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = getFacetOrGroupKey(facetBy.map(column => data.getColumnValue(column.value, i)));\n if (!facetKeysSet.has(facetKey)) {\n continue;\n }\n const xGroupKey = getFacetOrGroupKey(xGroupBy.map(column => data.getColumnValue(column.value, i)));\n const yGroupKey = getFacetOrGroupKey(yGroupBy.map(column => data.getColumnValue(column.value, i)));\n const xGroupLabel = xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ');\n const yGroupLabel = yGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ');\n result.meta.xGroupLabels[xGroupKey] = xGroupLabel;\n result.meta.yGroupLabels[yGroupKey] = yGroupLabel;\n const x = String(data.getColumnValue(xColumn.value, i));\n const y = String(data.getColumnValue(yColumn.value, i));\n\n const values = result.meta.valueSources.reduce((r, key) => {\n r[key] = (data.getColumnValue(valueColumns[key].value, i) ?? NAValueAs) as number | null;\n return r;\n }, {} as Record<string, DataValue>);\n\n if (x === 'null' || y === 'null') {\n continue;\n }\n\n const allValuesNull = Object.values(values).every(v => v === null);\n\n if (allValuesNull && !showEmptyRows && !showEmptyColumns) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n cells: {},\n };\n }\n if (!result.facets[facetKey].xKeysByGroups[xGroupKey]) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = [];\n }\n if (!result.facets[facetKey].yKeysByGroups[yGroupKey]) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = [];\n }\n\n if (!allValuesNull || showEmptyColumns) {\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].xKeysByGroups[xGroupKey].push(x);\n const xLabelsSourceValue = data.getColumnValue(xLabelsSource, i);\n if (result.meta.xLabels[x] && String(xLabelsSourceValue) !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n result.meta.xLabels[x] = String(xLabelsSourceValue);\n additionalDataColumnsX.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.xDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.xDataByKeys[columnKey][x] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.xDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.xDataByKeys[columnKey][x] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for x = ${x} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.xDataByKeys[columnKey][x] = data.getColumnValue(columnKey, i);\n }\n });\n }\n\n if (!allValuesNull || showEmptyRows) {\n result.facets[facetKey].yKeys.push(y);\n result.facets[facetKey].yKeysByGroups[yGroupKey].push(y);\n const yLabelsSourceValue = data.getColumnValue(yLabelsSource, i);\n if (result.meta.yLabels[y] && String(yLabelsSourceValue) !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.yLabels[y] = String(yLabelsSourceValue);\n additionalDataColumnsY.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.yDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.yDataByKeys[columnKey][y] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.yDataByKeys[columnKey][y] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for y = ${y} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.yDataByKeys[columnKey][y] = data.getColumnValue(columnKey, i);\n }\n });\n }\n\n if (allValuesNull) {\n continue;\n }\n\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n\n for (const valueSource of result.meta.valueSources) {\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value[valueSource] !== values[valueSource]) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n }\n\n result.facets[facetKey].cells[x][y] = {\n isCell: true,\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value: values,\n normalizedValue: values,\n };\n\n updateValueExtent(result, result.facets[facetKey].cells[x][y]);\n }\n\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n result.meta.facetKeys.forEach(facetKey => {\n const facet = result.facets[facetKey];\n const uniqueXKeys = lodash.uniq(facet.xKeys);\n const uniqueYKeys = lodash.uniq(facet.yKeys);\n facet.xKeys = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], uniqueXKeys) : uniqueXKeys;\n facet.yKeys = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], uniqueYKeys) : uniqueYKeys;\n xGroupKeys.forEach(xGroupKey => {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = lodash.intersection(\n facet.xKeys,\n result.facets[facetKey].xKeysByGroups[xGroupKey]\n );\n });\n yGroupKeys.forEach(yGroupKey => {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = lodash.intersection(\n facet.yKeys,\n result.facets[facetKey].yKeysByGroups[yGroupKey]\n );\n });\n });\n\n applyAggregation(result, aggregation, additionalDataColumnsX, additionalDataColumnsY, annotations);\n applyNormalization(result, normalizationBySource);\n\n // every facet may contain not all of available keys, but for shared axes it is necessary to have all of them\n result.meta.xKeysByGroups = result.meta.xGroupKeys.reduce((res: Record<string, string[]>, xGroupKey) => {\n const existingXKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].xKeysByGroups[xGroupKey]))\n ), xAxis.sorting, result.meta.xLabels);\n res[xGroupKey] = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], existingXKeys) : existingXKeys;\n return res;\n }, {});\n result.meta.xKeys = result.meta.xGroupKeys.reduce((res: string[], xGroupKey: string) => {\n res = res.concat(result.meta.xKeysByGroups[xGroupKey]);\n return res;\n }, []);\n\n result.meta.yKeysByGroups = result.meta.yGroupKeys.reduce((res: Record<string, string[]>, yGroupKey) => {\n const existingYKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].yKeysByGroups[yGroupKey]))\n ), yAxis.sorting, result.meta.yLabels);\n res[yGroupKey] = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], existingYKeys) : existingYKeys;\n return res;\n }, {});\n result.meta.yKeys = result.meta.yGroupKeys.reduce((res: string[], yGroupKey: string) => {\n res = res.concat(result.meta.yKeysByGroups[yGroupKey]);\n return res;\n }, []);\n\n for (const valueSource of result.meta.valueSources) {\n // avoid render errors on empty data\n if (result.meta.valueExtent[valueSource][0] === Infinity) {\n result.meta.valueExtent[valueSource][0] = 0;\n }\n if (result.meta.valueExtent[valueSource][1] === -Infinity) {\n result.meta.valueExtent[valueSource][1] = 0;\n }\n }\n\n result.meta.xLabels['null'] = xColumn.nullValueLabel ?? 'NA';\n result.meta.yLabels['null'] = yColumn.nullValueLabel ?? 'NA';\n result.meta.xGroupLabels['null'] = xGroupBy.map(column => column.nullValueLabel ?? 'NA').join(', ');\n result.meta.yGroupLabels['null'] = yGroupBy.map(column => column.nullValueLabel ?? 'NA').join(', ');\n return result;\n}"],"mappings":";;;;;;AAiEA,SAAS,EAAe,GAAkB;CACtC,IAAM,IAAW,EAAU,EAAO,EAC5B,IAAY,EAAK,EAAO;AAK9B,QAHI,MAAa,KAAA,KAAa,MAAc,KAAA,KAAa,MAAa,KAC1D,MAAc,KAElB,OAAe,IAAI,KAAa;;AAE5C,SAAS,EAAkB,GAAkB;CACzC,IAAM,IAAY,EAAK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Content":["import { deviation, extent, mean, quantileSorted, sum } from 'd3-array';\nimport type { DataFrame } from '../DataFrame';\nimport type { AggregationMethod, ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { exhaustive } from '../utils';\nimport { getFacetOrGroupKey } from '../utils/getFacetOrGroupKey';\nimport { intersect } from '../utils/intersect';\nimport type { BubbleSettingsImpl } from '../bubble/BubbleSettingsImpl';\nimport { getFacetLabels } from '../discrete/utils/getFacetLabels';\nimport { getFacetStringKey } from '../discrete/utils/getFacetStringKey';\n\nexport type Cell<T extends string> = {\n isCell: true;\n idx: number;\n id: string;\n value: Record<T, DataValue>;\n normalizedValue: Record<T, DataValue>;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData<T extends string> = {\n meta: {\n valueSources: T[]; // dataSource for heatmap, color and size for bubble - main data for every cell\n\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n\n xKeys: string[];\n yKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n\n // for titles, if facet by more 1 columns title has several values separated by commas\n facetKeyValues: Record<string, string[]>;\n xGroupKeyValues: Record<string, string[]>;\n yGroupKeyValues: Record<string, string[]>;\n\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n\n valueExtent: Record<T, [number, number]>; // for color/size scales\n // data for labels, annotations and dendrograms\n xDataByKeys: Record<string, Record<string, DataValue>>;\n yDataByKeys: Record<string, Record<string, DataValue>>;\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // axis keys grouped by group keys from meta\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell<T>>>;\n }\n >;\n};\n\nfunction normalizeByStd(values: number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / stdValue;\n}\nfunction normalizeByMinMax(values: number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined || max === min) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method: NormalizationMethod, values: number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v: number) => v;\n}\n\nfunction aggregateNumeric(method: AggregationMethod, values: number[]) {\n switch (method) {\n case 'max': {\n let res = values[0];\n for (const v of values) {\n res = Math.max(res, v);\n }\n return res;\n }\n case 'min': {\n let res = values[0];\n for (const v of values) {\n res = Math.min(res, v);\n }\n return res;\n }\n case 'median': {\n const valuesSorted = values.sort((a, b) => a - b);\n return quantileSorted(valuesSorted, 0.5) as number;\n }\n case 'mean': {\n return mean(values) ?? values[0];\n }\n case 'sum': {\n return sum(values) as number;\n }\n default: exhaustive(method, `Unknown aggregation function ${method}`);\n }\n}\nfunction aggregateString(values: string[]) {\n const list = [...new Set(values)].sort();\n if (list.length > 3) {\n return [...list.slice(0, 3), '...'].join(', ');\n }\n return list.join(', ');\n}\n\n// all combinations with 1 key from each list\nfunction getKeysCombinations(keysLists: string[][]) {\n if (!keysLists.length) {\n return [];\n }\n let result: string[][] = [[]];\n for (const keys of keysLists) {\n const nextResult: string[][] = [];\n for (const key of keys) {\n nextResult.push(...result.map(resultItem => [...resultItem, key]));\n }\n result = nextResult;\n }\n return result;\n}\nconst sortByLabels = (arr: string[], direction: 'asc' | 'desc', labels: Record<string, string> = {}) => {\n const sign = direction === 'asc' ? 1 : -1;\n return arr.sort((a, b) => sign * (labels[a] ?? a).localeCompare((labels[b] ?? b), 'en', { numeric: true }));\n};\n\nfunction isMissing(v: DataValue | undefined): boolean {\n if (v === null || v === undefined) return true;\n if (typeof v === 'number' && Number.isNaN(v)) return true;\n return false;\n}\n\nfunction compareValues(a: DataValue | undefined, b: DataValue | undefined, direction: 'asc' | 'desc'): number {\n const aMissing = isMissing(a);\n const bMissing = isMissing(b);\n if (aMissing && bMissing) return 0;\n if (aMissing) return 1; // NA pushed to end regardless of direction\n if (bMissing) return -1;\n const sign = direction === 'asc' ? 1 : -1;\n if (typeof a === 'number' && typeof b === 'number') {\n return sign * (a < b ? -1 : a > b ? 1 : 0);\n }\n return sign * String(a).localeCompare(String(b), 'en', { numeric: true });\n}\n\nexport const sortByColumns = (\n arr: string[],\n direction: 'asc' | 'desc',\n sortColumns: ColumnName[],\n dataByKeys: Record<string, Record<string, DataValue>>\n) => {\n return arr.sort((a, b) => {\n for (const col of sortColumns) {\n const cmp = compareValues(dataByKeys[col.value]?.[a], dataByKeys[col.value]?.[b], direction);\n if (cmp !== 0) return cmp;\n }\n return 0;\n });\n};\nfunction applyAggregation<T extends string>(\n result: GroupedCellsData<T>,\n aggregation: HeatmapSettingsImpl['aggregation'],\n additionalDataColumnsX: string[],\n additionalDataColumnsY: string[],\n annotations: HeatmapSettingsImpl['annotations']\n) {\n if (aggregation.x || aggregation.y) {\n const valueExtent: GroupedCellsData<T>['meta']['valueExtent'] = result.meta.valueSources.reduce((r, key) => {\n r[key] = [Infinity, -Infinity] as [number, number];\n return r;\n }, {} as GroupedCellsData<T>['meta']['valueExtent']);\n for (const facetKey of result.meta.facetKeys) {\n const { xKeys, yKeys, cells, xKeysByGroups, yKeysByGroups } = result.facets[facetKey];\n const xGroups = aggregation.x ? xKeysByGroups : xKeys.reduce((res, xKey) => { res[xKey] = [xKey]; return res; }, {} as Record<string, string[]>);\n const yGroups = aggregation.y ? yKeysByGroups : yKeys.reduce((res, yKey) => { res[yKey] = [yKey]; return res; }, {} as Record<string, string[]>);\n const xNewKeys = Object.keys(xGroups);\n const yNewKeys = Object.keys(yGroups);\n\n for (const xGroupKey of xNewKeys) {\n for (const yGroupKey of yNewKeys) {\n // collect values for aggregation to arrays\n const valuesBySources: Record<T, number[]> = result.meta.valueSources.reduce((r, v) => {\n r[v] = [];\n return r;\n }, {} as Record<T, number[]>);\n for (const xKey of xGroups[xGroupKey]) {\n for (const yKey of yGroups[yGroupKey]) {\n for (const valueSource of result.meta.valueSources) {\n const cellValue = cells[xKey]?.[yKey]?.value?.[valueSource];\n if (cellValue !== undefined) {\n valuesBySources[valueSource].push(cellValue as number);\n }\n }\n delete cells[xKey]?.[yKey];\n }\n }\n // create new cells with aggregated values\n for (const valueSource of result.meta.valueSources) {\n const values = valuesBySources[valueSource];\n if (values.length > 0) {\n const value = aggregateNumeric(aggregation.method, values);\n if (!result.facets[facetKey].cells[xGroupKey]) {\n result.facets[facetKey].cells[xGroupKey] = {};\n }\n if (!result.facets[facetKey].cells[xGroupKey][yGroupKey]) {\n result.facets[facetKey].cells[xGroupKey][yGroupKey] = {\n isCell: true,\n idx: 0,\n id: `${xGroupKey}_${yGroupKey}`,\n x: xGroupKey,\n y: yGroupKey,\n value: result.meta.valueSources.reduce((r, v) => { r[v] = null; return r; }, {} as Record<T, DataValue>),\n normalizedValue: result.meta.valueSources.reduce((r, v) => { r[v] = null; return r; }, {} as Record<T, DataValue>),\n };\n }\n const cell = result.facets[facetKey].cells[xGroupKey][yGroupKey];\n cell.value[valueSource] = value;\n cell.normalizedValue[valueSource] = value;\n\n valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource], valueExtent[valueSource][0]);\n valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource], valueExtent[valueSource][1]);\n }\n }\n }\n }\n // add aggregated values for X annotations\n if (aggregation.x) {\n for (const xGroupKey of xNewKeys) {\n for (const columnKey of additionalDataColumnsX) {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n continue;\n }\n const values: DataValue[] = [];\n for (const xKey of xGroups[xGroupKey]) {\n values.push(result.meta.xDataByKeys[columnKey][xKey]);\n delete result.meta.xDataByKeys[columnKey][xKey];\n }\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.xDataByKeys[columnKey][xGroupKey] = value;\n }\n }\n }\n // add aggregated values for Y annotations\n if (aggregation.y) {\n for (const columnKey of additionalDataColumnsY) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n for (const yGroupKey of yNewKeys) {\n for (const columnKey of additionalDataColumnsY) {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n continue;\n }\n const values: DataValue[] = [];\n for (const yKey of yGroups[yGroupKey]) {\n values.push(result.meta.yDataByKeys[columnKey][yKey]);\n delete result.meta.yDataByKeys[columnKey][yKey];\n }\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.yDataByKeys[columnKey][yGroupKey] = value;\n }\n }\n }\n // erase grouping - we aggregated by them and now there is no grouping in the chart;\n // replace axis keys with group keys - now group keys are new axis keys\n if (aggregation.x) {\n result.facets[facetKey].xKeys = Object.keys(xKeysByGroups);\n result.facets[facetKey].xKeysByGroups = { 'null': result.facets[facetKey].xKeys };\n result.meta.xLabels = result.meta.xGroupLabels;\n result.meta.xGroupKeys = ['null'];\n result.meta.xGroupKeyValues = { null: ['null'] };\n }\n if (aggregation.y) {\n result.facets[facetKey].yKeys = Object.keys(yKeysByGroups);\n result.facets[facetKey].yKeysByGroups = { 'null': result.facets[facetKey].yKeys };\n result.meta.yLabels = result.meta.yGroupLabels;\n result.meta.yGroupKeys = ['null'];\n result.meta.yGroupKeyValues = { null: ['null'] };\n }\n }\n result.meta.valueExtent = valueExtent;\n }\n}\n\nfunction updateValueExtent<T extends string>(result: GroupedCellsData<T>, cell: Cell<T>) {\n for (const valueSource of result.meta.valueSources) {\n result.meta.valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource] as number, result.meta.valueExtent[valueSource][0]);\n result.meta.valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource] as number, result.meta.valueExtent[valueSource][1]);\n }\n\n}\nfunction applyNormalization<T extends string>(\n result: GroupedCellsData<T>,\n normalizationBySources: Record<T, HeatmapSettingsImpl['normalization']>,\n) {\n if (Object.values(normalizationBySources).length) {\n const valueExtent: GroupedCellsData<T>['meta']['valueExtent'] = result.meta.valueSources.reduce((r, key) => {\n if (normalizationBySources[key]) {\n r[key] = [Infinity, -Infinity] as [number, number];\n }\n return r;\n }, {} as GroupedCellsData<T>['meta']['valueExtent']);\n for (const facetKey of result.meta.facetKeys) {\n const { xKeys, yKeys, cells } = result.facets[facetKey];\n\n for (const valueSource of result.meta.valueSources) {\n const normalization = normalizationBySources[valueSource];\n if (!normalization) {\n continue;\n }\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter = normalization.direction === 'row'\n ? (cellKey: string, groupKey: string) => cells[cellKey]?.[groupKey]\n : (cellKey: string, groupKey: string) => cells[groupKey]?.[cellKey];\n for (const groupKey of groupKeys) {\n const values: number[] = [];\n for (const cellKey of cellKeys) {\n const v = cellGetter(cellKey, groupKey)?.value?.[valueSource];\n if (v !== undefined) {\n values.push(v as number);\n }\n }\n const normalize = getNormalizationFn(normalization.method, values);\n for (const cellKey of cellKeys) {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n cell.normalizedValue[valueSource] = normalize(cell.value?.[valueSource] as number);\n valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource], valueExtent[valueSource][0]);\n valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource], valueExtent[valueSource][1]);\n }\n }\n }\n }\n\n }\n result.meta.valueExtent = {...result.meta.valueExtent, valueExtent};\n }\n}\n\nexport function fillCellsData<T extends string>(\n result: GroupedCellsData<T>,\n {\n data,\n xColumn,\n yColumn,\n valueColumns,\n facetBy,\n xGroupBy,\n yGroupBy,\n facetSettings,\n annotations,\n dendrogramX,\n dendrogramY,\n normalizationBySource, // separated for color and size for example\n NAValueAs,\n transformBySource, // same per-source pattern as normalization\n keysOrder,\n xAxis,\n yAxis,\n xSortBy,\n ySortBy,\n aggregation,\n showEmptyRows = false,\n showEmptyColumns = false,\n }: {\n data: DataFrame;\n xColumn: ColumnName;\n yColumn: ColumnName;\n valueColumns: Record<string, ColumnName>;\n facetBy: ColumnName[];\n xGroupBy: ColumnName[];\n yGroupBy: ColumnName[];\n facetSettings: HeatmapSettingsImpl['facetSettings'];\n annotations: HeatmapSettingsImpl['annotations'];\n dendrogramX: HeatmapSettingsImpl['dendrogramX'];\n dendrogramY: HeatmapSettingsImpl['dendrogramY'];\n normalizationBySource: Record<T, HeatmapSettingsImpl['normalization']>;\n NAValueAs: HeatmapSettingsImpl['NAValueAs'];\n transformBySource?: Record<T, HeatmapSettingsImpl['transform']>;\n keysOrder: HeatmapSettingsImpl['keysOrder'];\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'] | BubbleSettingsImpl['chartSettings']['xAxis'];\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'] | BubbleSettingsImpl['chartSettings']['yAxis'];\n xSortBy?: HeatmapSettingsImpl['xSortBy'];\n ySortBy?: HeatmapSettingsImpl['ySortBy'];\n aggregation: HeatmapSettingsImpl['aggregation'];\n showEmptyRows?: boolean;\n showEmptyColumns?: boolean;\n }\n) {\n const facetKeysLists = facetBy.length\n ? facetBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n\n const xGroupKeysLists = xGroupBy.length\n ? xGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const yGroupKeysLists = yGroupBy.length\n ? yGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n let facetKeysCombinations = getKeysCombinations(facetKeysLists);\n const xGroupKeysCombinations = getKeysCombinations(xGroupKeysLists);\n const yGroupKeysCombinations = getKeysCombinations(yGroupKeysLists);\n\n if (facetSettings?.order?.length) {\n facetKeysCombinations = facetKeysCombinations.filter(keys => facetSettings.order?.includes(getFacetStringKey(keys)));\n }\n const facetKeys = facetKeysCombinations.map(getFacetOrGroupKey);\n const facetKeysSet = new Set(facetKeys);\n const xGroupKeys = xGroupKeysCombinations.map(getFacetOrGroupKey);\n const yGroupKeys = yGroupKeysCombinations.map(getFacetOrGroupKey);\n\n result.meta.facetKeys = facetKeys;\n result.meta.xGroupKeys = xGroupKeys;\n result.meta.yGroupKeys = yGroupKeys;\n\n const facetLabels = getFacetLabels(data, facetBy, facetKeys, facetKeysCombinations);\n result.meta.facetKeyValues = facetKeys.reduce((res: Record<string, string[]>, key) => {\n res[key] = facetLabels[key];\n return res;\n }, {});\n\n result.meta.xGroupKeyValues = xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {});\n result.meta.yGroupKeyValues = yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\n }, {});\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n const annotationColumnsX = annotations.filter(item => item.axis === 'x').map(item => item.valueColumn.valueLabels ?? item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.valueLabels ?? item.valueColumn.value);\n const dendrogramXColumns = Object.values(dendrogramX ?? {}).map(column => column.value);\n const dendrogramYColumns = Object.values(dendrogramY ?? {}).map(column => column.value);\n const xSortByColumns = (xSortBy ?? []).map(c => c.value);\n const ySortByColumns = (ySortBy ?? []).map(c => c.value);\n const additionalDataColumnsX = [...new Set([...annotationColumnsX, ...dendrogramXColumns, ...xSortByColumns, xLabelsSource])];\n const additionalDataColumnsY = [...new Set([...annotationColumnsY, ...dendrogramYColumns, ...ySortByColumns, yLabelsSource])];\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = getFacetOrGroupKey(facetBy.map(column => data.getColumnValue(column.value, i)));\n if (!facetKeysSet.has(facetKey)) {\n continue;\n }\n const xGroupKey = getFacetOrGroupKey(xGroupBy.map(column => data.getColumnValue(column.value, i)));\n const yGroupKey = getFacetOrGroupKey(yGroupBy.map(column => data.getColumnValue(column.value, i)));\n const xGroupLabel = xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ');\n const yGroupLabel = yGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ');\n result.meta.xGroupLabels[xGroupKey] = xGroupLabel;\n result.meta.yGroupLabels[yGroupKey] = yGroupLabel;\n const x = String(data.getColumnValue(xColumn.value, i));\n const y = String(data.getColumnValue(yColumn.value, i));\n\n const values = result.meta.valueSources.reduce((r, key) => {\n let v = (data.getColumnValue(valueColumns[key].value, i) ?? NAValueAs) as number | null;\n if (transformBySource?.[key] === 'log' && typeof v === 'number') {\n const transformed = Math.log10(v);\n v = Number.isFinite(transformed) ? transformed : null;\n }\n r[key] = v;\n return r;\n }, {} as Record<string, DataValue>);\n\n if (x === 'null' || y === 'null') {\n continue;\n }\n\n const allValuesNull = Object.values(values).every(v => v === null);\n\n if (allValuesNull && !showEmptyRows && !showEmptyColumns) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n cells: {},\n };\n }\n if (!result.facets[facetKey].xKeysByGroups[xGroupKey]) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = [];\n }\n if (!result.facets[facetKey].yKeysByGroups[yGroupKey]) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = [];\n }\n\n if (!allValuesNull || showEmptyColumns) {\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].xKeysByGroups[xGroupKey].push(x);\n const xLabelsSourceValue = data.getColumnValue(xLabelsSource, i);\n if (result.meta.xLabels[x] && String(xLabelsSourceValue) !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n result.meta.xLabels[x] = String(xLabelsSourceValue);\n for (const columnKey of additionalDataColumnsX) {\n const isAddedColumn = typeof result.meta.xDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.xDataByKeys[columnKey][x] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.xDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.xDataByKeys[columnKey][x] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for x = ${x} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.xDataByKeys[columnKey][x] = data.getColumnValue(columnKey, i);\n }\n }\n }\n\n if (!allValuesNull || showEmptyRows) {\n result.facets[facetKey].yKeys.push(y);\n result.facets[facetKey].yKeysByGroups[yGroupKey].push(y);\n const yLabelsSourceValue = data.getColumnValue(yLabelsSource, i);\n if (result.meta.yLabels[y] && String(yLabelsSourceValue) !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.yLabels[y] = String(yLabelsSourceValue);\n for (const columnKey of additionalDataColumnsY) {\n const isAddedColumn = typeof result.meta.yDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.yDataByKeys[columnKey][y] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.yDataByKeys[columnKey][y] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for y = ${y} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.yDataByKeys[columnKey][y] = data.getColumnValue(columnKey, i);\n }\n }\n }\n\n if (allValuesNull) {\n continue;\n }\n\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n\n for (const valueSource of result.meta.valueSources) {\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value[valueSource] !== values[valueSource]) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n }\n\n result.facets[facetKey].cells[x][y] = {\n isCell: true,\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value: values,\n normalizedValue: values,\n };\n\n updateValueExtent(result, result.facets[facetKey].cells[x][y]);\n }\n\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n for (const facetKey of result.meta.facetKeys) {\n const facet = result.facets[facetKey];\n const uniqueXKeys = [...new Set(facet.xKeys)];\n const uniqueYKeys = [...new Set(facet.yKeys)];\n facet.xKeys = keysOrder[xColumn.value] ? intersect(keysOrder[xColumn.value], uniqueXKeys) : uniqueXKeys;\n facet.yKeys = keysOrder[yColumn.value] ? intersect(keysOrder[yColumn.value], uniqueYKeys) : uniqueYKeys;\n for (const xGroupKey of xGroupKeys) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = intersect(\n facet.xKeys,\n result.facets[facetKey].xKeysByGroups[xGroupKey]\n );\n }\n for (const yGroupKey of yGroupKeys) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = intersect(\n facet.yKeys,\n result.facets[facetKey].yKeysByGroups[yGroupKey]\n );\n }\n }\n\n applyAggregation(result, aggregation, additionalDataColumnsX, additionalDataColumnsY, annotations);\n applyNormalization(result, normalizationBySource);\n\n // All sorting is consolidated here. Dendrograms run later in getDendrograms and reorder\n // per-facet keys for axes where clustering is on — that's the only post-fillCellsData sort.\n\n // Sort group keys (by group labels). Skip when user supplied custom order via keysOrder.\n const xGroupCustomOrder = xGroupBy.some(c => keysOrder[c.value]?.length > 0);\n const yGroupCustomOrder = yGroupBy.some(c => keysOrder[c.value]?.length > 0);\n if (!xGroupCustomOrder) {\n result.meta.xGroupKeys = sortByLabels([...result.meta.xGroupKeys], xAxis.sorting, result.meta.xGroupLabels);\n }\n if (!yGroupCustomOrder) {\n result.meta.yGroupKeys = sortByLabels([...result.meta.yGroupKeys], yAxis.sorting, result.meta.yGroupLabels);\n }\n\n // every facet may contain not all of available keys, but for shared axes it is necessary to have all of them\n const effectiveXSortBy = (!dendrogramX && !aggregation.x && xSortBy?.length) ? xSortBy : null;\n result.meta.xKeysByGroups = result.meta.xGroupKeys.reduce((res: Record<string, string[]>, xGroupKey) => {\n const uniqueXKeys = [...new Set(\n result.meta.facetKeys.flatMap(facetKey => result.facets[facetKey].xKeysByGroups[xGroupKey])\n )];\n const existingXKeys = effectiveXSortBy\n ? sortByColumns(uniqueXKeys, xAxis.sorting, effectiveXSortBy, result.meta.xDataByKeys)\n : sortByLabels(uniqueXKeys, xAxis.sorting, result.meta.xLabels);\n res[xGroupKey] = keysOrder[xColumn.value] ? intersect(keysOrder[xColumn.value], existingXKeys) : existingXKeys;\n return res;\n }, {});\n result.meta.xKeys = result.meta.xGroupKeys.reduce((res: string[], xGroupKey: string) => {\n res = res.concat(result.meta.xKeysByGroups[xGroupKey]);\n return res;\n }, []);\n\n const effectiveYSortBy = (!dendrogramY && !aggregation.y && ySortBy?.length) ? ySortBy : null;\n result.meta.yKeysByGroups = result.meta.yGroupKeys.reduce((res: Record<string, string[]>, yGroupKey) => {\n const uniqueYKeys = [...new Set(\n result.meta.facetKeys.flatMap(facetKey => result.facets[facetKey].yKeysByGroups[yGroupKey])\n )];\n const existingYKeys = effectiveYSortBy\n ? sortByColumns(uniqueYKeys, yAxis.sorting, effectiveYSortBy, result.meta.yDataByKeys)\n : sortByLabels(uniqueYKeys, yAxis.sorting, result.meta.yLabels);\n res[yGroupKey] = keysOrder[yColumn.value] ? intersect(keysOrder[yColumn.value], existingYKeys) : existingYKeys;\n return res;\n }, {});\n result.meta.yKeys = result.meta.yGroupKeys.reduce((res: string[], yGroupKey: string) => {\n res = res.concat(result.meta.yKeysByGroups[yGroupKey]);\n return res;\n }, []);\n\n // Propagate the sorted meta order to per-facet keys. Used by the renderer when sharedX/Y is\n // false. Intersection preserves meta order while filtering down to keys present in each facet.\n // getDendrograms may re-order facet keys later for axes with clustering on.\n for (const facetKey of result.meta.facetKeys) {\n for (const xGroupKey of result.meta.xGroupKeys) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = intersect(\n result.meta.xKeysByGroups[xGroupKey],\n result.facets[facetKey].xKeysByGroups[xGroupKey] ?? []\n );\n }\n result.facets[facetKey].xKeys = result.meta.xGroupKeys.flatMap(\n g => result.facets[facetKey].xKeysByGroups[g] ?? []\n );\n for (const yGroupKey of result.meta.yGroupKeys) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = intersect(\n result.meta.yKeysByGroups[yGroupKey],\n result.facets[facetKey].yKeysByGroups[yGroupKey] ?? []\n );\n }\n result.facets[facetKey].yKeys = result.meta.yGroupKeys.flatMap(\n g => result.facets[facetKey].yKeysByGroups[g] ?? []\n );\n }\n\n for (const valueSource of result.meta.valueSources) {\n // avoid render errors on empty data\n if (result.meta.valueExtent[valueSource][0] === Infinity) {\n result.meta.valueExtent[valueSource][0] = 0;\n }\n if (result.meta.valueExtent[valueSource][1] === -Infinity) {\n result.meta.valueExtent[valueSource][1] = 0;\n }\n }\n\n result.meta.xLabels['null'] = xColumn.nullValueLabel ?? 'NA';\n result.meta.yLabels['null'] = yColumn.nullValueLabel ?? 'NA';\n result.meta.xGroupLabels['null'] = xGroupBy.map(column => column.nullValueLabel ?? 'NA').join(', ');\n result.meta.yGroupLabels['null'] = yGroupBy.map(column => column.nullValueLabel ?? 'NA').join(', ');\n return result;\n}"],"mappings":";;;;;;AAiEA,SAAS,EAAe,GAAkB;CACtC,IAAM,IAAW,EAAU,EAAO,EAC5B,IAAY,EAAK,EAAO;AAK9B,QAHI,MAAa,KAAA,KAAa,MAAc,KAAA,KAAa,MAAa,KAC1D,MAAc,KAElB,OAAe,IAAI,KAAa;;AAE5C,SAAS,EAAkB,GAAkB;CACzC,IAAM,IAAY,EAAK,EAAO,EACxB,CAAC,GAAK,KAAO,EAAO,EAAO;AAIjC,QAHI,MAAc,KAAA,KAAa,MAA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,EAAO,OAAO,GAAU,cAAc,MAAM,EAAE,CACtD;AACD,OAAK,IAAM,KAAa,EAAO,KAAK,WAChC,GAAO,OAAO,GAAU,cAAc,KAAa,EAC/C,EAAO,KAAK,cAAc,IAC1B,EAAO,OAAO,GAAU,cAAc,MAAc,EAAE,CACzD;AAEL,IAAO,OAAO,GAAU,QAAQ,EAAO,KAAK,WAAW,SACnD,MAAK,EAAO,OAAO,GAAU,cAAc,MAAM,EAAE,CACtD;;AAGL,MAAK,IAAM,KAAe,EAAO,KAAK,aAKlC,CAHI,EAAO,KAAK,YAAY,GAAa,OAAO,aAC5C,EAAO,KAAK,YAAY,GAAa,KAAK,IAE1C,EAAO,KAAK,YAAY,GAAa,OAAO,cAC5C,EAAO,KAAK,YAAY,GAAa,KAAK;AAQlD,QAJA,EAAO,KAAK,QAAQ,OAAU,EAAQ,kBAAkB,MACxD,EAAO,KAAK,QAAQ,OAAU,EAAQ,kBAAkB,MACxD,EAAO,KAAK,aAAa,OAAU,EAAS,KAAI,MAAU,EAAO,kBAAkB,KAAK,CAAC,KAAK,KAAK,EACnG,EAAO,KAAK,aAAa,OAAU,EAAS,KAAI,MAAU,EAAO,kBAAkB,KAAK,CAAC,KAAK,KAAK,EAC5F"}
|
|
@@ -5,7 +5,7 @@ import { Cell, GroupedCellsData } from './fillCellsData';
|
|
|
5
5
|
export type CellHeatmap = Cell<'dataSource'>;
|
|
6
6
|
export type GroupedCellsHeatmap = GroupedCellsData<'dataSource'>;
|
|
7
7
|
export declare function createEmptyGroupedCells(): GroupedCellsHeatmap;
|
|
8
|
-
export declare function getCells({ data, xColumn, yColumn, valueColumns, facetBy, xGroupBy, yGroupBy, facetSettings, annotations, dendrogramX, dendrogramY, normalization, NAValueAs, keysOrder, xAxis, yAxis, aggregation, showEmptyRows, showEmptyColumns, }: {
|
|
8
|
+
export declare function getCells({ data, xColumn, yColumn, valueColumns, facetBy, xGroupBy, yGroupBy, xSortBy, ySortBy, facetSettings, annotations, dendrogramX, dendrogramY, normalization, NAValueAs, transform, keysOrder, xAxis, yAxis, aggregation, showEmptyRows, showEmptyColumns, }: {
|
|
9
9
|
data: DataFrame;
|
|
10
10
|
xColumn: ColumnName;
|
|
11
11
|
yColumn: ColumnName;
|
|
@@ -13,12 +13,15 @@ export declare function getCells({ data, xColumn, yColumn, valueColumns, facetBy
|
|
|
13
13
|
facetBy: ColumnName[];
|
|
14
14
|
xGroupBy: ColumnName[];
|
|
15
15
|
yGroupBy: ColumnName[];
|
|
16
|
+
xSortBy: ColumnName[];
|
|
17
|
+
ySortBy: ColumnName[];
|
|
16
18
|
facetSettings: HeatmapSettingsImpl['facetSettings'];
|
|
17
19
|
annotations: HeatmapSettingsImpl['annotations'];
|
|
18
20
|
dendrogramX: HeatmapSettingsImpl['dendrogramX'];
|
|
19
21
|
dendrogramY: HeatmapSettingsImpl['dendrogramY'];
|
|
20
22
|
normalization: HeatmapSettingsImpl['normalization'];
|
|
21
23
|
NAValueAs: HeatmapSettingsImpl['NAValueAs'];
|
|
24
|
+
transform: HeatmapSettingsImpl['transform'];
|
|
22
25
|
keysOrder: HeatmapSettingsImpl['keysOrder'];
|
|
23
26
|
xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'];
|
|
24
27
|
yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.d.ts","sourceRoot":"","sources":["../../src/heatmap/getCells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,CAAA;AAC5C,MAAM,MAAM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