@milaboratories/graph-maker 1.1.139 → 1.1.140
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/Chart.vue.d.ts.map +1 -1
- package/dist/GraphMaker/components/Chart.vue.js +1 -0
- package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
- package/dist/GraphMaker/dataBindAes.d.ts +5 -5
- package/dist/GraphMaker/dataBindAes.d.ts.map +1 -1
- package/dist/GraphMaker/dataBindAes.js +52 -49
- package/dist/GraphMaker/dataBindAes.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +14 -14
- package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js +125 -124
- 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/composeChartSettings.d.ts +4 -8
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +2 -2
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +5 -5
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +7 -7
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +9 -9
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +20 -16
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +56 -62
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +20 -16
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +20 -19
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +57 -54
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
- package/dist/lib.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js +5 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +8 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +22 -22
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js +4 -22
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +53 -53
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +6 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +45 -45
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +71 -70
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +117 -112
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +6 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +36 -36
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +24 -24
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +23 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +13 -10
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +67 -73
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +44 -39
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js +18 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +68 -64
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +23 -17
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +23 -17
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js +7 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +690 -684
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,88 +1,82 @@
|
|
|
1
|
-
import { PALETTE_MAP as
|
|
2
|
-
import { SCATTERPLOT_TEMPLATES_MAP as
|
|
3
|
-
import { getScatterplotAes as M, DEFAULT_LINE_WIDTH as U, DEFAULT_DOT_SIZE as Y, DEFAULT_DOT_SHAPE as
|
|
4
|
-
import { getScatterplotLayersSettings as
|
|
5
|
-
import { getAxesDataFromForms as
|
|
1
|
+
import { PALETTE_MAP as D, DEFAULT_CATEGORICAL_PALETTE as F, UNKNOWN_COLOR as C, DEFAULT_BLACK as P } from "../../constantsAesthetic.js";
|
|
2
|
+
import { SCATTERPLOT_TEMPLATES_MAP as R, isMappedAes as K, THRESHOLDS_KEY as N, PALETTE_KEY as I, UPPER_LIMIT_KEY as y, LOWER_LIMIT_KEY as T, SYMMETRIC_RANGE_KEY as L } from "../../constantsCommon.js";
|
|
3
|
+
import { getScatterplotAes as M, DEFAULT_LINE_WIDTH as U, DEFAULT_DOT_SIZE as Y, DEFAULT_DOT_SHAPE as H } from "../../dataBindAes.js";
|
|
4
|
+
import { getScatterplotLayersSettings as V } from "./getLayersDataFromForms.js";
|
|
5
|
+
import { getAxesDataFromForms as W } from "./getAxesDataFromForms.js";
|
|
6
6
|
import "../../../node_modules/@milaboratories/pf-plots/dist/index.js";
|
|
7
7
|
import "vue";
|
|
8
|
-
function
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
const { columnId:
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
const
|
|
8
|
+
function j(o, f, n, m, r) {
|
|
9
|
+
var x, E, u, A;
|
|
10
|
+
const s = (x = f.selectorStates[0]) == null ? void 0 : x.selectedSource, i = (E = n.selectorStates[0]) == null ? void 0 : E.selectedSource, c = (u = m.selectorStates[0]) == null ? void 0 : u.selectedSource, t = r.getSourceInfo(i), e = r.getSourceInfo(c);
|
|
11
|
+
if (f.selectorStates.length) {
|
|
12
|
+
const a = r.getSourceInfo(s).annotations;
|
|
13
|
+
if (a != null && a[N] && (JSON.parse(a[N]) ?? []).forEach((_) => {
|
|
14
|
+
const { columnId: l, value: S } = _;
|
|
15
|
+
l && t.kind === "column" && t.type === l.valueType && t.name === l.name && (o.xAxis.significantLines || (o.xAxis.significantLines = []), o.xAxis.significantLines.push(Number(S))), l && e.kind === "column" && e.type === l.valueType && e.name === l.name && (o.yAxis.significantLines || (o.yAxis.significantLines = []), o.yAxis.significantLines.push(Number(S)));
|
|
16
|
+
}), a != null && a[I]) {
|
|
17
|
+
const d = JSON.parse(a[I]), { mapping: _ = {}, name: l = "" } = d;
|
|
18
18
|
o.layers.forEach((p) => {
|
|
19
|
-
p.type === "dots" && (p.aes || (p.aes = {}), p.aes.dotFill = { type: "grouping", value:
|
|
19
|
+
p.type === "dots" && (p.aes || (p.aes = {}), p.aes.dotFill = { type: "grouping", value: s });
|
|
20
20
|
});
|
|
21
|
-
const S = [...Object.entries(_), ["null",
|
|
22
|
-
o.inheritedAes[
|
|
23
|
-
const
|
|
24
|
-
return p[
|
|
25
|
-
fillColor:
|
|
26
|
-
lineColor:
|
|
27
|
-
dotFill:
|
|
28
|
-
dotShape:
|
|
21
|
+
const S = [...Object.entries(_), ["null", C]], O = ((A = D[l]) == null ? void 0 : A.colors) ?? [];
|
|
22
|
+
o.inheritedAes[s] = S.reduce((p, [b, g]) => {
|
|
23
|
+
const h = O[Number(g)] ?? P;
|
|
24
|
+
return p[b] = {
|
|
25
|
+
fillColor: h,
|
|
26
|
+
lineColor: h,
|
|
27
|
+
dotFill: h,
|
|
28
|
+
dotShape: H,
|
|
29
29
|
dotSize: Y,
|
|
30
30
|
lineWidth: U
|
|
31
31
|
}, p;
|
|
32
32
|
}, {});
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
t.annotations && (t.annotations[
|
|
35
|
+
t.annotations && (t.annotations[y] && (o.xAxis.upperValue = Number(t.annotations[y])), t.annotations[T] && (o.xAxis.lowerValue = Number(t.annotations[T])), t.annotations[L] && (o.xAxis.symmetricRange = Number(t.annotations[L]))), e.annotations && (e.annotations[y] && (o.yAxis.upperValue = Number(e.annotations[y])), e.annotations[T] && (o.yAxis.lowerValue = Number(e.annotations[T])), e.annotations[L] && (o.yAxis.symmetricRange = Number(e.annotations[L])));
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const A = e[E];
|
|
52
|
-
if (g(A) && A.value === a) {
|
|
53
|
-
const y = ((s = b[((u = i[a]) == null ? void 0 : u.palette) ?? C]) == null ? void 0 : s.colors) ?? [];
|
|
54
|
-
A.palette = y;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
37
|
+
function k(o, f, n, m, r) {
|
|
38
|
+
(f.selectorStates.length || n != null && n.selectorStates.length) && (o.grouping = [...o.grouping ?? []].map((s) => ({ ...s })), o.grouping.forEach((s) => {
|
|
39
|
+
const i = s.columnName.value, c = M(i, m, r);
|
|
40
|
+
c.order.length ? (s.order = c.order, s.inheritedAes = c.inheritedAes) : o.layers.forEach((t) => {
|
|
41
|
+
const e = t.aes;
|
|
42
|
+
if (!e)
|
|
43
|
+
return;
|
|
44
|
+
Object.keys(e).forEach((E) => {
|
|
45
|
+
var A, a;
|
|
46
|
+
const u = e[E];
|
|
47
|
+
if (K(u) && u.value === i) {
|
|
48
|
+
const d = ((a = D[((A = r[i]) == null ? void 0 : A.palette) ?? F]) == null ? void 0 : a.colors) ?? [];
|
|
49
|
+
u.palette = d;
|
|
50
|
+
}
|
|
57
51
|
});
|
|
58
|
-
})
|
|
59
|
-
}
|
|
52
|
+
});
|
|
53
|
+
}));
|
|
60
54
|
}
|
|
61
|
-
function X(o,
|
|
62
|
-
var
|
|
63
|
-
o.layers =
|
|
64
|
-
|
|
55
|
+
function X(o, f, n, m, r) {
|
|
56
|
+
var c, t;
|
|
57
|
+
o.layers = V(
|
|
58
|
+
R[n.template],
|
|
65
59
|
n.layersSettings,
|
|
66
|
-
|
|
60
|
+
f,
|
|
67
61
|
n.optionsState,
|
|
68
62
|
n.dataBindAes,
|
|
69
63
|
m,
|
|
70
|
-
o == null ? void 0 : o.grouping
|
|
71
|
-
),
|
|
64
|
+
(c = o == null ? void 0 : o.grouping) == null ? void 0 : c.map((e) => e.columnName)
|
|
65
|
+
), k(
|
|
72
66
|
o,
|
|
73
67
|
n.optionsState.components.grouping,
|
|
74
68
|
n.optionsState.components.shape,
|
|
75
|
-
|
|
69
|
+
r,
|
|
76
70
|
n.dataBindAes
|
|
77
71
|
);
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
color: (
|
|
72
|
+
const s = n.statisticsSettings, i = o.layers.find((e) => e.type === "dots");
|
|
73
|
+
return s.trend.on && i && (o.trend = {
|
|
74
|
+
color: (t = i.aes) == null ? void 0 : t.dotFill,
|
|
81
75
|
bounded: !1
|
|
82
76
|
}), Object.assign(
|
|
83
77
|
o,
|
|
84
|
-
|
|
85
|
-
),
|
|
78
|
+
W(n.axesSettings, n.chartType)
|
|
79
|
+
), j(
|
|
86
80
|
o,
|
|
87
81
|
n.optionsState.components.grouping,
|
|
88
82
|
n.optionsState.components.x,
|
|
@@ -91,8 +85,8 @@ function X(o, l, n, m, i) {
|
|
|
91
85
|
), o;
|
|
92
86
|
}
|
|
93
87
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
j as applyChartInfoFromAnnotations,
|
|
89
|
+
k as applyInheritedAes,
|
|
96
90
|
X as composeScatterplotSettings
|
|
97
91
|
};
|
|
98
92
|
//# sourceMappingURL=composeScatterplotSettings.js.map
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScatterplotSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.ts"],"sourcesContent":["import { ScatterplotSettings, ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport {\n ComponentStateFilter,\n ComponentStateSimple,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n ScatterplotUIState\n} from '@milaboratories/pf-plots';\nimport {\n DEFAULT_BLACK,\n DEFAULT_CATEGORICAL_PALETTE,\n PALETTE_MAP,\n UNKNOWN_COLOR\n} from '../../constantsAesthetic';\nimport {\n isMappedAes,\n LOWER_LIMIT_KEY, MappingLink,\n PALETTE_KEY,\n SCATTERPLOT_TEMPLATES_MAP,\n ScatterplotStatisticsState, SYMMETRIC_RANGE_KEY,\n THRESHOLDS_KEY, UPPER_LIMIT_KEY\n} from '../../constantsCommon';\nimport {\n AestheticMappingState,\n DEFAULT_DOT_SHAPE,\n DEFAULT_DOT_SIZE,\n DEFAULT_LINE_WIDTH,\n getScatterplotAes\n} from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromForms, getScatterplotLayersSettings } from '../index';\n\nexport function applyChartInfoFromAnnotations (\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n x: ComponentStateSimple | ComponentStateFilter,\n y: ComponentStateSimple | ComponentStateFilter,\n inputGuide: InputGuide<InputState>\n) {\n const groupingSource = grouping.selectorStates[0]?.selectedSource;\n const xSource = x.selectorStates[0]?.selectedSource;\n const ySource = y.selectorStates[0]?.selectedSource;\n const xInfo = inputGuide.getSourceInfo(xSource);\n const yInfo = inputGuide.getSourceInfo(ySource);\n\n if (grouping.selectorStates.length) {\n const annotations = inputGuide.getSourceInfo(groupingSource).annotations;\n if (annotations?.[THRESHOLDS_KEY]) {\n const thresholdsData = JSON.parse(annotations[THRESHOLDS_KEY]) ?? [];\n\n thresholdsData.forEach((thresholdData: { columnId: Record<string, string>, value: number }) => {\n const { columnId, value } = thresholdData;\n if (columnId && (xInfo.kind === 'column' && xInfo.type === columnId.valueType && xInfo.name === columnId.name)) {\n if (!settings.xAxis!.significantLines) {\n settings.xAxis!.significantLines = [];\n }\n settings.xAxis!.significantLines.push(Number(value));\n }\n\n if (columnId && (yInfo.kind === 'column' && yInfo.type === columnId.valueType && yInfo.name === columnId.name)) {\n if (!settings.yAxis!.significantLines) {\n settings.yAxis!.significantLines = [];\n }\n settings.yAxis!.significantLines.push(Number(value));\n }\n });\n }\n\n if (annotations?.[PALETTE_KEY]) {\n const paletteData = JSON.parse(annotations[PALETTE_KEY]);\n const { mapping = {}, name = '' } = paletteData;\n settings.layers.forEach(layer => {\n if (layer.type === 'dots') {\n if (!layer.aes) {\n layer.aes = {};\n }\n layer.aes.dotFill = { type: 'grouping', value: groupingSource };\n }\n });\n const paletteEntries = [...Object.entries(mapping), ['null', UNKNOWN_COLOR]];\n const paletteColors = PALETTE_MAP[name as keyof typeof PALETTE_MAP]?.colors ?? [];\n settings.inheritedAes![groupingSource] = paletteEntries.reduce((res: Record<string, any>, [key, value]) => {\n const color = paletteColors[Number(value)] ?? DEFAULT_BLACK;\n res[key] = {\n fillColor: color,\n lineColor: color,\n dotFill: color,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n lineWidth: DEFAULT_LINE_WIDTH\n };\n return res;\n }, {});\n }\n }\n if (xInfo.annotations) {\n if (xInfo.annotations[UPPER_LIMIT_KEY]) {\n settings.xAxis!.upperValue = Number(xInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (xInfo.annotations[LOWER_LIMIT_KEY]) {\n settings.xAxis!.lowerValue = Number(xInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (xInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n settings.xAxis!.symmetricRange = Number(xInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n\n if (yInfo.annotations) {\n if (yInfo.annotations[UPPER_LIMIT_KEY]) {\n settings.yAxis!.upperValue = Number(yInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (yInfo.annotations[LOWER_LIMIT_KEY]) {\n settings.yAxis!.lowerValue = Number(yInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (yInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n settings.yAxis!.symmetricRange = Number(yInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n}\n\nexport function applyInheritedAes(\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n shape: ComponentStateSimple | ComponentStateFilter | undefined,\n uniqueValuesData: UniqueValuesBySourceMap,\n dataBindAes: AestheticMappingState\n) {\n if (grouping.selectorStates.length || shape?.selectorStates.length) {\n const states = [...grouping.selectorStates, ...(shape?.selectorStates ?? [])];\n const inheritedAes: Record<string, Record<string, unknown>> = {};\n states.forEach(({ selectedSource }) => {\n inheritedAes[selectedSource] = getScatterplotAes(\n selectedSource,\n uniqueValuesData,\n dataBindAes\n );\n // if mapping exists but doesn't have saved order and value-color pairs - add just colors list to chart settings, chart will use it\n if (!Object.keys(inheritedAes[selectedSource]).length) {\n settings.layers.forEach(layer=> {\n const layerAes = layer.aes;\n if (!layerAes) {\n return;\n }\n const aesKeys = Object.keys(layerAes);\n aesKeys.forEach((aesKey) => {\n const value = layerAes[aesKey as keyof typeof layerAes] as unknown;\n if (isMappedAes(value) && value.value === selectedSource) {\n const colors = PALETTE_MAP[dataBindAes[selectedSource]?.palette ?? DEFAULT_CATEGORICAL_PALETTE]?.colors ?? [];\n (value as MappingLink & {palette: string[]}).palette = colors;\n }\n })\n })\n }\n });\n\n Object.assign(settings, { inheritedAes });\n }\n}\nexport function composeScatterplotSettings(\n settings: ScatterplotSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping\n );\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.shape,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n const statisticsSettings = reactiveState.statisticsSettings as ScatterplotStatisticsState;\n const dotsLayer = settings.layers.find(layer => layer.type === 'dots');\n if (statisticsSettings.trend.on && dotsLayer) {\n settings.trend = {\n color: dotsLayer.aes?.dotFill,\n bounded: false\n };\n }\n\n Object.assign(\n settings,\n getAxesDataFromForms(reactiveState.axesSettings, reactiveState.chartType)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n return settings;\n}"],"names":["applyChartInfoFromAnnotations","settings","grouping","x","y","inputGuide","groupingSource","_a","xSource","_b","ySource","_c","xInfo","yInfo","annotations","THRESHOLDS_KEY","thresholdData","columnId","value","PALETTE_KEY","paletteData","mapping","name","layer","paletteEntries","UNKNOWN_COLOR","paletteColors","_d","PALETTE_MAP","res","key","color","DEFAULT_BLACK","DEFAULT_DOT_SHAPE","DEFAULT_DOT_SIZE","DEFAULT_LINE_WIDTH","UPPER_LIMIT_KEY","LOWER_LIMIT_KEY","SYMMETRIC_RANGE_KEY","applyInheritedAes","shape","uniqueValuesData","dataBindAes","states","inheritedAes","selectedSource","getScatterplotAes","layerAes","aesKey","isMappedAes","colors","DEFAULT_CATEGORICAL_PALETTE","composeScatterplotSettings","dataByColumns","reactiveState","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","statisticsSettings","dotsLayer","getAxesDataFromForms"],"mappings":";;;;;;;AAqCO,SAASA,EACdC,GACAC,GACAC,GACAC,GACAC,GACA;;AACA,QAAMC,KAAiBC,IAAAL,EAAS,eAAe,CAAC,MAAzB,gBAAAK,EAA4B,gBAC7CC,KAAUC,IAAAN,EAAE,eAAe,CAAC,MAAlB,gBAAAM,EAAqB,gBAC/BC,KAAUC,IAAAP,EAAE,eAAe,CAAC,MAAlB,gBAAAO,EAAqB,gBAC/BC,IAAQP,EAAW,cAAcG,CAAO,GACxCK,IAAQR,EAAW,cAAcK,CAAO;AAE9C,MAAIR,EAAS,eAAe,QAAQ;AAClC,UAAMY,IAAcT,EAAW,cAAcC,CAAc,EAAE;AAsB7D,QArBIQ,KAAA,QAAAA,EAAcC,OACO,KAAK,MAAMD,EAAYC,CAAc,CAAC,KAAK,CAAA,GAEnD,QAAQ,CAACC,MAAuE;AAC7F,YAAM,EAAE,UAAAC,GAAU,OAAAC,EAAA,IAAUF;AAC5B,MAAIC,KAAaL,EAAM,SAAS,YAAYA,EAAM,SAASK,EAAS,aAAaL,EAAM,SAASK,EAAS,SAClGhB,EAAS,MAAO,qBACnBA,EAAS,MAAO,mBAAmB,CA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,MAA/E,gBAAA1C,EAAkF,WAAU,CAAA;AAC1G,YAAAS,EAA4C,UAAUgC;AAAA,UACzD;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AAAA,IAEL,CAAC,GAED,OAAO,OAAOjD,GAAU,EAAE,cAAA2C,EAAA,CAAc;AAAA,EAC1C;AACF;AACO,SAASQ,EACdnD,GACAoD,GACAC,GACAjD,GACAoC,GACA;;AACA,EAAAxC,EAAS,SAASsD;AAAA,IAChBC,EAA0BF,EAAc,QAAqC;AAAA,IAC7EA,EAAc;AAAA,IACdD;AAAA,IACAC,EAAc;AAAA,IACdA,EAAc;AAAA,IACdjD;AAAA,IACAJ,KAAA,gBAAAA,EAAU;AAAA,EAAA,GAGZsC;AAAA,IACEtC;AAAA,IACAqD,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCb;AAAA,IACAa,EAAc;AAAA,EAAA;AAGhB,QAAMG,IAAqBH,EAAc,oBACnCI,IAAYzD,EAAS,OAAO,KAAK,CAAAsB,MAASA,EAAM,SAAS,MAAM;AACrE,SAAIkC,EAAmB,MAAM,MAAMC,MACjCzD,EAAS,QAAQ;AAAA,IACf,QAAOM,IAAAmD,EAAU,QAAV,gBAAAnD,EAAe;AAAA,IACtB,SAAS;AAAA,EAAA,IAIb,OAAO;AAAA,IACLN;AAAA,IACA0D,EAAqBL,EAAc,cAAcA,EAAc,SAAS;AAAA,EAAA,GAG1EtD;AAAA,IACEC;AAAA,IACAqD,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCjD;AAAA,EAAA,GAGKJ;AACT;"}
|
|
1
|
+
{"version":3,"file":"composeScatterplotSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.ts"],"sourcesContent":["import { ScatterplotSettings, ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport {\n ComponentStateFilter,\n ComponentStateSimple,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n ScatterplotUIState\n} from '@milaboratories/pf-plots';\nimport {\n DEFAULT_BLACK,\n DEFAULT_CATEGORICAL_PALETTE,\n PALETTE_MAP,\n UNKNOWN_COLOR\n} from '../../constantsAesthetic';\nimport {\n isMappedAes,\n LOWER_LIMIT_KEY, MappingLink,\n PALETTE_KEY,\n SCATTERPLOT_TEMPLATES_MAP,\n ScatterplotStatisticsState, SYMMETRIC_RANGE_KEY,\n THRESHOLDS_KEY, UPPER_LIMIT_KEY\n} from '../../constantsCommon';\nimport {\n AestheticMappingState,\n DEFAULT_DOT_SHAPE,\n DEFAULT_DOT_SIZE,\n DEFAULT_LINE_WIDTH,\n getScatterplotAes\n} from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromForms, getScatterplotLayersSettings } from '../index';\n\nexport function applyChartInfoFromAnnotations (\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n x: ComponentStateSimple | ComponentStateFilter,\n y: ComponentStateSimple | ComponentStateFilter,\n inputGuide: InputGuide<InputState>\n) {\n const groupingSource = grouping.selectorStates[0]?.selectedSource;\n const xSource = x.selectorStates[0]?.selectedSource;\n const ySource = y.selectorStates[0]?.selectedSource;\n const xInfo = inputGuide.getSourceInfo(xSource);\n const yInfo = inputGuide.getSourceInfo(ySource);\n\n if (grouping.selectorStates.length) {\n const annotations = inputGuide.getSourceInfo(groupingSource).annotations;\n if (annotations?.[THRESHOLDS_KEY]) {\n const thresholdsData = JSON.parse(annotations[THRESHOLDS_KEY]) ?? [];\n\n thresholdsData.forEach((thresholdData: { columnId: Record<string, string>, value: number }) => {\n const { columnId, value } = thresholdData;\n if (columnId && (xInfo.kind === 'column' && xInfo.type === columnId.valueType && xInfo.name === columnId.name)) {\n if (!settings.xAxis!.significantLines) {\n settings.xAxis!.significantLines = [];\n }\n settings.xAxis!.significantLines.push(Number(value));\n }\n\n if (columnId && (yInfo.kind === 'column' && yInfo.type === columnId.valueType && yInfo.name === columnId.name)) {\n if (!settings.yAxis!.significantLines) {\n settings.yAxis!.significantLines = [];\n }\n settings.yAxis!.significantLines.push(Number(value));\n }\n });\n }\n\n if (annotations?.[PALETTE_KEY]) {\n const paletteData = JSON.parse(annotations[PALETTE_KEY]);\n const { mapping = {}, name = '' } = paletteData;\n settings.layers.forEach(layer => {\n if (layer.type === 'dots') {\n if (!layer.aes) {\n layer.aes = {};\n }\n layer.aes.dotFill = { type: 'grouping', value: groupingSource };\n }\n });\n const paletteEntries = [...Object.entries(mapping), ['null', UNKNOWN_COLOR]];\n const paletteColors = PALETTE_MAP[name as keyof typeof PALETTE_MAP]?.colors ?? [];\n settings.inheritedAes![groupingSource] = paletteEntries.reduce((res: Record<string, any>, [key, value]) => {\n const color = paletteColors[Number(value)] ?? DEFAULT_BLACK;\n res[key] = {\n fillColor: color,\n lineColor: color,\n dotFill: color,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n lineWidth: DEFAULT_LINE_WIDTH\n };\n return res;\n }, {});\n }\n }\n if (xInfo.annotations) {\n if (xInfo.annotations[UPPER_LIMIT_KEY]) {\n settings.xAxis!.upperValue = Number(xInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (xInfo.annotations[LOWER_LIMIT_KEY]) {\n settings.xAxis!.lowerValue = Number(xInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (xInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n settings.xAxis!.symmetricRange = Number(xInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n\n if (yInfo.annotations) {\n if (yInfo.annotations[UPPER_LIMIT_KEY]) {\n settings.yAxis!.upperValue = Number(yInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (yInfo.annotations[LOWER_LIMIT_KEY]) {\n settings.yAxis!.lowerValue = Number(yInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (yInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n settings.yAxis!.symmetricRange = Number(yInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n}\n\nexport function applyInheritedAes(\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n shape: ComponentStateSimple | ComponentStateFilter | undefined,\n uniqueValuesData: UniqueValuesBySourceMap,\n dataBindAes: AestheticMappingState\n) {\n if (grouping.selectorStates.length || shape?.selectorStates.length) {\n settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\n settings.grouping.forEach((el) => {\n const selectedSource = el.columnName.value;\n const savedData = getScatterplotAes(selectedSource, uniqueValuesData, dataBindAes); // get saved or default color or shape mapping\n // if mapping exists but doesn't have saved order and value-color pairs - add just colors list to chart settings, chart will use it\n if (!savedData.order.length) {\n settings.layers.forEach(layer=> {\n const layerAes = layer.aes;\n if (!layerAes) {\n return;\n }\n const aesKeys = Object.keys(layerAes);\n aesKeys.forEach((aesKey) => {\n const value = layerAes[aesKey as keyof typeof layerAes] as unknown;\n if (isMappedAes(value) && value.value === selectedSource) {\n const colors = PALETTE_MAP[dataBindAes[selectedSource]?.palette ?? DEFAULT_CATEGORICAL_PALETTE]?.colors ?? [];\n (value as MappingLink & {palette: string[]}).palette = colors;\n }\n })\n })\n } else {\n el.order = savedData.order;\n el.inheritedAes = savedData.inheritedAes;\n }\n });\n }\n}\nexport function composeScatterplotSettings(\n settings: ScatterplotSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping?.map(v => v.columnName)\n );\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.shape,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n const statisticsSettings = reactiveState.statisticsSettings as ScatterplotStatisticsState;\n const dotsLayer = settings.layers.find(layer => layer.type === 'dots');\n if (statisticsSettings.trend.on && dotsLayer) {\n settings.trend = {\n color: dotsLayer.aes?.dotFill,\n bounded: false\n };\n }\n\n Object.assign(\n settings,\n getAxesDataFromForms(reactiveState.axesSettings, reactiveState.chartType)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n return settings;\n}"],"names":["applyChartInfoFromAnnotations","settings","grouping","x","y","inputGuide","groupingSource","_a","xSource","_b","ySource","_c","xInfo","yInfo","annotations","THRESHOLDS_KEY","thresholdData","columnId","value","PALETTE_KEY","paletteData","mapping","name","layer","paletteEntries","UNKNOWN_COLOR","paletteColors","_d","PALETTE_MAP","res","key","color","DEFAULT_BLACK","DEFAULT_DOT_SHAPE","DEFAULT_DOT_SIZE","DEFAULT_LINE_WIDTH","UPPER_LIMIT_KEY","LOWER_LIMIT_KEY","SYMMETRIC_RANGE_KEY","applyInheritedAes","shape","uniqueValuesData","dataBindAes","v","el","selectedSource","savedData","getScatterplotAes","layerAes","aesKey","isMappedAes","colors","DEFAULT_CATEGORICAL_PALETTE","composeScatterplotSettings","dataByColumns","reactiveState","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","statisticsSettings","dotsLayer","getAxesDataFromForms"],"mappings":";;;;;;;AAqCO,SAASA,EACdC,GACAC,GACAC,GACAC,GACAC,GACA;;AACA,QAAMC,KAAiBC,IAAAL,EAAS,eAAe,CAAC,MAAzB,gBAAAK,EAA4B,gBAC7CC,KAAUC,IAAAN,EAAE,eAAe,CAAC,MAAlB,gBAAAM,EAAqB,gBAC/BC,KAAUC,IAAAP,E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,IAAAkD,EAAU,QAAV,gBAAAlD,EAAe;AAAA,IACtB,SAAS;AAAA,EAAA,IAIb,OAAO;AAAA,IACLR;AAAA,IACA2D,EAAqBL,EAAc,cAAcA,EAAc,SAAS;AAAA,EAAA,GAG1EvD;AAAA,IACEC;AAAA,IACAsD,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtClD;AAAA,EAAA,GAGKJ;AACT;"}
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
6
6
|
title: {
|
|
7
7
|
name: string;
|
|
8
8
|
show?: boolean | undefined;
|
|
9
|
-
position?: "
|
|
9
|
+
position?: "left" | "center" | "right" | undefined;
|
|
10
10
|
};
|
|
11
11
|
x: {
|
|
12
12
|
type: "column";
|
|
@@ -96,15 +96,28 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
96
96
|
valueLabels?: string | undefined;
|
|
97
97
|
} | undefined;
|
|
98
98
|
grouping?: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
columnName: {
|
|
100
|
+
type: "column";
|
|
101
|
+
value: string;
|
|
102
|
+
format?: string | undefined;
|
|
103
|
+
label?: string | undefined;
|
|
104
|
+
valueLabels?: string | undefined;
|
|
105
|
+
};
|
|
106
|
+
order?: (string | number | null)[] | undefined;
|
|
107
|
+
inheritedAes?: Record<string, {
|
|
108
|
+
dotFill?: string | undefined;
|
|
109
|
+
dotShape?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "20" | "21" | "22" | "23" | "24" | "25" | undefined;
|
|
110
|
+
dotSize?: number | undefined;
|
|
111
|
+
lineWidth?: number | undefined;
|
|
112
|
+
lineShape?: "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash" | undefined;
|
|
113
|
+
lineColor?: string | undefined;
|
|
114
|
+
fillColor?: string | undefined;
|
|
115
|
+
}> | undefined;
|
|
116
|
+
allowNullGroup?: boolean | undefined;
|
|
104
117
|
}[] | undefined;
|
|
105
118
|
legend?: {
|
|
106
119
|
show?: boolean | undefined;
|
|
107
|
-
position?: "right" | "
|
|
120
|
+
position?: "right" | "inside" | "top" | "bottom" | undefined;
|
|
108
121
|
} | undefined;
|
|
109
122
|
tooltips?: {
|
|
110
123
|
show?: boolean | undefined;
|
|
@@ -173,14 +186,5 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
173
186
|
label?: string | undefined;
|
|
174
187
|
valueLabels?: string | undefined;
|
|
175
188
|
} | undefined;
|
|
176
|
-
inheritedAes?: Record<string, Record<string, {
|
|
177
|
-
dotFill?: string | undefined;
|
|
178
|
-
dotShape?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "20" | "21" | "22" | "23" | "24" | "25" | undefined;
|
|
179
|
-
dotSize?: number | undefined;
|
|
180
|
-
lineWidth?: number | undefined;
|
|
181
|
-
lineShape?: "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash" | undefined;
|
|
182
|
-
lineColor?: string | undefined;
|
|
183
|
-
fillColor?: string | undefined;
|
|
184
|
-
}>> | undefined;
|
|
185
189
|
};
|
|
186
190
|
//# sourceMappingURL=composeScatterplotUmapSettings.d.ts.map
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScatterplotUmapSettings.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAG3G,OAAO,EACL,aAAa,EAEb,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAOrB,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,uBAAuB,EACjC,aAAa,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EACvD,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,gBAAgB,EAAE,uBAAuB;;;;
|
|
1
|
+
{"version":3,"file":"composeScatterplotUmapSettings.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAG3G,OAAO,EACL,aAAa,EAEb,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAOrB,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,uBAAuB,EACjC,aAAa,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EACvD,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,gBAAgB,EAAE,uBAAuB;;;;YAwC6z9D,CAAC;gBAAuC,CAAC;;;;;cAAwH,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;;;;cAAmG,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;;;WAA6E,CAAC;mBAAuB,CAAC;;;;0BAA4I,CAAC;yBAA+C,CAAC;+BAAqD,CAAC;;;;oBAAgI,CAAC;;;;uBAA0I,CAAC;;oBAAuE,CAAC;;;uBAAiQ,CAAC;;mBAAsE,CAAC;;;;0BAA4I,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-1,43 +1,44 @@
|
|
|
1
|
-
import { SCATTERPLOT_TEMPLATES_MAP as
|
|
2
|
-
import { DEFAULT_DOT_SIZE_CANVAS as
|
|
3
|
-
import { getScatterplotLayersSettings as
|
|
4
|
-
import { getAxesDataFromForms as
|
|
1
|
+
import { SCATTERPLOT_TEMPLATES_MAP as _ } from "../../constantsCommon.js";
|
|
2
|
+
import { DEFAULT_DOT_SIZE_CANVAS as l } from "../../dataBindAes.js";
|
|
3
|
+
import { getScatterplotLayersSettings as E } from "./getLayersDataFromForms.js";
|
|
4
|
+
import { getAxesDataFromForms as s } from "./getAxesDataFromForms.js";
|
|
5
5
|
import "../../../node_modules/@milaboratories/pf-plots/dist/index.js";
|
|
6
6
|
import "vue";
|
|
7
7
|
import "../../constantsAesthetic.js";
|
|
8
|
-
import { applyInheritedAes as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { applyInheritedAes as h, applyChartInfoFromAnnotations as L } from "./composeScatterplotSettings.js";
|
|
9
|
+
const a = 750, f = 450;
|
|
10
|
+
function U(p, r, o, m, T) {
|
|
11
|
+
var n;
|
|
12
|
+
return p.layers = E(
|
|
13
|
+
_[o.template],
|
|
13
14
|
o.layersSettings,
|
|
14
|
-
|
|
15
|
+
r,
|
|
15
16
|
o.optionsState,
|
|
16
17
|
o.dataBindAes,
|
|
17
18
|
m,
|
|
18
|
-
p == null ? void 0 : p.grouping,
|
|
19
|
-
|
|
20
|
-
),
|
|
19
|
+
(n = p == null ? void 0 : p.grouping) == null ? void 0 : n.map((A) => A.columnName),
|
|
20
|
+
l
|
|
21
|
+
), h(
|
|
21
22
|
p,
|
|
22
23
|
o.optionsState.components.grouping,
|
|
23
24
|
void 0,
|
|
24
|
-
|
|
25
|
+
T,
|
|
25
26
|
o.dataBindAes
|
|
26
27
|
), Object.assign(
|
|
27
28
|
p,
|
|
28
|
-
|
|
29
|
-
),
|
|
29
|
+
s(o.axesSettings, o.chartType)
|
|
30
|
+
), L(
|
|
30
31
|
p,
|
|
31
32
|
o.optionsState.components.grouping,
|
|
32
33
|
o.optionsState.components.x,
|
|
33
34
|
o.optionsState.components.y,
|
|
34
35
|
m
|
|
35
36
|
), p.size = {
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
37
|
+
width: a * o.chartScale / 100,
|
|
38
|
+
height: f * o.chartScale / 100
|
|
38
39
|
}, p;
|
|
39
40
|
}
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
U as composeScatterplotUmapSettings
|
|
42
43
|
};
|
|
43
44
|
//# sourceMappingURL=composeScatterplotUmapSettings.js.map
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScatterplotUmapSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"sourcesContent":["import { ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport { InputGuide, InputState, PlotDataAndSettings, ScatterplotUIState } from '@milaboratories/pf-plots';\nimport { SCATTERPLOT_TEMPLATES_MAP } from '../../constantsCommon';\nimport { DEFAULT_DOT_SIZE_CANVAS } from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromForms, getScatterplotLayersSettings } from '../index';\nimport { applyChartInfoFromAnnotations, applyInheritedAes } from './composeScatterplotSettings';\n\nconst DEFAULT_WIDTH_SCATTERPLOT_UMAP = 750;\nconst DEFAULT_HEIGHT_SCATTERPLOT_UMAP = 450;\n\nexport function composeScatterplotUmapSettings(\n settings: ScatterplotUmapSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping,\n DEFAULT_DOT_SIZE_CANVAS\n ) as ScatterplotUmapSettings['layers'];\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n undefined,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n Object.assign(\n settings,\n getAxesDataFromForms(reactiveState.axesSettings, reactiveState.chartType)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n settings.size = {\n width: DEFAULT_WIDTH_SCATTERPLOT_UMAP * reactiveState.chartScale / 100,\n height: DEFAULT_HEIGHT_SCATTERPLOT_UMAP * reactiveState.chartScale / 100\n }\n\n return settings;\n}"],"names":["DEFAULT_WIDTH_SCATTERPLOT_UMAP","DEFAULT_HEIGHT_SCATTERPLOT_UMAP","composeScatterplotUmapSettings","settings","dataByColumns","reactiveState","inputGuide","uniqueValuesData","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","DEFAULT_DOT_SIZE_CANVAS","applyInheritedAes","getAxesDataFromForms","applyChartInfoFromAnnotations"],"mappings":";;;;;;;;AAYA,MAAMA,IAAiC,KACjCC,IAAkC;AAEjC,SAASC,EACdC,GACAC,GACAC,GACAC,GACAC,GACA
|
|
1
|
+
{"version":3,"file":"composeScatterplotUmapSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"sourcesContent":["import { ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport { InputGuide, InputState, PlotDataAndSettings, ScatterplotUIState } from '@milaboratories/pf-plots';\nimport { SCATTERPLOT_TEMPLATES_MAP } from '../../constantsCommon';\nimport { DEFAULT_DOT_SIZE_CANVAS } from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromForms, getScatterplotLayersSettings } from '../index';\nimport { applyChartInfoFromAnnotations, applyInheritedAes } from './composeScatterplotSettings';\n\nconst DEFAULT_WIDTH_SCATTERPLOT_UMAP = 750;\nconst DEFAULT_HEIGHT_SCATTERPLOT_UMAP = 450;\n\nexport function composeScatterplotUmapSettings(\n settings: ScatterplotUmapSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping?.map(v => v.columnName),\n DEFAULT_DOT_SIZE_CANVAS\n ) as ScatterplotUmapSettings['layers'];\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n undefined,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n Object.assign(\n settings,\n getAxesDataFromForms(reactiveState.axesSettings, reactiveState.chartType)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n settings.size = {\n width: DEFAULT_WIDTH_SCATTERPLOT_UMAP * reactiveState.chartScale / 100,\n height: DEFAULT_HEIGHT_SCATTERPLOT_UMAP * reactiveState.chartScale / 100\n }\n\n return settings;\n}"],"names":["DEFAULT_WIDTH_SCATTERPLOT_UMAP","DEFAULT_HEIGHT_SCATTERPLOT_UMAP","composeScatterplotUmapSettings","settings","dataByColumns","reactiveState","inputGuide","uniqueValuesData","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","_a","v","DEFAULT_DOT_SIZE_CANVAS","applyInheritedAes","getAxesDataFromForms","applyChartInfoFromAnnotations"],"mappings":";;;;;;;;AAYA,MAAMA,IAAiC,KACjCC,IAAkC;AAEjC,SAASC,EACdC,GACAC,GACAC,GACAC,GACAC,GACA;;AACA,SAAAJ,EAAS,SAASK;AAAA,IAChBC,EAA0BJ,EAAc,QAAqC;AAAA,IAC7EA,EAAc;AAAA,IACdD;AAAA,IACAC,EAAc;AAAA,IACdA,EAAc;AAAA,IACdC;AAAA,KACAI,IAAAP,KAAA,gBAAAA,EAAU,aAAV,gBAAAO,EAAoB,IAAI,CAAAC,MAAKA,EAAE;AAAA,IAC/BC;AAAA,EAAA,GAGFC;AAAA,IACEV;AAAA,IACAE,EAAc,aAAa,WAAW;AAAA,IACtC;AAAA,IACAE;AAAA,IACAF,EAAc;AAAA,EAAA,GAGhB,OAAO;AAAA,IACLF;AAAA,IACAW,EAAqBT,EAAc,cAAcA,EAAc,SAAS;AAAA,EAAA,GAG1EU;AAAA,IACEZ;AAAA,IACAE,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCC;AAAA,EAAA,GAGFH,EAAS,OAAO;AAAA,IACd,OAAOH,IAAiCK,EAAc,aAAa;AAAA,IACnE,QAAQJ,IAAkCI,EAAc,aAAa;AAAA,EAAA,GAGhEF;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;AAoBnD,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,CAwGlC;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,86 +1,89 @@
|
|
|
1
|
-
import { AXIS_NATURE_KEY as
|
|
2
|
-
const
|
|
1
|
+
import { AXIS_NATURE_KEY as g } from "../constantsCommon.js";
|
|
2
|
+
const v = 100, d = ["primaryGrouping", "secondaryGrouping"], T = ["grouping"], R = ["grouping"], m = [
|
|
3
3
|
"nodeColor",
|
|
4
4
|
"nodeShape",
|
|
5
5
|
"lineColor",
|
|
6
6
|
"heatmapAnnotation"
|
|
7
7
|
// dendro
|
|
8
|
-
],
|
|
9
|
-
async function
|
|
8
|
+
], I = (o) => o.sort((i, p) => i.label.localeCompare(p.label, "en", { numeric: !0 }));
|
|
9
|
+
async function y(o, i, p, E, f) {
|
|
10
10
|
const a = {};
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
for (let
|
|
14
|
-
const
|
|
15
|
-
if (S.has(
|
|
11
|
+
function c(s, e) {
|
|
12
|
+
const t = o.data.byColumns.values[s], n = e ? o.data.byColumns.values[e] : null, S = /* @__PURE__ */ new Set(), _ = [];
|
|
13
|
+
for (let l = 0; l < t.length; l++) {
|
|
14
|
+
const r = String(t[l]);
|
|
15
|
+
if (S.has(r) || t[l] === null)
|
|
16
16
|
continue;
|
|
17
|
-
if (S.size ===
|
|
18
|
-
a[
|
|
17
|
+
if (S.size === v) {
|
|
18
|
+
a[s] = null;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
S.add(
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
S.add(r);
|
|
22
|
+
const A = n ? String(n[l]) : r;
|
|
23
|
+
_.push({ value: r, label: A });
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
list:
|
|
27
|
-
labels:
|
|
28
|
-
options:
|
|
25
|
+
I(_), a[s] = {
|
|
26
|
+
list: _.map((l) => l.value),
|
|
27
|
+
labels: _.reduce((l, r) => (l[r.value] = r.value, l), {}),
|
|
28
|
+
options: _
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
const e =
|
|
31
|
+
o.settings.type === "discrete" && d.forEach((s) => {
|
|
32
|
+
const e = o.settings[s];
|
|
33
33
|
if (e) {
|
|
34
|
-
const { columnName:
|
|
35
|
-
|
|
34
|
+
const { columnName: t } = e;
|
|
35
|
+
c(t.value, t.valueLabels);
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
38
|
-
const e =
|
|
39
|
-
e == null || e.forEach(({
|
|
40
|
-
|
|
37
|
+
}), (o.settings.type === "scatterplot" || o.settings.type === "scatterplot-umap") && T.forEach((s) => {
|
|
38
|
+
const e = o.settings[s];
|
|
39
|
+
e == null || e.forEach(({ columnName: t }) => {
|
|
40
|
+
c(t.value, t.valueLabels);
|
|
41
41
|
});
|
|
42
|
-
}),
|
|
43
|
-
const e =
|
|
44
|
-
e &&
|
|
42
|
+
}), o.settings.type === "histogram" && R.forEach((s) => {
|
|
43
|
+
const e = o.settings[s];
|
|
44
|
+
e && c(e.value, e.valueLabels);
|
|
45
|
+
}), o.settings.type === "dendro" && m.forEach((s) => {
|
|
46
|
+
const e = o.settings[s];
|
|
47
|
+
e && c(e.value, e.valueLabels);
|
|
45
48
|
});
|
|
46
49
|
const u = [];
|
|
47
|
-
[...
|
|
48
|
-
var
|
|
49
|
-
const e =
|
|
50
|
-
e.kind === "axis" && ((
|
|
50
|
+
[...i.freeOptionsSet].forEach((s) => {
|
|
51
|
+
var t, n, S;
|
|
52
|
+
const e = i.getSourceInfo(s);
|
|
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" && u.push(s);
|
|
51
54
|
});
|
|
52
|
-
for (const
|
|
53
|
-
if (!a[
|
|
54
|
-
if (
|
|
55
|
-
a[
|
|
56
|
-
else if (
|
|
57
|
-
const e = await
|
|
58
|
-
e.overflow ? a[
|
|
59
|
-
list: e.values.map((
|
|
55
|
+
for (const s of u)
|
|
56
|
+
if (!a[s]) {
|
|
57
|
+
if (f[s] && !a[s])
|
|
58
|
+
a[s] = f[s];
|
|
59
|
+
else if (E) {
|
|
60
|
+
const e = await p.getUniqueSourceValuesWithLabels(E, i, s, v);
|
|
61
|
+
e.overflow ? a[s] = null : a[s] = {
|
|
62
|
+
list: e.values.map((t) => t.value),
|
|
60
63
|
options: e.values,
|
|
61
|
-
labels: e.values.reduce((
|
|
64
|
+
labels: e.values.reduce((t, n) => (t[n.value] = n.label, t), {})
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
return a;
|
|
66
69
|
}
|
|
67
|
-
async function N(
|
|
68
|
-
const
|
|
70
|
+
async function N(o, i, p, E) {
|
|
71
|
+
const f = [];
|
|
69
72
|
["filters", "tabBy"].forEach((u) => {
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
for (const { selectedSource: e, selectedFilterValue:
|
|
73
|
-
u === "filters" &&
|
|
73
|
+
const s = o[u];
|
|
74
|
+
if (s)
|
|
75
|
+
for (const { selectedSource: e, selectedFilterValue: t, type: n } of s.selectorStates)
|
|
76
|
+
u === "filters" && n === "equals" && t ? f.push([e, t]) : t && f.push([e, t]);
|
|
74
77
|
});
|
|
75
|
-
const
|
|
76
|
-
for (const [u,
|
|
77
|
-
const e = await
|
|
78
|
-
e.values.length === 1 && (
|
|
78
|
+
const c = {};
|
|
79
|
+
for (const [u, s] of f) {
|
|
80
|
+
const e = await p.getUniqueSourceValuesWithLabels(E, i, u, 1, void 0, s);
|
|
81
|
+
e.values.length === 1 && (c[u] = e.values[0]);
|
|
79
82
|
}
|
|
80
|
-
return
|
|
83
|
+
return c;
|
|
81
84
|
}
|
|
82
85
|
export {
|
|
83
|
-
|
|
86
|
+
y as getUniqueValuesFromReadyChartData,
|
|
84
87
|
N as loadFilterLabelsForTitle
|
|
85
88
|
};
|
|
86
89
|
//# 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 { DiscreteSettings, 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_GROUPING_ARR = ['grouping'];\nconst SAVED_IN_CHART_DATA_GROUPING_SINGLE = [\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 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 SAVED_IN_CHART_DATA_GROUPING_ARR.forEach((inputName:string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({value, valueLabels}) => {\n addUniqueData(value, valueLabels);\n });\n });\n SAVED_IN_CHART_DATA_GROUPING_SINGLE.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as ScatterplotSettings['label'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\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_GROUPING_ARR","SAVED_IN_CHART_DATA_GROUPING_SINGLE","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","value","valueLabels","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,IAAmC,CAAC,UAAU,GAC9CC,IAAsC;AAAA,EAC1C;AAAA,EAAa;AAAA,EAAa;AAAA,EAAa;AAAA;AACzC,GAEMC,IAAa,CAACC,MAA0CA,EAAO,KAAK,CAACC,GAAGC,MAAMD,EAAE,MAAM,cAAcC,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ACZC,IACN,CAAA,CAAE;AAAA,QAAA;AAAA,MAGX;AAAA;AAEF,SAAOZ;AACT;AAiEA,eAAsB6B,EACpBC,GACAlC,GACAC,GACAC,GACoC;AACpC,QAAMiC,IAA+B,CAAA;AAErC,EADiC,CAAC,WAAW,OAAO,EAC3B,QAAQ,CAAAlB,MAAa;AAC5C,UAAMmB,IAAiBF,EAAajB,CAAS;AAC7C,QAAImB;AACF,iBAAW,EAAE,gBAAAC,GAAgB,qBAAAC,GAAqB,MAAAC,EAAA,KAAUH,EAAe;AACzE,QAAInB,MAAc,aAAasB,MAAS,YAAYD,IAClDH,EAAS,KAAK,CAACE,GAAgBC,CAAmB,CAAC,IAC1CA,KACTH,EAAS,KAAK,CAACE,GAAgBC,CAAmB,CAAC;AAAA,EAI3D,CAAC;AACD,QAAM3B,IAAoC,CAAA;AAC1C,aAAW,CAACoB,GAAQS,CAAa,KAAKL,GAAU;AAC9C,UAAMH,IAAuB,MAAM/B,EAAW,gCAAgCC,GAAWF,GAAY+B,GAAQ,GAAG,QAAWS,CAAa;AACxI,IAAIR,EAAqB,OAAO,WAAW,MACzCrB,EAAOoB,CAAM,IAAIC,EAAqB,OAAO,CAAC;AAAA,EAElD;AACA,SAAOrB;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', // 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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