@milaboratories/graph-maker 1.1.139 → 1.1.141
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 +115 -113
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/store.js +9 -9
- 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 +65 -69
- 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/loadDefaultSources.js +4 -3
- package/dist/GraphMaker/utils/loadDefaultSources.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/_virtual/_commonjsHelpers.js +3 -5
- package/dist/_virtual/_commonjsHelpers.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/_virtual/_commonjsHelpers.js +9 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash.js +8 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/lodash.js.map +1 -1
- package/dist/{_virtual/lodash.js → node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify.js +3 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map +1 -1
- package/dist/{_virtual/stringify.js → node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +15 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +198 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +342 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +278 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +453 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +203 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +432 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +170 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +315 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +323 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js +11 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +36 -3420
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/{pl-error-like → pf-plots/dist/node_modules/@milaboratories/pl-error-like}/dist/index.js +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +979 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +1599 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js +19 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js +26 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js +3678 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js.map +1 -0
- package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js +1141 -1141
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/zod/lib/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +247 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +62 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +286 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -0
- package/package.json +3 -3
- package/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -584
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1559
- package/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
- package/dist/node_modules/json-stringify-safe/stringify.js +0 -20
- package/dist/node_modules/json-stringify-safe/stringify.js.map +0 -1
- package/dist/node_modules/lodash/lodash.js +0 -3678
- package/dist/node_modules/lodash/lodash.js.map +0 -1
- package/dist/node_modules/zod/lib/index.js.map +0 -1
|
@@ -5,30 +5,30 @@ import { getKeysCombinations as D } from "../utils/getKeysCombination.js";
|
|
|
5
5
|
import b from "./ChartRenderer.js";
|
|
6
6
|
import { createHistogramDataByFacets as S } from "./getHistogramData.js";
|
|
7
7
|
import { HistogramSettingsImpl as g } from "./HistogramSettingsImpl.js";
|
|
8
|
-
var _ = Object.defineProperty, w = (u, e, t) => e in u ? _(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t,
|
|
8
|
+
var _ = Object.defineProperty, w = (u, e, t) => e in u ? _(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t, d = (u, e, t) => w(u, typeof e != "symbol" ? e + "" : e, t);
|
|
9
9
|
function x(u, e, t) {
|
|
10
|
-
return e.reduce((a,
|
|
11
|
-
const o = u.getColumnCategories(
|
|
12
|
-
|
|
13
|
-
u.getColumnCategoryRowIndex(
|
|
14
|
-
)) : r, i = o.reduce((r,
|
|
15
|
-
return a[
|
|
16
|
-
values: o.sort((r,
|
|
17
|
-
aesMap: t[
|
|
10
|
+
return e.reduce((a, s) => {
|
|
11
|
+
const o = u.getColumnCategories(s.value, !1), l = (r) => s.valueLabels ? String(u.getColumnValue(
|
|
12
|
+
s.valueLabels,
|
|
13
|
+
u.getColumnCategoryRowIndex(s.value, r)
|
|
14
|
+
)) : r, i = o.reduce((r, n) => (r[n] = l(n), r), {});
|
|
15
|
+
return a[s.value] = {
|
|
16
|
+
values: o.sort((r, n) => i[r].localeCompare(i[n], "en", { numeric: !0 })),
|
|
17
|
+
aesMap: t[s.value],
|
|
18
18
|
labels: i
|
|
19
19
|
}, a;
|
|
20
20
|
}, {});
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class K extends f {
|
|
23
23
|
constructor(e, t, a) {
|
|
24
|
-
super(e, t),
|
|
25
|
-
}),
|
|
24
|
+
super(e, t), d(this, "settings"), d(this, "chartRenderer", new b()), d(this, "onTooltipHintSwitch", () => {
|
|
25
|
+
}), d(this, "calculatedData", null), this.settings = new g(t), a && (this.onTooltipHintSwitch = a[0]);
|
|
26
26
|
}
|
|
27
27
|
mount(e) {
|
|
28
28
|
try {
|
|
29
|
-
this.chartRenderer.init(e), this._updateData(), this._updateChart();
|
|
29
|
+
this.chartRenderer.init(e), this._updateData(), this._updateChart(), this.hasError = !1;
|
|
30
30
|
} catch (t) {
|
|
31
|
-
t instanceof Error && (this.chartRenderer.renderError(t.message), console.error(t));
|
|
31
|
+
this.hasError = !0, t instanceof Error && (this.chartRenderer.renderError(t.message), console.error(t));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
unmount() {
|
|
@@ -36,10 +36,10 @@ class T extends f {
|
|
|
36
36
|
}
|
|
37
37
|
updateSettingsAndData(e, t) {
|
|
38
38
|
try {
|
|
39
|
-
const a = this.settings,
|
|
40
|
-
this.settings = new g(t), this.data = e, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(
|
|
39
|
+
const a = this.settings, s = this.data;
|
|
40
|
+
this.settings = new g(t), this.data = e, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(s, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart(), this.hasError = !1;
|
|
41
41
|
} catch (a) {
|
|
42
|
-
a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
|
|
42
|
+
this.hasError = !0, a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
updateChartState(e, t) {
|
|
@@ -49,33 +49,33 @@ class T extends f {
|
|
|
49
49
|
return this._updateChart(), C(this.chartRenderer.component);
|
|
50
50
|
}
|
|
51
51
|
_needUpdateCalculatedDataBySettings(e, t) {
|
|
52
|
-
var a,
|
|
52
|
+
var a, s, o, l;
|
|
53
53
|
return e.valueColumn.value !== t.valueColumn.value || e.facetBy.some((i, r) => {
|
|
54
|
-
var
|
|
55
|
-
return i.value !== ((
|
|
56
|
-
}) || ((a = e.grouping) == null ? void 0 : a.value) !== ((
|
|
57
|
-
var
|
|
58
|
-
return i !== ((
|
|
54
|
+
var n;
|
|
55
|
+
return i.value !== ((n = t.facetBy[r]) == null ? void 0 : n.value);
|
|
56
|
+
}) || ((a = e.grouping) == null ? void 0 : a.value) !== ((s = t.grouping) == null ? void 0 : s.value) || e.layers.length !== t.layers.length || e.layers.some((i, r) => i.type !== t.layers[r].type) || e.binsCount !== t.binsCount || e.chartSettings.xAxis.scale !== t.chartSettings.xAxis.scale || ((o = e.groupingOrder) == null ? void 0 : o.some((i, r) => {
|
|
57
|
+
var n;
|
|
58
|
+
return i !== ((n = t.groupingOrder) == null ? void 0 : n[r]);
|
|
59
59
|
})) || ((l = t.groupingOrder) == null ? void 0 : l.some((i, r) => {
|
|
60
|
-
var
|
|
61
|
-
return i !== ((
|
|
60
|
+
var n;
|
|
61
|
+
return i !== ((n = e.groupingOrder) == null ? void 0 : n[r]);
|
|
62
62
|
}));
|
|
63
63
|
}
|
|
64
64
|
_needUpdateCalculatedDataByData(e, t) {
|
|
65
|
-
const a = Object.keys(e.data),
|
|
66
|
-
return e.id !== t.id || a.length !==
|
|
65
|
+
const a = Object.keys(e.data), s = Object.keys(t.data);
|
|
66
|
+
return e.id !== t.id || a.length !== s.length || a.some((o) => {
|
|
67
67
|
var l;
|
|
68
68
|
return e.data[o].length !== ((l = t.data[o]) == null ? void 0 : l.length);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
_updateData() {
|
|
72
|
-
const { valueColumn: e, facetBy: t, grouping: a, binsCount:
|
|
73
|
-
let
|
|
74
|
-
i && (
|
|
75
|
-
const v = S(this.data,
|
|
72
|
+
const { valueColumn: e, facetBy: t, grouping: a, binsCount: s, chartSettings: o, inheritedAes: l, groupingOrder: i } = this.settings, r = t.map((h) => this.data.getColumnCategories(h.value)), n = r.length ? D([...r]) : [["null"]], p = t.map((h) => h.value) ?? null, m = a ? [a.value] : [];
|
|
73
|
+
let c = a ? this.data.getColumnCategories(a.value) : ["null"];
|
|
74
|
+
i && (c = y.intersection(i, c)), this.data.setGrouping([...p, ...m]);
|
|
75
|
+
const v = S(this.data, n, c, e, s, o.xAxis.scale);
|
|
76
76
|
this.calculatedData = {
|
|
77
|
-
facetKeys:
|
|
78
|
-
facetKeysCombinations:
|
|
77
|
+
facetKeys: n.map((h) => h.join(", ")),
|
|
78
|
+
facetKeysCombinations: n,
|
|
79
79
|
histogramDataByFacets: v,
|
|
80
80
|
legendInfo: x(this.data, a ? [a] : [], l)
|
|
81
81
|
};
|
|
@@ -86,7 +86,7 @@ class T extends f {
|
|
|
86
86
|
_updateChart() {
|
|
87
87
|
if (!this.calculatedData)
|
|
88
88
|
return;
|
|
89
|
-
const { id: e, chartSettings: t, facetSettings: a, inheritedAes:
|
|
89
|
+
const { id: e, chartSettings: t, facetSettings: a, inheritedAes: s, layers: o, grouping: l, groupingDirection: i, groupingStack: r } = this.settings;
|
|
90
90
|
this.chartRenderer.render(
|
|
91
91
|
this.data,
|
|
92
92
|
e,
|
|
@@ -98,7 +98,7 @@ class T extends f {
|
|
|
98
98
|
this.calculatedData.histogramDataByFacets,
|
|
99
99
|
this.calculatedData.legendInfo,
|
|
100
100
|
o,
|
|
101
|
-
|
|
101
|
+
s,
|
|
102
102
|
l,
|
|
103
103
|
r,
|
|
104
104
|
i,
|
|
@@ -107,6 +107,6 @@ class T extends f {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
export {
|
|
110
|
-
|
|
110
|
+
K as ChartHistogram
|
|
111
111
|
};
|
|
112
112
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/histogram/index.ts"],"sourcesContent":["import {\n intersection\n} from 'lodash';\nimport { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { Category, ColumnName, HistogramEventHandlers, HistogramSettings } from '../types';\nimport { getKeysCombinations } from '../utils/getKeysCombination';\nimport ChartRenderer from './ChartRenderer';\nimport type { HistogramLegendInfo } from './components/types';\nimport type { GroupedHistogramData } from './getHistogramData';\nimport { createHistogramDataByFacets } from './getHistogramData';\nimport { HistogramSettingsImpl } from './HistogramSettingsImpl';\n\nfunction getLegendInfo(\n data: DataFrame,\n grouping: ColumnName[],\n inheritedAes: HistogramSettingsImpl['inheritedAes']\n): HistogramLegendInfo {\n return grouping.reduce((res: HistogramLegendInfo, column) => {\n const categories = data.getColumnCategories(column.value, false);\n const getValueLabel = (category: Category) => (column.valueLabels\n ? String(data.getColumnValue(\n column.valueLabels,\n data.getColumnCategoryRowIndex(column.value, category)\n ))\n : category\n );\n const labels = categories.reduce((res: Record<string, string>, category) => {\n res[category] = getValueLabel(category);\n return res;\n }, {});\n res[column.value] = {\n values: categories.sort((a, b) => labels[a].localeCompare(labels[b], 'en', {numeric: true})),\n aesMap: inheritedAes[column.value],\n labels,\n };\n return res;\n }, {});\n}\n\nexport class ChartHistogram extends AbstractChart {\n settings: HistogramSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n facetKeys: string[];\n facetKeysCombinations: string[][];\n histogramDataByFacets: Record<string, GroupedHistogramData>\n legendInfo: HistogramLegendInfo\n } | null = null;\n\n constructor(data: DataFrame, settings: HistogramSettings, eventHandlers?: HistogramEventHandlers) {\n super(data, settings);\n\n this.settings = new HistogramSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: HistogramSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new HistogramSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for histogram');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: HistogramSettingsImpl, settings: HistogramSettingsImpl) {\n return (\n prevSettings.valueColumn.value !== settings.valueColumn.value ||\n prevSettings.facetBy.some((el, idx) => el.value !== settings.facetBy[idx]?.value) ||\n prevSettings.grouping?.value !== settings.grouping?.value ||\n prevSettings.layers.length !== settings.layers.length ||\n prevSettings.layers.some((l, idx) => l.type !== settings.layers[idx].type) ||\n prevSettings.binsCount !== settings.binsCount ||\n prevSettings.chartSettings.xAxis.scale !== settings.chartSettings.xAxis.scale ||\n prevSettings.groupingOrder?.some((key, idx) => key !== settings.groupingOrder?.[idx]) ||\n settings.groupingOrder?.some((key, idx) => key !== prevSettings.groupingOrder?.[idx])\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {valueColumn, facetBy, grouping, binsCount, chartSettings, inheritedAes, groupingOrder} = this.settings;\n\n const facetKeysLists = facetBy.map(column => this.data.getColumnCategories(column.value));\n const facetKeysCombinations = facetKeysLists.length ? getKeysCombinations([...facetKeysLists]) : [['null']];\n const facetGroupingValues = facetBy.map(column => column.value) ?? null;\n const groupingValues = grouping ? [grouping.value] : [];\n let groupingKeys = grouping ? this.data.getColumnCategories(grouping.value) : ['null'];\n if (groupingOrder) {\n groupingKeys = intersection(groupingOrder, groupingKeys);\n }\n\n this.data.setGrouping([...facetGroupingValues, ...groupingValues]);\n const histogramDataByFacets = createHistogramDataByFacets(this.data, facetKeysCombinations, groupingKeys, valueColumn, binsCount, chartSettings.xAxis.scale);\n\n this.calculatedData = {\n facetKeys: facetKeysCombinations.map(v => v.join(', ')),\n facetKeysCombinations,\n histogramDataByFacets,\n legendInfo: getLegendInfo(this.data, grouping ? [grouping] : [], inheritedAes)\n };\n }\n\n _updateAesInData() {\n const calculated = this.calculatedData;\n if (!calculated) {\n return;\n }\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {id, chartSettings, facetSettings, inheritedAes, layers, grouping, groupingDirection, groupingStack} = this.settings;\n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n this.calculatedData.facetKeys,\n this.calculatedData.facetKeysCombinations, //for titles, if facet by more than 1 column\n this.calculatedData.histogramDataByFacets,\n this.calculatedData.legendInfo,\n layers,\n inheritedAes,\n grouping,\n groupingStack,\n groupingDirection,\n this.onTooltipHintSwitch\n );\n }\n}\n"],"names":["getLegendInfo","data","grouping","inheritedAes","res","column","categories","getValueLabel","category","labels","a","b","ChartHistogram","AbstractChart","settings","eventHandlers","__publicField","ChartRenderer","HistogramSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","el","idx","_a","_b","l","_c","key","_d","prevData","prevKeys","keys","valueColumn","facetBy","binsCount","chartSettings","groupingOrder","facetKeysLists","facetKeysCombinations","getKeysCombinations","facetGroupingValues","groupingValues","groupingKeys","intersection","histogramDataByFacets","createHistogramDataByFacets","v","id","facetSettings","layers","groupingDirection","groupingStack"],"mappings":";;;;;;;;AAcA,SAASA,EACLC,GACAC,GACAC,GACmB;AACnB,SAAOD,EAAS,OAAO,CAACE,GAA0BC,MAAW;AACzD,UAAMC,IAAaL,EAAK,oBAAoBI,EAAO,OAAO,EAAK,GACzDE,IAAgB,CAACC,MAAwBH,EAAO,cAChD,OAAOJ,EAAK;AAAA,MACVI,EAAO;AAAA,MACPJ,EAAK,0BAA0BI,EAAO,OAAOG,CAAQ;AAAA,IAAA,CACxD,IACCA,GAEAC,IAASH,EAAW,OAAO,CAACF,GAA6BI,OAC3DJ,EAAII,CAAQ,IAAID,EAAcC,CAAQ,GAC/BJ,IACR,EAAE;AACL,WAAAA,EAAIC,EAAO,KAAK,IAAI;AAAA,MAChB,QAAQC,EAAW,KAAK,CAACI,GAAGC,MAAMF,EAAOC,CAAC,EAAE,cAAcD,EAAOE,CAAC,GAAG,MAAM,EAAC,SAAS,GAAA,CAAK,CAAC;AAAA,MAC3F,QAAQR,EAAaE,EAAO,KAAK;AAAA,MACjC,QAAAI;AAAAA,IAAA,GAEGL;AAAAA,EACX,GAAG,CAAA,CAAE;AACT;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AAA,MACAZ;AAAAA,MACAa;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA;AAAA,MACpB,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA,MACpBC;AAAAA,MACApD;AAAAA,MACAD;AAAAA,MACAuD;AAAAA,MACAD;AAAAA,MACA,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/histogram/index.ts"],"sourcesContent":["import {\n intersection\n} from 'lodash';\nimport { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { Category, ColumnName, HistogramEventHandlers, HistogramSettings } from '../types';\nimport { getKeysCombinations } from '../utils/getKeysCombination';\nimport ChartRenderer from './ChartRenderer';\nimport type { HistogramLegendInfo } from './components/types';\nimport type { GroupedHistogramData } from './getHistogramData';\nimport { createHistogramDataByFacets } from './getHistogramData';\nimport { HistogramSettingsImpl } from './HistogramSettingsImpl';\n\nfunction getLegendInfo(\n data: DataFrame,\n grouping: ColumnName[],\n inheritedAes: HistogramSettingsImpl['inheritedAes']\n): HistogramLegendInfo {\n return grouping.reduce((res: HistogramLegendInfo, column) => {\n const categories = data.getColumnCategories(column.value, false);\n const getValueLabel = (category: Category) => (column.valueLabels\n ? String(data.getColumnValue(\n column.valueLabels,\n data.getColumnCategoryRowIndex(column.value, category)\n ))\n : category\n );\n const labels = categories.reduce((res: Record<string, string>, category) => {\n res[category] = getValueLabel(category);\n return res;\n }, {});\n res[column.value] = {\n values: categories.sort((a, b) => labels[a].localeCompare(labels[b], 'en', {numeric: true})),\n aesMap: inheritedAes[column.value],\n labels,\n };\n return res;\n }, {});\n}\n\nexport class ChartHistogram extends AbstractChart {\n settings: HistogramSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n facetKeys: string[];\n facetKeysCombinations: string[][];\n histogramDataByFacets: Record<string, GroupedHistogramData>\n legendInfo: HistogramLegendInfo\n } | null = null;\n\n constructor(data: DataFrame, settings: HistogramSettings, eventHandlers?: HistogramEventHandlers) {\n super(data, settings);\n\n this.settings = new HistogramSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: HistogramSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new HistogramSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for histogram');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: HistogramSettingsImpl, settings: HistogramSettingsImpl) {\n return (\n prevSettings.valueColumn.value !== settings.valueColumn.value ||\n prevSettings.facetBy.some((el, idx) => el.value !== settings.facetBy[idx]?.value) ||\n prevSettings.grouping?.value !== settings.grouping?.value ||\n prevSettings.layers.length !== settings.layers.length ||\n prevSettings.layers.some((l, idx) => l.type !== settings.layers[idx].type) ||\n prevSettings.binsCount !== settings.binsCount ||\n prevSettings.chartSettings.xAxis.scale !== settings.chartSettings.xAxis.scale ||\n prevSettings.groupingOrder?.some((key, idx) => key !== settings.groupingOrder?.[idx]) ||\n settings.groupingOrder?.some((key, idx) => key !== prevSettings.groupingOrder?.[idx])\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {valueColumn, facetBy, grouping, binsCount, chartSettings, inheritedAes, groupingOrder} = this.settings;\n\n const facetKeysLists = facetBy.map(column => this.data.getColumnCategories(column.value));\n const facetKeysCombinations = facetKeysLists.length ? getKeysCombinations([...facetKeysLists]) : [['null']];\n const facetGroupingValues = facetBy.map(column => column.value) ?? null;\n const groupingValues = grouping ? [grouping.value] : [];\n let groupingKeys = grouping ? this.data.getColumnCategories(grouping.value) : ['null'];\n if (groupingOrder) {\n groupingKeys = intersection(groupingOrder, groupingKeys);\n }\n\n this.data.setGrouping([...facetGroupingValues, ...groupingValues]);\n const histogramDataByFacets = createHistogramDataByFacets(this.data, facetKeysCombinations, groupingKeys, valueColumn, binsCount, chartSettings.xAxis.scale);\n\n this.calculatedData = {\n facetKeys: facetKeysCombinations.map(v => v.join(', ')),\n facetKeysCombinations,\n histogramDataByFacets,\n legendInfo: getLegendInfo(this.data, grouping ? [grouping] : [], inheritedAes)\n };\n }\n\n _updateAesInData() {\n const calculated = this.calculatedData;\n if (!calculated) {\n return;\n }\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {id, chartSettings, facetSettings, inheritedAes, layers, grouping, groupingDirection, groupingStack} = this.settings;\n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n this.calculatedData.facetKeys,\n this.calculatedData.facetKeysCombinations, //for titles, if facet by more than 1 column\n this.calculatedData.histogramDataByFacets,\n this.calculatedData.legendInfo,\n layers,\n inheritedAes,\n grouping,\n groupingStack,\n groupingDirection,\n this.onTooltipHintSwitch\n );\n }\n}\n"],"names":["getLegendInfo","data","grouping","inheritedAes","res","column","categories","getValueLabel","category","labels","a","b","ChartHistogram","AbstractChart","settings","eventHandlers","__publicField","ChartRenderer","HistogramSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","el","idx","_a","_b","l","_c","key","_d","prevData","prevKeys","keys","valueColumn","facetBy","binsCount","chartSettings","groupingOrder","facetKeysLists","facetKeysCombinations","getKeysCombinations","facetGroupingValues","groupingValues","groupingKeys","intersection","histogramDataByFacets","createHistogramDataByFacets","v","id","facetSettings","layers","groupingDirection","groupingStack"],"mappings":";;;;;;;;AAcA,SAASA,EACLC,GACAC,GACAC,GACmB;AACnB,SAAOD,EAAS,OAAO,CAACE,GAA0BC,MAAW;AACzD,UAAMC,IAAaL,EAAK,oBAAoBI,EAAO,OAAO,EAAK,GACzDE,IAAgB,CAACC,MAAwBH,EAAO,cAChD,OAAOJ,EAAK;AAAA,MACVI,EAAO;AAAA,MACPJ,EAAK,0BAA0BI,EAAO,OAAOG,CAAQ;AAAA,IAAA,CACxD,IACCA,GAEAC,IAASH,EAAW,OAAO,CAACF,GAA6BI,OAC3DJ,EAAII,CAAQ,IAAID,EAAcC,CAAQ,GAC/BJ,IACR,EAAE;AACL,WAAAA,EAAIC,EAAO,KAAK,IAAI;AAAA,MAChB,QAAQC,EAAW,KAAK,CAACI,GAAGC,MAAMF,EAAOC,CAAC,EAAE,cAAcD,EAAOE,CAAC,GAAG,MAAM,EAAC,SAAS,GAAA,CAAK,CAAC;AAAA,MAC3F,QAAQR,EAAaE,EAAO,KAAK;AAAA,MACjC,QAAAI;AAAAA,IAAA,GAEGL;AAAAA,EACX,GAAG,CAAA,CAAE;AACT;AAEO,MAAMQ,UAAuBC,EAAc;AAAA,EAY9C,YAAYZ,GAAiBa,GAA6BC,GAAwC;AAC9F,UAAMd,GAAMa,CAAQ,GAZxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,iBAAgB,IAAIC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e;AAAA,MACpB,KAAK,eAAe;AAAA,MACpBC;AAAAA,MACApD;AAAAA,MACAD;AAAAA,MACAuD;AAAAA,MACAD;AAAAA,MACA,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;","x_google_ignoreList":[0]}
|
package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import p from "../node_modules/lodash/lodash.js";
|
|
2
|
-
import { DEFAULT_HEIGHT_SMALL as
|
|
2
|
+
import { DEFAULT_HEIGHT_SMALL as c, DEFAULT_HEIGHT as d, DEFAULT_WIDTH_SMALL as y, DEFAULT_WIDTH as g, BLACK as a } from "../constants.js";
|
|
3
3
|
import "../types/common.js";
|
|
4
4
|
import "../types/discrete.js";
|
|
5
5
|
import { ScatterplotSettingsSchema as m } from "../types/scatterplot.js";
|
|
@@ -8,11 +8,11 @@ import "../types/dendro.js";
|
|
|
8
8
|
import "../types/histogram.js";
|
|
9
9
|
import "../types/bubble.js";
|
|
10
10
|
import { exhaustive as f } from "../utils/index.js";
|
|
11
|
-
var v = Object.defineProperty, S = (
|
|
12
|
-
class
|
|
11
|
+
var v = Object.defineProperty, S = (i, t, s) => t in i ? v(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s, e = (i, t, s) => S(i, typeof t != "symbol" ? t + "" : t, s);
|
|
12
|
+
class w {
|
|
13
13
|
constructor(t) {
|
|
14
|
-
|
|
15
|
-
dotFill:
|
|
14
|
+
e(this, "type", "dots"), e(this, "aes", {
|
|
15
|
+
dotFill: a,
|
|
16
16
|
dotShape: "21",
|
|
17
17
|
dotSize: 3,
|
|
18
18
|
opacity: 1
|
|
@@ -22,10 +22,10 @@ class A {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
class
|
|
25
|
+
class x {
|
|
26
26
|
constructor(t) {
|
|
27
|
-
|
|
28
|
-
lineColor:
|
|
27
|
+
e(this, "type", "curve"), e(this, "smoothing"), e(this, "aes", {
|
|
28
|
+
lineColor: a,
|
|
29
29
|
lineWidth: 1,
|
|
30
30
|
lineShape: "solid",
|
|
31
31
|
opacity: 1
|
|
@@ -37,12 +37,12 @@ class w {
|
|
|
37
37
|
}
|
|
38
38
|
class k {
|
|
39
39
|
constructor(t) {
|
|
40
|
-
|
|
41
|
-
var
|
|
40
|
+
e(this, "id"), e(this, "type", "scatterplot"), e(this, "keyColumn"), e(this, "facetSettings"), e(this, "x"), e(this, "y"), e(this, "facetBy"), e(this, "grouping"), e(this, "label"), e(this, "highlight"), e(this, "chartSettings"), e(this, "trend"), e(this, "layers");
|
|
41
|
+
var s, r, h, n, o, u;
|
|
42
42
|
m.parse(t), this.id = p.uniqueId("settings"), this.keyColumn = t.keyColumn, this.facetSettings = { sharedX: !0, sharedY: !0, titlePosition: "left", ...t.facetSettings }, this.x = t.x, this.y = t.y, this.facetBy = t.facetBy ?? [], this.grouping = t.grouping ?? [], this.label = t.label ?? null, this.highlight = t.highlight ?? null, this.chartSettings = {
|
|
43
43
|
size: {
|
|
44
|
-
width: ((
|
|
45
|
-
height: ((r = t == null ? void 0 : t.size) == null ? void 0 : r.height) ?? (this.facetBy.length ?
|
|
44
|
+
width: ((s = t == null ? void 0 : t.size) == null ? void 0 : s.width) ?? (this.facetBy.length ? y : g),
|
|
45
|
+
height: ((r = t == null ? void 0 : t.size) == null ? void 0 : r.height) ?? (this.facetBy.length ? c : d)
|
|
46
46
|
},
|
|
47
47
|
title: {
|
|
48
48
|
position: "center",
|
|
@@ -64,7 +64,7 @@ class k {
|
|
|
64
64
|
showTicks: !0,
|
|
65
65
|
...t.xAxis
|
|
66
66
|
},
|
|
67
|
-
frame: { type: ((
|
|
67
|
+
frame: { type: ((n = t.frame) == null ? void 0 : n.type) ?? "full" },
|
|
68
68
|
legend: {
|
|
69
69
|
show: !0,
|
|
70
70
|
position: "right",
|
|
@@ -72,23 +72,23 @@ class k {
|
|
|
72
72
|
},
|
|
73
73
|
tooltips: {
|
|
74
74
|
...t.tooltips,
|
|
75
|
-
show: ((
|
|
75
|
+
show: ((o = t.tooltips) == null ? void 0 : o.show) !== !1 && (((u = t.tooltips) == null ? void 0 : u.content) ?? []).length > 0
|
|
76
76
|
}
|
|
77
|
-
}, this.
|
|
77
|
+
}, this.trend = t != null && t.trend ? {
|
|
78
78
|
bounded: t.trend.bounded ?? !1,
|
|
79
|
-
color: t.trend.color ??
|
|
80
|
-
} : null, this.layers = t.layers.map((
|
|
81
|
-
if (
|
|
82
|
-
return new
|
|
83
|
-
if (
|
|
84
|
-
return new
|
|
85
|
-
f(
|
|
79
|
+
color: t.trend.color ?? a
|
|
80
|
+
} : null, this.layers = t.layers.map((l) => {
|
|
81
|
+
if (l.type === "dots")
|
|
82
|
+
return new w(l);
|
|
83
|
+
if (l.type === "curve")
|
|
84
|
+
return new x(l);
|
|
85
|
+
f(l, "Unknown layer type");
|
|
86
86
|
}).filter(Boolean);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
x as CurveLayer,
|
|
91
|
+
w as DotsLayer,
|
|
92
92
|
k as ScatterplotSettingsImpl
|
|
93
93
|
};
|
|
94
94
|
//# sourceMappingURL=ScatterplotSettingsImpl.js.map
|
package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScatterplotSettingsImpl.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot/ScatterplotSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\nimport {
|
|
1
|
+
{"version":3,"file":"ScatterplotSettingsImpl.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot/ScatterplotSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\nimport {BLACK, DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL} from '../constants';\nimport type {\n AxisSettings,\n ColumnName,\n ContinuousAesFromColumn,\n DataValue,\n FrameType,\n InheritAesScatterplot,\n LegendPosition,\n LineShape,\n CurveLayer as OuterCurveLayer,\n DotsLayer as OuterDotsLayer,\n PointShape,\n ScatterplotSettings,\n SettingsInterface,\n TitlePosition,\n} from '../types';\nimport {type AesRecord, ScatterplotSettingsSchema} from '../types';\nimport {exhaustive} from '../utils';\n\nexport class DotsLayer {\n readonly type = 'dots';\n readonly aes: {\n dotFill: string | InheritAesScatterplot | ContinuousAesFromColumn<string>;\n dotShape: PointShape | InheritAesScatterplot;\n dotSize: number | ContinuousAesFromColumn<number>;\n opacity: number;\n } = {\n dotFill: BLACK,\n dotShape: '21',\n dotSize: 3,\n opacity: 1,\n };\n\n constructor(layer: OuterDotsLayer) {\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n}\n\nexport class CurveLayer {\n readonly type = 'curve';\n readonly smoothing: boolean;\n readonly aes: {\n lineColor: string | InheritAesScatterplot | ContinuousAesFromColumn<string>;\n lineWidth: number;\n lineShape: LineShape;\n opacity: number;\n } = {\n lineColor: BLACK,\n lineWidth: 1,\n lineShape: 'solid',\n opacity: 1,\n };\n\n constructor(layer: OuterCurveLayer) {\n this.smoothing = layer.smoothing ?? false;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n}\n\nexport type ScatterplotLayer = DotsLayer | CurveLayer;\n\nexport interface ScatterplotAxisSettings extends AxisSettings {\n title: string | ColumnName;\n}\n\nexport class ScatterplotSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'scatterplot';\n readonly keyColumn: ColumnName;\n readonly facetSettings: {\n sharedX: boolean;\n sharedY: boolean;\n nRows?: number;\n nCols?: number;\n titlePosition: 'left' | 'center' | 'right';\n };\n readonly x: ColumnName;\n readonly y: ColumnName;\n readonly facetBy: ColumnName[];\n readonly grouping: {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n }[];\n readonly label: ColumnName | null;\n readonly highlight: ColumnName | null;\n readonly chartSettings: {\n readonly size: {width: number; height: number};\n readonly title: {name: string; show: boolean; position: TitlePosition};\n readonly yAxis: ScatterplotAxisSettings;\n readonly xAxis: ScatterplotAxisSettings;\n readonly frame: {type: FrameType};\n readonly legend: {show: boolean; position: LegendPosition};\n readonly tooltips: {show: boolean; content?: ColumnName[]};\n };\n\n readonly trend: {\n bounded: boolean;\n color: string | InheritAesScatterplot | ContinuousAesFromColumn<string>;\n } | null;\n\n readonly layers: ScatterplotLayer[];\n\n constructor(settings: ScatterplotSettings) {\n ScatterplotSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n this.keyColumn = settings.keyColumn;\n this.facetSettings = {sharedX: true, sharedY: true, titlePosition: 'left', ...settings.facetSettings};\n this.x = settings.x;\n this.y = settings.y;\n this.facetBy = settings.facetBy ?? [];\n this.grouping = settings.grouping ?? [];\n this.label = settings.label ?? null;\n this.highlight = settings.highlight ?? null;\n this.chartSettings = {\n size: {\n width: settings?.size?.width ?? (this.facetBy.length ? DEFAULT_WIDTH_SMALL : DEFAULT_WIDTH),\n height: settings?.size?.height ?? (this.facetBy.length ? DEFAULT_HEIGHT_SMALL : DEFAULT_HEIGHT),\n },\n title: {\n position: 'center',\n show: true,\n ...settings.title,\n name: settings.title?.name ?? 'Chart',\n },\n yAxis: {\n title: settings.y.label ?? settings.y.value,\n scale: 'linear',\n showGrid: true,\n showTicks: true,\n ...settings.yAxis,\n },\n xAxis: {\n title: settings.x.label ?? settings.x.value,\n scale: 'linear',\n showGrid: true,\n showTicks: true,\n ...settings.xAxis,\n },\n frame: {type: settings.frame?.type ?? 'full'},\n legend: {\n show: true,\n position: 'right',\n ...settings.legend,\n },\n tooltips: {\n ...settings.tooltips,\n show: !(settings.tooltips?.show === false) && (settings.tooltips?.content ?? []).length > 0,\n },\n };\n\n this.trend = settings?.trend\n ? {\n bounded: settings.trend.bounded ?? false,\n color: settings.trend.color ?? BLACK,\n }\n : null;\n\n this.layers = settings.layers\n .map(layer => {\n if (layer.type === 'dots') {\n return new DotsLayer(layer);\n }\n if (layer.type === 'curve') {\n return new CurveLayer(layer);\n }\n exhaustive(layer, 'Unknown layer type');\n })\n .filter(Boolean) as ScatterplotLayer[];\n }\n}\n"],"names":["DotsLayer","layer","__publicField","BLACK","CurveLayer","ScatterplotSettingsImpl","settings","ScatterplotSettingsSchema","lodash","_a","DEFAULT_WIDTH_SMALL","DEFAULT_WIDTH","_b","DEFAULT_HEIGHT_SMALL","DEFAULT_HEIGHT","_c","_d","_e","_f","exhaustive"],"mappings":";;;;;;;;;;;AAqBO,MAAMA,EAAU;AAAA,EAcnB,YAAYC,GAAuB;AAb1BC,MAAA,MAAA,QAAO,MAAA,GACPA,EAAA,MAAA,OAKL;AAAA,MACA,SAASC;AAAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,MACT,SAAS;AAAA,IAAA,CAAA,GAIT,KAAK,MAAM;AAAA,MACP,GAAG,KAAK;AAAA,MACR,GAAGF,EAAM;AAAA,IAAA;AAAA,EAEjB;AACJ;AAEO,MAAMG,EAAW;AAAA,EAepB,YAAYH,GAAwB;AAd3BC,MAAA,MAAA,QAAO,OAAA,GACPA,EAAA,MAAA,WAAA,GACAA,EAAA,MAAA,OAKL;AAAA,MACA,WAAWC;AAAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,SAAS;AAAA,IAAA,CAAA,GAIT,KAAK,YAAYF,EAAM,aAAa,IACpC,KAAK,MAAM;AAAA,MACP,GAAG,KAAK;AAAA,MACR,GAAGA,EAAM;AAAA,IAAA;AAAA,EAEjB;AACJ;AAQO,MAAMI,EAAqD;AAAA,EAsC9D,YAAYC,GAA+B;AArClCJ,MAAA,MAAA,IAAA,GACAA,EAAA,MAAA,QAAO,aAAA,GACPA,EAAA,MAAA,WAAA,GACAA,EAAA,MAAA,eAAA,GAOAA,EAAA,MAAA,GAAA,GACAA,EAAA,MAAA,GA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AAAA,QACV,WAAW;AAAA,QACX,GAAGA,EAAS;AAAA,MAAA;AAAA,MAEhB,OAAO,EAAC,QAAMU,IAAAV,EAAS,UAAT,OAAA,SAAAU,EAAgB,SAAQ,OAAA;AAAA,MACtC,QAAQ;AAAA,QACJ,MAAM;AAAA,QACN,UAAU;AAAA,QACV,GAAGV,EAAS;AAAA,MAAA;AAAA,MAEhB,UAAU;AAAA,QACN,GAAGA,EAAS;AAAA,QACZ,QAAQW,IAAAX,EAAS,aAAT,OAAA,SAAAW,EAAmB,UAAS,SAAWC,IAAAZ,EAAS,aAAT,OAAA,SAAAY,EAAmB,YAAW,CAAA,GAAI,SAAS;AAAA,MAAA;AAAA,IAAA,GAIlG,KAAK,QAAQZ,KAAA,QAAAA,EAAU,QACjB;AAAA,MACI,SAASA,EAAS,MAAM,WAAW;AAAA,MACnC,OAAOA,EAAS,MAAM,SAASH;AAAAA,IAAA,IAEnC,MAEN,KAAK,SAASG,EAAS,OAClB,IAAI,CAAAL,MAAS;AACV,UAAIA,EAAM,SAAS;AACf,eAAO,IAAID,EAAUC,CAAK;AAE9B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIG,EAAWH,CAAK;AAE/BkB,MAAAA,EAAWlB,GAAO,oBAAoB;AAAA,IAC1C,CAAC,EACA,OAAO,OAAO;AAAA,EACvB;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
import { formatColumnValue as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { formatColumnValue as V } from "./utils/formatColumnValue.js";
|
|
2
|
+
import { sortDotsByGrouping as y } from "./utils/sortDotsByGrouping.js";
|
|
3
|
+
import { format as D } from "../node_modules/d3-format/src/defaultLocale.js";
|
|
4
|
+
function Y(o, x, h, d, a, l, v) {
|
|
5
|
+
const c = {}, C = a != null && a.format ? D(a.format) : void 0;
|
|
6
|
+
for (const g of x) {
|
|
6
7
|
const e = [];
|
|
7
|
-
let u = 1 / 0,
|
|
8
|
-
const
|
|
9
|
-
for (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
dimmed: g ? !o.getColumnValue(g.value, t) : !1,
|
|
19
|
-
idx: t
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
8
|
+
let u = 1 / 0, s = 1 / 0, r = -1 / 0, i = -1 / 0;
|
|
9
|
+
const M = g.concat([""]), p = o.getRowsByGrouping(M);
|
|
10
|
+
for (let f = 0; f < p.length; f++) {
|
|
11
|
+
const t = p[f], m = o.getColumnValue(h.value, t), n = o.getColumnValue(d.value, t);
|
|
12
|
+
m === null && n === null || (u = Math.min(u, m), s = Math.min(s, n), r = Math.max(r, m), i = Math.max(i, n), e.push({
|
|
13
|
+
x: m,
|
|
14
|
+
y: n,
|
|
15
|
+
label: V(o, t, a, C),
|
|
16
|
+
dimmed: l ? !o.getColumnValue(l.value, t) : !1,
|
|
17
|
+
idx: t
|
|
18
|
+
}));
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
y(o, e, v, l), c[g.join("_")] = {
|
|
24
21
|
minX: u,
|
|
25
|
-
maxX:
|
|
26
|
-
minY:
|
|
27
|
-
maxY:
|
|
22
|
+
maxX: r,
|
|
23
|
+
minY: s,
|
|
24
|
+
maxY: i,
|
|
28
25
|
dots: e
|
|
29
26
|
};
|
|
30
27
|
}
|
|
31
|
-
return
|
|
28
|
+
return c;
|
|
32
29
|
}
|
|
33
30
|
export {
|
|
34
|
-
|
|
31
|
+
Y as getDots
|
|
35
32
|
};
|
|
36
33
|
//# sourceMappingURL=dots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dots.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot/dots.ts"],"sourcesContent":["import {format} from 'd3-format';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue } from '../types';\nimport {formatColumnValue} from './utils/formatColumnValue';\n\nexport type Dot = {\n idx: number;\n x: number;\n y: number;\n label: DataValue | null;\n dimmed: boolean;\n};\n\nexport type GroupedDots = Record<\n string,\n {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n dots: Dot[];\n }\n>;\n\nexport function getDots(\n data: DataFrame,\n facetKeysCombinations: string[][],\n x: ColumnName,\n y: ColumnName,\n label: ColumnName | null,\n highlight: ColumnName | null,\n
|
|
1
|
+
{"version":3,"file":"dots.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot/dots.ts"],"sourcesContent":["import {format} from 'd3-format';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue } from '../types';\nimport type { ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';\nimport {formatColumnValue} from './utils/formatColumnValue';\nimport {sortDotsByGrouping} from './utils/sortDotsByGrouping';\n\nexport type Dot = {\n idx: number;\n x: number;\n y: number;\n label: DataValue | null;\n dimmed: boolean;\n};\n\nexport type GroupedDots = Record<\n string,\n {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n dots: Dot[];\n }\n>;\n\nexport function getDots(\n data: DataFrame,\n facetKeysCombinations: string[][],\n x: ColumnName,\n y: ColumnName,\n label: ColumnName | null,\n highlight: ColumnName | null,\n grouping: ScatterplotSettingsImpl['grouping']\n): GroupedDots {\n const result: GroupedDots = {};\n\n const labelFormatter = label?.format ? format(label.format) : undefined;\n\n for (const facetKeys of facetKeysCombinations) {\n const dots: Dot[] = [];\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n const templateGroupPath = facetKeys.concat(['']);\n const rows = data.getRowsByGrouping(templateGroupPath);\n\n for (let i = 0; i < rows.length; i++) {\n const rowIdx = rows[i];\n const valueX = data.getColumnValue(x.value, rowIdx) as number;\n const valueY = data.getColumnValue(y.value, rowIdx) as number;\n\n if (valueX === null && valueY === null) continue;\n\n minX = Math.min(minX, valueX);\n minY = Math.min(minY, valueY);\n maxX = Math.max(maxX, valueX);\n maxY = Math.max(maxY, valueY);\n\n dots.push({\n x: valueX,\n y: valueY,\n label: formatColumnValue(data, rowIdx, label, labelFormatter),\n dimmed: highlight ? !data.getColumnValue(highlight.value, rowIdx) : false,\n idx: rowIdx\n });\n }\n\n sortDotsByGrouping(data, dots, grouping, highlight);\n\n result[facetKeys.join('_')] = {\n minX,\n maxX,\n minY,\n maxY,\n dots,\n };\n }\n\n return result;\n}\n"],"names":["getDots","data","facetKeysCombinations","x","y","label","highlight","grouping","result","labelFormatter","format","facetKeys","dots","minX","minY","maxX","maxY","templateGroupPath","rows","i","rowIdx","valueX","valueY","formatColumnValue","sortDotsByGrouping"],"mappings":";;;AA0BO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACW;AACX,QAAMC,IAAsB,CAAA,GAEtBC,IAAiBJ,KAAA,QAAAA,EAAO,SAASK,EAAOL,EAAM,MAAM,IAAI;AAE9D,aAAWM,KAAaT,GAAuB;AAC3C,UAAMU,IAAc,CAAA;AACpB,QAAIC,IAAO,OACPC,IAAO,OACPC,IAAO,QACPC,IAAO;AAEX,UAAMC,IAAoBN,EAAU,OAAO,CAAC,EAAE,CAAC,GACzCO,IAAOjB,EAAK,kBAAkBgB,CAAiB;AAErD,aAASE,IAAI,GAAGA,IAAID,EAAK,QAAQC,KAAK;AAClC,YAAMC,IAASF,EAAKC,CAAC,GACfE,IAASpB,EAAK,eAAeE,EAAE,OAAOiB,CAAM,GAC5CE,IAASrB,EAAK,eAAeG,EAAE,OAAOgB,CAAM;AAE9CC,MAAAA,MAAW,QAAQC,MAAW,SAElCT,IAAO,KAAK,IAAIA,GAAMQ,CAAM,GAC5BP,IAAO,KAAK,IAAIA,GAAMQ,CAAM,GAC5BP,IAAO,KAAK,IAAIA,GAAMM,CAAM,GAC5BL,IAAO,KAAK,IAAIA,GAAMM,CAAM,GAE5BV,EAAK,KAAK;AAAA,QACN,GAAGS;AAAAA,QACH,GAAGC;AAAAA,QACH,OAAOC,EAAkBtB,GAAMmB,GAAQf,GAAOI,CAAc;AAAA,QAC5D,QAAQH,IAAY,CAACL,EAAK,eAAeK,EAAU,OAAOc,CAAM,IAAI;AAAA,QACpE,KAAKA;AAAAA,MAAA,CACR;AAAA,IACL;AAEAI,IAAAA,EAAmBvB,GAAMW,GAAML,GAAUD,CAAS,GAElDE,EAAOG,EAAU,KAAK,GAAG,CAAC,IAAI;AAAA,MAC1B,MAAAE;AAAAA,MACA,MAAAE;AAAAA,MACA,MAAAD;AAAAA,MACA,MAAAE;AAAAA,MACA,MAAAJ;AAAAA,IAAA;AAAA,EAER;AAEA,SAAOJ;AACX;","x_google_ignoreList":[0]}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import { exhaustive as m } from "../utils/index.js";
|
|
2
|
-
function
|
|
3
|
-
return
|
|
4
|
-
const
|
|
5
|
-
return
|
|
2
|
+
function v(i, p, l, f, y, c) {
|
|
3
|
+
return l.reduce((n, s) => {
|
|
4
|
+
const u = f[s].dots;
|
|
5
|
+
return n[s] = p.map((e) => {
|
|
6
6
|
if (e.type === "curve")
|
|
7
7
|
return {
|
|
8
8
|
type: "curve",
|
|
9
9
|
info: e,
|
|
10
|
-
geoms:
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
geoms: y.map((t) => {
|
|
11
|
+
const a = u.filter(
|
|
12
|
+
(r) => c.every((o, d) => String(i.getColumnValue(o.value, r.idx)) === t[d])
|
|
13
|
+
);
|
|
14
|
+
return a.sort((r, o) => r.x - o.x), { dots: a };
|
|
15
|
+
}).filter((t) => t.dots.length > 0)
|
|
13
16
|
};
|
|
14
17
|
if (e.type === "dots")
|
|
15
18
|
return {
|
|
16
19
|
type: "dots",
|
|
17
20
|
info: e,
|
|
18
|
-
geoms:
|
|
21
|
+
geoms: u
|
|
19
22
|
};
|
|
20
23
|
m(e, "Unknown scatterplot layer type");
|
|
21
|
-
}),
|
|
24
|
+
}), n;
|
|
22
25
|
}, {});
|
|
23
26
|
}
|
|
24
27
|
export {
|
|
25
|
-
|
|
28
|
+
v as getLayersData
|
|
26
29
|
};
|
|
27
30
|
//# sourceMappingURL=getLayersData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayersData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot/getLayersData.ts"],"sourcesContent":["import type { DataFrame } from '../DataFrame';\nimport type { ColumnName, ScatterplotLayer } from '../types';\nimport { exhaustive } from '../utils';\nimport type { Dot, GroupedDots } from './dots';\nimport type { CurveLayer, DotsLayer } from './ScatterplotSettingsImpl';\n\nexport type DotsLayerData = {\n type: 'dots',\n info: DotsLayer,\n geoms: Dot[]\n}\n\nexport type CurveData = {\n dots: Dot[],\n}\nexport type CurveLayerData = {\n type: 'curve',\n info: CurveLayer,\n geoms: CurveData[]\n}\n\nexport type ScatterplotLayerData = DotsLayerData | CurveLayerData;\n\nexport function getLayersData(\n dataFrame: DataFrame,\n layers: ScatterplotLayer[],\n facetKeys: string[],\n dotsByFacets: GroupedDots,\n categoryGroupingCombinations: string[][],\n grouping: ColumnName[]\n): Record<string, ScatterplotLayerData[]> {\n return facetKeys.reduce((res:Record<string, ScatterplotLayerData[]>, key) => {\n const facetDots = dotsByFacets[key].dots;\n res[key] = layers.map(layer => {\n if (layer.type === 'curve') {\n return {\n type: 'curve',\n info: layer,\n geoms: categoryGroupingCombinations.map(values => {\n const dots = facetDots.filter(dot =>\n grouping.every((column, idx) => String(dataFrame.getColumnValue(column.value, dot.idx)) === values[idx])\n );\n return {dots};\n }).filter(item => item.dots.length > 0)\n } as CurveLayerData;\n }\n if (layer.type === 'dots') {\n return {\n type: 'dots',\n info: layer,\n geoms: facetDots,\n } as DotsLayerData;\n }\n exhaustive(layer, 'Unknown scatterplot layer type');\n });\n return res;\n }, {});\n}\n"],"names":["getLayersData","dataFrame","layers","facetKeys","dotsByFacets","categoryGroupingCombinations","grouping","res","key","facetDots","layer","values","column","idx","dot","item","exhaustive"],"mappings":";AAuBO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACsC;AACtC,SAAOH,EAAU,OAAO,CAACI,GAA4CC,MAAQ;AACzE,UAAMC,IAAYL,EAAaI,CAAG,EAAE;AACpC,WAAAD,EAAIC,CAAG,IAAIN,EAAO,IAAI,CAAAQ,MAAS;AAC3B,UAAIA,EAAM,SAAS;AACf,eAAO;AAAA,UACH,MAAM;AAAA,UACN,MAAMA;AAAAA,UACN,OAAOL,EAA6B,IAAI,CAAAM,
|
|
1
|
+
{"version":3,"file":"getLayersData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot/getLayersData.ts"],"sourcesContent":["import type { DataFrame } from '../DataFrame';\nimport type { ColumnName, ScatterplotLayer } from '../types';\nimport { exhaustive } from '../utils';\nimport type { Dot, GroupedDots } from './dots';\nimport type { CurveLayer, DotsLayer } from './ScatterplotSettingsImpl';\n\nexport type DotsLayerData = {\n type: 'dots',\n info: DotsLayer,\n geoms: Dot[]\n}\n\nexport type CurveData = {\n dots: Dot[],\n}\nexport type CurveLayerData = {\n type: 'curve',\n info: CurveLayer,\n geoms: CurveData[]\n}\n\nexport type ScatterplotLayerData = DotsLayerData | CurveLayerData;\n\nexport function getLayersData(\n dataFrame: DataFrame,\n layers: ScatterplotLayer[],\n facetKeys: string[],\n dotsByFacets: GroupedDots,\n categoryGroupingCombinations: string[][],\n grouping: ColumnName[]\n): Record<string, ScatterplotLayerData[]> {\n return facetKeys.reduce((res:Record<string, ScatterplotLayerData[]>, key) => {\n const facetDots = dotsByFacets[key].dots;\n res[key] = layers.map(layer => {\n if (layer.type === 'curve') {\n return {\n type: 'curve',\n info: layer,\n geoms: categoryGroupingCombinations.map(values => {\n const dots = facetDots.filter(dot =>\n grouping.every((column, idx) => String(dataFrame.getColumnValue(column.value, dot.idx)) === values[idx])\n );\n dots.sort((d1, d2) => d1.x - d2.x);\n return {dots};\n }).filter(item => item.dots.length > 0)\n } as CurveLayerData;\n }\n if (layer.type === 'dots') {\n return {\n type: 'dots',\n info: layer,\n geoms: facetDots,\n } as DotsLayerData;\n }\n exhaustive(layer, 'Unknown scatterplot layer type');\n });\n return res;\n }, {});\n}\n"],"names":["getLayersData","dataFrame","layers","facetKeys","dotsByFacets","categoryGroupingCombinations","grouping","res","key","facetDots","layer","values","dots","column","idx","dot","d1","d2","item","exhaustive"],"mappings":";AAuBO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACsC;AACtC,SAAOH,EAAU,OAAO,CAACI,GAA4CC,MAAQ;AACzE,UAAMC,IAAYL,EAAaI,CAAG,EAAE;AACpC,WAAAD,EAAIC,CAAG,IAAIN,EAAO,IAAI,CAAAQ,MAAS;AAC3B,UAAIA,EAAM,SAAS;AACf,eAAO;AAAA,UACH,MAAM;AAAA,UACN,MAAMA;AAAAA,UACN,OAAOL,EAA6B,IAAI,CAAAM,MAAU;AAC9C,kBAAMC,IAAOH,EAAU;AAAA,cAAO,OAC1BH,EAAS,MAAM,CAACO,GAAQC,MAAQ,OAAOb,EAAU,eAAeY,EAAO,OAAOE,EAAI,GAAG,CAAC,MAAMJ,EAAOG,CAAG,CAAC;AAAA,YAAA;AAE3G,mBAAAF,EAAK,KAAK,CAACI,GAAIC,MAAOD,EAAG,IAAIC,EAAG,CAAC,GAC1B,EAAC,MAAAL,EAAAA;AAAAA,UACZ,CAAC,EAAE,OAAO,OAAQM,EAAK,KAAK,SAAS,CAAC;AAAA,QAAA;AAG9C,UAAIR,EAAM,SAAS;AACf,eAAO;AAAA,UACH,MAAM;AAAA,UACN,MAAMA;AAAAA,UACN,OAAOD;AAAAA,QAAA;AAGfU,MAAAA,EAAWT,GAAO,gCAAgC;AAAA,IACtD,CAAC,GACMH;AAAAA,EACX,GAAG,CAAA,CAAE;AACT;","x_google_ignoreList":[0]}
|