@milaboratories/graph-maker 1.1.141 → 1.1.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GraphMaker/components/LassoControls/index.vue.js +1 -1
- package/dist/GraphMaker/components/ReorderForm.vue.d.ts +15 -0
- package/dist/GraphMaker/components/ReorderForm.vue.d.ts.map +1 -0
- package/dist/GraphMaker/components/ReorderForm.vue.js +43 -0
- package/dist/GraphMaker/components/ReorderForm.vue.js.map +1 -0
- package/dist/GraphMaker/components/ReorderForm.vue2.js +5 -0
- package/dist/GraphMaker/components/ReorderForm.vue2.js.map +1 -0
- package/dist/GraphMaker/constantsCommon.d.ts +23 -0
- package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
- package/dist/GraphMaker/constantsCommon.js +97 -83
- package/dist/GraphMaker/constantsCommon.js.map +1 -1
- package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
- package/dist/GraphMaker/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js +305 -172
- package/dist/GraphMaker/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.d.ts +3 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.d.ts.map +1 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.js +90 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.js.map +1 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue2.js +5 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue2.js.map +1 -0
- package/dist/GraphMaker/forms/LayersForm/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/index.vue.js +45 -43
- package/dist/GraphMaker/forms/LayersForm/index.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js +33 -34
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/types.d.ts +1 -1
- package/dist/GraphMaker/types.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +3 -3
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +9 -9
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +21 -11
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +3 -3
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +31 -5
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +56 -53
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +1 -7
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +13 -13
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts +6 -4
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js +42 -13
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js +84 -70
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +48 -44
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/{discrete/components → common}/BandAxis.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/common/BandAxis.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/common/ContinuousGrid.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +197 -270
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +182 -161
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js +121 -104
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/ChartsGroup.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Grid.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js +105 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedBarElement.js +66 -59
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedBarElement.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +61 -58
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedArea.js +17 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedArea.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-scale/src/band.js +44 -34
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-scale/src/band.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +272 -195
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +23 -23
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +54 -50
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxis.js +32 -28
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxis.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +29 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +44 -41
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Grid.js +31 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Grid.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +29 -18
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +71 -57
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/isNumericScale.js +11 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/isNumericScale.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +10 -10
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +6 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +35 -25
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +51 -36
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +6 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +7 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/createMultilineDiscreteLabels.js +32 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/createMultilineDiscreteLabels.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getFacetRowsColumns.js +18 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getFacetRowsColumns.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/measureMultilineDiscreteLabels.js +63 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/measureMultilineDiscreteLabels.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/{discrete/utils → utils}/splitTextByWidth.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/splitTextByWidth.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +2 -2
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -1
- package/package.json +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/BandAxis.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Axis.js +0 -59
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Axis.js.map +0 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { isContinuousDataMapping as g } from "../../constantsCommon.js";
|
|
2
|
-
import { AMINOACID_COLOR_MAPPING as
|
|
3
|
-
import { DEFAULT_DOT_SIZE as
|
|
4
|
-
function x(
|
|
2
|
+
import { AMINOACID_COLOR_MAPPING as L, NUCLEOTIDE_COLOR_MAPPING as A, PALETTE_MAP as b, DEFAULT_BLACK as C, DEFAULT_CONTINUOUS_PALETTE as F, DEFAULT_DOT_SHAPE as I } from "../../constantsAesthetic.js";
|
|
3
|
+
import { DEFAULT_DOT_SIZE as _, DEFAULT_DOT_RANGE as P, isAestheticMappingContinuous as V, createContinuousMappingFromPalette as N } from "../../dataBindAes.js";
|
|
4
|
+
function x(r) {
|
|
5
5
|
const l = [];
|
|
6
|
-
if (
|
|
6
|
+
if (r.overall.data.testMethod && r.overall.validity.testMethod && l.push({
|
|
7
7
|
type: "stat",
|
|
8
8
|
statType: "overall",
|
|
9
|
-
testMethod:
|
|
10
|
-
}),
|
|
9
|
+
testMethod: r.overall.data.testMethod
|
|
10
|
+
}), r.referenceGroup.data.testMethod && r.referenceGroup.validity.testMethod && r.referenceGroup.validity.referenceGroup) {
|
|
11
11
|
const p = {
|
|
12
12
|
type: "stat",
|
|
13
13
|
statType: "referenceGroup",
|
|
14
|
-
testMethod:
|
|
15
|
-
referenceGroup:
|
|
16
|
-
format:
|
|
17
|
-
ns:
|
|
14
|
+
testMethod: r.referenceGroup.data.testMethod,
|
|
15
|
+
referenceGroup: r.referenceGroup.data.referenceGroup,
|
|
16
|
+
format: r.referenceGroup.data.format,
|
|
17
|
+
ns: r.referenceGroup.data.ns
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
r.referenceGroup.data.correctionMethod !== "none" && (p.correctionMethod = r.referenceGroup.data.correctionMethod), l.push(p);
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
21
|
+
if (r.pairwise.data.testMethod && r.pairwise.validity.testMethod) {
|
|
22
22
|
const p = {
|
|
23
23
|
type: "stat",
|
|
24
24
|
statType: "pairwise",
|
|
25
|
-
testMethod:
|
|
26
|
-
format:
|
|
27
|
-
ns:
|
|
25
|
+
testMethod: r.pairwise.data.testMethod,
|
|
26
|
+
format: r.pairwise.data.format,
|
|
27
|
+
ns: r.pairwise.data.ns
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
r.referenceGroup.data.correctionMethod !== "none" && (p.correctionMethod = r.referenceGroup.data.correctionMethod), l.push(p);
|
|
30
30
|
}
|
|
31
31
|
return l;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const o = [],
|
|
35
|
-
function i(
|
|
36
|
-
return
|
|
33
|
+
function B(r, l, p, u, d) {
|
|
34
|
+
const o = [], n = u.components.primaryGrouping.selectorStates.length > 0, c = u.components.secondaryGrouping.selectorStates.length > 0;
|
|
35
|
+
function i(t, f = !1) {
|
|
36
|
+
return t === null ? c ? { type: "secondaryGrouping" } : n && !f ? { type: "primaryGrouping" } : { type: "secondaryGrouping" } : t;
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return r.forEach((t) => {
|
|
39
39
|
var f;
|
|
40
|
-
if (
|
|
41
|
-
const e = l[
|
|
40
|
+
if (t === "box") {
|
|
41
|
+
const e = l[t];
|
|
42
42
|
o.push({
|
|
43
43
|
type: "box",
|
|
44
44
|
aes: {
|
|
@@ -51,8 +51,8 @@ function j(t, l, p, u, d) {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
55
|
-
const e = l[
|
|
54
|
+
if (t === "binnedDots") {
|
|
55
|
+
const e = l[t];
|
|
56
56
|
o.push({
|
|
57
57
|
type: "binnedDots",
|
|
58
58
|
aes: {
|
|
@@ -63,8 +63,8 @@ function j(t, l, p, u, d) {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
if (
|
|
67
|
-
const e = l[
|
|
66
|
+
if (t === "jitteredDots") {
|
|
67
|
+
const e = l[t];
|
|
68
68
|
o.push({
|
|
69
69
|
type: "dot",
|
|
70
70
|
aes: {
|
|
@@ -76,8 +76,8 @@ function j(t, l, p, u, d) {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
if (
|
|
80
|
-
const e = l[
|
|
79
|
+
if (t === "violin") {
|
|
80
|
+
const e = l[t];
|
|
81
81
|
o.push({
|
|
82
82
|
type: "violin",
|
|
83
83
|
stat: {
|
|
@@ -94,8 +94,8 @@ function j(t, l, p, u, d) {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
if (
|
|
98
|
-
const e = l[
|
|
97
|
+
if (t === "bar") {
|
|
98
|
+
const e = l[t];
|
|
99
99
|
o.push({
|
|
100
100
|
type: "bar",
|
|
101
101
|
height: e.height,
|
|
@@ -106,8 +106,8 @@ function j(t, l, p, u, d) {
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
if (
|
|
110
|
-
const e = l[
|
|
109
|
+
if (t === "stackedBar") {
|
|
110
|
+
const e = l[t];
|
|
111
111
|
o.push({
|
|
112
112
|
type: "stackedBar",
|
|
113
113
|
normalize: e.normalize,
|
|
@@ -118,8 +118,22 @@ function j(t, l, p, u, d) {
|
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
-
if (
|
|
122
|
-
const e = l[
|
|
121
|
+
if (t === "stackedArea") {
|
|
122
|
+
const e = l[t];
|
|
123
|
+
o.push({
|
|
124
|
+
type: "stackedArea",
|
|
125
|
+
normalize: e.normalize,
|
|
126
|
+
showBars: e.showBars,
|
|
127
|
+
aes: {
|
|
128
|
+
fillColor: i(e.fillColor),
|
|
129
|
+
lineColor: i(e.lineColor),
|
|
130
|
+
barsOpacity: e.barsOpacity,
|
|
131
|
+
areaOpacity: e.areaOpacity
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (t === "line") {
|
|
136
|
+
const e = l[t];
|
|
123
137
|
o.push({
|
|
124
138
|
type: "line",
|
|
125
139
|
pointsValues: e.pointsValues,
|
|
@@ -132,8 +146,8 @@ function j(t, l, p, u, d) {
|
|
|
132
146
|
}
|
|
133
147
|
});
|
|
134
148
|
}
|
|
135
|
-
if (
|
|
136
|
-
const e = l[
|
|
149
|
+
if (t === "errorbar") {
|
|
150
|
+
const e = l[t];
|
|
137
151
|
o.push({
|
|
138
152
|
type: "errorbar",
|
|
139
153
|
pointsValues: e.pointsValues,
|
|
@@ -146,8 +160,8 @@ function j(t, l, p, u, d) {
|
|
|
146
160
|
}
|
|
147
161
|
});
|
|
148
162
|
}
|
|
149
|
-
if (
|
|
150
|
-
const e = l[
|
|
163
|
+
if (t === "sina") {
|
|
164
|
+
const e = l[t];
|
|
151
165
|
o.push({
|
|
152
166
|
type: "sina",
|
|
153
167
|
aes: {
|
|
@@ -157,71 +171,71 @@ function j(t, l, p, u, d) {
|
|
|
157
171
|
}
|
|
158
172
|
});
|
|
159
173
|
}
|
|
160
|
-
if (
|
|
161
|
-
const e = l[
|
|
174
|
+
if (t === "logo" && c) {
|
|
175
|
+
const e = l[t], m = ((f = d.getSourceInfo(u.components.secondaryGrouping.selectorStates[0].selectedSource).spec.domain) == null ? void 0 : f["pl7.app/alphabet"]) === "aminoacid";
|
|
162
176
|
o.push({
|
|
163
177
|
type: "logo",
|
|
164
178
|
normalize: e.normalize,
|
|
165
179
|
aes: {
|
|
166
180
|
opacity: e.opacity,
|
|
167
|
-
dotFill: m ?
|
|
181
|
+
dotFill: m ? L : A
|
|
168
182
|
}
|
|
169
183
|
});
|
|
170
184
|
}
|
|
171
|
-
}),
|
|
185
|
+
}), n && !c && o.push(...x(p)), o;
|
|
172
186
|
}
|
|
173
|
-
function
|
|
174
|
-
if (
|
|
175
|
-
const d = g(l) ? l : { column:
|
|
176
|
-
return p.values[
|
|
177
|
-
const c = Number(
|
|
187
|
+
function z(r, l, p, u) {
|
|
188
|
+
if (r) {
|
|
189
|
+
const d = g(l) ? l : { column: r.value, range: P }, o = [1 / 0, -1 / 0];
|
|
190
|
+
return p.values[r.value].forEach((n) => {
|
|
191
|
+
const c = Number(n);
|
|
178
192
|
c < o[0] && (o[0] = c), c > o[1] && (o[1] = c);
|
|
179
|
-
}), { columnName:
|
|
193
|
+
}), { columnName: r, domain: o, range: [d.range.min, d.range.max] };
|
|
180
194
|
}
|
|
181
195
|
return g(l) ? u : l ?? u;
|
|
182
196
|
}
|
|
183
|
-
function
|
|
184
|
-
const d = p.find((
|
|
197
|
+
function w(r, l, p, u) {
|
|
198
|
+
const d = p.find((n) => n.value === r);
|
|
185
199
|
let o = [1 / 0, -1 / 0];
|
|
186
200
|
if (d) {
|
|
187
|
-
const { range:
|
|
201
|
+
const { range: n, palette: c, midPoint: i, log: t } = l, f = (n == null ? void 0 : n.minValue) === null || (n == null ? void 0 : n.minValue) === void 0, e = (n == null ? void 0 : n.maxValue) === null || (n == null ? void 0 : n.maxValue) === void 0;
|
|
188
202
|
if ((f || e) && u.values[d.value].forEach((h) => {
|
|
189
203
|
const m = Number(h);
|
|
190
204
|
f && m < o[0] && (o[0] = m), e && m > o[1] && (o[1] = m);
|
|
191
|
-
}), f || (o[0] =
|
|
205
|
+
}), f || (o[0] = n == null ? void 0 : n.minValue), e || (o[1] = n == null ? void 0 : n.maxValue), i != null) {
|
|
192
206
|
const h = Math.max(Math.abs(i - o[0]), Math.abs(i - o[1]));
|
|
193
207
|
o[0] = i - h, o[1] = i + h;
|
|
194
208
|
}
|
|
195
209
|
return {
|
|
196
210
|
columnName: d,
|
|
197
211
|
domain: o,
|
|
198
|
-
range:
|
|
199
|
-
type:
|
|
212
|
+
range: b[c].colors,
|
|
213
|
+
type: t ? "log" : "linear"
|
|
200
214
|
};
|
|
201
215
|
}
|
|
202
|
-
return
|
|
216
|
+
return C;
|
|
203
217
|
}
|
|
204
|
-
function
|
|
205
|
-
var
|
|
218
|
+
function R(r, l, p, u, d, o, n = [], c = _) {
|
|
219
|
+
var y, M;
|
|
206
220
|
const i = [];
|
|
207
|
-
function
|
|
221
|
+
function t(a, s, D, G = !1) {
|
|
208
222
|
var v;
|
|
209
223
|
if (s.length) {
|
|
210
|
-
const
|
|
211
|
-
return a === null ||
|
|
224
|
+
const O = s.length ? (v = o.getSourceInfo(s[0])) == null ? void 0 : v.type : void 0, E = O === "String" || !G ? { type: "grouping", value: s[0] } : w(s[0], N(F), n, p), T = d[s[0]];
|
|
225
|
+
return a === null || O === "String" || !G || !V(T) ? E : w(s[0], T, n, p);
|
|
212
226
|
}
|
|
213
|
-
return typeof a == "object" ?
|
|
227
|
+
return typeof a == "object" ? D : a;
|
|
214
228
|
}
|
|
215
|
-
const f = u.components.grouping.selectorStates.map((a) => a.selectedSource), e = ((
|
|
216
|
-
return
|
|
229
|
+
const f = u.components.grouping.selectorStates.map((a) => a.selectedSource), e = ((y = u.components.shape) == null ? void 0 : y.selectorStates.map((a) => a.selectedSource)) ?? [], h = (M = u.components.size) == null ? void 0 : M.selectorStates.map((a) => a.selectedSource)[0], m = h ? n.find((a) => a.value === h) : void 0;
|
|
230
|
+
return r.forEach((a) => {
|
|
217
231
|
if (a === "dots") {
|
|
218
232
|
const s = l[a];
|
|
219
233
|
i.push({
|
|
220
234
|
type: "dots",
|
|
221
235
|
aes: {
|
|
222
|
-
dotFill:
|
|
223
|
-
dotShape:
|
|
224
|
-
dotSize:
|
|
236
|
+
dotFill: t(s.dotFill, f, C, !0),
|
|
237
|
+
dotShape: t(s.dotShape, e, I),
|
|
238
|
+
dotSize: z(m, s.dotSize, p, c)
|
|
225
239
|
}
|
|
226
240
|
});
|
|
227
241
|
}
|
|
@@ -231,15 +245,15 @@ function k(t, l, p, u, d, o, r = [], c = b) {
|
|
|
231
245
|
type: "curve",
|
|
232
246
|
smoothing: s.smoothing,
|
|
233
247
|
aes: {
|
|
234
|
-
lineColor:
|
|
248
|
+
lineColor: t(s.lineColor, f, C, !0)
|
|
235
249
|
}
|
|
236
250
|
});
|
|
237
251
|
}
|
|
238
252
|
}), i;
|
|
239
253
|
}
|
|
240
254
|
export {
|
|
241
|
-
|
|
242
|
-
|
|
255
|
+
B as getDiscreteLayersSettings,
|
|
256
|
+
R as getScatterplotLayersSettings,
|
|
243
257
|
x as getStatLayers
|
|
244
258
|
};
|
|
245
259
|
//# sourceMappingURL=getLayersDataFromForms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayersDataFromForms.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.ts"],"sourcesContent":["import {\n ColorAes,\n getDefaultLayersSettings,\n NumberRange,\n LayersSettings,\n MappingLink,\n DiscreteStatisticsState,\n ColumnNameSchema,\n ContinuousDataMappingSize,\n isContinuousDataMapping,\n ContinuousDataMappingForGraph\n} from '../../constantsCommon';\nimport {\n Layer,\n ReactiveState\n} from '../../types';\nimport {\n DiscreteUIState, InputGuide,\n InputState,\n PlotDataAndSettings,\n ScatterplotUIState\n} from '@milaboratories/pf-plots';\nimport { DotShape, LineType } from '../../components/AesSettings/types';\nimport {\n AMINOACID_COLOR_MAPPING,\n DEFAULT_BLACK,\n DEFAULT_CONTINUOUS_PALETTE,\n DEFAULT_DOT_SHAPE, NUCLEOTIDE_COLOR_MAPPING,\n PALETTE_MAP\n} from '../../constantsAesthetic';\nimport {\n AestheticMappingContinuous, createContinuousMappingFromPalette,\n DEFAULT_DOT_RANGE,\n DEFAULT_DOT_SIZE\n} from '../../dataBindAes';\nimport { ScatterplotSettings } from '@milaboratories/miplots4';\nimport { isAestheticMappingContinuous } from '../../dataBindAes';\n\nexport function getStatLayers(statisticsSettings: DiscreteStatisticsState) {\n const layers: ChartLayerSettings[] = [];\n if (\n statisticsSettings.overall.data.testMethod &&\n statisticsSettings.overall.validity.testMethod\n ) {\n layers.push({\n type: 'stat',\n statType: 'overall',\n testMethod: statisticsSettings.overall.data.testMethod\n });\n }\n if (\n statisticsSettings.referenceGroup.data.testMethod &&\n statisticsSettings.referenceGroup.validity.testMethod &&\n statisticsSettings.referenceGroup.validity.referenceGroup\n ) {\n const layer: ChartLayerSettings = {\n type: 'stat',\n statType: 'referenceGroup',\n testMethod: statisticsSettings.referenceGroup.data.testMethod,\n referenceGroup: statisticsSettings.referenceGroup.data.referenceGroup,\n format: statisticsSettings.referenceGroup.data.format,\n ns: statisticsSettings.referenceGroup.data.ns\n };\n if (statisticsSettings.referenceGroup.data.correctionMethod !== 'none') {\n layer.correctionMethod =\n statisticsSettings.referenceGroup.data.correctionMethod;\n }\n layers.push(layer);\n }\n if (\n statisticsSettings.pairwise.data.testMethod &&\n statisticsSettings.pairwise.validity.testMethod\n ) {\n const layer: ChartLayerSettings = {\n type: 'stat',\n statType: 'pairwise',\n testMethod: statisticsSettings.pairwise.data.testMethod,\n format: statisticsSettings.pairwise.data.format,\n ns: statisticsSettings.pairwise.data.ns\n };\n if (statisticsSettings.referenceGroup.data.correctionMethod !== 'none') {\n layer.correctionMethod =\n statisticsSettings.referenceGroup.data.correctionMethod;\n }\n layers.push(layer);\n }\n return layers;\n}\n\nexport function getDiscreteLayersSettings(\n layers: Layer[],\n layerSettings: LayersSettings,\n statisticsSettings: DiscreteStatisticsState,\n optionsState: DiscreteUIState,\n inputGuide: InputGuide<InputState>\n): ChartLayerSettings[] {\n const result: ChartLayerSettings[] = [];\n const hasPrimaryGrouping =\n optionsState.components.primaryGrouping.selectorStates.length > 0;\n const hasSecondaryGrouping =\n optionsState.components.secondaryGrouping.selectorStates.length > 0;\n // If user didn't touch layers settings, some aes that can be mapped to groupings has 'null' value - we set them to secondary or primary grouping if available\n // for 'line', 'errorbar' layer it isn't possible to set primary grouping as a color aes\n function useDefaultColor(\n value: ColorAes | null,\n onlySecondaryAvailable = false\n ) {\n if (value === null) {\n if (hasSecondaryGrouping) {\n return { type: 'secondaryGrouping' };\n }\n if (hasPrimaryGrouping && !onlySecondaryAvailable) {\n return { type: 'primaryGrouping' };\n }\n return { type: 'secondaryGrouping' };\n }\n return value;\n }\n\n layers.forEach((layer) => {\n if (layer === 'box') {\n const settings = layerSettings[layer];\n result.push({\n type: 'box',\n aes: {\n showOutliers: settings.showOutliers,\n dotShape: settings.dotShape,\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n lineShape: settings.lineType,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'binnedDots') {\n const settings = layerSettings[layer];\n result.push({\n type: 'binnedDots',\n aes: {\n showOutliers: settings.showOutliers,\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'jitteredDots') {\n const settings = layerSettings[layer];\n result.push({\n type: 'dot',\n aes: {\n showOutliers: settings.showOutliers,\n dotFill: useDefaultColor(settings.dotFill),\n dotShape: settings.dotShape,\n lineColor: settings.lineColor,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'violin') {\n const settings = layerSettings[layer];\n result.push({\n type: 'violin',\n stat: {\n trim: settings.trim\n },\n aes: {\n showQuartiles: settings.showQuartiles,\n medianLineStyle: settings.medianLineStyle,\n quartilesLineStyle: settings.quartilesLineStyle,\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n lineShape: settings.lineType,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'bar') {\n const settings = layerSettings[layer];\n result.push({\n type: 'bar',\n height: settings.height,\n aes: {\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'stackedBar') {\n const settings = layerSettings[layer];\n result.push({\n type: 'stackedBar',\n normalize: settings.normalize,\n aes: {\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'line') {\n const settings = layerSettings[layer];\n result.push({\n type: 'line',\n pointsValues: settings.pointsValues,\n aes: {\n lineColor: useDefaultColor(settings.lineColor, true),\n fillColor: useDefaultColor(settings.dotFill, true),\n lineShape: settings.lineType,\n dotShape: settings.dotShape,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'errorbar') {\n const settings = layerSettings[layer];\n result.push({\n type: 'errorbar',\n pointsValues: settings.pointsValues,\n interval: settings.interval,\n aes: {\n lineColor: useDefaultColor(settings.lineColor, true),\n fillColor: useDefaultColor(settings.dotFill, true),\n dotShape: settings.dotShape,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'sina') {\n const settings = layerSettings[layer];\n result.push({\n type: 'sina',\n aes: {\n showOutliers: settings.showOutliers,\n dotFill: useDefaultColor(settings.dotFill),\n dotShape: settings.dotShape\n }\n });\n }\n if (layer === 'logo' && hasSecondaryGrouping) {\n const settings = layerSettings[layer];\n const secondaryGroupingInfo = inputGuide.getSourceInfo(optionsState.components.secondaryGrouping.selectorStates[0].selectedSource);\n const isProtein = secondaryGroupingInfo.spec.domain?.['pl7.app/alphabet'] === 'aminoacid';\n result.push({\n type: 'logo',\n normalize: settings.normalize,\n aes: {\n opacity: settings.opacity,\n dotFill: isProtein ? AMINOACID_COLOR_MAPPING : NUCLEOTIDE_COLOR_MAPPING\n }\n });\n }\n });\n if (hasPrimaryGrouping && !hasSecondaryGrouping) {\n result.push(...getStatLayers(statisticsSettings));\n }\n return result;\n}\n\nfunction getDotSize(\n column: ColumnNameSchema | undefined,\n dotSize: ContinuousDataMappingSize | number | null,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n defaultDotSize: number\n): number | { columnName: ColumnNameSchema, domain: number[], range: number[] } {\n if (column) {\n const mapping = isContinuousDataMapping(dotSize) ? dotSize : { column: column.value, range: DEFAULT_DOT_RANGE };\n const domain = [Infinity, -Infinity];\n dataByColumns.values[column.value].forEach((v) => {\n const value = Number(v);\n if (value < domain[0]) {\n domain[0] = value;\n }\n if (value > domain[1]) {\n domain[1] = value;\n }\n });\n return { columnName: column, domain, range: [mapping.range.min, mapping.range.max] };\n }\n return isContinuousDataMapping(dotSize) ? defaultDotSize : dotSize ?? defaultDotSize;\n}\n\nfunction getContinuousColor<T extends string>(\n columnKey: string,\n value: AestheticMappingContinuous,\n groupingColumns: ColumnNameSchema[],\n dataByColumns: PlotDataAndSettings['data']['byColumns']\n): T | ContinuousDataMappingForGraph<T> {\n const column = groupingColumns.find(groupingColumn => groupingColumn.value === columnKey);\n let domain = [Infinity, -Infinity];\n if (column) {\n const { range, palette, midPoint, log } = value;\n const minValueMissed = range?.minValue === null || range?.minValue === undefined;\n const maxValueMissed = range?.maxValue === null || range?.maxValue === undefined;\n if (minValueMissed || maxValueMissed) {\n dataByColumns.values[column.value].forEach((v) => {\n const value = Number(v);\n if (minValueMissed && value < domain[0]) {\n domain[0] = value;\n }\n if (maxValueMissed && value > domain[1]) {\n domain[1] = value;\n }\n });\n }\n if (!minValueMissed) {\n domain[0] = range?.minValue as number;\n }\n if (!maxValueMissed) {\n domain[1] = range?.maxValue as number;\n }\n if (midPoint !== null && midPoint !== undefined) {\n const maxDistance = Math.max(Math.abs(midPoint - domain[0]), Math.abs(midPoint - domain[1]));\n domain[0] = midPoint - maxDistance;\n domain[1] = midPoint + maxDistance;\n }\n\n return {\n columnName: column,\n domain,\n range: PALETTE_MAP[palette].colors,\n type: log ? 'log' : 'linear'\n } as ContinuousDataMappingForGraph<T>;\n }\n return DEFAULT_BLACK as T;\n}\n\nexport function getScatterplotLayersSettings(\n layers: Layer[],\n layerSettings: ReturnType<typeof getDefaultLayersSettings>,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n optionsState: ScatterplotUIState,\n dataBindAes: ReactiveState['dataBindAes'],\n inputGuide: InputGuide<InputState>,\n groupingSchema: ColumnNameSchema[] = [],\n defaultDotSize = DEFAULT_DOT_SIZE\n): ScatterplotSettings['layers'] {\n const result: ScatterplotSettings['layers'] = [];\n\n function useDefault<T extends string>(value: T | MappingLink | null, columns: string[], defaultValue: T, continousAvailable = false): T | {\n type: 'grouping',\n value: string\n } | ContinuousDataMappingForGraph<T> {\n if (columns.length) {\n const valueType = columns.length ? inputGuide.getSourceInfo(columns[0])?.type : undefined;\n const defaultByColumn = (valueType === 'String' || !continousAvailable)\n ? { type: 'grouping', value: columns[0] } as { type: 'grouping', value: string }\n : getContinuousColor<T>(columns[0], createContinuousMappingFromPalette(DEFAULT_CONTINUOUS_PALETTE), groupingSchema, dataByColumns);\n\n const savedMapping = dataBindAes[columns[0]];\n\n if (value === null || (valueType === 'String' || !continousAvailable) || !isAestheticMappingContinuous(savedMapping)) {\n return defaultByColumn;\n }\n return getContinuousColor<T>(columns[0], savedMapping as AestheticMappingContinuous, groupingSchema, dataByColumns);\n }\n\n return typeof value === 'object' ? defaultValue : value as T;\n }\n\n const grouping = optionsState.components.grouping.selectorStates.map((s) => s.selectedSource);\n const shape = optionsState.components.shape?.selectorStates.map((s) => s.selectedSource) ?? [];\n const sizeKey = optionsState.components.size?.selectorStates.map((s) => s.selectedSource)[0];\n const sizeColumn = sizeKey ? groupingSchema.find(column => column.value === sizeKey) : undefined;\n\n layers.forEach((layer) => {\n if (layer === 'dots') {\n const settings = layerSettings[layer];\n result.push({\n type: 'dots',\n aes: {\n dotFill: useDefault<string>(settings.dotFill, grouping, DEFAULT_BLACK, true) as string | {\n type: 'grouping',\n value: string\n } | ContinuousDataMappingForGraph<string>,\n dotShape: useDefault<DotShape>(settings.dotShape, shape, DEFAULT_DOT_SHAPE) as {\n type: 'grouping',\n value: string\n } | DotShape,\n dotSize: getDotSize(sizeColumn, settings.dotSize, dataByColumns, defaultDotSize)\n }\n });\n }\n if (layer === 'curve') {\n const settings = layerSettings[layer];\n result.push({\n type: 'curve',\n smoothing: settings.smoothing,\n aes: {\n lineColor: useDefault<string>(settings.lineColor, grouping, DEFAULT_BLACK, true) as {\n type: 'grouping',\n value: string\n } | string\n }\n });\n }\n });\n return result;\n}\n\nexport type ChartLayerSettings = {\n [key: string]: string | boolean | null | Record<string, string | DotShape | NumberRange | {\n domain: number[],\n range: number[]\n } | LineType | boolean | number | MappingLink | Record<string, string>> | undefined;\n type: string,\n aes?: Record<string, string | DotShape | NumberRange | {\n domain: number[],\n range: number[]\n } | LineType | boolean | number | MappingLink | Record<string, string>>,\n}\n"],"names":["getStatLayers","statisticsSettings","layers","layer","getDiscreteLayersSettings","layerSettings","optionsState","inputGuide","result","hasPrimaryGrouping","hasSecondaryGrouping","useDefaultColor","value","onlySecondaryAvailable","settings","isProtein","_a","AMINOACID_COLOR_MAPPING","NUCLEOTIDE_COLOR_MAPPING","getDotSize","column","dotSize","dataByColumns","defaultDotSize","mapping","isContinuousDataMapping","DEFAULT_DOT_RANGE","domain","v","getContinuousColor","columnKey","groupingColumns","groupingColumn","range","palette","midPoint","log","minValueMissed","maxValueMissed","maxDistance","PALETTE_MAP","DEFAULT_BLACK","getScatterplotLayersSettings","dataBindAes","groupingSchema","DEFAULT_DOT_SIZE","useDefault","columns","defaultValue","continousAvailable","valueType","defaultByColumn","createContinuousMappingFromPalette","DEFAULT_CONTINUOUS_PALETTE","savedMapping","isAestheticMappingContinuous","grouping","s","shape","sizeKey","_b","sizeColumn","DEFAULT_DOT_SHAPE"],"mappings":";;;AAsCO,SAASA,EAAcC,GAA6C;AACzE,QAAMC,IAA+B,CAAA;AAWrC,MATED,EAAmB,QAAQ,KAAK,cAChCA,EAAmB,QAAQ,SAAS,cAEpCC,EAAO,KAAK;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAYD,EAAmB,QAAQ,KAAK;AAAA,EAAA,CAC7C,GAGDA,EAAmB,eAAe,KAAK,cACvCA,EAAmB,eAAe,SAAS,cAC3CA,EAAmB,eAAe,SAAS,gBAC3C;AACA,UAAME,IAA4B;AAAA,MAChC,MAAM;AAAA,MACN,UAAU;AAAA,MACV,YAAYF,EAAmB,eAAe,KAAK;AAAA,MACnD,gBAAgBA,EAAmB,eAAe,KAAK;AAAA,MACvD,QAAQA,EAAmB,eAAe,KAAK;AAAA,MAC/C,IAAIA,EAAmB,eAAe,KAAK;AAAA,IAAA;AAE7C,IAAIA,EAAmB,eAAe,KAAK,qBAAqB,WAC9DE,EAAM,mBACJF,EAAmB,eAAe,KAAK,mBAE3CC,EAAO,KAAKC,CAAK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AAK;AACpC,MAAAK,EAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,WAAWM,EAAS;AAAA,QACpB,KAAK;AAAA,UACH,WAAWgC,EAAmBhC,EAAS,WAAW0C,GAAUf,GAAe,EAAI;AAAA,QAAA;AAAA,MAIjF,CACD;AAAA,IACH;AAAA,EACF,CAAC,GACMjC;AACT;"}
|
|
1
|
+
{"version":3,"file":"getLayersDataFromForms.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.ts"],"sourcesContent":["import {\n ColorAes,\n getDefaultLayersSettings,\n NumberRange,\n LayersSettings,\n MappingLink,\n DiscreteStatisticsState,\n ColumnNameSchema,\n ContinuousDataMappingSize,\n isContinuousDataMapping,\n ContinuousDataMappingForGraph\n} from '../../constantsCommon';\nimport {\n Layer,\n ReactiveState\n} from '../../types';\nimport {\n DiscreteUIState, InputGuide,\n InputState,\n PlotDataAndSettings,\n ScatterplotUIState\n} from '@milaboratories/pf-plots';\nimport { DotShape, LineType } from '../../components/AesSettings/types';\nimport {\n AMINOACID_COLOR_MAPPING,\n DEFAULT_BLACK,\n DEFAULT_CONTINUOUS_PALETTE,\n DEFAULT_DOT_SHAPE, NUCLEOTIDE_COLOR_MAPPING,\n PALETTE_MAP\n} from '../../constantsAesthetic';\nimport {\n AestheticMappingContinuous, createContinuousMappingFromPalette,\n DEFAULT_DOT_RANGE,\n DEFAULT_DOT_SIZE\n} from '../../dataBindAes';\nimport { ScatterplotSettings } from '@milaboratories/miplots4';\nimport { isAestheticMappingContinuous } from '../../dataBindAes';\n\nexport function getStatLayers(statisticsSettings: DiscreteStatisticsState) {\n const layers: ChartLayerSettings[] = [];\n if (\n statisticsSettings.overall.data.testMethod &&\n statisticsSettings.overall.validity.testMethod\n ) {\n layers.push({\n type: 'stat',\n statType: 'overall',\n testMethod: statisticsSettings.overall.data.testMethod\n });\n }\n if (\n statisticsSettings.referenceGroup.data.testMethod &&\n statisticsSettings.referenceGroup.validity.testMethod &&\n statisticsSettings.referenceGroup.validity.referenceGroup\n ) {\n const layer: ChartLayerSettings = {\n type: 'stat',\n statType: 'referenceGroup',\n testMethod: statisticsSettings.referenceGroup.data.testMethod,\n referenceGroup: statisticsSettings.referenceGroup.data.referenceGroup,\n format: statisticsSettings.referenceGroup.data.format,\n ns: statisticsSettings.referenceGroup.data.ns\n };\n if (statisticsSettings.referenceGroup.data.correctionMethod !== 'none') {\n layer.correctionMethod =\n statisticsSettings.referenceGroup.data.correctionMethod;\n }\n layers.push(layer);\n }\n if (\n statisticsSettings.pairwise.data.testMethod &&\n statisticsSettings.pairwise.validity.testMethod\n ) {\n const layer: ChartLayerSettings = {\n type: 'stat',\n statType: 'pairwise',\n testMethod: statisticsSettings.pairwise.data.testMethod,\n format: statisticsSettings.pairwise.data.format,\n ns: statisticsSettings.pairwise.data.ns\n };\n if (statisticsSettings.referenceGroup.data.correctionMethod !== 'none') {\n layer.correctionMethod =\n statisticsSettings.referenceGroup.data.correctionMethod;\n }\n layers.push(layer);\n }\n return layers;\n}\n\nexport function getDiscreteLayersSettings(\n layers: Layer[],\n layerSettings: LayersSettings,\n statisticsSettings: DiscreteStatisticsState,\n optionsState: DiscreteUIState,\n inputGuide: InputGuide<InputState>\n): ChartLayerSettings[] {\n const result: ChartLayerSettings[] = [];\n const hasPrimaryGrouping =\n optionsState.components.primaryGrouping.selectorStates.length > 0;\n const hasSecondaryGrouping =\n optionsState.components.secondaryGrouping.selectorStates.length > 0;\n // If user didn't touch layers settings, some aes that can be mapped to groupings has 'null' value - we set them to secondary or primary grouping if available\n // for 'line', 'errorbar' layer it isn't possible to set primary grouping as a color aes\n function useDefaultColor(\n value: ColorAes | null,\n onlySecondaryAvailable = false\n ) {\n if (value === null) {\n if (hasSecondaryGrouping) {\n return { type: 'secondaryGrouping' };\n }\n if (hasPrimaryGrouping && !onlySecondaryAvailable) {\n return { type: 'primaryGrouping' };\n }\n return { type: 'secondaryGrouping' };\n }\n return value;\n }\n\n layers.forEach((layer) => {\n if (layer === 'box') {\n const settings = layerSettings[layer];\n result.push({\n type: 'box',\n aes: {\n showOutliers: settings.showOutliers,\n dotShape: settings.dotShape,\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n lineShape: settings.lineType,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'binnedDots') {\n const settings = layerSettings[layer];\n result.push({\n type: 'binnedDots',\n aes: {\n showOutliers: settings.showOutliers,\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'jitteredDots') {\n const settings = layerSettings[layer];\n result.push({\n type: 'dot',\n aes: {\n showOutliers: settings.showOutliers,\n dotFill: useDefaultColor(settings.dotFill),\n dotShape: settings.dotShape,\n lineColor: settings.lineColor,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'violin') {\n const settings = layerSettings[layer];\n result.push({\n type: 'violin',\n stat: {\n trim: settings.trim\n },\n aes: {\n showQuartiles: settings.showQuartiles,\n medianLineStyle: settings.medianLineStyle,\n quartilesLineStyle: settings.quartilesLineStyle,\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n lineShape: settings.lineType,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'bar') {\n const settings = layerSettings[layer];\n result.push({\n type: 'bar',\n height: settings.height,\n aes: {\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'stackedBar') {\n const settings = layerSettings[layer];\n result.push({\n type: 'stackedBar',\n normalize: settings.normalize,\n aes: {\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'stackedArea') {\n const settings = layerSettings[layer];\n result.push({\n type: 'stackedArea',\n normalize: settings.normalize,\n showBars: settings.showBars,\n aes: {\n fillColor: useDefaultColor(settings.fillColor),\n lineColor: useDefaultColor(settings.lineColor),\n barsOpacity: settings.barsOpacity,\n areaOpacity: settings.areaOpacity,\n }\n });\n }\n if (layer === 'line') {\n const settings = layerSettings[layer];\n result.push({\n type: 'line',\n pointsValues: settings.pointsValues,\n aes: {\n lineColor: useDefaultColor(settings.lineColor, true),\n fillColor: useDefaultColor(settings.dotFill, true),\n lineShape: settings.lineType,\n dotShape: settings.dotShape,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'errorbar') {\n const settings = layerSettings[layer];\n result.push({\n type: 'errorbar',\n pointsValues: settings.pointsValues,\n interval: settings.interval,\n aes: {\n lineColor: useDefaultColor(settings.lineColor, true),\n fillColor: useDefaultColor(settings.dotFill, true),\n dotShape: settings.dotShape,\n opacity: settings.opacity\n }\n });\n }\n if (layer === 'sina') {\n const settings = layerSettings[layer];\n result.push({\n type: 'sina',\n aes: {\n showOutliers: settings.showOutliers,\n dotFill: useDefaultColor(settings.dotFill),\n dotShape: settings.dotShape\n }\n });\n }\n if (layer === 'logo' && hasSecondaryGrouping) {\n const settings = layerSettings[layer];\n const secondaryGroupingInfo = inputGuide.getSourceInfo(optionsState.components.secondaryGrouping.selectorStates[0].selectedSource);\n const isProtein = secondaryGroupingInfo.spec.domain?.['pl7.app/alphabet'] === 'aminoacid';\n result.push({\n type: 'logo',\n normalize: settings.normalize,\n aes: {\n opacity: settings.opacity,\n dotFill: isProtein ? AMINOACID_COLOR_MAPPING : NUCLEOTIDE_COLOR_MAPPING\n }\n });\n }\n });\n if (hasPrimaryGrouping && !hasSecondaryGrouping) {\n result.push(...getStatLayers(statisticsSettings));\n }\n return result;\n}\n\nfunction getDotSize(\n column: ColumnNameSchema | undefined,\n dotSize: ContinuousDataMappingSize | number | null,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n defaultDotSize: number\n): number | { columnName: ColumnNameSchema, domain: number[], range: number[] } {\n if (column) {\n const mapping = isContinuousDataMapping(dotSize) ? dotSize : { column: column.value, range: DEFAULT_DOT_RANGE };\n const domain = [Infinity, -Infinity];\n dataByColumns.values[column.value].forEach((v) => {\n const value = Number(v);\n if (value < domain[0]) {\n domain[0] = value;\n }\n if (value > domain[1]) {\n domain[1] = value;\n }\n });\n return { columnName: column, domain, range: [mapping.range.min, mapping.range.max] };\n }\n return isContinuousDataMapping(dotSize) ? defaultDotSize : dotSize ?? defaultDotSize;\n}\n\nfunction getContinuousColor<T extends string>(\n columnKey: string,\n value: AestheticMappingContinuous,\n groupingColumns: ColumnNameSchema[],\n dataByColumns: PlotDataAndSettings['data']['byColumns']\n): T | ContinuousDataMappingForGraph<T> {\n const column = groupingColumns.find(groupingColumn => groupingColumn.value === columnKey);\n let domain = [Infinity, -Infinity];\n if (column) {\n const { range, palette, midPoint, log } = value;\n const minValueMissed = range?.minValue === null || range?.minValue === undefined;\n const maxValueMissed = range?.maxValue === null || range?.maxValue === undefined;\n if (minValueMissed || maxValueMissed) {\n dataByColumns.values[column.value].forEach((v) => {\n const value = Number(v);\n if (minValueMissed && value < domain[0]) {\n domain[0] = value;\n }\n if (maxValueMissed && value > domain[1]) {\n domain[1] = value;\n }\n });\n }\n if (!minValueMissed) {\n domain[0] = range?.minValue as number;\n }\n if (!maxValueMissed) {\n domain[1] = range?.maxValue as number;\n }\n if (midPoint !== null && midPoint !== undefined) {\n const maxDistance = Math.max(Math.abs(midPoint - domain[0]), Math.abs(midPoint - domain[1]));\n domain[0] = midPoint - maxDistance;\n domain[1] = midPoint + maxDistance;\n }\n\n return {\n columnName: column,\n domain,\n range: PALETTE_MAP[palette].colors,\n type: log ? 'log' : 'linear'\n } as ContinuousDataMappingForGraph<T>;\n }\n return DEFAULT_BLACK as T;\n}\n\nexport function getScatterplotLayersSettings(\n layers: Layer[],\n layerSettings: ReturnType<typeof getDefaultLayersSettings>,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n optionsState: ScatterplotUIState,\n dataBindAes: ReactiveState['dataBindAes'],\n inputGuide: InputGuide<InputState>,\n groupingSchema: ColumnNameSchema[] = [],\n defaultDotSize = DEFAULT_DOT_SIZE\n): ScatterplotSettings['layers'] {\n const result: ScatterplotSettings['layers'] = [];\n\n function useDefault<T extends string>(value: T | MappingLink | null, columns: string[], defaultValue: T, continousAvailable = false): T | {\n type: 'grouping',\n value: string\n } | ContinuousDataMappingForGraph<T> {\n if (columns.length) {\n const valueType = columns.length ? inputGuide.getSourceInfo(columns[0])?.type : undefined;\n const defaultByColumn = (valueType === 'String' || !continousAvailable)\n ? { type: 'grouping', value: columns[0] } as { type: 'grouping', value: string }\n : getContinuousColor<T>(columns[0], createContinuousMappingFromPalette(DEFAULT_CONTINUOUS_PALETTE), groupingSchema, dataByColumns);\n\n const savedMapping = dataBindAes[columns[0]];\n\n if (value === null || (valueType === 'String' || !continousAvailable) || !isAestheticMappingContinuous(savedMapping)) {\n return defaultByColumn;\n }\n return getContinuousColor<T>(columns[0], savedMapping as AestheticMappingContinuous, groupingSchema, dataByColumns);\n }\n\n return typeof value === 'object' ? defaultValue : value as T;\n }\n\n const grouping = optionsState.components.grouping.selectorStates.map((s) => s.selectedSource);\n const shape = optionsState.components.shape?.selectorStates.map((s) => s.selectedSource) ?? [];\n const sizeKey = optionsState.components.size?.selectorStates.map((s) => s.selectedSource)[0];\n const sizeColumn = sizeKey ? groupingSchema.find(column => column.value === sizeKey) : undefined;\n\n layers.forEach((layer) => {\n if (layer === 'dots') {\n const settings = layerSettings[layer];\n result.push({\n type: 'dots',\n aes: {\n dotFill: useDefault<string>(settings.dotFill, grouping, DEFAULT_BLACK, true) as string | {\n type: 'grouping',\n value: string\n } | ContinuousDataMappingForGraph<string>,\n dotShape: useDefault<DotShape>(settings.dotShape, shape, DEFAULT_DOT_SHAPE) as {\n type: 'grouping',\n value: string\n } | DotShape,\n dotSize: getDotSize(sizeColumn, settings.dotSize, dataByColumns, defaultDotSize)\n }\n });\n }\n if (layer === 'curve') {\n const settings = layerSettings[layer];\n result.push({\n type: 'curve',\n smoothing: settings.smoothing,\n aes: {\n lineColor: useDefault<string>(settings.lineColor, grouping, DEFAULT_BLACK, true) as {\n type: 'grouping',\n value: string\n } | string\n }\n });\n }\n });\n return result;\n}\n\nexport type ChartLayerSettings = {\n [key: string]: string | boolean | null | Record<string, string | DotShape | NumberRange | {\n domain: number[],\n range: number[]\n } | LineType | boolean | number | MappingLink | Record<string, string>> | undefined;\n type: string,\n aes?: Record<string, string | DotShape | NumberRange | {\n domain: number[],\n range: number[]\n } | LineType | boolean | number | MappingLink | Record<string, string>>,\n}\n"],"names":["getStatLayers","statisticsSettings","layers","layer","getDiscreteLayersSettings","layerSettings","optionsState","inputGuide","result","hasPrimaryGrouping","hasSecondaryGrouping","useDefaultColor","value","onlySecondaryAvailable","settings","isProtein","_a","AMINOACID_COLOR_MAPPING","NUCLEOTIDE_COLOR_MAPPING","getDotSize","column","dotSize","dataByColumns","defaultDotSize","mapping","isContinuousDataMapping","DEFAULT_DOT_RANGE","domain","v","getContinuousColor","columnKey","groupingColumns","groupingColumn","range","palette","midPoint","log","minValueMissed","maxValueMissed","maxDistance","PALETTE_MAP","DEFAULT_BLACK","getScatterplotLayersSettings","dataBindAes","groupingSchema","DEFAULT_DOT_SIZE","useDefault","columns","defaultValue","continousAvailable","valueType","defaultByColumn","createContinuousMappingFromPalette","DEFAULT_CONTINUOUS_PALETTE","savedMapping","isAestheticMappingContinuous","grouping","s","shape","sizeKey","_b","sizeColumn","DEFAULT_DOT_SHAPE"],"mappings":";;;AAsCO,SAASA,EAAcC,GAA6C;AACzE,QAAMC,IAA+B,CAAA;AAWrC,MATED,EAAmB,QAAQ,KAAK,cAChCA,EAAmB,QAAQ,SAAS,cAEpCC,EAAO,KAAK;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAYD,EAAmB,QAAQ,KAAK;AAAA,EAAA,CAC7C,GAGDA,EAAmB,eAAe,KAAK,cACvCA,EAAmB,eAAe,SAAS,cAC3CA,EAAmB,eAAe,SAAS,gBAC3C;AACA,UAAME,IAA4B;AAAA,MAChC,MAA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yC,MAAMA,EAAE,oBAAmB,CAAA,GACtFE,KAAUC,IAAAtD,EAAa,WAAW,SAAxB,gBAAAsD,EAA8B,eAAe,IAAI,CAACH,MAAMA,EAAE,gBAAgB,IACpFI,IAAaF,IAAUf,EAAe,KAAK,OAAUxB,EAAO,UAAUuC,CAAO,IAAI;AAEvF,SAAAzD,EAAO,QAAQ,CAACC,MAAU;AACxB,QAAIA,MAAU,QAAQ;AACpB,YAAMW,IAAWT,EAAcF,CAAK;AACpC,MAAAK,EAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,KAAK;AAAA,UACH,SAASsC,EAAmBhC,EAAS,SAAS0C,GAAUf,GAAe,EAAI;AAAA,UAI3E,UAAUK,EAAqBhC,EAAS,UAAU4C,GAAOI,CAAiB;AAAA,UAI1E,SAAS3C,EAAW0C,GAAY/C,EAAS,SAASQ,GAAeC,CAAc;AAAA,QAAA;AAAA,MACjF,CACD;AAAA,IACH;AACA,QAAIpB,MAAU,SAAS;AACrB,YAAMW,IAAWT,EAAcF,CAAK;AACpC,MAAAK,EAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,WAAWM,EAAS;AAAA,QACpB,KAAK;AAAA,UACH,WAAWgC,EAAmBhC,EAAS,WAAW0C,GAAUf,GAAe,EAAI;AAAA,QAAA;AAAA,MAIjF,CACD;AAAA,IACH;AAAA,EACF,CAAC,GACMjC;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadUniqueValuesToSave.d.ts","sourceRoot":"","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"loadUniqueValuesToSave.d.ts","sourceRoot":"","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAqBnD,wBAAsB,iCAAiC,CACrD,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,oBAAoB,EAAE,uBAAuB,GAC5C,OAAO,CAAC,uBAAuB,CAAC,CAoHlC;AACD,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,oBAAoB,EAAE,uBAAuB,GAC7C,OAAO,CAAC,uBAAuB,CAAC,CAwDjC;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAuBpC"}
|
|
@@ -1,89 +1,93 @@
|
|
|
1
1
|
import { AXIS_NATURE_KEY as g } from "../constantsCommon.js";
|
|
2
|
-
const
|
|
2
|
+
const A = 100, T = ["primaryGrouping", "secondaryGrouping"], y = ["grouping"], I = ["x", "y"], R = ["grouping"], d = [
|
|
3
3
|
"nodeColor",
|
|
4
4
|
"nodeShape",
|
|
5
5
|
"lineColor",
|
|
6
6
|
"heatmapAnnotation"
|
|
7
7
|
// dendro
|
|
8
|
-
],
|
|
9
|
-
async function
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const t = o.data.byColumns.values[s], n = e ? o.data.byColumns.values[e] : null, S = /* @__PURE__ */ new Set(),
|
|
8
|
+
], L = (o) => o.sort((a, _) => a.label.localeCompare(_.label, "en", { numeric: !0 }));
|
|
9
|
+
async function m(o, a, _, v, f) {
|
|
10
|
+
const u = {};
|
|
11
|
+
function i(s, e) {
|
|
12
|
+
const t = o.data.byColumns.values[s], n = e ? o.data.byColumns.values[e] : null, S = /* @__PURE__ */ new Set(), p = [];
|
|
13
13
|
for (let l = 0; l < t.length; l++) {
|
|
14
14
|
const r = String(t[l]);
|
|
15
15
|
if (S.has(r) || t[l] === null)
|
|
16
16
|
continue;
|
|
17
|
-
if (S.size ===
|
|
18
|
-
|
|
17
|
+
if (S.size === A) {
|
|
18
|
+
u[s] = null;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
S.add(r);
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const E = n ? String(n[l]) : r;
|
|
23
|
+
p.push({ value: r, label: E });
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
list:
|
|
27
|
-
labels:
|
|
28
|
-
options:
|
|
25
|
+
L(p), u[s] = {
|
|
26
|
+
list: p.map((l) => l.value),
|
|
27
|
+
labels: p.reduce((l, r) => (l[r.value] = r.value, l), {}),
|
|
28
|
+
options: p
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
o.settings.type === "discrete" &&
|
|
31
|
+
o.settings.type === "discrete" && T.forEach((s) => {
|
|
32
32
|
const e = o.settings[s];
|
|
33
33
|
if (e) {
|
|
34
34
|
const { columnName: t } = e;
|
|
35
|
-
|
|
35
|
+
i(t.value, t.valueLabels);
|
|
36
36
|
}
|
|
37
|
-
}), (o.settings.type === "scatterplot" || o.settings.type === "scatterplot-umap") &&
|
|
37
|
+
}), (o.settings.type === "scatterplot" || o.settings.type === "scatterplot-umap") && (I.forEach((s) => {
|
|
38
|
+
const e = o.settings[s];
|
|
39
|
+
e && a.getSourceInfo(e.value).type === "String" && i(e.value, e.valueLabels);
|
|
40
|
+
}), y.forEach((s) => {
|
|
38
41
|
const e = o.settings[s];
|
|
39
42
|
e == null || e.forEach(({ columnName: t }) => {
|
|
40
|
-
|
|
43
|
+
const n = a.getSourceInfo(t.value).type;
|
|
44
|
+
(n === "String" || n === "Int" || n === "Long") && i(t.value, t.valueLabels);
|
|
41
45
|
});
|
|
42
|
-
}), o.settings.type === "histogram" && R.forEach((s) => {
|
|
46
|
+
})), o.settings.type === "histogram" && R.forEach((s) => {
|
|
43
47
|
const e = o.settings[s];
|
|
44
|
-
e &&
|
|
45
|
-
}), o.settings.type === "dendro" &&
|
|
48
|
+
e && i(e.value, e.valueLabels);
|
|
49
|
+
}), o.settings.type === "dendro" && d.forEach((s) => {
|
|
46
50
|
const e = o.settings[s];
|
|
47
|
-
e &&
|
|
51
|
+
e && i(e.value, e.valueLabels);
|
|
48
52
|
});
|
|
49
|
-
const
|
|
50
|
-
[...
|
|
53
|
+
const c = [];
|
|
54
|
+
[...a.freeOptionsSet].forEach((s) => {
|
|
51
55
|
var t, n, S;
|
|
52
|
-
const e =
|
|
53
|
-
e.kind === "axis" && ((t = e.annotations) != null && t[g]) && ((n = e.annotations) == null ? void 0 : n[g]) !== "homogeneous" && ((S = e.annotations) == null ? void 0 : S[g]) !== "homogenous" &&
|
|
56
|
+
const e = a.getSourceInfo(s);
|
|
57
|
+
e.kind === "axis" && ((t = e.annotations) != null && t[g]) && ((n = e.annotations) == null ? void 0 : n[g]) !== "homogeneous" && ((S = e.annotations) == null ? void 0 : S[g]) !== "homogenous" && c.push(s);
|
|
54
58
|
});
|
|
55
|
-
for (const s of
|
|
56
|
-
if (!
|
|
57
|
-
if (f[s] && !
|
|
58
|
-
|
|
59
|
-
else if (
|
|
60
|
-
const e = await
|
|
61
|
-
e.overflow ?
|
|
59
|
+
for (const s of c)
|
|
60
|
+
if (!u[s]) {
|
|
61
|
+
if (f[s] && !u[s])
|
|
62
|
+
u[s] = f[s];
|
|
63
|
+
else if (v) {
|
|
64
|
+
const e = await _.getUniqueSourceValuesWithLabels(v, a, s, A);
|
|
65
|
+
e.overflow ? u[s] = null : u[s] = {
|
|
62
66
|
list: e.values.map((t) => t.value),
|
|
63
67
|
options: e.values,
|
|
64
68
|
labels: e.values.reduce((t, n) => (t[n.value] = n.label, t), {})
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
return
|
|
72
|
+
return u;
|
|
69
73
|
}
|
|
70
|
-
async function N(o,
|
|
74
|
+
async function N(o, a, _, v) {
|
|
71
75
|
const f = [];
|
|
72
|
-
["filters", "tabBy"].forEach((
|
|
73
|
-
const s = o[
|
|
76
|
+
["filters", "tabBy"].forEach((c) => {
|
|
77
|
+
const s = o[c];
|
|
74
78
|
if (s)
|
|
75
79
|
for (const { selectedSource: e, selectedFilterValue: t, type: n } of s.selectorStates)
|
|
76
|
-
|
|
80
|
+
c === "filters" && n === "equals" && t ? f.push([e, t]) : t && f.push([e, t]);
|
|
77
81
|
});
|
|
78
|
-
const
|
|
79
|
-
for (const [
|
|
80
|
-
const e = await
|
|
81
|
-
e.values.length === 1 && (c
|
|
82
|
+
const i = {};
|
|
83
|
+
for (const [c, s] of f) {
|
|
84
|
+
const e = await _.getUniqueSourceValuesWithLabels(v, a, c, 1, void 0, s);
|
|
85
|
+
e.values.length === 1 && (i[c] = e.values[0]);
|
|
82
86
|
}
|
|
83
|
-
return
|
|
87
|
+
return i;
|
|
84
88
|
}
|
|
85
89
|
export {
|
|
86
|
-
|
|
90
|
+
m as getUniqueValuesFromReadyChartData,
|
|
87
91
|
N as loadFilterLabelsForTitle
|
|
88
92
|
};
|
|
89
93
|
//# sourceMappingURL=loadUniqueValuesToSave.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadUniqueValuesToSave.js","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"sourcesContent":["import { AXIS_NATURE_KEY } from '../constantsCommon';\nimport { UniqueValuesBySourceMap, UniqueValuesData } from '../types';\nimport {\n Controller,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter\n} from '@milaboratories/pf-plots';\nimport { ListOption } from '@platforma-sdk/ui-vue';\nimport { DendroSettings, DiscreteSettings, HistogramSettings, ScatterplotSettings } from '@milaboratories/miplots4';\n\nconst INPUTS_REQUESTING_UNIQUE_VALUES = [\n 'primaryGrouping', 'secondaryGrouping', // discrete charts\n 'grouping', 'shape', // scatterplot\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation', // dendro\n 'filters', 'highlight', 'tabBy' // all\n] as ((keyof InputState['components'])[]);\nconst SAVED_UNIQUE_VALUES_LIMIT = 100;\n\nconst SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS = ['primaryGrouping', 'secondaryGrouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS = ['grouping'];\nconst SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING = ['grouping'];\nconst SAVED_IN_CHART_DATA_DENDRO_GROUPING = [\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation' // dendro\n];\n\nconst sortValues = (values:{value:string, label:string}[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', {numeric: true}))\n\nexport async function getUniqueValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap\n): Promise<UniqueValuesBySourceMap> {\n const resultMap:UniqueValuesBySourceMap = {};\n function addUniqueData(sourceId:string, labelId?:string) {\n const data = chartData!.data.byColumns.values[sourceId];\n const dataLabels = labelId ? chartData!.data.byColumns.values[labelId] : null;\n\n const resultSet = new Set();\n const result:{value:string, label:string}[] = [];\n for (let i = 0; i < data.length; i++) {\n const v = String(data[i]);\n if (resultSet.has(v) || data[i] === null) {\n continue;\n }\n if (resultSet.size === SAVED_UNIQUE_VALUES_LIMIT) {\n resultMap[sourceId] = null;\n return;\n }\n resultSet.add(v);\n const label = dataLabels ? String(dataLabels[i]) : v;\n result.push({value: v, label});\n }\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.value;\n return res;\n }, {} as Record<string, string>),\n options: result\n };\n }\n if (chartData.settings.type === 'discrete') {\n SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS.forEach((inputName:string) => {\n const savedData = chartData.settings[inputName] as unknown as DiscreteSettings['primaryGrouping'];\n if (savedData) {\n const {columnName} = savedData;\n addUniqueData(columnName.value, columnName.valueLabels)\n }\n });\n }\n if (chartData.settings.type === 'scatterplot' || chartData.settings.type === 'scatterplot-umap') {\n SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS.forEach((inputName:string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({columnName}) => {\n addUniqueData(columnName.value, columnName.valueLabels);\n });\n });\n }\n\n if (chartData.settings.type === 'histogram') {\n SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as HistogramSettings['grouping'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n if (chartData.settings.type === 'dendro') {\n SAVED_IN_CHART_DATA_DENDRO_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as DendroSettings['heatmapAnnotation'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n // sources for loading\n const selectedSources: string[] = [];\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n\n for (const source of selectedSources) {\n if (resultMap[source]) {\n continue;\n }\n if (previousUniqueValues[source] && !resultMap[source]) {\n resultMap[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n resultMap[source] = null;\n } else {\n resultMap[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return resultMap;\n}\nexport async function loadUniqueValuesToSave(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap // save null for too long lists of unique values\n):Promise<UniqueValuesBySourceMap> {\n const selectedSources: string[] = [];\n INPUTS_REQUESTING_UNIQUE_VALUES.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource } of componentState.selectorStates) {\n const info = inputGuide.getSourceInfo(selectedSource);\n if (inputName === 'filters' || inputName === 'highlight') {\n if (info.type === 'String' || info.type === 'Int' || info.type === 'Long') {\n selectedSources.push(selectedSource);\n }\n } else if (inputName === 'grouping') {\n if (info.type === 'String') {\n selectedSources.push(selectedSource);\n }\n } else {\n selectedSources.push(selectedSource);\n }\n }\n }\n });\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n ([...inputGuide.axesToBeFixedSet]).forEach(id => {\n selectedSources.push(id);\n });\n const nextUniqueValuesData: UniqueValuesBySourceMap = {};\n for (const source of selectedSources) {\n if (previousUniqueValues[source]) {\n nextUniqueValuesData[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n nextUniqueValuesData[source] = null;\n } else {\n nextUniqueValuesData[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return nextUniqueValuesData;\n}\n\nexport async function loadFilterLabelsForTitle(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n):Promise<Record<string, ListOption>> {\n const selected: [string, string][] = [];\n const INPUTS_REQUESTING_LABELS = ['filters', 'tabBy'] as ((keyof InputState['components'])[]);\n INPUTS_REQUESTING_LABELS.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource, selectedFilterValue, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (inputName === 'filters' && type === 'equals' && selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n } else if (selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n }\n }\n }\n });\n const result:Record<string, ListOption> = {};\n for (const [source, selectedValue] of selected) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, 1, undefined, selectedValue);\n if (uniqueValuesResponse.values.length === 1) {\n result[source] = uniqueValuesResponse.values[0];\n }\n }\n return result;\n}"],"names":["SAVED_UNIQUE_VALUES_LIMIT","SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS","SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING","SAVED_IN_CHART_DATA_DENDRO_GROUPING","sortValues","values","a","b","getUniqueValuesFromReadyChartData","chartData","inputGuide","controller","dataStore","previousUniqueValues","resultMap","addUniqueData","sourceId","labelId","data","dataLabels","resultSet","result","i","v","label","el","res","inputName","savedData","columnName","savedInGrouping","savedByInputName","selectedSources","id","info","_a","AXIS_NATURE_KEY","_b","_c","source","uniqueValuesResponse","loadFilterLabelsForTitle","optionsState","selected","componentState","selectedSource","selectedFilterValue","type","selectedValue"],"mappings":";AAmBA,MAAMA,IAA4B,KAE5BC,IAAyC,CAAC,mBAAmB,mBAAmB,GAChFC,IAA4C,CAAC,UAAU,GACvDC,IAAyC,CAAC,UAAU,GACpDC,IAAsC;AAAA,EAC1C;AAAA,EAAa;AAAA,EAAa;AAAA,EAAa;AAAA;AACzC,GAEMC,IAAa,CAACC,MAA0CA,EAAO,KAAK,CAACC,GAAGC,MAAMD,EAAE,MAAM,cAAcC,EAAE,OAAO,MAAM,EAAC,SAAS,GAAA,CAAK,CAAC;AAEzI,eAAsBC,EACpBC,GACAC,GACAC,GACAC,GACAC,GACkC;AAClC,QAAMC,IAAoC,CAAA;AAC1C,WAASC,EAAcC,GAAiBC,GAAiB;AACvD,UAAMC,IAAOT,EAAW,KAAK,UAAU,OAAOO,CAAQ,GAChDG,IAAaF,IAAUR,EAAW,KAAK,UAAU,OAAOQ,CAAO,IAAI,MAEnEG,wBAAgB,IAAA,GAChBC,IAAwC,CAAA;AAC9C,aAASC,IAAI,GAAGA,IAAIJ,EAAK,QAAQI,KAAK;AACpC,YAAMC,IAAI,OAAOL,EAAKI,CAAC,CAAC;AACxB,UAAIF,EAAU,IAAIG,CAAC,KAAKL,EAAKI,CAAC,MAAM;AAClC;AAEF,UAAIF,EAAU,SAASrB,GAA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EAAaf,CAAS;AAC7C,QAAIiB;AACF,iBAAW,EAAE,gBAAAC,GAAgB,qBAAAC,GAAqB,MAAAC,EAAA,KAAUH,EAAe;AACzE,QAAIjB,MAAc,aAAaoB,MAAS,YAAYD,IAClDH,EAAS,KAAK,CAACE,GAAgBC,CAAmB,CAAC,IAC1CA,KACTH,EAAS,KAAK,CAACE,GAAgBC,CAAmB,CAAC;AAAA,EAI3D,CAAC;AACD,QAAMzB,IAAoC,CAAA;AAC1C,aAAW,CAACkB,GAAQS,CAAa,KAAKL,GAAU;AAC9C,UAAMH,IAAuB,MAAM7B,EAAW,gCAAgCC,GAAWF,GAAY6B,GAAQ,GAAG,QAAWS,CAAa;AACxI,IAAIR,EAAqB,OAAO,WAAW,MACzCnB,EAAOkB,CAAM,IAAIC,EAAqB,OAAO,CAAC;AAAA,EAElD;AACA,SAAOnB;AACT;"}
|
|
1
|
+
{"version":3,"file":"loadUniqueValuesToSave.js","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"sourcesContent":["import { AXIS_NATURE_KEY } from '../constantsCommon';\nimport { UniqueValuesBySourceMap, UniqueValuesData } from '../types';\nimport {\n Controller,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter\n} from '@milaboratories/pf-plots';\nimport { ListOption } from '@platforma-sdk/ui-vue';\nimport { DendroSettings, DiscreteSettings, HistogramSettings, ScatterplotSettings } from '@milaboratories/miplots4';\n\nconst INPUTS_REQUESTING_UNIQUE_VALUES = [\n 'primaryGrouping', 'secondaryGrouping', // discrete charts\n 'grouping', 'shape', 'x', 'y', // scatterplot\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation', // dendro\n 'filters', 'highlight', 'tabBy' // all\n] as ((keyof InputState['components'])[]);\nconst SAVED_UNIQUE_VALUES_LIMIT = 100;\n\nconst SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS = ['primaryGrouping', 'secondaryGrouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS = ['grouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_XY = ['x', 'y'];\nconst SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING = ['grouping'];\nconst SAVED_IN_CHART_DATA_DENDRO_GROUPING = [\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation' // dendro\n];\n\nconst sortValues = (values:{value:string, label:string}[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', {numeric: true}))\n\nexport async function getUniqueValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap\n): Promise<UniqueValuesBySourceMap> {\n const resultMap:UniqueValuesBySourceMap = {};\n function addUniqueData(sourceId:string, labelId?:string) {\n const data = chartData!.data.byColumns.values[sourceId];\n const dataLabels = labelId ? chartData!.data.byColumns.values[labelId] : null;\n\n const resultSet = new Set();\n const result:{value:string, label:string}[] = [];\n for (let i = 0; i < data.length; i++) {\n const v = String(data[i]);\n if (resultSet.has(v) || data[i] === null) {\n continue;\n }\n if (resultSet.size === SAVED_UNIQUE_VALUES_LIMIT) {\n resultMap[sourceId] = null;\n return;\n }\n resultSet.add(v);\n const label = dataLabels ? String(dataLabels[i]) : v;\n result.push({value: v, label});\n }\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.value;\n return res;\n }, {} as Record<string, string>),\n options: result\n };\n }\n if (chartData.settings.type === 'discrete') {\n SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS.forEach((inputName:string) => {\n const savedData = chartData.settings[inputName] as unknown as DiscreteSettings['primaryGrouping'];\n if (savedData) {\n const {columnName} = savedData;\n addUniqueData(columnName.value, columnName.valueLabels)\n }\n });\n }\n if (chartData.settings.type === 'scatterplot' || chartData.settings.type === 'scatterplot-umap') {\n SAVED_IN_CHART_DATA_SCATTERPLOT_XY.forEach((inputName:string) => {\n const columnName = chartData.settings[inputName] as unknown as ScatterplotSettings['x'];\n if (columnName) {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String') {\n addUniqueData(columnName.value, columnName.valueLabels);\n }\n }\n });\n SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS.forEach((inputName:string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({columnName}) => {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String' || valueType === 'Int' || valueType === 'Long') {\n addUniqueData(columnName.value, columnName.valueLabels);\n }\n });\n });\n }\n\n if (chartData.settings.type === 'histogram') {\n SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as HistogramSettings['grouping'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n if (chartData.settings.type === 'dendro') {\n SAVED_IN_CHART_DATA_DENDRO_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as DendroSettings['heatmapAnnotation'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n // sources for loading\n const selectedSources: string[] = [];\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n\n for (const source of selectedSources) {\n if (resultMap[source]) {\n continue;\n }\n if (previousUniqueValues[source] && !resultMap[source]) {\n resultMap[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n resultMap[source] = null;\n } else {\n resultMap[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return resultMap;\n}\nexport async function loadUniqueValuesToSave(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap // save null for too long lists of unique values\n):Promise<UniqueValuesBySourceMap> {\n const selectedSources: string[] = [];\n INPUTS_REQUESTING_UNIQUE_VALUES.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource } of componentState.selectorStates) {\n const info = inputGuide.getSourceInfo(selectedSource);\n if (inputName === 'filters' || inputName === 'highlight') {\n if (info.type === 'String' || info.type === 'Int' || info.type === 'Long') {\n selectedSources.push(selectedSource);\n }\n } else if (inputName === 'grouping' || inputName === 'x' || inputName === 'y') {\n if (info.type === 'String') {\n selectedSources.push(selectedSource);\n }\n } else {\n selectedSources.push(selectedSource);\n }\n }\n }\n });\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n ([...inputGuide.axesToBeFixedSet]).forEach(id => {\n selectedSources.push(id);\n });\n const nextUniqueValuesData: UniqueValuesBySourceMap = {};\n for (const source of selectedSources) {\n if (previousUniqueValues[source]) {\n nextUniqueValuesData[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n nextUniqueValuesData[source] = null;\n } else {\n nextUniqueValuesData[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return nextUniqueValuesData;\n}\n\nexport async function loadFilterLabelsForTitle(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n):Promise<Record<string, ListOption>> {\n const selected: [string, string][] = [];\n const INPUTS_REQUESTING_LABELS = ['filters', 'tabBy'] as ((keyof InputState['components'])[]);\n INPUTS_REQUESTING_LABELS.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource, selectedFilterValue, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (inputName === 'filters' && type === 'equals' && selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n } else if (selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n }\n }\n }\n });\n const result:Record<string, ListOption> = {};\n for (const [source, selectedValue] of selected) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, 1, undefined, selectedValue);\n if (uniqueValuesResponse.values.length === 1) {\n result[source] = uniqueValuesResponse.values[0];\n }\n }\n return result;\n}"],"names":["SAVED_UNIQUE_VALUES_LIMIT","SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_XY","SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING","SAVED_IN_CHART_DATA_DENDRO_GROUPING","sortValues","values","b","getUniqueValuesFromReadyChartData","chartData","inputGuide","controller","dataStore","previousUniqueValues","resultMap","addUniqueData","sourceId","labelId","data","dataLabels","resultSet","result","i","v","label","el","res","inputName","savedData","columnName","savedInGrouping","valueType","savedByInputName","selectedSources","id","info","_a","AXIS_NATURE_KEY","_b","_c","source","uniqueValuesResponse","loadFilterLabelsForTitle","optionsState","selected","componentState","selectedSource","selectedFilterValue","type","selectedValue"],"mappings":";AAmBA,MAAMA,IAA4B,KAE5BC,IAAyC,CAAC,mBAAmB,mBAAmB,GAChFC,IAA4C,CAAC,UAAU,GACvDC,IAAqC,CAAC,KAAK,GAAG,GAC9CC,IAAyC,CAAC,UAAU,GACpDC,IAAsC;AAAA,EAC1C;AAAA,EAAa;AAAA,EAAa;AAAA,EAAa;AAAA;AACzC,GAEMC,IAAa,CAACC,MAA0CA,EAAO,KAAK,CAAC,GAAGC,MAAM,EAAE,MAAM,cAAcA,EAAE,OAAO,MAAM,EAAC,SAAS,GAAA,CAAK,CAAC;AAEzI,eAAsBC,EACpBC,GACAC,GACAC,GACAC,GACAC,GACkC;AAClC,QAAMC,IAAoC,CAAA;AAC1C,WAASC,EAAcC,GAAiBC,GAAiB;AACvD,UAAMC,IAAOT,EAAW,KAAK,UAAU,OAAOO,CAAQ,GAChDG,IAAaF,IAAUR,EAAW,KAAK,UAAU,OAAOQ,CAAO,IAAI,MAEnEG,wBAAgB,IAAA,GAChBC,IAAwC,CAAA;AAC9C,aAASC,IAAI,GAAGA,IAAIJ,EAAK,QAAQI,KAAK;AACpC,YAAMC,IAAI,OAAOL,EAAKI,CAAC,CAAC;AACxB,UAAIF,EAAU,IAAIG,CAAC,KAAKL,EAAKI,CAAC,MAAM;AAClC;AAEF,UAAIF,EAAU,SAASrB,GAA2B;AAChD,QAAAe,EAAUE,CAAQ,IAAI;AACtB;AAAA,MACF;AACA,MAAAI,EAAU,IAAIG,CAAC;AACf,YAAMC,IAAQL,IAAa,OAAOA,EAAWG,CAAC,CAAC,IAAIC;AACnD,MAAAF,EAAO,KAAK,EAAC,OAAOE,GAAG,OAAAC,GAAM;AAAA,IAC/B;AACA,IAAAnB,EAA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WAAW,OAAO,EAC3B,QAAQ,CAAAjB,MAAa;AAC5C,UAAMkB,IAAiBF,EAAahB,CAAS;AAC7C,QAAIkB;AACF,iBAAW,EAAE,gBAAAC,GAAgB,qBAAAC,GAAqB,MAAAC,EAAA,KAAUH,EAAe;AACzE,QAAIlB,MAAc,aAAaqB,MAAS,YAAYD,IAClDH,EAAS,KAAK,CAACE,GAAgBC,CAAmB,CAAC,IAC1CA,KACTH,EAAS,KAAK,CAACE,GAAgBC,CAAmB,CAAC;AAAA,EAI3D,CAAC;AACD,QAAM1B,IAAoC,CAAA;AAC1C,aAAW,CAACmB,GAAQS,CAAa,KAAKL,GAAU;AAC9C,UAAMH,IAAuB,MAAM9B,EAAW,gCAAgCC,GAAWF,GAAY8B,GAAQ,GAAG,QAAWS,CAAa;AACxI,IAAIR,EAAqB,OAAO,WAAW,MACzCpB,EAAOmB,CAAM,IAAIC,EAAqB,OAAO,CAAC;AAAA,EAElD;AACA,SAAOpB;AACT;"}
|
|
@@ -7,7 +7,7 @@ import { ChartScatterplotUmap as f } from "./scatterplot-umap/index.js";
|
|
|
7
7
|
import { ChartBubble as d } from "./bubble/index.js";
|
|
8
8
|
import { DataFrame as s } from "./DataFrame.js";
|
|
9
9
|
import { exhaustive as l } from "./utils/index.js";
|
|
10
|
-
var C = Object.defineProperty,
|
|
10
|
+
var C = Object.defineProperty, w = (o, t, r) => t in o ? C(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r, i = (o, t, r) => w(o, typeof t != "symbol" ? t + "" : t, r);
|
|
11
11
|
class h {
|
|
12
12
|
constructor(t) {
|
|
13
13
|
i(this, "node"), i(this, "chart"), this.chart = t;
|