@milaboratories/miplots4 1.2.4 → 1.4.0
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/bubble/BubbleSettingsImpl.d.ts +4 -2
- package/dist/bubble/BubbleSettingsImpl.d.ts.map +1 -1
- package/dist/bubble/BubbleSettingsImpl.js +32 -29
- package/dist/bubble/BubbleSettingsImpl.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 +2 -2
- package/dist/bubble/getGroupedCellsData.js.map +1 -1
- package/dist/bubble/index.d.ts.map +1 -1
- package/dist/bubble/index.js +16 -15
- package/dist/bubble/index.js.map +1 -1
- package/dist/discrete/components/layers/ErrorBarElement.d.ts.map +1 -1
- package/dist/discrete/components/layers/ErrorBarElement.js +1 -0
- package/dist/discrete/components/layers/ErrorBarElement.js.map +1 -1
- package/dist/discrete/components/layers/LineElement.d.ts.map +1 -1
- package/dist/discrete/components/layers/LineElement.js +1 -0
- package/dist/discrete/components/layers/LineElement.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +4 -2
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +20 -17
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/fillCellsData.d.ts +3 -3
- package/dist/heatmap/fillCellsData.d.ts.map +1 -1
- package/dist/heatmap/fillCellsData.js +89 -94
- package/dist/heatmap/fillCellsData.js.map +1 -1
- package/dist/heatmap/getCells.d.ts +3 -3
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +3 -3
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +21 -22
- package/dist/heatmap/index.js.map +1 -1
- package/dist/heatmap/labelParts.d.ts +21 -0
- package/dist/heatmap/labelParts.d.ts.map +1 -0
- package/dist/heatmap/labelParts.js +55 -0
- package/dist/heatmap/labelParts.js.map +1 -0
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +2 -1
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +1 -0
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +2 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.js +2 -1
- package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +1 -0
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +2 -0
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/scatterplot-umap/types.d.ts +1 -0
- package/dist/scatterplot-umap/types.d.ts.map +1 -1
- package/dist/types/bubble.d.ts +26 -16
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/bubble.js +4 -3
- package/dist/types/bubble.js.map +1 -1
- package/dist/types/heatmap.d.ts +22 -12
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +4 -3
- package/dist/types/heatmap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +5 -0
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/types/scatterplot.js +2 -1
- package/dist/types/scatterplot.js.map +1 -1
- package/dist/utils/compareColumnGroups.d.ts +4 -0
- package/dist/utils/compareColumnGroups.d.ts.map +1 -0
- package/dist/utils/compareColumnGroups.js +7 -0
- package/dist/utils/compareColumnGroups.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { BLACK as e } from "../constants.js";
|
|
2
2
|
import { HeatmapSettingsSchema as t } from "../types/heatmap.js";
|
|
3
3
|
import "../types/index.js";
|
|
4
|
-
import n from "
|
|
5
|
-
|
|
4
|
+
import { joinAxisTitle as n, resolveLabelParts as r } from "./labelParts.js";
|
|
5
|
+
import i from "lodash";
|
|
6
|
+
var a = {
|
|
6
7
|
lineColor: e,
|
|
7
8
|
dotShape: "21",
|
|
8
9
|
dotFill: e,
|
|
9
10
|
dotSize: 3,
|
|
10
11
|
lineShape: "solid",
|
|
11
12
|
lineWidth: 1
|
|
12
|
-
},
|
|
13
|
+
}, o = {
|
|
13
14
|
size: 150,
|
|
14
15
|
distance: "euclidean",
|
|
15
16
|
linkage: "average",
|
|
@@ -17,15 +18,15 @@ var r = {
|
|
|
17
18
|
showNodes: !0,
|
|
18
19
|
hidden: !1,
|
|
19
20
|
edgeInheritance: "up",
|
|
20
|
-
aes:
|
|
21
|
-
},
|
|
21
|
+
aes: a
|
|
22
|
+
}, s = class {
|
|
22
23
|
id;
|
|
23
24
|
type = "heatmap";
|
|
24
25
|
facetSettings;
|
|
25
|
-
|
|
26
|
+
x;
|
|
26
27
|
xGroupBy;
|
|
27
28
|
xSortBy;
|
|
28
|
-
|
|
29
|
+
y;
|
|
29
30
|
yGroupBy;
|
|
30
31
|
ySortBy;
|
|
31
32
|
valueColumn;
|
|
@@ -45,7 +46,7 @@ var r = {
|
|
|
45
46
|
showEmptyColumns;
|
|
46
47
|
cellsRenderingMode;
|
|
47
48
|
constructor(e) {
|
|
48
|
-
if (t.parse(e), this.id =
|
|
49
|
+
if (t.parse(e), this.id = i.uniqueId("settings"), this.x = e.x, this.xGroupBy = e.xGroupBy ?? [], this.xSortBy = e.xSortBy ?? [], this.y = e.y, this.yGroupBy = e.yGroupBy ?? [], this.ySortBy = e.ySortBy ?? [], this.valueColumn = e.valueColumn, this.facetBy = e.facetBy ?? [], this.chartSettings = {
|
|
49
50
|
title: {
|
|
50
51
|
position: "left",
|
|
51
52
|
show: !0,
|
|
@@ -63,7 +64,7 @@ var r = {
|
|
|
63
64
|
frame: { type: e.frame?.type ?? "none" },
|
|
64
65
|
valueType: e.valueType ?? "continuous",
|
|
65
66
|
yAxis: {
|
|
66
|
-
title: e.
|
|
67
|
+
title: n(r(e.y, e.yAxis?.labelParts)),
|
|
67
68
|
showTicks: !0,
|
|
68
69
|
showTitle: !0,
|
|
69
70
|
showAxisLabels: !0,
|
|
@@ -73,10 +74,11 @@ var r = {
|
|
|
73
74
|
axisLabelsAngle: 90,
|
|
74
75
|
groupLabelsAngle: 0,
|
|
75
76
|
sorting: "asc",
|
|
77
|
+
labelParts: null,
|
|
76
78
|
...e.yAxis
|
|
77
79
|
},
|
|
78
80
|
xAxis: {
|
|
79
|
-
title: e.
|
|
81
|
+
title: n(r(e.x, e.xAxis?.labelParts)),
|
|
80
82
|
showTicks: !0,
|
|
81
83
|
showTitle: !0,
|
|
82
84
|
showAxisLabels: !0,
|
|
@@ -86,6 +88,7 @@ var r = {
|
|
|
86
88
|
axisLabelsAngle: 90,
|
|
87
89
|
groupLabelsAngle: 0,
|
|
88
90
|
sorting: "asc",
|
|
91
|
+
labelParts: null,
|
|
89
92
|
...e.xAxis
|
|
90
93
|
},
|
|
91
94
|
legend: {
|
|
@@ -115,7 +118,7 @@ var r = {
|
|
|
115
118
|
groupGap: e.aes?.groupGap ?? 3,
|
|
116
119
|
emptyCellColor: e.aes?.emptyCellColor ?? "white"
|
|
117
120
|
}, this.annotations = (e.annotations ?? []).map((e) => e.axis === "x" ? {
|
|
118
|
-
id:
|
|
121
|
+
id: i.uniqueId("annotation"),
|
|
119
122
|
axis: "x",
|
|
120
123
|
valueColumn: e.valueColumn,
|
|
121
124
|
position: e.position ?? this.chartSettings.xAxis.position,
|
|
@@ -124,7 +127,7 @@ var r = {
|
|
|
124
127
|
type: e.type,
|
|
125
128
|
colors: e.colors ?? ["white", "black"]
|
|
126
129
|
} : {
|
|
127
|
-
id:
|
|
130
|
+
id: i.uniqueId("annotation"),
|
|
128
131
|
axis: "y",
|
|
129
132
|
valueColumn: e.valueColumn,
|
|
130
133
|
position: e.position ?? this.chartSettings.yAxis.position,
|
|
@@ -139,24 +142,24 @@ var r = {
|
|
|
139
142
|
method: "min",
|
|
140
143
|
...e.aggregation
|
|
141
144
|
}, this.dendrogramX = e.dendrogramX ? {
|
|
142
|
-
...
|
|
145
|
+
...o,
|
|
143
146
|
position: "top",
|
|
144
147
|
...e.dendrogramX,
|
|
145
148
|
aes: {
|
|
146
|
-
...
|
|
149
|
+
...a,
|
|
147
150
|
...e.dendrogramX?.aes
|
|
148
151
|
}
|
|
149
152
|
} : null, this.dendrogramY = e.dendrogramY ? {
|
|
150
|
-
...
|
|
153
|
+
...o,
|
|
151
154
|
position: "left",
|
|
152
155
|
...e.dendrogramY,
|
|
153
156
|
aes: {
|
|
154
|
-
...
|
|
157
|
+
...a,
|
|
155
158
|
...e.dendrogramY?.aes
|
|
156
159
|
}
|
|
157
160
|
} : null, this.inheritedDendrogramAes = e.inheritedDendrogramAes ?? null, this.cellsRenderingMode = e.cellsRenderingMode ?? null;
|
|
158
161
|
}
|
|
159
162
|
};
|
|
160
|
-
export {
|
|
163
|
+
export { s as HeatmapSettingsImpl };
|
|
161
164
|
|
|
162
165
|
//# sourceMappingURL=HeatmapSettingsImpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeatmapSettingsImpl.js","names":[],"sources":["../../src/heatmap/HeatmapSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\nimport { BLACK, DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL } from '../constants';\nimport type {\n AesRecord,\n AggregationMethod,\n ColumnName, DendrogramDistance, DendrogramLinkage, HeatmapSettings,\n LegendPosition, LineShape, NormalizationDirection, NormalizationMethod, PointShape,\n SettingsInterface,\n TitlePosition\n} from '../types';\nimport { HeatmapSettingsSchema } from '../types';\nimport { MIN_MARGIN, MIN_PADDING } from './constants';\n\nconst DEFAULT_DENDRO_AES = {\n lineColor: BLACK,\n dotShape: '21' as PointShape,\n dotFill: BLACK,\n dotSize: 3,\n lineShape: 'solid' as LineShape,\n lineWidth: 1,\n};\nconst DEFAULT_DENDRO: HeatmapDendrogramSettings = {\n size: 150,\n distance: 'euclidean',\n linkage: 'average',\n fillNA: 0,\n showNodes: true,\n hidden: false,\n edgeInheritance: 'up',\n aes: DEFAULT_DENDRO_AES,\n};\n\nexport interface HeatmapDendrogramSettings {\n size: number;\n distance: DendrogramDistance;\n linkage: DendrogramLinkage;\n fillNA: number;\n showNodes: boolean;\n hidden: boolean;\n edgeInheritance: 'up' | 'down';\n aes: {\n lineColor: string | ColumnName;\n dotFill: string | ColumnName;\n dotShape: PointShape | ColumnName;\n dotSize: number | ColumnName;\n lineShape: LineShape | ColumnName;\n lineWidth: number | ColumnName;\n };\n}\n\ninterface HeatmapDendrogramSettingsX extends HeatmapDendrogramSettings {\n position: 'top' | 'bottom';\n}\ninterface HeatmapDendrogramSettingsY extends HeatmapDendrogramSettings {\n position: 'left' | 'right';\n}\n\ninterface HeatmapAnnotation {\n id: string;\n valueColumn: ColumnName;\n showTitle: boolean;\n type: 'discrete' | 'continuous';\n colors: string[];\n}\n\ninterface HeatmapAnnotationX extends HeatmapAnnotation {\n axis: 'x';\n position: 'top' | 'bottom';\n titlePosition: 'left' | 'right';\n}\ninterface HeatmapAnnotationY extends HeatmapAnnotation {\n axis: 'y';\n position: 'left' | 'right';\n titlePosition: 'top' | 'bottom';\n}\n\nexport class HeatmapSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'heatmap';\n readonly facetSettings: {\n order: string[] | null;\n sharedX: boolean;\n sharedY: boolean;\n nRows?: number;\n nCols?: number;\n };\n readonly xColumn: ColumnName;\n readonly xGroupBy: ColumnName[];\n readonly xSortBy: ColumnName[];\n readonly yColumn: ColumnName;\n readonly yGroupBy: ColumnName[];\n readonly ySortBy: ColumnName[];\n readonly valueColumn: ColumnName;\n readonly facetBy: ColumnName[];\n readonly normalization: { direction: NormalizationDirection, method: NormalizationMethod, colorRange?: number[] } | null;\n readonly chartSettings: {\n readonly title: { name: string; show: boolean; position: TitlePosition };\n readonly size: {\n width: number;\n height: number;\n cellWidth: number | null;\n cellHeight: number | null;\n innerOffset: number;\n outerOffset: number;\n };\n readonly frame: { type: 'full' | 'groups' | 'none' };\n readonly valueType: 'discrete' | 'continuous';\n readonly yAxis: {\n title: string;\n showTicks: boolean;\n showTitle: boolean;\n showAxisLabels: boolean;\n showGroupLabels: boolean;\n position: 'left' | 'right';\n groupingPosition: 'left' | 'right';\n axisLabelsAngle: 0 | 45 | 90;\n groupLabelsAngle: 0 | 45 | 90;\n sorting: 'asc' | 'desc';\n };\n readonly xAxis: {\n title: string;\n showTicks: boolean;\n showTitle: boolean;\n showAxisLabels: boolean;\n showGroupLabels: boolean;\n position: 'bottom' | 'top';\n groupingPosition: 'bottom' | 'top';\n axisLabelsAngle: 0 | 45 | 90;\n groupLabelsAngle: 0 | 45 | 90;\n sorting: 'asc' | 'desc';\n };\n readonly legend: { show: boolean; position: LegendPosition };\n readonly tooltips: { show: boolean; content?: ColumnName[] };\n };\n readonly keysOrder: Record<string, string[]>;\n readonly aes: {\n colorsList: string[];\n colorsMap: Record<string, string> | null;\n valueColors: string[] | null;\n valuesByColors: number[] | null;\n groupGap: number;\n cellStrokeColor: string;\n emptyCellColor: string;\n };\n\n readonly aggregation: {\n x: boolean;\n y: boolean;\n method: AggregationMethod;\n };\n\n readonly annotations: (HeatmapAnnotationX | HeatmapAnnotationY)[];\n\n readonly dendrogramX: HeatmapDendrogramSettingsX | null;\n readonly dendrogramY: HeatmapDendrogramSettingsY | null;\n readonly inheritedDendrogramAes: Record<string, AesRecord> | null;\n readonly NAValueAs: number | null;\n readonly transform: 'log' | null;\n readonly showEmptyRows: boolean;\n readonly showEmptyColumns: boolean;\n readonly cellsRenderingMode: 'canvas' | 'svg' | null;\n\n constructor(settings: HeatmapSettings) {\n HeatmapSettingsSchema.parse(settings);\n\n this.id = lodash.uniqueId('settings');\n this.xColumn = settings.xColumn;\n this.xGroupBy = settings.xGroupBy ?? [];\n this.xSortBy = settings.xSortBy ?? [];\n this.yColumn = settings.yColumn;\n this.yGroupBy = settings.yGroupBy ?? [];\n this.ySortBy = settings.ySortBy ?? [];\n this.valueColumn = settings.valueColumn;\n this.facetBy = settings.facetBy ?? [];\n this.chartSettings = {\n title: {\n position: 'left',\n show: true,\n ...settings.title,\n name: settings.title?.name ?? 'Chart',\n },\n size: {\n width: settings?.size?.width ?? (this.facetBy.length ? DEFAULT_WIDTH_SMALL : DEFAULT_WIDTH),\n height: settings?.size?.height ?? (this.facetBy.length ? DEFAULT_HEIGHT_SMALL : DEFAULT_HEIGHT),\n innerOffset: settings.size?.innerOffset ?? MIN_PADDING,\n outerOffset: settings.size?.outerOffset ?? MIN_MARGIN,\n cellWidth: settings?.size?.cellWidth ?? null,\n cellHeight: settings?.size?.cellHeight ?? null,\n },\n frame: { type: settings.frame?.type ?? 'none' },\n valueType: settings.valueType ?? 'continuous',\n yAxis: {\n title: settings.yColumn.label ?? settings.yColumn.value,\n showTicks: true,\n showTitle: true,\n showAxisLabels: true,\n showGroupLabels: true,\n position: 'left',\n groupingPosition: 'left',\n axisLabelsAngle: 90,\n groupLabelsAngle: 0,\n sorting: 'asc',\n ...settings.yAxis,\n },\n xAxis: {\n title: settings.xColumn.label ?? settings.xColumn.value,\n showTicks: true,\n showTitle: true,\n showAxisLabels: true,\n showGroupLabels: true,\n position: 'bottom',\n groupingPosition: 'bottom',\n axisLabelsAngle: 90,\n groupLabelsAngle: 0,\n sorting: 'asc',\n ...settings.xAxis,\n },\n legend: {\n show: true,\n position: 'right',\n ...settings.legend,\n },\n tooltips: {\n show: true,\n ...settings.tooltips,\n },\n };\n this.facetSettings = {\n sharedX: true,\n sharedY: true,\n order: settings.facetSettings?.order ?? null,\n ...settings.facetSettings,\n };\n if (this.chartSettings.size.cellWidth && this.facetBy.length > 0) {\n this.facetSettings.sharedX = true;\n }\n if (this.chartSettings.size.cellHeight && this.facetBy.length > 0) {\n this.facetSettings.sharedY = true;\n }\n this.keysOrder = settings.keysOrder ?? {};\n this.normalization = this.chartSettings.valueType === 'continuous' ? settings.normalization ?? null : null;\n this.transform = this.chartSettings.valueType === 'continuous' ? settings.transform ?? null : null;\n this.NAValueAs = settings.NAValueAs ?? null;\n this.showEmptyRows = settings.showEmptyRows ?? false;\n this.showEmptyColumns = settings.showEmptyColumns ?? false;\n this.aes = {\n colorsList: settings.aes?.colorsList ?? ['black', 'white', 'red'],\n colorsMap: settings.aes?.colorsMap ?? null,\n valueColors: settings.aes?.valueColors ?? null,\n valuesByColors: settings.aes?.valuesByColors ?? null,\n cellStrokeColor: settings.aes?.cellStrokeColor ?? 'none',\n groupGap: settings.aes?.groupGap ?? 3,\n emptyCellColor: settings.aes?.emptyCellColor ?? 'white',\n };\n\n this.annotations = (settings.annotations ?? []).map(item => {\n if (item.axis === 'x') {\n return {\n id: lodash.uniqueId('annotation'),\n axis: 'x',\n valueColumn: item.valueColumn,\n position: item.position ?? this.chartSettings.xAxis.position,\n titlePosition: item.titlePosition ?? 'right',\n showTitle: item.showTitle ?? true,\n type: item.type,\n colors: item.colors ?? ['white', 'black'],\n };\n }\n return {\n id: lodash.uniqueId('annotation'),\n axis: 'y',\n valueColumn: item.valueColumn,\n position: item.position ?? this.chartSettings.yAxis.position,\n titlePosition: item.titlePosition ?? 'top',\n showTitle: item.showTitle ?? true,\n type: item.type,\n colors: item.colors ?? ['white', 'black'],\n };\n });\n\n if (settings.valueType === 'discrete' && (settings.dendrogramX || settings.dendrogramY)) {\n throw Error('Dendrogram is not available with discrete cells values');\n }\n\n this.aggregation = {\n x: false,\n y: false,\n method: 'min',\n ...settings.aggregation\n };\n\n this.dendrogramX = settings.dendrogramX\n ? {\n ...DEFAULT_DENDRO,\n position: 'top',\n ...settings.dendrogramX,\n aes: {\n ...DEFAULT_DENDRO_AES,\n ...settings.dendrogramX?.aes,\n },\n }\n : null;\n this.dendrogramY = settings.dendrogramY\n ? {\n ...DEFAULT_DENDRO,\n position: 'left',\n ...settings.dendrogramY,\n aes: {\n ...DEFAULT_DENDRO_AES,\n ...settings.dendrogramY?.aes,\n },\n }\n : null;\n this.inheritedDendrogramAes = settings.inheritedDendrogramAes ?? null;\n this.cellsRenderingMode = settings.cellsRenderingMode ?? null;\n }\n}\n"],"mappings":";;;;AAaA,IAAM,IAAqB;CACvB,WAAW;CACX,UAAU;CACV,SAAS;CACT,SAAS;CACT,WAAW;CACX,WAAW;CACd,EACK,IAA4C;CAC9C,MAAM;CACN,UAAU;CACV,SAAS;CACT,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,iBAAiB;CACjB,KAAK;CACR,EA8CY,IAAb,MAA8D;CAC1D;CACA,OAAgB;CAChB;CAOA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAuCA;CACA;CAUA;CAMA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,GAA2B;AAsHnC,MArHA,EAAsB,MAAM,EAAS,EAErC,KAAK,KAAK,EAAO,SAAS,WAAW,EACrC,KAAK,UAAU,EAAS,SACxB,KAAK,WAAW,EAAS,YAAY,EAAE,EACvC,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,UAAU,EAAS,SACxB,KAAK,WAAW,EAAS,YAAY,EAAE,EACvC,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,cAAc,EAAS,aAC5B,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,gBAAgB;GACjB,OAAO;IACH,UAAU;IACV,MAAM;IACN,GAAG,EAAS;IACZ,MAAM,EAAS,OAAO,QAAQ;IACjC;GACD,MAAM;IACF,OAAO,GAAU,MAAM,UAAU,K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,EAAS,aAAa;IAC5B;GACJ,GACC,MACN,KAAK,yBAAyB,EAAS,0BAA0B,MACjE,KAAK,qBAAqB,EAAS,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"HeatmapSettingsImpl.js","names":[],"sources":["../../src/heatmap/HeatmapSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\nimport { BLACK, DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL } from '../constants';\nimport type {\n AesRecord,\n AggregationMethod,\n ColumnName, DendrogramDistance, DendrogramLinkage, HeatmapSettings,\n LegendPosition, LineShape, NormalizationDirection, NormalizationMethod, PointShape,\n SettingsInterface,\n TitlePosition\n} from '../types';\nimport { HeatmapSettingsSchema } from '../types';\nimport { MIN_MARGIN, MIN_PADDING } from './constants';\nimport { joinAxisTitle, resolveLabelParts } from './labelParts';\n\nconst DEFAULT_DENDRO_AES = {\n lineColor: BLACK,\n dotShape: '21' as PointShape,\n dotFill: BLACK,\n dotSize: 3,\n lineShape: 'solid' as LineShape,\n lineWidth: 1,\n};\nconst DEFAULT_DENDRO: HeatmapDendrogramSettings = {\n size: 150,\n distance: 'euclidean',\n linkage: 'average',\n fillNA: 0,\n showNodes: true,\n hidden: false,\n edgeInheritance: 'up',\n aes: DEFAULT_DENDRO_AES,\n};\n\nexport interface HeatmapDendrogramSettings {\n size: number;\n distance: DendrogramDistance;\n linkage: DendrogramLinkage;\n fillNA: number;\n showNodes: boolean;\n hidden: boolean;\n edgeInheritance: 'up' | 'down';\n aes: {\n lineColor: string | ColumnName;\n dotFill: string | ColumnName;\n dotShape: PointShape | ColumnName;\n dotSize: number | ColumnName;\n lineShape: LineShape | ColumnName;\n lineWidth: number | ColumnName;\n };\n}\n\ninterface HeatmapDendrogramSettingsX extends HeatmapDendrogramSettings {\n position: 'top' | 'bottom';\n}\ninterface HeatmapDendrogramSettingsY extends HeatmapDendrogramSettings {\n position: 'left' | 'right';\n}\n\ninterface HeatmapAnnotation {\n id: string;\n valueColumn: ColumnName;\n showTitle: boolean;\n type: 'discrete' | 'continuous';\n colors: string[];\n}\n\ninterface HeatmapAnnotationX extends HeatmapAnnotation {\n axis: 'x';\n position: 'top' | 'bottom';\n titlePosition: 'left' | 'right';\n}\ninterface HeatmapAnnotationY extends HeatmapAnnotation {\n axis: 'y';\n position: 'left' | 'right';\n titlePosition: 'top' | 'bottom';\n}\n\nexport class HeatmapSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'heatmap';\n readonly facetSettings: {\n order: string[] | null;\n sharedX: boolean;\n sharedY: boolean;\n nRows?: number;\n nCols?: number;\n };\n readonly x: ColumnName[];\n readonly xGroupBy: ColumnName[];\n readonly xSortBy: ColumnName[];\n readonly y: ColumnName[];\n readonly yGroupBy: ColumnName[];\n readonly ySortBy: ColumnName[];\n readonly valueColumn: ColumnName;\n readonly facetBy: ColumnName[];\n readonly normalization: { direction: NormalizationDirection, method: NormalizationMethod, colorRange?: number[] } | null;\n readonly chartSettings: {\n readonly title: { name: string; show: boolean; position: TitlePosition };\n readonly size: {\n width: number;\n height: number;\n cellWidth: number | null;\n cellHeight: number | null;\n innerOffset: number;\n outerOffset: number;\n };\n readonly frame: { type: 'full' | 'groups' | 'none' };\n readonly valueType: 'discrete' | 'continuous';\n readonly yAxis: {\n title: string;\n showTicks: boolean;\n showTitle: boolean;\n showAxisLabels: boolean;\n showGroupLabels: boolean;\n position: 'left' | 'right';\n groupingPosition: 'left' | 'right';\n axisLabelsAngle: 0 | 45 | 90;\n groupLabelsAngle: 0 | 45 | 90;\n sorting: 'asc' | 'desc';\n labelParts: ColumnName['value'][] | null;\n };\n readonly xAxis: {\n title: string;\n showTicks: boolean;\n showTitle: boolean;\n showAxisLabels: boolean;\n showGroupLabels: boolean;\n position: 'bottom' | 'top';\n groupingPosition: 'bottom' | 'top';\n axisLabelsAngle: 0 | 45 | 90;\n groupLabelsAngle: 0 | 45 | 90;\n sorting: 'asc' | 'desc';\n labelParts: ColumnName['value'][] | null;\n };\n readonly legend: { show: boolean; position: LegendPosition };\n readonly tooltips: { show: boolean; content?: ColumnName[] };\n };\n readonly keysOrder: Record<string, string[]>;\n readonly aes: {\n colorsList: string[];\n colorsMap: Record<string, string> | null;\n valueColors: string[] | null;\n valuesByColors: number[] | null;\n groupGap: number;\n cellStrokeColor: string;\n emptyCellColor: string;\n };\n\n readonly aggregation: {\n x: boolean;\n y: boolean;\n method: AggregationMethod;\n };\n\n readonly annotations: (HeatmapAnnotationX | HeatmapAnnotationY)[];\n\n readonly dendrogramX: HeatmapDendrogramSettingsX | null;\n readonly dendrogramY: HeatmapDendrogramSettingsY | null;\n readonly inheritedDendrogramAes: Record<string, AesRecord> | null;\n readonly NAValueAs: number | null;\n readonly transform: 'log' | null;\n readonly showEmptyRows: boolean;\n readonly showEmptyColumns: boolean;\n readonly cellsRenderingMode: 'canvas' | 'svg' | null;\n\n constructor(settings: HeatmapSettings) {\n HeatmapSettingsSchema.parse(settings);\n\n this.id = lodash.uniqueId('settings');\n this.x = settings.x;\n this.xGroupBy = settings.xGroupBy ?? [];\n this.xSortBy = settings.xSortBy ?? [];\n this.y = settings.y;\n this.yGroupBy = settings.yGroupBy ?? [];\n this.ySortBy = settings.ySortBy ?? [];\n this.valueColumn = settings.valueColumn;\n this.facetBy = settings.facetBy ?? [];\n this.chartSettings = {\n title: {\n position: 'left',\n show: true,\n ...settings.title,\n name: settings.title?.name ?? 'Chart',\n },\n size: {\n width: settings?.size?.width ?? (this.facetBy.length ? DEFAULT_WIDTH_SMALL : DEFAULT_WIDTH),\n height: settings?.size?.height ?? (this.facetBy.length ? DEFAULT_HEIGHT_SMALL : DEFAULT_HEIGHT),\n innerOffset: settings.size?.innerOffset ?? MIN_PADDING,\n outerOffset: settings.size?.outerOffset ?? MIN_MARGIN,\n cellWidth: settings?.size?.cellWidth ?? null,\n cellHeight: settings?.size?.cellHeight ?? null,\n },\n frame: { type: settings.frame?.type ?? 'none' },\n valueType: settings.valueType ?? 'continuous',\n yAxis: {\n // Default title joins only the *visible* y parts (labelParts ids\n // mapped back to y, else the full y); the consumer can still\n // override via settings.yAxis.title.\n title: joinAxisTitle(resolveLabelParts(settings.y, settings.yAxis?.labelParts)),\n showTicks: true,\n showTitle: true,\n showAxisLabels: true,\n showGroupLabels: true,\n position: 'left',\n groupingPosition: 'left',\n axisLabelsAngle: 90,\n groupLabelsAngle: 0,\n sorting: 'asc',\n labelParts: null,\n ...settings.yAxis,\n },\n xAxis: {\n title: joinAxisTitle(resolveLabelParts(settings.x, settings.xAxis?.labelParts)),\n showTicks: true,\n showTitle: true,\n showAxisLabels: true,\n showGroupLabels: true,\n position: 'bottom',\n groupingPosition: 'bottom',\n axisLabelsAngle: 90,\n groupLabelsAngle: 0,\n sorting: 'asc',\n labelParts: null,\n ...settings.xAxis,\n },\n legend: {\n show: true,\n position: 'right',\n ...settings.legend,\n },\n tooltips: {\n show: true,\n ...settings.tooltips,\n },\n };\n this.facetSettings = {\n sharedX: true,\n sharedY: true,\n order: settings.facetSettings?.order ?? null,\n ...settings.facetSettings,\n };\n if (this.chartSettings.size.cellWidth && this.facetBy.length > 0) {\n this.facetSettings.sharedX = true;\n }\n if (this.chartSettings.size.cellHeight && this.facetBy.length > 0) {\n this.facetSettings.sharedY = true;\n }\n this.keysOrder = settings.keysOrder ?? {};\n this.normalization = this.chartSettings.valueType === 'continuous' ? settings.normalization ?? null : null;\n this.transform = this.chartSettings.valueType === 'continuous' ? settings.transform ?? null : null;\n this.NAValueAs = settings.NAValueAs ?? null;\n this.showEmptyRows = settings.showEmptyRows ?? false;\n this.showEmptyColumns = settings.showEmptyColumns ?? false;\n this.aes = {\n colorsList: settings.aes?.colorsList ?? ['black', 'white', 'red'],\n colorsMap: settings.aes?.colorsMap ?? null,\n valueColors: settings.aes?.valueColors ?? null,\n valuesByColors: settings.aes?.valuesByColors ?? null,\n cellStrokeColor: settings.aes?.cellStrokeColor ?? 'none',\n groupGap: settings.aes?.groupGap ?? 3,\n emptyCellColor: settings.aes?.emptyCellColor ?? 'white',\n };\n\n this.annotations = (settings.annotations ?? []).map(item => {\n if (item.axis === 'x') {\n return {\n id: lodash.uniqueId('annotation'),\n axis: 'x',\n valueColumn: item.valueColumn,\n position: item.position ?? this.chartSettings.xAxis.position,\n titlePosition: item.titlePosition ?? 'right',\n showTitle: item.showTitle ?? true,\n type: item.type,\n colors: item.colors ?? ['white', 'black'],\n };\n }\n return {\n id: lodash.uniqueId('annotation'),\n axis: 'y',\n valueColumn: item.valueColumn,\n position: item.position ?? this.chartSettings.yAxis.position,\n titlePosition: item.titlePosition ?? 'top',\n showTitle: item.showTitle ?? true,\n type: item.type,\n colors: item.colors ?? ['white', 'black'],\n };\n });\n\n if (settings.valueType === 'discrete' && (settings.dendrogramX || settings.dendrogramY)) {\n throw Error('Dendrogram is not available with discrete cells values');\n }\n\n this.aggregation = {\n x: false,\n y: false,\n method: 'min',\n ...settings.aggregation\n };\n\n this.dendrogramX = settings.dendrogramX\n ? {\n ...DEFAULT_DENDRO,\n position: 'top',\n ...settings.dendrogramX,\n aes: {\n ...DEFAULT_DENDRO_AES,\n ...settings.dendrogramX?.aes,\n },\n }\n : null;\n this.dendrogramY = settings.dendrogramY\n ? {\n ...DEFAULT_DENDRO,\n position: 'left',\n ...settings.dendrogramY,\n aes: {\n ...DEFAULT_DENDRO_AES,\n ...settings.dendrogramY?.aes,\n },\n }\n : null;\n this.inheritedDendrogramAes = settings.inheritedDendrogramAes ?? null;\n this.cellsRenderingMode = settings.cellsRenderingMode ?? null;\n }\n}\n"],"mappings":";;;;;AAcA,IAAM,IAAqB;CACvB,WAAW;CACX,UAAU;CACV,SAAS;CACT,SAAS;CACT,WAAW;CACX,WAAW;CACd,EACK,IAA4C;CAC9C,MAAM;CACN,UAAU;CACV,SAAS;CACT,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,iBAAiB;CACjB,KAAK;CACR,EA8CY,IAAb,MAA8D;CAC1D;CACA,OAAgB;CAChB;CAOA;CAC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QAAQ,EAAK,UAAU,CAAC,SAAS,QAAQ;GAC5C,GAEE;GACH,IAAI,EAAO,SAAS,aAAa;GACjC,MAAM;GACN,aAAa,EAAK;GAClB,UAAU,EAAK,YAAY,KAAK,cAAc,MAAM;GACpD,eAAe,EAAK,iBAAiB;GACrC,WAAW,EAAK,aAAa;GAC7B,MAAM,EAAK;GACX,QAAQ,EAAK,UAAU,CAAC,SAAS,QAAQ;GAC5C,CACH,EAEE,EAAS,cAAc,eAAe,EAAS,eAAe,EAAS,aACvE,OAAM,MAAM,yDAAyD;AAiCzE,EA9BA,KAAK,cAAc;GACf,GAAG;GACH,GAAG;GACH,QAAQ;GACR,GAAG,EAAS;GACf,EAED,KAAK,cAAc,EAAS,cACtB;GACE,GAAG;GACH,UAAU;GACV,GAAG,EAAS;GACZ,KAAK;IACD,GAAG;IACH,GAAG,EAAS,aAAa;IAC5B;GACJ,GACC,MACN,KAAK,cAAc,EAAS,cACtB;GACE,GAAG;GACH,UAAU;GACV,GAAG,EAAS;GACZ,KAAK;IACD,GAAG;IACH,GAAG,EAAS,aAAa;IAC5B;GACJ,GACC,MACN,KAAK,yBAAyB,EAAS,0BAA0B,MACjE,KAAK,qBAAqB,EAAS,sBAAsB"}
|
|
@@ -41,12 +41,12 @@ export type GroupedCellsData<T extends string> = {
|
|
|
41
41
|
}>;
|
|
42
42
|
};
|
|
43
43
|
export declare const sortByColumns: (arr: string[], direction: "asc" | "desc", sortColumns: ColumnName[], dataByKeys: Record<string, Record<string, DataValue>>) => string[];
|
|
44
|
-
export declare function fillCellsData<T extends string>(result: GroupedCellsData<T>, { data,
|
|
44
|
+
export declare function fillCellsData<T extends string>(result: GroupedCellsData<T>, { data, x, y, valueColumns, facetBy, xGroupBy, yGroupBy, facetSettings, annotations, dendrogramX, dendrogramY, normalizationBySource, // separated for color and size for example
|
|
45
45
|
NAValueAs, transformBySource, // same per-source pattern as normalization
|
|
46
46
|
keysOrder, xAxis, yAxis, xSortBy, ySortBy, aggregation, showEmptyRows, showEmptyColumns, }: {
|
|
47
47
|
data: DataFrame;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
x: ColumnName[];
|
|
49
|
+
y: ColumnName[];
|
|
50
50
|
valueColumns: Record<string, ColumnName>;
|
|
51
51
|
facetBy: ColumnName[];
|
|
52
52
|
xGroupBy: ColumnName[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fillCellsData.d.ts","sourceRoot":"","sources":["../../src/heatmap/fillCellsData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAqB,UAAU,EAAE,SAAS,EAAuB,MAAM,UAAU,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"fillCellsData.d.ts","sourceRoot":"","sources":["../../src/heatmap/fillCellsData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAqB,UAAU,EAAE,SAAS,EAAuB,MAAM,UAAU,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAKvE,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,MAAM,IAAI;IACjC,MAAM,EAAE,IAAI,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACtC,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;CAChB,C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BAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;IACvE,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC;IAChE,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,KAAK,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC;IACpG,KAAK,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC;IACpG,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACzC,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,uBA6SJ"}
|
|
@@ -3,19 +3,20 @@ 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
5
|
import { intersect as i } from "../utils/intersect.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { joinLabel as a, resolveLabelParts as o } from "./labelParts.js";
|
|
7
|
+
import { deviation as s, extent as c, mean as l, quantileSorted as u, sum as d } from "d3-array";
|
|
8
|
+
function f(e) {
|
|
9
|
+
let t = s(e), n = l(e);
|
|
9
10
|
return t === void 0 || n === void 0 || t === 0 ? (e) => e : (e) => (e - n) / t;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
let t =
|
|
12
|
+
function p(e) {
|
|
13
|
+
let t = l(e), [n, r] = c(e);
|
|
13
14
|
return t === void 0 || n === void 0 || r === void 0 || r === n ? (e) => e : (e) => (e - t) / (r - n);
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
return e === "standardScaling" ?
|
|
16
|
+
function m(e, t) {
|
|
17
|
+
return e === "standardScaling" ? f(t) : e === "meanNormalization" ? p(t) : (e) => e;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function h(t, n) {
|
|
19
20
|
switch (t) {
|
|
20
21
|
case "max": {
|
|
21
22
|
let e = n[0];
|
|
@@ -27,17 +28,17 @@ function p(t, n) {
|
|
|
27
28
|
for (let t of n) e = Math.min(e, t);
|
|
28
29
|
return e;
|
|
29
30
|
}
|
|
30
|
-
case "median": return
|
|
31
|
-
case "mean": return
|
|
32
|
-
case "sum": return
|
|
31
|
+
case "median": return u(n.sort((e, t) => e - t), .5);
|
|
32
|
+
case "mean": return l(n) ?? n[0];
|
|
33
|
+
case "sum": return d(n);
|
|
33
34
|
default: e(t, `Unknown aggregation function ${t}`);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function g(e) {
|
|
37
38
|
let t = [...new Set(e)].sort();
|
|
38
39
|
return t.length > 3 ? [...t.slice(0, 3), "..."].join(", ") : t.join(", ");
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function _(e) {
|
|
41
42
|
if (!e.length) return [];
|
|
42
43
|
let t = [[]];
|
|
43
44
|
for (let n of e) {
|
|
@@ -47,36 +48,36 @@ function h(e) {
|
|
|
47
48
|
}
|
|
48
49
|
return t;
|
|
49
50
|
}
|
|
50
|
-
var
|
|
51
|
+
var v = (e, t, n = {}) => {
|
|
51
52
|
let r = t === "asc" ? 1 : -1;
|
|
52
53
|
return e.sort((e, t) => r * (n[e] ?? e).localeCompare(n[t] ?? t, "en", { numeric: !0 }));
|
|
53
54
|
};
|
|
54
|
-
function
|
|
55
|
+
function y(e) {
|
|
55
56
|
return !!(e == null || typeof e == "number" && Number.isNaN(e));
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
let r =
|
|
58
|
+
function b(e, t, n) {
|
|
59
|
+
let r = y(e), i = y(t);
|
|
59
60
|
if (r && i) return 0;
|
|
60
61
|
if (r) return 1;
|
|
61
62
|
if (i) return -1;
|
|
62
63
|
let a = n === "asc" ? 1 : -1;
|
|
63
64
|
return typeof e == "number" && typeof t == "number" ? a * (e < t ? -1 : e > t ? 1 : 0) : a * String(e).localeCompare(String(t), "en", { numeric: !0 });
|
|
64
65
|
}
|
|
65
|
-
const
|
|
66
|
+
const x = (e, t, n, r) => e.sort((e, i) => {
|
|
66
67
|
for (let a of n) {
|
|
67
|
-
let n =
|
|
68
|
+
let n = b(r[a.value]?.[e], r[a.value]?.[i], t);
|
|
68
69
|
if (n !== 0) return n;
|
|
69
70
|
}
|
|
70
71
|
return 0;
|
|
71
72
|
});
|
|
72
|
-
function
|
|
73
|
+
function ee(e, t, n, r, i) {
|
|
73
74
|
if (t.x || t.y) {
|
|
74
75
|
let a = e.meta.valueSources.reduce((e, t) => (e[t] = [Infinity, -Infinity], e), {});
|
|
75
76
|
for (let o of e.meta.facetKeys) {
|
|
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), {}),
|
|
77
|
-
for (let n of
|
|
77
|
+
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), {}), p = t.y ? d : c.reduce((e, t) => (e[t] = [t], e), {}), m = Object.keys(f), _ = Object.keys(p);
|
|
78
|
+
for (let n of m) for (let r of _) {
|
|
78
79
|
let i = e.meta.valueSources.reduce((e, t) => (e[t] = [], e), {});
|
|
79
|
-
for (let t of f[n]) for (let n of
|
|
80
|
+
for (let t of f[n]) for (let n of p[r]) {
|
|
80
81
|
for (let r of e.meta.valueSources) {
|
|
81
82
|
let e = l[t]?.[n]?.value?.[r];
|
|
82
83
|
e !== void 0 && i[r].push(e);
|
|
@@ -86,7 +87,7 @@ function b(e, t, n, r, i) {
|
|
|
86
87
|
for (let s of e.meta.valueSources) {
|
|
87
88
|
let c = i[s];
|
|
88
89
|
if (c.length > 0) {
|
|
89
|
-
let i =
|
|
90
|
+
let i = h(t.method, c);
|
|
90
91
|
e.facets[o].cells[n] || (e.facets[o].cells[n] = {}), e.facets[o].cells[n][r] || (e.facets[o].cells[n][r] = {
|
|
91
92
|
isCell: !0,
|
|
92
93
|
idx: 0,
|
|
@@ -101,12 +102,12 @@ function b(e, t, n, r, i) {
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
if (t.x) for (let r of
|
|
105
|
+
if (t.x) for (let r of m) for (let a of n) {
|
|
105
106
|
let n = i.find((e) => e.valueColumn.value === a || e.valueColumn.valueLabels === a);
|
|
106
107
|
if (!n) continue;
|
|
107
108
|
let o = [];
|
|
108
109
|
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" ?
|
|
110
|
+
let s = n.type === "continuous" ? h(t.method, o) : g(o);
|
|
110
111
|
e.meta.xDataByKeys[a][r] = s;
|
|
111
112
|
}
|
|
112
113
|
if (t.y) {
|
|
@@ -115,8 +116,8 @@ function b(e, t, n, r, i) {
|
|
|
115
116
|
let r = i.find((e) => e.valueColumn.value === a || e.valueColumn.valueLabels === a);
|
|
116
117
|
if (!r) continue;
|
|
117
118
|
let o = [];
|
|
118
|
-
for (let t of
|
|
119
|
-
let s = r.type === "continuous" ?
|
|
119
|
+
for (let t of p[n]) o.push(e.meta.yDataByKeys[a][t]), delete e.meta.yDataByKeys[a][t];
|
|
120
|
+
let s = r.type === "continuous" ? h(t.method, o) : g(o);
|
|
120
121
|
e.meta.yDataByKeys[a][n] = s;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -125,10 +126,10 @@ function b(e, t, n, r, i) {
|
|
|
125
126
|
e.meta.valueExtent = a;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function S(e, t) {
|
|
129
130
|
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]);
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
+
function C(e, t) {
|
|
132
133
|
if (Object.values(t).length) {
|
|
133
134
|
let n = e.meta.valueSources.reduce((e, n) => (t[n] && (e[n] = [Infinity, -Infinity]), e), {});
|
|
134
135
|
for (let r of e.meta.facetKeys) {
|
|
@@ -143,7 +144,7 @@ function S(e, t) {
|
|
|
143
144
|
let n = l(e, t)?.value?.[r];
|
|
144
145
|
n !== void 0 && i.push(n);
|
|
145
146
|
}
|
|
146
|
-
let a =
|
|
147
|
+
let a = m(e.method, i);
|
|
147
148
|
for (let e of s) {
|
|
148
149
|
let i = l(e, t);
|
|
149
150
|
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]));
|
|
@@ -157,102 +158,96 @@ function S(e, t) {
|
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
function
|
|
161
|
-
let
|
|
162
|
-
|
|
163
|
-
let
|
|
164
|
-
e.meta.facetKeys =
|
|
165
|
-
let
|
|
166
|
-
e.meta.facetKeyValues =
|
|
167
|
-
let
|
|
161
|
+
function w(e, { data: s, x: c, y: l, valueColumns: u, facetBy: d, xGroupBy: f, yGroupBy: p, facetSettings: m, annotations: h, dendrogramX: g, dendrogramY: y, normalizationBySource: b, NAValueAs: w, transformBySource: T, keysOrder: E, xAxis: D, yAxis: O, xSortBy: k, ySortBy: A, aggregation: j, showEmptyRows: M = !1, showEmptyColumns: N = !1 }) {
|
|
162
|
+
let P = o(c, "labelParts" in D ? D.labelParts : null), F = o(l, "labelParts" in O ? O.labelParts : null), te = d.length ? d.map((e) => E[e.value] ?? s.getColumnCategories(e.value)) : [["null"]], ne = f.length ? f.map((e) => E[e.value] ?? s.getColumnCategories(e.value)) : [["null"]], I = p.length ? p.map((e) => E[e.value] ?? s.getColumnCategories(e.value)) : [["null"]], L = _(te), R = _(ne), z = _(I);
|
|
163
|
+
m?.order?.length && (L = L.filter((e) => m.order?.includes(t(e))));
|
|
164
|
+
let B = L.map(r), re = new Set(B), V = R.map(r), H = z.map(r);
|
|
165
|
+
e.meta.facetKeys = B, e.meta.xGroupKeys = V, e.meta.yGroupKeys = H;
|
|
166
|
+
let U = n(s, d, B, L);
|
|
167
|
+
e.meta.facetKeyValues = B.reduce((e, t) => (e[t] = U[t], e), {}), e.meta.xGroupKeyValues = V.reduce((e, t, n) => (e[t] = R[n], e), {}), e.meta.yGroupKeyValues = H.reduce((e, t, n) => (e[t] = z[n], e), {});
|
|
168
|
+
let W = h.filter((e) => e.axis === "x").map((e) => e.valueColumn.valueLabels ?? e.valueColumn.value), G = h.filter((e) => e.axis === "y").map((e) => e.valueColumn.valueLabels ?? e.valueColumn.value), K = Object.values(g ?? {}).map((e) => e.value), q = Object.values(y ?? {}).map((e) => e.value), J = (k ?? []).map((e) => e.value), Y = (A ?? []).map((e) => e.value), X = [...new Set([
|
|
168
169
|
...W,
|
|
169
170
|
...K,
|
|
170
|
-
...J
|
|
171
|
-
H
|
|
171
|
+
...J
|
|
172
172
|
])], Z = [...new Set([
|
|
173
173
|
...G,
|
|
174
174
|
...q,
|
|
175
|
-
...Y
|
|
176
|
-
U
|
|
175
|
+
...Y
|
|
177
176
|
])];
|
|
178
|
-
for (let t = 0; t <
|
|
179
|
-
let n = r(
|
|
180
|
-
if (!
|
|
181
|
-
let i = r(
|
|
182
|
-
e.meta.xGroupLabels[i] =
|
|
183
|
-
let
|
|
184
|
-
let r =
|
|
185
|
-
if (
|
|
177
|
+
for (let t = 0; t < s.rowsCount; t++) {
|
|
178
|
+
let n = r(d.map((e) => s.getColumnValue(e.value, t)));
|
|
179
|
+
if (!re.has(n)) continue;
|
|
180
|
+
let i = r(f.map((e) => s.getColumnValue(e.value, t))), o = r(p.map((e) => s.getColumnValue(e.value, t))), m = a(f, s, t), h = a(p, s, t);
|
|
181
|
+
e.meta.xGroupLabels[i] = m, e.meta.yGroupLabels[o] = h;
|
|
182
|
+
let g = r([...c.map((e) => s.getColumnValue(e.value, t)), ...f.map((e) => s.getColumnValue(e.value, t))]), _ = r([...l.map((e) => s.getColumnValue(e.value, t)), ...p.map((e) => s.getColumnValue(e.value, t))]), v = a(P, s, t), y = a(F, s, t), b = e.meta.valueSources.reduce((e, n) => {
|
|
183
|
+
let r = s.getColumnValue(u[n].value, t) ?? w;
|
|
184
|
+
if (T?.[n] === "log" && typeof r == "number") {
|
|
186
185
|
let e = Math.log10(r);
|
|
187
186
|
r = Number.isFinite(e) ? e : null;
|
|
188
187
|
}
|
|
189
188
|
return e[n] = r, e;
|
|
190
189
|
}, {});
|
|
191
|
-
if (
|
|
192
|
-
let
|
|
193
|
-
if (!(
|
|
190
|
+
if (g === "null" || _ === "null") continue;
|
|
191
|
+
let x = Object.values(b).every((e) => e === null);
|
|
192
|
+
if (!(x && !M && !N)) {
|
|
194
193
|
if (e.facets[n] || (e.facets[n] = {
|
|
195
194
|
xKeys: [],
|
|
196
195
|
yKeys: [],
|
|
197
196
|
xKeysByGroups: {},
|
|
198
197
|
yKeysByGroups: {},
|
|
199
198
|
cells: {}
|
|
200
|
-
}), e.facets[n].xKeysByGroups[i] || (e.facets[n].xKeysByGroups[i] = []), e.facets[n].yKeysByGroups[
|
|
201
|
-
e.facets[n].xKeys.push(
|
|
202
|
-
|
|
203
|
-
if (e.meta.xLabels[h] && String(r) !== e.meta.xLabels[h]) throw Error(`More than 1 x-label value for x=${h}`);
|
|
204
|
-
e.meta.xLabels[h] = String(r);
|
|
199
|
+
}), e.facets[n].xKeysByGroups[i] || (e.facets[n].xKeysByGroups[i] = []), e.facets[n].yKeysByGroups[o] || (e.facets[n].yKeysByGroups[o] = []), !x || N) {
|
|
200
|
+
if (e.facets[n].xKeys.push(g), e.facets[n].xKeysByGroups[i].push(g), e.meta.xLabels[g] && v !== e.meta.xLabels[g]) throw Error(`More than 1 x-label value for x=${g}`);
|
|
201
|
+
e.meta.xLabels[g] = v;
|
|
205
202
|
for (let n of X) {
|
|
206
|
-
let r = e.meta.xDataByKeys[n] !== void 0, i = r && e.meta.xDataByKeys[n][
|
|
207
|
-
if (r || (e.meta.xDataByKeys[n] = {}), i && e.meta.xDataByKeys[n][
|
|
208
|
-
i || (e.meta.xDataByKeys[n][
|
|
203
|
+
let r = e.meta.xDataByKeys[n] !== void 0, i = r && e.meta.xDataByKeys[n][g] !== void 0;
|
|
204
|
+
if (r || (e.meta.xDataByKeys[n] = {}), i && e.meta.xDataByKeys[n][g] !== s.getColumnValue(n, t)) throw Error(`More than 1 value for x = ${g} and column = ${n}`);
|
|
205
|
+
i || (e.meta.xDataByKeys[n][g] = s.getColumnValue(n, t));
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
|
-
if (!
|
|
212
|
-
e.facets[n].yKeys.push(
|
|
213
|
-
|
|
214
|
-
if (e.meta.yLabels[g] && String(r) !== e.meta.yLabels[g]) throw Error(`More than 1 y-label value for y=${g}`);
|
|
215
|
-
e.meta.yLabels[g] = String(r);
|
|
208
|
+
if (!x || M) {
|
|
209
|
+
if (e.facets[n].yKeys.push(_), e.facets[n].yKeysByGroups[o].push(_), e.meta.yLabels[_] && y !== e.meta.yLabels[_]) throw Error(`More than 1 y-label value for y=${_}`);
|
|
210
|
+
e.meta.yLabels[_] = y;
|
|
216
211
|
for (let n of Z) {
|
|
217
|
-
let r = e.meta.yDataByKeys[n] !== void 0, i = r && e.meta.yDataByKeys[n][
|
|
218
|
-
if (r || (e.meta.yDataByKeys[n] = {}), i && e.meta.yDataByKeys[n][
|
|
219
|
-
i || (e.meta.yDataByKeys[n][
|
|
212
|
+
let r = e.meta.yDataByKeys[n] !== void 0, i = r && e.meta.yDataByKeys[n][_] !== void 0;
|
|
213
|
+
if (r || (e.meta.yDataByKeys[n] = {}), i && e.meta.yDataByKeys[n][_] !== s.getColumnValue(n, t)) throw Error(`More than 1 value for y = ${_} and column = ${n}`);
|
|
214
|
+
i || (e.meta.yDataByKeys[n][_] = s.getColumnValue(n, t));
|
|
220
215
|
}
|
|
221
216
|
}
|
|
222
|
-
if (!
|
|
223
|
-
e.facets[n].cells[
|
|
224
|
-
for (let t of e.meta.valueSources) if (e.facets[n].cells[
|
|
225
|
-
e.facets[n].cells[
|
|
217
|
+
if (!x) {
|
|
218
|
+
e.facets[n].cells[g] || (e.facets[n].cells[g] = {});
|
|
219
|
+
for (let t of e.meta.valueSources) if (e.facets[n].cells[g][_] && e.facets[n].cells[g][_].value[t] !== b[t]) throw Error(`More than 1 value for x=${g}, y=${_}`);
|
|
220
|
+
e.facets[n].cells[g][_] = {
|
|
226
221
|
isCell: !0,
|
|
227
222
|
idx: t,
|
|
228
|
-
id: `${
|
|
229
|
-
x:
|
|
230
|
-
y:
|
|
231
|
-
value:
|
|
232
|
-
normalizedValue:
|
|
233
|
-
},
|
|
223
|
+
id: `${g}_${_}`,
|
|
224
|
+
x: g,
|
|
225
|
+
y: _,
|
|
226
|
+
value: b,
|
|
227
|
+
normalizedValue: b
|
|
228
|
+
}, S(e, e.facets[n].cells[g][_]);
|
|
234
229
|
}
|
|
235
230
|
}
|
|
236
231
|
}
|
|
237
232
|
e.meta.facetKeys = e.meta.facetKeys.filter((t) => e.facets[t]);
|
|
238
233
|
for (let t of e.meta.facetKeys) {
|
|
239
234
|
let n = e.facets[t], r = [...new Set(n.xKeys)], a = [...new Set(n.yKeys)];
|
|
240
|
-
n.xKeys =
|
|
241
|
-
for (let r of
|
|
242
|
-
for (let r of
|
|
235
|
+
n.xKeys = E.x ? i(E.x, r) : r, n.yKeys = E.y ? i(E.y, a) : a;
|
|
236
|
+
for (let r of V) e.facets[t].xKeysByGroups[r] = i(n.xKeys, e.facets[t].xKeysByGroups[r]);
|
|
237
|
+
for (let r of H) e.facets[t].yKeysByGroups[r] = i(n.yKeys, e.facets[t].yKeysByGroups[r]);
|
|
243
238
|
}
|
|
244
|
-
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
let Q = !
|
|
239
|
+
ee(e, j, X, Z, h), C(e, b);
|
|
240
|
+
let ie = f.some((e) => E[e.value]?.length > 0), ae = p.some((e) => E[e.value]?.length > 0);
|
|
241
|
+
ie || (e.meta.xGroupKeys = v([...e.meta.xGroupKeys], D.sorting, e.meta.xGroupLabels)), ae || (e.meta.yGroupKeys = v([...e.meta.yGroupKeys], O.sorting, e.meta.yGroupLabels));
|
|
242
|
+
let Q = !g && !j.x && k?.length ? k : null;
|
|
248
243
|
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 ?
|
|
250
|
-
return t[n] =
|
|
244
|
+
let r = [...new Set(e.meta.facetKeys.flatMap((t) => e.facets[t].xKeysByGroups[n]))], a = Q ? x(r, D.sorting, Q, e.meta.xDataByKeys) : v(r, D.sorting, e.meta.xLabels);
|
|
245
|
+
return t[n] = E.x ? i(E.x, a) : a, t;
|
|
251
246
|
}, {}), e.meta.xKeys = e.meta.xGroupKeys.reduce((t, n) => (t = t.concat(e.meta.xKeysByGroups[n]), t), []);
|
|
252
|
-
let $ = !
|
|
247
|
+
let $ = !y && !j.y && A?.length ? A : null;
|
|
253
248
|
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 = $ ?
|
|
255
|
-
return t[n] =
|
|
249
|
+
let r = [...new Set(e.meta.facetKeys.flatMap((t) => e.facets[t].yKeysByGroups[n]))], a = $ ? x(r, O.sorting, $, e.meta.yDataByKeys) : v(r, O.sorting, e.meta.yLabels);
|
|
250
|
+
return t[n] = E.y ? i(E.y, a) : a, t;
|
|
256
251
|
}, {}), e.meta.yKeys = e.meta.yGroupKeys.reduce((t, n) => (t = t.concat(e.meta.yKeysByGroups[n]), t), []);
|
|
257
252
|
for (let t of e.meta.facetKeys) {
|
|
258
253
|
for (let n of e.meta.xGroupKeys) e.facets[t].xKeysByGroups[n] = i(e.meta.xKeysByGroups[n], e.facets[t].xKeysByGroups[n] ?? []);
|
|
@@ -261,8 +256,8 @@ function C(e, { data: a, xColumn: o, yColumn: s, valueColumns: c, facetBy: l, xG
|
|
|
261
256
|
e.facets[t].yKeys = e.meta.yGroupKeys.flatMap((n) => e.facets[t].yKeysByGroups[n] ?? []);
|
|
262
257
|
}
|
|
263
258
|
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);
|
|
264
|
-
return e.meta.xLabels.null =
|
|
259
|
+
return e.meta.xLabels.null = P.map((e) => e.nullValueLabel ?? "NA").join(", "), e.meta.yLabels.null = F.map((e) => e.nullValueLabel ?? "NA").join(", "), e.meta.xGroupLabels.null = f.map((e) => e.nullValueLabel ?? "NA").join(", "), e.meta.yGroupLabels.null = p.map((e) => e.nullValueLabel ?? "NA").join(", "), e;
|
|
265
260
|
}
|
|
266
|
-
export {
|
|
261
|
+
export { w as fillCellsData };
|
|
267
262
|
|
|
268
263
|
//# sourceMappingURL=fillCellsData.js.map
|