@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,84 +1,87 @@
|
|
|
1
|
-
import { PALETTE_MAP as
|
|
2
|
-
import { SCATTERPLOT_TEMPLATES_MAP as
|
|
3
|
-
import { getScatterplotAes as
|
|
4
|
-
import { getScatterplotLayersSettings as
|
|
5
|
-
import {
|
|
1
|
+
import { PALETTE_MAP as C, DEFAULT_CATEGORICAL_PALETTE as K, UNKNOWN_COLOR as M, DEFAULT_BLACK as U } from "../../constantsAesthetic.js";
|
|
2
|
+
import { SCATTERPLOT_TEMPLATES_MAP as Y, isMappedAes as H, THRESHOLDS_KEY as D, PALETTE_KEY as F, UPPER_LIMIT_KEY as y, LOWER_LIMIT_KEY as _, SYMMETRIC_RANGE_KEY as h } from "../../constantsCommon.js";
|
|
3
|
+
import { getScatterplotAes as W, DEFAULT_LINE_WIDTH as j, DEFAULT_DOT_SIZE as k, DEFAULT_DOT_SHAPE as V } from "../../dataBindAes.js";
|
|
4
|
+
import { getScatterplotLayersSettings as w } from "./getLayersDataFromForms.js";
|
|
5
|
+
import { getAxesDataFromFormsScatterplot as B } 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
o.
|
|
19
|
-
|
|
8
|
+
function J(o, E, n, f, r) {
|
|
9
|
+
var d, A, S, L, x;
|
|
10
|
+
const s = (d = E.selectorStates[0]) == null ? void 0 : d.selectedSource, i = (A = n.selectorStates[0]) == null ? void 0 : A.selectedSource, c = (S = f.selectorStates[0]) == null ? void 0 : S.selectedSource, t = r.getSourceInfo(i), e = r.getSourceInfo(c);
|
|
11
|
+
o.grouping = [...o.grouping ?? []].map((a) => ({ ...a }));
|
|
12
|
+
const m = o.xAxis, l = o.yAxis;
|
|
13
|
+
if (E.selectorStates.length) {
|
|
14
|
+
const a = r.getSourceInfo(s).annotations;
|
|
15
|
+
if (a != null && a[D] && (JSON.parse(a[D]) ?? []).forEach((N) => {
|
|
16
|
+
var g;
|
|
17
|
+
const { columnId: p, value: T } = N;
|
|
18
|
+
p && t.kind === "column" && t.type === p.valueType && t.name === p.name && ((g = o.xAxis) == null ? void 0 : g.scale) === "discrete" && (m.significantLines || (m.significantLines = []), m.significantLines.push(Number(T))), p && e.kind === "column" && e.type === p.valueType && e.name === p.name && (l.significantLines || (l.significantLines = []), l.significantLines.push(Number(T)));
|
|
19
|
+
}), a != null && a[F]) {
|
|
20
|
+
const O = JSON.parse(a[F]), { mapping: N = {}, name: p = "" } = O;
|
|
21
|
+
o.layers.forEach((u) => {
|
|
22
|
+
u.type === "dots" && (u.aes || (u.aes = {}), u.aes.dotFill = { type: "grouping", value: s });
|
|
20
23
|
});
|
|
21
|
-
const
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
fillColor:
|
|
27
|
-
lineColor:
|
|
28
|
-
dotFill:
|
|
29
|
-
dotShape:
|
|
30
|
-
dotSize:
|
|
31
|
-
lineWidth:
|
|
32
|
-
},
|
|
24
|
+
const T = [...Object.entries(N), ["null", M]], g = ((L = C[p]) == null ? void 0 : L.colors) ?? [];
|
|
25
|
+
(x = o.grouping) == null || x.forEach((u) => {
|
|
26
|
+
u.columnName.value === s && (u.inheritedAes = T.reduce((b, [P, R]) => {
|
|
27
|
+
const I = g[Number(R)] ?? U;
|
|
28
|
+
return b[P] = {
|
|
29
|
+
fillColor: I,
|
|
30
|
+
lineColor: I,
|
|
31
|
+
dotFill: I,
|
|
32
|
+
dotShape: V,
|
|
33
|
+
dotSize: k,
|
|
34
|
+
lineWidth: j
|
|
35
|
+
}, b;
|
|
33
36
|
}, {}));
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
t.annotations && (t.annotations[y] && (
|
|
40
|
+
t.annotations && (t.annotations[y] && (m.upperValue = Number(t.annotations[y])), t.annotations[_] && (m.lowerValue = Number(t.annotations[_])), t.annotations[h] && (m.symmetricRange = Number(t.annotations[h]))), e.annotations && (e.annotations[y] && (l.upperValue = Number(e.annotations[y])), e.annotations[_] && (l.lowerValue = Number(e.annotations[_])), e.annotations[h] && (l.symmetricRange = Number(e.annotations[h])));
|
|
38
41
|
}
|
|
39
|
-
function
|
|
40
|
-
(
|
|
41
|
-
const i =
|
|
42
|
-
c.order.length ? (
|
|
42
|
+
function z(o, E, n, f, r) {
|
|
43
|
+
(E.selectorStates.length || n != null && n.selectorStates.length) && (o.grouping = [...o.grouping ?? []].map((s) => ({ ...s })), o.grouping.forEach((s) => {
|
|
44
|
+
const i = s.columnName.value, c = W(i, f, r);
|
|
45
|
+
c.order.length ? (s.order = c.order, s.inheritedAes = c.inheritedAes) : o.layers.forEach((t) => {
|
|
43
46
|
const e = t.aes;
|
|
44
47
|
if (!e)
|
|
45
48
|
return;
|
|
46
|
-
Object.keys(e).forEach((
|
|
47
|
-
var A,
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
49
|
+
Object.keys(e).forEach((l) => {
|
|
50
|
+
var A, S;
|
|
51
|
+
const d = e[l];
|
|
52
|
+
if (H(d) && d.value === i) {
|
|
53
|
+
const L = ((S = C[((A = r[i]) == null ? void 0 : A.palette) ?? K]) == null ? void 0 : S.colors) ?? [];
|
|
54
|
+
d.palette = L;
|
|
52
55
|
}
|
|
53
56
|
});
|
|
54
57
|
});
|
|
55
58
|
}));
|
|
56
59
|
}
|
|
57
|
-
function
|
|
60
|
+
function oo(o, E, n, f, r) {
|
|
58
61
|
var c, t;
|
|
59
|
-
o.layers =
|
|
60
|
-
|
|
62
|
+
o.layers = w(
|
|
63
|
+
Y[n.template],
|
|
61
64
|
n.layersSettings,
|
|
62
|
-
|
|
65
|
+
E,
|
|
63
66
|
n.optionsState,
|
|
64
67
|
n.dataBindAes,
|
|
65
68
|
f,
|
|
66
69
|
(c = o == null ? void 0 : o.grouping) == null ? void 0 : c.map((e) => e.columnName)
|
|
67
|
-
),
|
|
70
|
+
), z(
|
|
68
71
|
o,
|
|
69
72
|
n.optionsState.components.grouping,
|
|
70
73
|
n.optionsState.components.shape,
|
|
71
|
-
|
|
74
|
+
r,
|
|
72
75
|
n.dataBindAes
|
|
73
76
|
);
|
|
74
|
-
const
|
|
75
|
-
return
|
|
77
|
+
const s = n.statisticsSettings, i = o.layers.find((e) => e.type === "dots");
|
|
78
|
+
return s.trend.on && i && (o.trend = {
|
|
76
79
|
color: (t = i.aes) == null ? void 0 : t.dotFill,
|
|
77
80
|
bounded: !1
|
|
78
81
|
}), Object.assign(
|
|
79
82
|
o,
|
|
80
|
-
|
|
81
|
-
),
|
|
83
|
+
B(n.axesSettings, r, n.optionsState, f)
|
|
84
|
+
), J(
|
|
82
85
|
o,
|
|
83
86
|
n.optionsState.components.grouping,
|
|
84
87
|
n.optionsState.components.x,
|
|
@@ -87,8 +90,8 @@ function G(o, u, n, f, s) {
|
|
|
87
90
|
), o;
|
|
88
91
|
}
|
|
89
92
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
J as applyChartInfoFromAnnotations,
|
|
94
|
+
z as applyInheritedAes,
|
|
95
|
+
oo as composeScatterplotSettings
|
|
93
96
|
};
|
|
94
97
|
//# 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 settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\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\n settings.grouping?.forEach((groupingElement) => {\n if (groupingElement.columnName.value === groupingSource) {\n groupingElement.inheritedAes = 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 }\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","v","annotations","THRESHOLDS_KEY","thresholdData","columnId","value","PALETTE_KEY","paletteData","mapping","name","layer","paletteEntries","UNKNOWN_COLOR","paletteColors","_d","PALETTE_MAP","_e","groupingElement","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","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,EAAE,eAAe,CAAC,MAAlB,gBAAAO,EAAqB,gBAC/BC,IAAQP,EAAW,cAAcG,CAAO,GACxCK,IAAQR,EAA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AAuB,MAASA,EAAM,SAAS,MAAM;AACrE,SAAIoC,EAAmB,MAAM,MAAMC,MACjC5D,EAAS,QAAQ;AAAA,IACf,QAAOQ,IAAAoD,EAAU,QAAV,gBAAApD,EAAe;AAAA,IACtB,SAAS;AAAA,EAAA,IAIb,OAAO;AAAA,IACLR;AAAA,IACA6D,EAAqBL,EAAc,cAAcA,EAAc,SAAS;AAAA,EAAA,GAG1EzD;AAAA,IACEC;AAAA,IACAwD,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCpD;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, getAxesDataFromFormsScatterplot, getScatterplotLayersSettings } from '../index';\nimport { AxisSettingsContinuous } from '@milaboratories/miplots4';\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 settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\n\n const xAxis = settings.xAxis as AxisSettingsContinuous;\n const yAxis = settings.yAxis as AxisSettingsContinuous;\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 && settings.xAxis?.scale === 'discrete')) {\n if (!xAxis.significantLines) {\n xAxis.significantLines = [];\n }\n xAxis.significantLines.push(Number(value));\n }\n\n if (columnId && (yInfo.kind === 'column' && yInfo.type === columnId.valueType && yInfo.name === columnId.name)) {\n if (!yAxis.significantLines) {\n yAxis.significantLines = [];\n }\n 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\n settings.grouping?.forEach((groupingElement) => {\n if (groupingElement.columnName.value === groupingSource) {\n groupingElement.inheritedAes = 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 }\n }\n if (xInfo.annotations) {\n if (xInfo.annotations[UPPER_LIMIT_KEY]) {\n xAxis!.upperValue = Number(xInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (xInfo.annotations[LOWER_LIMIT_KEY]) {\n xAxis!.lowerValue = Number(xInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (xInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n xAxis!.symmetricRange = Number(xInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n\n if (yInfo.annotations) {\n if (yInfo.annotations[UPPER_LIMIT_KEY]) {\n yAxis!.upperValue = Number(yInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (yInfo.annotations[LOWER_LIMIT_KEY]) {\n yAxis!.lowerValue = Number(yInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (yInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n 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 getAxesDataFromFormsScatterplot(reactiveState.axesSettings, uniqueValuesData, reactiveState.optionsState, inputGuide)\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","v","xAxis","yAxis","annotations","THRESHOLDS_KEY","thresholdData","columnId","value","PALETTE_KEY","paletteData","mapping","name","layer","paletteEntries","UNKNOWN_COLOR","paletteColors","_d","PALETTE_MAP","_e","groupingElement","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","el","selectedSource","savedData","getScatterplotAes","layerAes","aesKey","isMappedAes","colors","DEFAULT_CATEGORICAL_PALETTE","composeScatterplotSettings","dataByColumns","reactiveState","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","statisticsSettings","dotsLayer","getAxesDataFromFormsScatterplot"],"mappings":";;;;;;;AAsCO,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,EAAAT,EAAS,WAAW,CAAC,GAAIA,EAAS,YAAY,CAAA,CAAG,EAAE,IAAI,CAAAa,OAAM,EAAC,GAAGA,IAAG;AAEpE,QAAMC,IAAQd,EAAS,OACjBe,IAAQf,EAAS;AACvB,MAAIC,EAAS,eAAe,QAAQ;AAClC,UAAMe,IAAcZ,EAAW,cAAcC,CAAc,EAAE;AAsB7D,QArBIW,KAAA,QAAAA,EAAcC,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U;AAAA,EAAA,GAGtHL;AAAA,IACEC;AAAA,IACA0D,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCtD;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?: "center" | "left" | "right" | undefined;
|
|
10
10
|
};
|
|
11
11
|
x: {
|
|
12
12
|
type: "column";
|
|
@@ -149,15 +149,12 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
149
149
|
} | undefined;
|
|
150
150
|
scale?: "linear" | "log" | undefined;
|
|
151
151
|
showGrid?: boolean | undefined;
|
|
152
|
-
linesBetweenCategories?: boolean | undefined;
|
|
153
152
|
showTicks?: boolean | undefined;
|
|
154
|
-
labelsPosition?: "center" | "45deg" | "90deg" | undefined;
|
|
155
153
|
significantLines?: number[] | undefined;
|
|
156
154
|
significantLinesStyle?: "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash" | undefined;
|
|
157
155
|
symmetricRange?: number | undefined;
|
|
158
156
|
upperValue?: number | undefined;
|
|
159
157
|
lowerValue?: number | undefined;
|
|
160
|
-
hiddenLabels?: boolean | undefined;
|
|
161
158
|
} | undefined;
|
|
162
159
|
yAxis?: {
|
|
163
160
|
title?: string | {
|
|
@@ -169,15 +166,12 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
169
166
|
} | undefined;
|
|
170
167
|
scale?: "linear" | "log" | undefined;
|
|
171
168
|
showGrid?: boolean | undefined;
|
|
172
|
-
linesBetweenCategories?: boolean | undefined;
|
|
173
169
|
showTicks?: boolean | undefined;
|
|
174
|
-
labelsPosition?: "center" | "45deg" | "90deg" | undefined;
|
|
175
170
|
significantLines?: number[] | undefined;
|
|
176
171
|
significantLinesStyle?: "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash" | undefined;
|
|
177
172
|
symmetricRange?: number | undefined;
|
|
178
173
|
upperValue?: number | undefined;
|
|
179
174
|
lowerValue?: number | undefined;
|
|
180
|
-
hiddenLabels?: boolean | undefined;
|
|
181
175
|
} | undefined;
|
|
182
176
|
highlight?: {
|
|
183
177
|
type: "column";
|
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,aAA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AAC;;;kBAAsF,CAAC;iBAAuC,CAAC;uBAA6C,CAAC;;aAA0D,CAAC;gBAAgD,CAAC;iBAAwC,CAAC;wBAA+C,CAAC;6BAAqD,CAAC;sBAAwG,CAAC;kBAAwC,CAAC;kBAAwC,CAAC;;;aAAoE,CAAC;;;kBAAsF,CAAC;iBAAuC,CAAC;uBAA6C,CAAC;;aAA0D,CAAC;gBAAgD,CAAC;iBAAwC,CAAC;wBAA+C,CAAC;6BAAqD,CAAC;sBAAwG,CAAC;kBAAwC,CAAC;kBAAwC,CAAC;;;;;cAAwH,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;EAAz1nE"}
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { SCATTERPLOT_TEMPLATES_MAP as _ } from "../../constantsCommon.js";
|
|
2
2
|
import { DEFAULT_DOT_SIZE_CANVAS as l } from "../../dataBindAes.js";
|
|
3
3
|
import { getScatterplotLayersSettings as E } from "./getLayersDataFromForms.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getAxesDataFromFormsScatterplot 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
|
-
var
|
|
8
|
+
import { applyInheritedAes as t, applyChartInfoFromAnnotations as S } from "./composeScatterplotSettings.js";
|
|
9
|
+
const L = 750, f = 450;
|
|
10
|
+
function C(p, A, o, m, n) {
|
|
11
|
+
var r;
|
|
12
12
|
return p.layers = E(
|
|
13
13
|
_[o.template],
|
|
14
14
|
o.layersSettings,
|
|
15
|
-
|
|
15
|
+
A,
|
|
16
16
|
o.optionsState,
|
|
17
17
|
o.dataBindAes,
|
|
18
18
|
m,
|
|
19
|
-
(
|
|
19
|
+
(r = p == null ? void 0 : p.grouping) == null ? void 0 : r.map((T) => T.columnName),
|
|
20
20
|
l
|
|
21
|
-
),
|
|
21
|
+
), t(
|
|
22
22
|
p,
|
|
23
23
|
o.optionsState.components.grouping,
|
|
24
24
|
void 0,
|
|
25
|
-
|
|
25
|
+
n,
|
|
26
26
|
o.dataBindAes
|
|
27
27
|
), Object.assign(
|
|
28
28
|
p,
|
|
29
|
-
s(o.axesSettings, o.
|
|
30
|
-
),
|
|
29
|
+
s(o.axesSettings, n, o.optionsState, m)
|
|
30
|
+
), S(
|
|
31
31
|
p,
|
|
32
32
|
o.optionsState.components.grouping,
|
|
33
33
|
o.optionsState.components.x,
|
|
34
34
|
o.optionsState.components.y,
|
|
35
35
|
m
|
|
36
36
|
), p.size = {
|
|
37
|
-
width:
|
|
37
|
+
width: L * o.chartScale / 100,
|
|
38
38
|
height: f * o.chartScale / 100
|
|
39
39
|
}, p;
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
C as composeScatterplotUmapSettings
|
|
43
43
|
};
|
|
44
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 {
|
|
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 { getAxesDataFromFormsScatterplot, 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 getAxesDataFromFormsScatterplot(reactiveState.axesSettings, uniqueValuesData, reactiveState.optionsState, inputGuide)\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","getAxesDataFromFormsScatterplot","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,EAAgCT,EAAc,cAAcE,GAAkBF,EAAc,cAAcC,CAAU;AAAA,EAAA,GAGtHS;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,9 +1,10 @@
|
|
|
1
1
|
import { AxesState } from '../../constantsCommon';
|
|
2
|
-
import { ChartType } from '@milaboratories/pf-plots';
|
|
3
|
-
import { LabelsRotation, UniqueValuesData } from '../../types';
|
|
2
|
+
import { ChartType, InputGuide, InputState } from '@milaboratories/pf-plots';
|
|
3
|
+
import { LabelsRotation, ReactiveState, UniqueValuesBySourceMap, UniqueValuesData } from '../../types';
|
|
4
|
+
import { AxisSettingsContinuous, AxisSettingsDiscrete, HeatmapSettings } from '@milaboratories/miplots4';
|
|
4
5
|
type AxesSettings = {
|
|
5
|
-
xAxis:
|
|
6
|
-
yAxis:
|
|
6
|
+
xAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['xAxis'];
|
|
7
|
+
yAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['yAxis'];
|
|
7
8
|
frame: {
|
|
8
9
|
type: string;
|
|
9
10
|
};
|
|
@@ -18,6 +19,7 @@ type AxesSettings = {
|
|
|
18
19
|
groupingStack?: AxesState['other']['groupingStack'];
|
|
19
20
|
};
|
|
20
21
|
export declare function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups?: UniqueValuesData['options']): LabelsRotation;
|
|
22
|
+
export declare function getAxesDataFromFormsScatterplot(axesFormsData: AxesState, uniqueValues: UniqueValuesBySourceMap, optionsState: ReactiveState['optionsState'], inputGuide: InputGuide<InputState>): AxesSettings;
|
|
21
23
|
export declare function getAxesDataFromForms(axesFormsData: AxesState, chartType: ChartType, discreteGroups?: UniqueValuesData['options']): AxesSettings;
|
|
22
24
|
export {};
|
|
23
25
|
//# sourceMappingURL=getAxesDataFromForms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAxesDataFromForms.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getAxesDataFromForms.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"names":[],"mappings":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C,EAC3C,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,GACjC,YAAY,CAmFd;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,GAAE,gBAAgB,CAAC,SAAS,CAAM,GAAG,YAAY,CAkDnJ"}
|
|
@@ -1,21 +1,50 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function E(e, l = []) {
|
|
2
|
+
return e !== null ? e : l.length > 6 && l.some(({ label: c }) => c.length > 5) ? "45deg" : "center";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
function H(e, l, c, n) {
|
|
5
|
+
var y, p, k, x, M, _, T, w, C, R, B, O;
|
|
6
|
+
let i = {}, t = {};
|
|
7
|
+
i.showGrid = e.axisX.gridlines, i.showTicks = e.axisX.ticks, t.showGrid = e.axisY.gridlines, t.showTicks = e.axisY.ticks;
|
|
8
|
+
const o = ((y = c.components.x.selectorStates) == null ? void 0 : y[0].selectedSource) ?? null, g = ((p = c.components.y.selectorStates) == null ? void 0 : p[0].selectedSource) ?? null, b = o ? n.getSourceInfo(o) : null, h = g ? n.getSourceInfo(g) : null, A = (b == null ? void 0 : b.type) === "String", Y = (h == null ? void 0 : h.type) === "String";
|
|
9
|
+
if (console.log("isDiscreteX", A, b), console.log("isDiscreteY", Y, h), A) {
|
|
10
|
+
i = i, i.scale = "discrete", i.labelsPosition = e.axisX.labelsRotation ?? "center";
|
|
11
|
+
const u = ((k = e.axisX.order) == null ? void 0 : k.source) === o, r = (x = l[o]) == null ? void 0 : x.list, d = (M = l[o]) == null ? void 0 : M.labels, f = u ? ((_ = e.axisX.order) == null ? void 0 : _.options.map((s) => s.value)) ?? r : r, S = u ? ((T = e.axisX.order) == null ? void 0 : T.options.reduce((s, X) => (s[X.value] = X.label, s), {})) ?? d : d;
|
|
12
|
+
f && S && (i.keys = f, i.labels = S);
|
|
13
|
+
} else
|
|
14
|
+
i = i, i.scale = e.axisX.scale, i.significantLinesStyle = e.axisX.significantLinesStyle;
|
|
15
|
+
if (Y) {
|
|
16
|
+
t = t, t.scale = "discrete", t.labelsPosition = e.axisY.labelsRotation ?? "center";
|
|
17
|
+
const u = (w = l[g]) == null ? void 0 : w.list, r = (C = l[g]) == null ? void 0 : C.labels, d = ((R = e.axisY.order) == null ? void 0 : R.source) === g, f = d ? ((B = e.axisY.order) == null ? void 0 : B.options.map((s) => s.value)) ?? u : u, S = d ? ((O = e.axisY.order) == null ? void 0 : O.options.reduce((s, X) => (s[X.value] = X.label, s), {})) ?? r : r;
|
|
18
|
+
f && S && (t.keys = f, t.labels = S);
|
|
19
|
+
} else
|
|
20
|
+
t = t, t.scale = e.axisY.scale, t.significantLinesStyle = e.axisY.significantLinesStyle;
|
|
21
|
+
e.axisY.titleMode !== "auto" && (t.title = e.axisY.titleMode === "custom" ? e.axisY.customTitle : ""), e.axisX.titleMode !== "auto" && (i.title = e.axisX.titleMode === "custom" ? e.axisX.customTitle : "");
|
|
22
|
+
const L = {
|
|
23
|
+
xAxis: i,
|
|
24
|
+
yAxis: t,
|
|
25
|
+
frame: { type: e.other.frame },
|
|
11
26
|
facetSettings: {
|
|
12
|
-
nCols:
|
|
27
|
+
nCols: e.other.facetColumns
|
|
13
28
|
}
|
|
14
29
|
};
|
|
15
|
-
return
|
|
30
|
+
return L.facetSettings.sharedX = ["x", "xy"].includes(e.other.facetSharedBy), L.facetSettings.sharedY = ["y", "xy"].includes(e.other.facetSharedBy), L;
|
|
31
|
+
}
|
|
32
|
+
function N(e, l, c = []) {
|
|
33
|
+
let n = {}, i = {};
|
|
34
|
+
l === "discrete" && (n.labelsPosition = E(e.axisX.labelsRotation, c), n.linesBetweenCategories = e.axisX.linesBetweenCategories, i.scale = e.axisY.scale, n.showGrid = e.axisX.gridlines, n.showTicks = e.axisX.ticks, i.showGrid = e.axisY.gridlines, i.showTicks = e.axisY.ticks), l === "histogram" && (n.scale = e.axisX.scale, i.scale = e.axisY.scale), (l === "heatmap" || l === "bubble") && (n.axisLabelsAngle = e.axisX.axisLabelsAngle, n.groupLabelsAngle = e.axisX.groupLabelsAngle, i.axisLabelsAngle = e.axisY.axisLabelsAngle, i.groupLabelsAngle = e.axisY.groupLabelsAngle, n.sorting = e.axisX.sorting, i.sorting = e.axisY.sorting), e.axisY.titleMode !== "auto" && (i.title = e.axisY.titleMode === "custom" ? e.axisY.customTitle : ""), e.axisX.titleMode !== "auto" && (n.title = e.axisX.titleMode === "custom" ? e.axisX.customTitle : "");
|
|
35
|
+
const t = {
|
|
36
|
+
xAxis: n,
|
|
37
|
+
yAxis: i,
|
|
38
|
+
frame: { type: e.other.frame },
|
|
39
|
+
facetSettings: {
|
|
40
|
+
nCols: e.other.facetColumns
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (l === "discrete" || l === "scatterplot" || l === "heatmap") && (t.orientation = e.other.reverse ? "horizontal" : "vertical", t.facetSettings.sharedX = ["x", "xy"].includes(e.other.facetSharedBy), t.facetSettings.sharedY = ["y", "xy"].includes(e.other.facetSharedBy)), l === "histogram" && (t.groupingDirection = e.other.groupingDirection, t.groupingStack = e.other.groupingStack), t;
|
|
16
44
|
}
|
|
17
45
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
46
|
+
N as getAxesDataFromForms,
|
|
47
|
+
H as getAxesDataFromFormsScatterplot,
|
|
48
|
+
E as getDiscreteLabelsRotation
|
|
20
49
|
};
|
|
21
50
|
//# sourceMappingURL=getAxesDataFromForms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAxesDataFromForms.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"sourcesContent":["import {AxesState} from '../../constantsCommon';\nimport {ChartType} from \"@milaboratories/pf-plots\";\nimport { LabelsRotation, UniqueValuesData } from '../../types';\n\ntype AxesSettings = {\n xAxis: Record<string, string|boolean|number|undefined>\n yAxis: Record<string, string|boolean|number|undefined>\n frame: {type: string}\n orientation?: string\n title?: Record<string, string>\n facetSettings: {\n nCols: number\n sharedX?: boolean,\n sharedY?: boolean\n },\n groupingDirection?: AxesState['other']['groupingDirection'],\n groupingStack?: AxesState['other']['groupingStack'],\n}\n\nconst HORIZONTAL_CAPTURES_MAX_COUNT = 6;\nconst SHORT_LABEL_MAX_LENGTH = 5;\nexport function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups:UniqueValuesData['options'] = []) {\n if (value !== null) {\n return value;\n }\n if (\n discreteGroups.length > HORIZONTAL_CAPTURES_MAX_COUNT &&\n discreteGroups.some(({label}) => label.length > SHORT_LABEL_MAX_LENGTH)\n ) {\n return '45deg';\n }\n return 'center';\n}\nexport function getAxesDataFromForms(axesFormsData:AxesState, chartType:ChartType, discreteGroups:UniqueValuesData['options'] = []):AxesSettings {\n let xAxis:AxesSettings['xAxis'] = {};\n let yAxis:AxesSettings['yAxis'] = {};\n if (chartType === 'discrete') {\n xAxis.labelsPosition = getDiscreteLabelsRotation(axesFormsData.axisX.labelsRotation, discreteGroups);\n xAxis.linesBetweenCategories = axesFormsData.axisX.linesBetweenCategories;\n yAxis.scale = axesFormsData.axisY.scale;\n }\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'scatterplot-umap') {\n xAxis.showGrid = axesFormsData.axisX.gridlines;\n xAxis.showTicks = axesFormsData.axisX.ticks;\n yAxis.showGrid = axesFormsData.axisY.gridlines;\n yAxis.showTicks = axesFormsData.axisY.ticks;\n }\n if (chartType === 'scatterplot' || chartType === 'scatterplot-umap') {\n xAxis.scale = axesFormsData.axisX.scale;\n yAxis.scale = axesFormsData.axisY.scale;\n xAxis.significantLinesStyle = axesFormsData.axisX.significantLinesStyle;\n yAxis.significantLinesStyle = axesFormsData.axisY.significantLinesStyle;\n }\n if (chartType === 'histogram') {\n xAxis.scale = axesFormsData.axisX.scale;\n yAxis.scale = axesFormsData.axisY.scale;\n }\n if (chartType === 'heatmap' || chartType === 'bubble') {\n xAxis.axisLabelsAngle = axesFormsData.axisX.axisLabelsAngle;\n xAxis.groupLabelsAngle = axesFormsData.axisX.groupLabelsAngle;\n yAxis.axisLabelsAngle = axesFormsData.axisY.axisLabelsAngle;\n yAxis.groupLabelsAngle = axesFormsData.axisY.groupLabelsAngle;\n xAxis.sorting = axesFormsData.axisX.sorting;\n yAxis.sorting = axesFormsData.axisY.sorting;\n }\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : ''\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : ''\n }\n\n const result:AxesSettings = {\n xAxis,\n yAxis,\n frame: {type: axesFormsData.other.frame},\n facetSettings: {\n nCols: axesFormsData.other.facetColumns\n }\n };\n\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'heatmap') {\n result.orientation = axesFormsData.other.reverse ? 'horizontal' : 'vertical';\n result.facetSettings.sharedX = (['x','xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y','xy']).includes(axesFormsData.other.facetSharedBy);\n }\n if (chartType === 'histogram') {\n result.groupingDirection = axesFormsData.other.groupingDirection;\n result.groupingStack = axesFormsData.other.groupingStack;\n }\n return result;\n}\n"],"names":["getDiscreteLabelsRotation","value","discreteGroups","label","getAxesDataFromForms","axesFormsData","chartType","xAxis","yAxis","result"],"mappings":"AAqBO,SAASA,EAA0BC,GAA8BC,IAA6C,IAAI;AACvH,SAAID,MAAU,OACLA,IAGPC,EAAe,SAAS,KACxBA,EAAe,KAAK,CAAC,EAAC,OAAAC,QAAWA,EAAM,SAAS,CAAsB,IAE/D,UAEF;AACT;AACO,SAASC,EAAqBC,GAAyBC,GAAqBJ,IAA6C,CAAA,GAAiB;AAC/I,MAAIK,IAA8B,CAAA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iBAAiBA,MAAc,eAC3EG,EAAO,cAAcJ,EAAc,MAAM,UAAU,eAAe,YAClEI,EAAO,cAAc,UAAW,CAAC,KAAI,IAAI,EAAG,SAASJ,EAAc,MAAM,aAAa,GACtFI,EAAO,cAAc,UAAW,CAAC,KAAI,IAAI,EAAG,SAASJ,EAAc,MAAM,aAAa,IAEpFC,MAAc,gBAChBG,EAAO,oBAAoBJ,EAAc,MAAM,mBAC/CI,EAAO,gBAAgBJ,EAAc,MAAM,gBAEtCI;AACT;"}
|
|
1
|
+
{"version":3,"file":"getAxesDataFromForms.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"sourcesContent":["import { AxesState } from '../../constantsCommon';\nimport { ChartType, InputGuide, InputState } from \"@milaboratories/pf-plots\";\nimport { LabelsRotation, ReactiveState, UniqueValuesBySourceMap, UniqueValuesData } from '../../types';\nimport { AxisSettingsContinuous } from '@milaboratories/miplots4';\nimport { AxisSettingsDiscrete } from '@milaboratories/miplots4';\nimport { HeatmapSettings } from '@milaboratories/miplots4';\n\ntype AxesSettings = {\n xAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['xAxis'];\n yAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['yAxis'];\n frame: { type: string };\n orientation?: string;\n title?: Record<string, string>;\n facetSettings: {\n nCols: number\n sharedX?: boolean,\n sharedY?: boolean\n };\n groupingDirection?: AxesState['other']['groupingDirection'];\n groupingStack?: AxesState['other']['groupingStack'];\n}\n\nconst HORIZONTAL_CAPTURES_MAX_COUNT = 6;\nconst SHORT_LABEL_MAX_LENGTH = 5;\n\nexport function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups: UniqueValuesData['options'] = []) {\n if (value !== null) {\n return value;\n }\n if (\n discreteGroups.length > HORIZONTAL_CAPTURES_MAX_COUNT &&\n discreteGroups.some(({ label }) => label.length > SHORT_LABEL_MAX_LENGTH)\n ) {\n return '45deg';\n }\n return 'center';\n}\n\nexport function getAxesDataFromFormsScatterplot(\n axesFormsData: AxesState,\n uniqueValues: UniqueValuesBySourceMap,\n optionsState: ReactiveState['optionsState'],\n inputGuide: InputGuide<InputState>,\n): AxesSettings {\n let xAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n let yAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n xAxis.showGrid = axesFormsData.axisX.gridlines;\n xAxis.showTicks = axesFormsData.axisX.ticks;\n yAxis.showGrid = axesFormsData.axisY.gridlines;\n yAxis.showTicks = axesFormsData.axisY.ticks;\n\n const xSource = optionsState.components.x.selectorStates?.[0].selectedSource ?? null;\n const ySource = optionsState.components.y.selectorStates?.[0].selectedSource ?? null;\n const infoX = xSource ? inputGuide.getSourceInfo(xSource) : null;\n const infoY = ySource ? inputGuide.getSourceInfo(ySource) : null;\n\n const isDiscreteX = infoX?.type === 'String';\n const isDiscreteY = infoY?.type === 'String';\n\n console.log('isDiscreteX', isDiscreteX, infoX);\n console.log('isDiscreteY', isDiscreteY, infoY);\n if (isDiscreteX) {\n xAxis = xAxis as AxisSettingsDiscrete;\n xAxis.scale = 'discrete';\n xAxis.labelsPosition = axesFormsData.axisX.labelsRotation ?? 'center';\n\n const saved = axesFormsData.axisX.order?.source === xSource;\n const uniqueList = uniqueValues[xSource]?.list;\n const uniqueLabels = uniqueValues[xSource]?.labels;\n const keys = saved ? axesFormsData.axisX.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved ? axesFormsData.axisX.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels : uniqueLabels;\n if (keys && labels) {\n xAxis.keys = keys;\n xAxis.labels = labels;\n };\n } else {\n xAxis = xAxis as AxisSettingsContinuous;\n xAxis.scale = axesFormsData.axisX.scale;\n xAxis.significantLinesStyle = axesFormsData.axisX.significantLinesStyle;\n }\n\n if (isDiscreteY) {\n yAxis = yAxis as AxisSettingsDiscrete;\n yAxis.scale = 'discrete';\n yAxis.labelsPosition = axesFormsData.axisY.labelsRotation ?? 'center';\n\n const uniqueList = uniqueValues[ySource]?.list;\n const uniqueLabels = uniqueValues[ySource]?.labels;\n const saved = axesFormsData.axisY.order?.source === ySource;\n const keys = saved ? axesFormsData.axisY.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved ? axesFormsData.axisY.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels : uniqueLabels;\n if (keys && labels) {\n yAxis.keys = keys;\n yAxis.labels = labels;\n };\n } else {\n yAxis = yAxis as AxisSettingsContinuous;\n yAxis.scale = axesFormsData.axisY.scale;\n yAxis.significantLinesStyle = axesFormsData.axisY.significantLinesStyle;\n }\n\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : ''\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : ''\n }\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns\n }\n };\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n\n return result;\n}\n\nexport function getAxesDataFromForms(axesFormsData: AxesState, chartType: ChartType, discreteGroups: UniqueValuesData['options'] = []): AxesSettings {\n let xAxis: AxesSettings['xAxis'] = {};\n let yAxis: AxesSettings['yAxis'] = {};\n if (chartType === 'discrete') {\n (xAxis as AxisSettingsDiscrete)!.labelsPosition = getDiscreteLabelsRotation(axesFormsData.axisX.labelsRotation, discreteGroups);\n (xAxis as AxisSettingsDiscrete)!.linesBetweenCategories = axesFormsData.axisX.linesBetweenCategories;\n (yAxis as AxisSettingsContinuous)!.scale = axesFormsData.axisY.scale;\n (xAxis as AxisSettingsDiscrete)!.showGrid = axesFormsData.axisX.gridlines;\n (xAxis as AxisSettingsDiscrete)!.showTicks = axesFormsData.axisX.ticks;\n (yAxis as AxisSettingsContinuous)!.showGrid = axesFormsData.axisY.gridlines;\n (yAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisY.ticks;\n }\n if (chartType === 'histogram') {\n (xAxis as AxisSettingsContinuous).scale = axesFormsData.axisX.scale;\n (yAxis as AxisSettingsContinuous).scale = axesFormsData.axisY.scale;\n }\n if (chartType === 'heatmap' || chartType === 'bubble') {\n (xAxis as HeatmapSettings['xAxis'])!.axisLabelsAngle = axesFormsData.axisX.axisLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.groupLabelsAngle = axesFormsData.axisX.groupLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.axisLabelsAngle = axesFormsData.axisY.axisLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.groupLabelsAngle = axesFormsData.axisY.groupLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.sorting = axesFormsData.axisX.sorting;\n (yAxis as HeatmapSettings['yAxis'])!.sorting = axesFormsData.axisY.sorting;\n }\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis!.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : ''\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis!.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : ''\n }\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns\n }\n };\n\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'heatmap') {\n result.orientation = axesFormsData.other.reverse ? 'horizontal' : 'vertical';\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n }\n if (chartType === 'histogram') {\n result.groupingDirection = axesFormsData.other.groupingDirection;\n result.groupingStack = axesFormsData.other.groupingStack;\n }\n return result;\n}\n"],"names":["getDiscreteLabelsRotation","value","discreteGroups","label","getAxesDataFromFormsScatterplot","axesFormsData","uniqueValues","optionsState","inputGuide","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","xAxis","yAxis","xSource","ySource","infoX","infoY","isDiscreteX","isDiscreteY","saved","uniqueList","uniqueLabels","keys","v","labels","res","result","getAxesDataFromForms","chartType"],"mappings":"AAyBO,SAASA,EAA0BC,GAA8BC,IAA8C,IAAI;AACxH,SAAID,MAAU,OACLA,IAGPC,EAAe,SAAS,KACxBA,EAAe,KAAK,CAAC,EAAE,OAAAC,QAAYA,EAAM,SAAS,CAAsB,IAEjE,UAEF;AACT;AAEO,SAASC,EACdC,GACAC,GACAC,GACAC,GACc;AArBhB,MAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC;AAsBE,MAAIC,IAAuD,CAAA,GACvDC,IAAuD,CAAA;AAC3D,EAAAD,EAAM,WAAWhB,EAAc,MAAM,WACrCgB,EAAM,YAAYhB,EAAc,MAAM,OACtCiB,EAAM,WAAWjB,EAAc,MAAM,WACrCiB,EAAM,YAAYjB,EAAc,MAAM;AAEtC,QAAMkB,MAAUd,IAAAF,EAAa,WAAW,EAAE,mBAA1B,gBAAAE,EAA2C,GAAG,mBAAkB,MAC1Ee,MAAUd,IAAAH,EAAa,WAAW,EAAE,mBAA1B,gBAAAG,EAA2C,GAAG,mBAAkB,MAC1Ee,IAAQF,IAAUf,EAAW,cAAce,CAAO,IAAI,MACtDG,IAAQF,IAAUhB,EAAW,cAAcgB,CAAO,IAAI,MAEtDG,KAAcF,KAAA,gBAAAA,EAAO,UAAS,UAC9BG,KAAcF,KAAA,gBAAAA,EAAO,UAAS;AAIpC,MAFA,QAAQ,IAAI,eAAeC,GA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,MAAc,gBACfjB,EAAiC,QAAQhB,EAAc,MAAM,OAC7DiB,EAAiC,QAAQjB,EAAc,MAAM,SAE5DiC,MAAc,aAAaA,MAAc,cAC1CjB,EAAoC,kBAAkBhB,EAAc,MAAM,iBAC1EgB,EAAoC,mBAAmBhB,EAAc,MAAM,kBAC3EiB,EAAoC,kBAAkBjB,EAAc,MAAM,iBAC1EiB,EAAoC,mBAAmBjB,EAAc,MAAM,kBAC3EgB,EAAoC,UAAUhB,EAAc,MAAM,SAClEiB,EAAoC,UAAUjB,EAAc,MAAM,UAEjEA,EAAc,MAAM,cAAc,WACpCiB,EAAO,QAAQjB,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc,KAE5FA,EAAc,MAAM,cAAc,WACpCgB,EAAO,QAAQhB,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc;AAGhG,QAAM+B,IAAuB;AAAA,IAC3B,OAAAf;AAAA,IACA,OAAAC;AAAA,IACA,OAAO,EAAE,MAAMjB,EAAc,MAAM,MAAA;AAAA,IACnC,eAAe;AAAA,MACb,OAAOA,EAAc,MAAM;AAAA,IAAA;AAAA,EAC7B;AAGF,UAAIiC,MAAc,cAAcA,MAAc,iBAAiBA,MAAc,eAC3EF,EAAO,cAAc/B,EAAc,MAAM,UAAU,eAAe,YAClE+B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS/B,EAAc,MAAM,aAAa,GACvF+B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS/B,EAAc,MAAM,aAAa,IAErFiC,MAAc,gBAChBF,EAAO,oBAAoB/B,EAAc,MAAM,mBAC/C+B,EAAO,gBAAgB/B,EAAc,MAAM,gBAEtC+B;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayersDataFromForms.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EACxB,WAAW,EACX,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,gBAAgB,EAIjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EAAE,UAAU,EAC3B,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAaxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAgB,aAAa,CAAC,kBAAkB,EAAE,uBAAuB,wBAiDxE;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,KAAK,EAAE,EACf,aAAa,EAAE,cAAc,EAC7B,kBAAkB,EAAE,uBAAuB,EAC3C,YAAY,EAAE,eAAe,EAC7B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,GACjC,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"getLayersDataFromForms.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EACxB,WAAW,EACX,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,gBAAgB,EAIjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EAAE,UAAU,EAC3B,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAaxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAgB,aAAa,CAAC,kBAAkB,EAAE,uBAAuB,wBAiDxE;AAED,wBAAgB,yB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