@milaboratories/miplots4 1.0.147 → 1.0.148
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/common/Legend.js +3 -3
- package/dist/common/Legend.js.map +1 -1
- package/dist/heatmap/ChartRenderer.js +1 -1
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +6 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +9 -3
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/components/Annotations/index.js +58 -58
- package/dist/heatmap/components/Annotations/index.js.map +1 -1
- package/dist/heatmap/getCells.d.ts +1 -1
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +204 -110
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +88 -85
- package/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/react/index.js +1 -1
- package/dist/node_modules/react-dom/index.js +1 -1
- package/dist/types/heatmap.d.ts +24 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +7 -2
- package/dist/types/heatmap.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as l } from "../../../node_modules/react/jsx-runtime.js";
|
|
2
2
|
import { Annotation as p } from "./Annotation.js";
|
|
3
|
-
import { ANNOTATION_WIDTH as c, ANNOTATIONS_OFFSET as
|
|
4
|
-
function
|
|
5
|
-
return
|
|
3
|
+
import { ANNOTATION_WIDTH as c, ANNOTATIONS_OFFSET as T } from "../../constants.js";
|
|
4
|
+
function v(u, n) {
|
|
5
|
+
return u.showTitle && n.includes(u.titlePosition);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
facetKey:
|
|
7
|
+
function G({
|
|
8
|
+
facetKey: u,
|
|
9
9
|
sideElementBBoxes: n,
|
|
10
|
-
annotations:
|
|
10
|
+
annotations: A,
|
|
11
11
|
annotationColorScales: s,
|
|
12
|
-
cellsMeta:
|
|
12
|
+
cellsMeta: x,
|
|
13
13
|
chartEdgeSides: a,
|
|
14
|
-
sharedX:
|
|
15
|
-
sharedY:
|
|
16
|
-
width:
|
|
17
|
-
height:
|
|
18
|
-
scales:
|
|
19
|
-
stepX:
|
|
20
|
-
stepY:
|
|
21
|
-
aes:
|
|
22
|
-
frame:
|
|
23
|
-
xGroupKeys:
|
|
24
|
-
yGroupKeys:
|
|
25
|
-
xKeysByGroups:
|
|
26
|
-
yKeysByGroups:
|
|
27
|
-
tooltipsData:
|
|
28
|
-
cellsRenderingMode:
|
|
14
|
+
sharedX: b,
|
|
15
|
+
sharedY: h,
|
|
16
|
+
width: j,
|
|
17
|
+
height: w,
|
|
18
|
+
scales: N,
|
|
19
|
+
stepX: C,
|
|
20
|
+
stepY: O,
|
|
21
|
+
aes: L,
|
|
22
|
+
frame: d,
|
|
23
|
+
xGroupKeys: D,
|
|
24
|
+
yGroupKeys: I,
|
|
25
|
+
xKeysByGroups: g,
|
|
26
|
+
yKeysByGroups: F,
|
|
27
|
+
tooltipsData: K,
|
|
28
|
+
cellsRenderingMode: P
|
|
29
29
|
}) {
|
|
30
|
-
const
|
|
31
|
-
facetKey:
|
|
32
|
-
scales:
|
|
33
|
-
stepX:
|
|
34
|
-
stepY:
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
37
|
-
aes:
|
|
38
|
-
frame:
|
|
39
|
-
xGroupKeys:
|
|
40
|
-
yGroupKeys:
|
|
41
|
-
xKeysByGroups:
|
|
42
|
-
yKeysByGroups:
|
|
43
|
-
tooltipsData:
|
|
44
|
-
cellsRenderingMode:
|
|
30
|
+
const i = A.filter((o) => a.includes(o.position) || !b && ["left", "right"].includes(o.position) || !h && ["top", "bottom"].includes(o.position)), _ = i.filter((o) => o.position === "left"), H = i.filter((o) => o.position === "right"), R = i.filter((o) => o.position === "top"), W = i.filter((o) => o.position === "bottom"), { xDataByKeys: f, yDataByKeys: y } = x, r = {
|
|
31
|
+
facetKey: u,
|
|
32
|
+
scales: N,
|
|
33
|
+
stepX: C,
|
|
34
|
+
stepY: O,
|
|
35
|
+
width: j,
|
|
36
|
+
height: w,
|
|
37
|
+
aes: L,
|
|
38
|
+
frame: d,
|
|
39
|
+
xGroupKeys: D,
|
|
40
|
+
yGroupKeys: I,
|
|
41
|
+
xKeysByGroups: g,
|
|
42
|
+
yKeysByGroups: F,
|
|
43
|
+
tooltipsData: K,
|
|
44
|
+
cellsRenderingMode: P
|
|
45
45
|
};
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
46
|
+
return /* @__PURE__ */ l.jsxs("g", { children: [
|
|
47
|
+
_.map((o, t) => /* @__PURE__ */ l.jsx(
|
|
48
48
|
p,
|
|
49
49
|
{
|
|
50
50
|
annotation: o,
|
|
51
51
|
colorScale: s[o.id],
|
|
52
|
-
data:
|
|
53
|
-
showTitle:
|
|
52
|
+
data: y[o.valueColumn.valueLabels ?? o.valueColumn.value],
|
|
53
|
+
showTitle: v(o, a),
|
|
54
54
|
x: n.left.annotations.x + t * c,
|
|
55
55
|
y: n.left.annotations.y,
|
|
56
|
-
...
|
|
56
|
+
...r
|
|
57
57
|
},
|
|
58
58
|
o.id
|
|
59
59
|
)),
|
|
60
|
-
|
|
60
|
+
H.map((o, t) => /* @__PURE__ */ l.jsx(
|
|
61
61
|
p,
|
|
62
62
|
{
|
|
63
63
|
annotation: o,
|
|
64
64
|
colorScale: s[o.id],
|
|
65
|
-
data:
|
|
66
|
-
showTitle:
|
|
67
|
-
x: n.right.annotations.x + t * c +
|
|
65
|
+
data: y[o.valueColumn.valueLabels ?? o.valueColumn.value],
|
|
66
|
+
showTitle: v(o, a),
|
|
67
|
+
x: n.right.annotations.x + t * c + T,
|
|
68
68
|
y: n.right.annotations.y,
|
|
69
|
-
...
|
|
69
|
+
...r
|
|
70
70
|
},
|
|
71
71
|
o.id
|
|
72
72
|
)),
|
|
73
|
-
|
|
73
|
+
R.map((o, t) => /* @__PURE__ */ l.jsx(
|
|
74
74
|
p,
|
|
75
75
|
{
|
|
76
76
|
annotation: o,
|
|
77
77
|
colorScale: s[o.id],
|
|
78
|
-
data:
|
|
79
|
-
showTitle:
|
|
78
|
+
data: f[o.valueColumn.valueLabels ?? o.valueColumn.value],
|
|
79
|
+
showTitle: v(o, a),
|
|
80
80
|
x: n.top.annotations.x,
|
|
81
81
|
y: n.top.annotations.y + t * c,
|
|
82
|
-
...
|
|
82
|
+
...r
|
|
83
83
|
},
|
|
84
84
|
o.id
|
|
85
85
|
)),
|
|
86
|
-
|
|
86
|
+
W.map((o, t) => /* @__PURE__ */ l.jsx(
|
|
87
87
|
p,
|
|
88
88
|
{
|
|
89
89
|
annotation: o,
|
|
90
90
|
colorScale: s[o.id],
|
|
91
|
-
data:
|
|
92
|
-
showTitle:
|
|
91
|
+
data: f[o.valueColumn.valueLabels ?? o.valueColumn.value],
|
|
92
|
+
showTitle: v(o, a),
|
|
93
93
|
x: n.bottom.annotations.x,
|
|
94
|
-
y: n.bottom.annotations.y + t * c +
|
|
95
|
-
...
|
|
94
|
+
y: n.bottom.annotations.y + t * c + T,
|
|
95
|
+
...r
|
|
96
96
|
},
|
|
97
97
|
o.id
|
|
98
98
|
))
|
|
99
99
|
] });
|
|
100
100
|
}
|
|
101
101
|
export {
|
|
102
|
-
|
|
102
|
+
G as Annotations
|
|
103
103
|
};
|
|
104
104
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","idx","jsx","Annotation","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET"],"mappings":";;;AAcA,SAASA,EAAUC,GAA6CC,GAAuD;AACnH,SAAOD,EAAK,aAAaC,EAAe,SAASD,EAAK,aAAa;AACvE;AA0BO,SAASE,EAAY;AAAA,EACxB,UAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAN;AAAA,EACA,SAAAO;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AACJ,GAAoB;AAChB,QAAMC,IAAkBlB,EAAY,OAAO,CAAAL,MAEnCC,EAAe,SAASD,EAAK,QAAQ,KACpC,CAACQ,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASR,EAAK,QAAQ,KACpD,CAACS,KAAW,CAAC,OAAO,QAAQ,EAAE,SAAST,EAAK,QAAQ,CAE5D,GACKwB,IAAkBD,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,MAAM,GACzEyB,IAAmBF,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,OAAO,GAC3E0B,IAAiBH,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,KAAK,GACvE2B,IAAoBJ,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,QAAQ,GAC7E,EAAC,aAAA4B,GAAa,aAAAC,EAAA,IAAetB,GAE7BuB,IAAc;AAAA,IAChB,UAAA3B;AAAA,IACA,QAAAS;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAJ;AAAA,IACA,QAAAC;AAAA,IACA,KAAAI;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA;AAEJ,gCACK,KAAA,EACI,UAAA;AAAA,IAAAE,EAAgB,IAAI,CAACxB,GAAM+B,MAEpBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM6B,EAAY7B,EAAK,YAAY,KAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","idx","jsx","Annotation","ANNOTATION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AWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,IAAI,YAAY;AAAA,QACrC,GAAGA,EAAkB,IAAI,YAAY,IAAI2B,IAAMG;AAAA,QAC9C,GAAGJ;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,IACA2B,EAAkB,IAAI,CAAC3B,GAAM+B,MAEtBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,eAAeA,EAAK,YAAY,KAAK;AAAA,QACxE,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,OAAO,YAAY;AAAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI2B,IAAMG,IAAmBC;AAAA,QACpE,GAAGL;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;"}
|
|
@@ -36,5 +36,5 @@ export type GroupedCellsData = {
|
|
|
36
36
|
cells: Record<string, Record<string, Cell>>;
|
|
37
37
|
}>;
|
|
38
38
|
};
|
|
39
|
-
export declare function getCells(data: DataFrame, xColumn: ColumnName, yColumn: ColumnName, valueColumn: ColumnName, facetBy: ColumnName[], xGroupBy: ColumnName[], yGroupBy: ColumnName[], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], normalization: HeatmapSettingsImpl['normalization'], NAValueAs: HeatmapSettingsImpl['NAValueAs'], keysOrder: HeatmapSettingsImpl['keysOrder'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis']): GroupedCellsData;
|
|
39
|
+
export declare function getCells(data: DataFrame, xColumn: ColumnName, yColumn: ColumnName, valueColumn: ColumnName, facetBy: ColumnName[], xGroupBy: ColumnName[], yGroupBy: ColumnName[], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], normalization: HeatmapSettingsImpl['normalization'], NAValueAs: HeatmapSettingsImpl['NAValueAs'], keysOrder: HeatmapSettingsImpl['keysOrder'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], aggregation: HeatmapSettingsImpl['aggregation']): GroupedCellsData;
|
|
40
40
|
//# sourceMappingURL=getCells.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.d.ts","sourceRoot":"","sources":["../../src/heatmap/getCells.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCells.d.ts","sourceRoot":"","sources":["../../src/heatmap/getCells.ts"],"names":[],"mappings":"AAEA,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;AAiEjE,MAAM,MAAM,IAAI,GAAG;IACf,MAAM,EAAE,IAAI,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,eAAe,EAAE,SAAS,CAAC;IAC3B,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,IAAI,EAAE;QACF,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,UAAU,EAAE,MAAM,EAAE,CA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,SAAS,EACf,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,UAAU,EACnB,WAAW,EAAE,UAAU,EACvB,OAAO,EAAE,UAAU,EAAE,EACrB,QAAQ,EAAE,UAAU,EAAE,EACtB,QAAQ,EAAE,UAAU,EAAE,EACtB,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,aAAa,EAAE,mBAAmB,CAAC,eAAe,CAAC,EACnD,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAC3C,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAC3C,KAAK,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EACpD,KAAK,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EACpD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,GAChD,gBAAgB,CA6LlB"}
|
package/dist/heatmap/getCells.js
CHANGED
|
@@ -1,38 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import K from "../node_modules/lodash/lodash.js";
|
|
2
|
+
import { exhaustive as ee } from "../utils/index.js";
|
|
3
|
+
import X from "../node_modules/d3-array/src/mean.js";
|
|
4
|
+
import { quantileSorted as te } from "../node_modules/d3-array/src/quantile.js";
|
|
5
|
+
import ae from "../node_modules/d3-array/src/deviation.js";
|
|
6
|
+
import se from "../node_modules/d3-array/src/extent.js";
|
|
7
|
+
function ne(t) {
|
|
8
|
+
const s = ae(t), n = X(t);
|
|
9
|
+
return s === void 0 || n === void 0 || s === 0 ? (u) => u : (u) => (u - n) / s;
|
|
8
10
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
11
|
+
function oe(t) {
|
|
12
|
+
const s = X(t), [n, u] = se(t);
|
|
13
|
+
return s === void 0 || n === void 0 || u === void 0 || u === n ? (r) => r : (r) => (r - s) / (u - n);
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
+
function le(t, s) {
|
|
16
|
+
return t === "standardScaling" ? ne(s) : t === "meanNormalization" ? oe(s) : (n) => n;
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
+
function N(t, s) {
|
|
19
|
+
switch (t) {
|
|
20
|
+
case "max": {
|
|
21
|
+
let n = s[0];
|
|
22
|
+
for (const u of s)
|
|
23
|
+
n = Math.max(n, u);
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
case "min": {
|
|
27
|
+
let n = s[0];
|
|
28
|
+
for (const u of s)
|
|
29
|
+
n = Math.min(n, u);
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
case "median": {
|
|
33
|
+
const n = s.sort((u, r) => u - r);
|
|
34
|
+
return te(n, 0.5);
|
|
35
|
+
}
|
|
36
|
+
case "mean":
|
|
37
|
+
return X(s) ?? s[0];
|
|
38
|
+
default:
|
|
39
|
+
ee(t, `Unknown aggregation function ${t}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function P(t) {
|
|
43
|
+
const s = [...new Set(t)].sort();
|
|
44
|
+
return s.length > 3 ? [...s.slice(0, 3), "..."].join(", ") : s.join(", ");
|
|
45
|
+
}
|
|
46
|
+
function A(t) {
|
|
47
|
+
if (!t.length)
|
|
18
48
|
return [];
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
49
|
+
let s = [[]];
|
|
50
|
+
return t.forEach((n) => {
|
|
51
|
+
const u = [];
|
|
52
|
+
n.forEach((r) => {
|
|
53
|
+
u.push(...s.map((p) => [...p, r]));
|
|
54
|
+
}), s = u;
|
|
55
|
+
}), s;
|
|
26
56
|
}
|
|
27
|
-
const
|
|
28
|
-
(
|
|
57
|
+
const Q = (t, s, n = {}) => t.sort(
|
|
58
|
+
(u, r) => s === "asc" ? (n[u] ?? u).localeCompare(n[r] ?? r, "en", { numeric: !0 }) : (n[r] ?? r).localeCompare(n[u] ?? u, "en", { numeric: !0 })
|
|
29
59
|
);
|
|
30
|
-
function
|
|
31
|
-
|
|
60
|
+
function ue() {
|
|
61
|
+
return {
|
|
32
62
|
meta: {
|
|
33
|
-
facetKeys:
|
|
34
|
-
xGroupKeys:
|
|
35
|
-
yGroupKeys:
|
|
63
|
+
facetKeys: [],
|
|
64
|
+
xGroupKeys: [],
|
|
65
|
+
yGroupKeys: [],
|
|
36
66
|
xKeysByGroups: {},
|
|
37
67
|
yKeysByGroups: {},
|
|
38
68
|
xLabels: {},
|
|
@@ -41,104 +71,168 @@ function le(n, o, l, c, f, d, b, D, z, X, C, Y, x, A, N) {
|
|
|
41
71
|
yGroupLabels: {},
|
|
42
72
|
xDataByKeys: {},
|
|
43
73
|
yDataByKeys: {},
|
|
44
|
-
facetKeyValues:
|
|
45
|
-
xGroupKeyValues:
|
|
46
|
-
yGroupKeyValues:
|
|
74
|
+
facetKeyValues: {},
|
|
75
|
+
xGroupKeyValues: {},
|
|
76
|
+
yGroupKeyValues: {},
|
|
47
77
|
valueExtent: [1 / 0, -1 / 0]
|
|
48
78
|
},
|
|
49
79
|
facets: {}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function ie(t, s, n, u, r) {
|
|
83
|
+
if (s.x || s.y) {
|
|
84
|
+
const p = [1 / 0, -1 / 0];
|
|
85
|
+
t.meta.facetKeys.forEach((y) => {
|
|
86
|
+
const { xKeys: B, yKeys: w, cells: g, xKeysByGroups: G, yKeysByGroups: E } = t.facets[y], c = s.x ? G : B.reduce((e, i) => (e[i] = [i], e), {}), V = s.y ? E : w.reduce((e, i) => (e[i] = [i], e), {}), d = Object.keys(c), D = Object.keys(V);
|
|
87
|
+
for (const e of d)
|
|
88
|
+
for (const i of D) {
|
|
89
|
+
const b = [];
|
|
90
|
+
if (c[e].forEach((v) => {
|
|
91
|
+
V[i].forEach((C) => {
|
|
92
|
+
var $, q, S;
|
|
93
|
+
const x = (q = ($ = g[v]) == null ? void 0 : $[C]) == null ? void 0 : q.value;
|
|
94
|
+
x !== void 0 && (b.push(x), (S = g[v]) == null || delete S[C]);
|
|
95
|
+
});
|
|
96
|
+
}), b.length > 0) {
|
|
97
|
+
const v = N(s.method, b);
|
|
98
|
+
t.facets[y].cells[e] || (t.facets[y].cells[e] = {}), t.facets[y].cells[e][i] = {
|
|
99
|
+
isCell: !0,
|
|
100
|
+
idx: 0,
|
|
101
|
+
id: `${e}_${i}`,
|
|
102
|
+
x: e,
|
|
103
|
+
y: i,
|
|
104
|
+
value: v,
|
|
105
|
+
normalizedValue: v
|
|
106
|
+
}, p[0] = Math.min(v, p[0]), p[1] = Math.max(v, p[1]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
s.x && d.forEach((e) => {
|
|
110
|
+
n.forEach((i) => {
|
|
111
|
+
const b = r.find((x) => x.valueColumn.value === i || x.valueColumn.valueLabels === i);
|
|
112
|
+
if (!b)
|
|
113
|
+
return;
|
|
114
|
+
const v = [];
|
|
115
|
+
c[e].forEach((x) => {
|
|
116
|
+
v.push(t.meta.xDataByKeys[i][x]), delete t.meta.xDataByKeys[i][x];
|
|
117
|
+
});
|
|
118
|
+
const C = b.type === "continuous" ? N(s.method, v) : P(v);
|
|
119
|
+
t.meta.xDataByKeys[i][e] = C;
|
|
120
|
+
});
|
|
121
|
+
}), s.y && (u.forEach((e) => {
|
|
122
|
+
t.meta.yDataByKeys[e] = {};
|
|
123
|
+
}), D.forEach((e) => {
|
|
124
|
+
u.forEach((i) => {
|
|
125
|
+
const b = r.find((x) => x.valueColumn.value === i || x.valueColumn.valueLabels === i);
|
|
126
|
+
if (!b)
|
|
127
|
+
return;
|
|
128
|
+
const v = [];
|
|
129
|
+
V[e].forEach((x) => {
|
|
130
|
+
v.push(t.meta.yDataByKeys[i][x]), delete t.meta.yDataByKeys[i][x];
|
|
131
|
+
});
|
|
132
|
+
const C = b.type === "continuous" ? N(s.method, v) : P(v);
|
|
133
|
+
t.meta.yDataByKeys[i][e] = C;
|
|
134
|
+
});
|
|
135
|
+
})), s.x && (t.facets[y].xKeys = Object.keys(G), t.facets[y].xKeysByGroups = { null: t.facets[y].xKeys }, t.meta.xLabels = t.meta.xGroupLabels, t.meta.xGroupKeys = ["null"], t.meta.xGroupKeyValues = { null: ["null"] }), s.y && (t.facets[y].yKeys = Object.keys(E), t.facets[y].yKeysByGroups = { null: t.facets[y].yKeys }, t.meta.yLabels = t.meta.yGroupLabels, t.meta.yGroupKeys = ["null"], t.meta.yGroupKeyValues = { null: ["null"] });
|
|
136
|
+
}), t.meta.valueExtent = p;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function re(t, s) {
|
|
140
|
+
if (s) {
|
|
141
|
+
const n = [1 / 0, -1 / 0];
|
|
142
|
+
t.meta.facetKeys.forEach((u) => {
|
|
143
|
+
const { xKeys: r, yKeys: p, cells: y } = t.facets[u], B = s.direction === "row" ? r : p, w = s.direction === "row" ? p : r, g = s.direction === "row" ? (G, E) => {
|
|
144
|
+
var c;
|
|
145
|
+
return (c = y[G]) == null ? void 0 : c[E];
|
|
146
|
+
} : (G, E) => {
|
|
147
|
+
var c;
|
|
148
|
+
return (c = y[E]) == null ? void 0 : c[G];
|
|
149
|
+
};
|
|
150
|
+
w.forEach((G) => {
|
|
151
|
+
const E = [];
|
|
152
|
+
B.forEach((V) => {
|
|
153
|
+
var D;
|
|
154
|
+
const d = (D = g(V, G)) == null ? void 0 : D.value;
|
|
155
|
+
d !== void 0 && E.push(d);
|
|
156
|
+
});
|
|
157
|
+
const c = le(s.method, E);
|
|
158
|
+
B.forEach((V) => {
|
|
159
|
+
const d = g(V, G);
|
|
160
|
+
d !== void 0 && (d.normalizedValue = c(d.value), n[0] = Math.min(d.normalizedValue, n[0]), n[1] = Math.max(d.normalizedValue, n[1]));
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}), t.meta.valueExtent = n;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function xe(t, s, n, u, r, p, y, B, w, g, G, E, c, V, d, D) {
|
|
167
|
+
const e = ue(), i = r.length ? r.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], b = p.length ? p.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], v = y.length ? y.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], C = A(i), x = A(b), $ = A(v), q = C.map((a) => a.join("_")), S = x.map((a) => a.join("_")), z = $.map((a) => a.join("_"));
|
|
168
|
+
e.meta.facetKeys = q, e.meta.xGroupKeys = S, e.meta.yGroupKeys = z, e.meta.facetKeyValues = q.reduce((a, o, f) => (a[o] = C[f], a), {}), e.meta.xGroupKeyValues = S.reduce((a, o, f) => (a[o] = x[f], a), {}), e.meta.yGroupKeyValues = z.reduce((a, o, f) => (a[o] = $[f], a), {});
|
|
169
|
+
const Y = s.valueLabels ?? s.value, F = n.valueLabels ?? n.value, T = B.filter((a) => a.axis === "x").map((a) => a.valueColumn.valueLabels ?? a.valueColumn.value), W = B.filter((a) => a.axis === "y").map((a) => a.valueColumn.valueLabels ?? a.valueColumn.value), Z = Object.values(w ?? {}).map((a) => a.value), O = Object.values(g ?? {}).map((a) => a.value), R = K.uniq([...T, ...Z, Y]), U = K.uniq([...W, ...O, F]);
|
|
170
|
+
for (let a = 0; a < t.rowsCount; a++) {
|
|
171
|
+
const o = r.length ? r.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", f = p.length ? p.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", L = y.length ? y.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", j = p.length ? p.map((l) => t.getColumnValue(l.valueLabels ?? l.value, a)).join(", ") : "", k = y.length ? y.map((l) => t.getColumnValue(l.valueLabels ?? l.value, a)).join(", ") : "";
|
|
172
|
+
e.meta.xGroupLabels[f] = j, e.meta.yGroupLabels[L] = k;
|
|
173
|
+
const m = String(t.getColumnValue(s.value, a)), h = String(t.getColumnValue(n.value, a)), M = t.getColumnValue(u.value, a) ?? E;
|
|
174
|
+
if (m === "null" || h === "null" || M === null)
|
|
56
175
|
continue;
|
|
57
|
-
if (
|
|
176
|
+
if (e.facets[o] || (e.facets[o] = {
|
|
58
177
|
xKeys: [],
|
|
59
178
|
yKeys: [],
|
|
60
179
|
xKeysByGroups: {},
|
|
61
180
|
yKeysByGroups: {},
|
|
62
181
|
cells: {}
|
|
63
|
-
}),
|
|
64
|
-
throw Error(`More than 1 value for x=${
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
throw Error(`More than 1 x-label value for x=${
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
throw Error(`More than 1 y-label value for y=${
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
throw Error(`More than 1 value for x = ${
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
throw Error(`More than 1 value for y = ${
|
|
80
|
-
|
|
81
|
-
}),
|
|
182
|
+
}), e.facets[o].xKeysByGroups[f] || (e.facets[o].xKeysByGroups[f] = []), e.facets[o].yKeysByGroups[L] || (e.facets[o].yKeysByGroups[L] = []), e.facets[o].xKeys.push(m), e.facets[o].yKeys.push(h), e.facets[o].xKeysByGroups[f].push(m), e.facets[o].yKeysByGroups[L].push(h), e.facets[o].cells[m] || (e.facets[o].cells[m] = {}), e.meta.valueExtent[0] = Math.min(M, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(M, e.meta.valueExtent[1]), e.facets[o].cells[m][h] && e.facets[o].cells[m][h].value !== M)
|
|
183
|
+
throw Error(`More than 1 value for x=${m}, y=${h}`);
|
|
184
|
+
const H = t.getColumnValue(Y, a);
|
|
185
|
+
if (e.meta.xLabels[m] && String(H) !== e.meta.xLabels[m])
|
|
186
|
+
throw Error(`More than 1 x-label value for x=${m}`);
|
|
187
|
+
const J = t.getColumnValue(F, a);
|
|
188
|
+
if (e.meta.yLabels[h] && String(J) !== e.meta.yLabels[h])
|
|
189
|
+
throw Error(`More than 1 y-label value for y=${h}`);
|
|
190
|
+
e.meta.xLabels[m] = String(H), e.meta.yLabels[h] = String(J), R.forEach((l) => {
|
|
191
|
+
const I = typeof e.meta.xDataByKeys[l] < "u", _ = I && typeof e.meta.xDataByKeys[l][m] < "u";
|
|
192
|
+
if (I || (e.meta.xDataByKeys[l] = {}), _ && e.meta.xDataByKeys[l][m] !== t.getColumnValue(l, a))
|
|
193
|
+
throw Error(`More than 1 value for x = ${m} and column = ${l}`);
|
|
194
|
+
_ || (e.meta.xDataByKeys[l][m] = t.getColumnValue(l, a));
|
|
195
|
+
}), U.forEach((l) => {
|
|
196
|
+
const I = typeof e.meta.yDataByKeys[l] < "u", _ = I && typeof e.meta.yDataByKeys[l][h] < "u";
|
|
197
|
+
if (I || (e.meta.yDataByKeys[l] = {}), _ && e.meta.yDataByKeys[l][h] !== t.getColumnValue(l, a))
|
|
198
|
+
throw Error(`More than 1 value for y = ${h} and column = ${l}`);
|
|
199
|
+
_ || (e.meta.yDataByKeys[l][h] = t.getColumnValue(l, a));
|
|
200
|
+
}), e.facets[o].cells[m][h] = {
|
|
82
201
|
isCell: !0,
|
|
83
|
-
idx:
|
|
84
|
-
id: `${
|
|
85
|
-
x:
|
|
86
|
-
y:
|
|
87
|
-
value:
|
|
88
|
-
normalizedValue:
|
|
202
|
+
idx: a,
|
|
203
|
+
id: `${m}_${h}`,
|
|
204
|
+
x: m,
|
|
205
|
+
y: h,
|
|
206
|
+
value: M,
|
|
207
|
+
normalizedValue: M
|
|
89
208
|
};
|
|
90
209
|
}
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
210
|
+
return e.meta.facetKeys = e.meta.facetKeys.filter((a) => e.facets[a]), e.meta.facetKeys.forEach((a) => {
|
|
211
|
+
const o = e.facets[a], f = K.uniq(o.xKeys), L = K.uniq(o.yKeys);
|
|
212
|
+
o.xKeys = c[s.value] ? K.intersection(c[s.value], f) : f, o.yKeys = c[n.value] ? K.intersection(c[n.value], L) : L, S.forEach((j) => {
|
|
213
|
+
e.facets[a].xKeysByGroups[j] = K.intersection(
|
|
214
|
+
o.xKeys,
|
|
215
|
+
e.facets[a].xKeysByGroups[j]
|
|
97
216
|
);
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
217
|
+
}), z.forEach((j) => {
|
|
218
|
+
e.facets[a].yKeysByGroups[j] = K.intersection(
|
|
219
|
+
o.yKeys,
|
|
220
|
+
e.facets[a].yKeysByGroups[j]
|
|
102
221
|
);
|
|
103
222
|
});
|
|
104
|
-
}),
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const h = [];
|
|
116
|
-
G.forEach((s) => {
|
|
117
|
-
var V;
|
|
118
|
-
const m = (V = r(s, p)) == null ? void 0 : V.value;
|
|
119
|
-
m !== void 0 && h.push(m);
|
|
120
|
-
});
|
|
121
|
-
const g = te(C.method, h);
|
|
122
|
-
G.forEach((s) => {
|
|
123
|
-
const m = r(s, p);
|
|
124
|
-
m !== void 0 && (m.normalizedValue = g(m.value), e[0] = Math.min(m.normalizedValue, e[0]), e[1] = Math.max(m.normalizedValue, e[1]));
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
}), t.meta.valueExtent = e;
|
|
128
|
-
}
|
|
129
|
-
return t.meta.xKeysByGroups = E.reduce((e, a) => {
|
|
130
|
-
const u = _(v.uniq(
|
|
131
|
-
v.flatten(t.meta.facetKeys.map((y) => t.facets[y].xKeysByGroups[a]))
|
|
132
|
-
), A.sorting, t.meta.xLabels);
|
|
133
|
-
return e[a] = x[o.value] ? v.intersection(x[o.value], u) : u, e;
|
|
134
|
-
}, {}), t.meta.yKeysByGroups = L.reduce((e, a) => {
|
|
135
|
-
const u = _(v.uniq(
|
|
136
|
-
v.flatten(t.meta.facetKeys.map((y) => t.facets[y].yKeysByGroups[a]))
|
|
137
|
-
), N.sorting, t.meta.yLabels);
|
|
138
|
-
return e[a] = x[l.value] ? v.intersection(x[l.value], u) : u, e;
|
|
139
|
-
}, {}), t.meta.valueExtent[0] === 1 / 0 && (t.meta.valueExtent[0] = 0), t.meta.valueExtent[1] === -1 / 0 && (t.meta.valueExtent[1] = 0), t;
|
|
223
|
+
}), ie(e, D, R, U, B), re(e, G), e.meta.xKeysByGroups = e.meta.xGroupKeys.reduce((a, o) => {
|
|
224
|
+
const f = Q(K.uniq(
|
|
225
|
+
K.flatten(e.meta.facetKeys.map((L) => e.facets[L].xKeysByGroups[o]))
|
|
226
|
+
), V.sorting, e.meta.xLabels);
|
|
227
|
+
return a[o] = c[s.value] ? K.intersection(c[s.value], f) : f, a;
|
|
228
|
+
}, {}), e.meta.yKeysByGroups = e.meta.yGroupKeys.reduce((a, o) => {
|
|
229
|
+
const f = Q(K.uniq(
|
|
230
|
+
K.flatten(e.meta.facetKeys.map((L) => e.facets[L].yKeysByGroups[o]))
|
|
231
|
+
), d.sorting, e.meta.yLabels);
|
|
232
|
+
return a[o] = c[n.value] ? K.intersection(c[n.value], f) : f, a;
|
|
233
|
+
}, {}), e.meta.valueExtent[0] === 1 / 0 && (e.meta.valueExtent[0] = 0), e.meta.valueExtent[1] === -1 / 0 && (e.meta.valueExtent[1] = 0), e;
|
|
140
234
|
}
|
|
141
235
|
export {
|
|
142
|
-
|
|
236
|
+
xe as getCells
|
|
143
237
|
};
|
|
144
238
|
//# sourceMappingURL=getCells.js.map
|