@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
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { AbstractChart as _ } from "../AbstractChart.js";
|
|
2
2
|
import { createLegendInfo as U, addPalettesToAesMapping as L } from "../scatterplot/utils/createLegendInfo.js";
|
|
3
3
|
import { formatColumnValue as A } from "../scatterplot/utils/formatColumnValue.js";
|
|
4
|
-
import R from "
|
|
5
|
-
import {
|
|
4
|
+
import { sortDotsByGrouping as R } from "../scatterplot/utils/sortDotsByGrouping.js";
|
|
5
|
+
import { arraysAreDifferent as S } from "../utils/arraysAreDifferent.js";
|
|
6
|
+
import T from "./ChartRenderer.js";
|
|
7
|
+
import { SCATTERPLOT_LASSO_EVENTS as m } from "./constants.js";
|
|
6
8
|
import { ScatterplotUmapSettingsImpl as b } from "./SettingsImpl.js";
|
|
7
|
-
import { format as
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
return typeof
|
|
9
|
+
import { format as P } from "../node_modules/d3-format/src/defaultLocale.js";
|
|
10
|
+
var B = Object.defineProperty, N = (l, t, e) => t in l ? B(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e, g = (l, t, e) => N(l, typeof t != "symbol" ? t + "" : t, e);
|
|
11
|
+
function O(l) {
|
|
12
|
+
return typeof l == "object" && "type" in l && l.type === "grouping";
|
|
11
13
|
}
|
|
12
|
-
class
|
|
14
|
+
class G extends _ {
|
|
13
15
|
constructor(t, e, a) {
|
|
14
16
|
super(t, e), g(this, "settings"), g(this, "chartRenderer"), g(this, "onPolygonUpdate", () => {
|
|
15
17
|
}), g(this, "onTooltipHintSwitch", () => {
|
|
16
18
|
}), g(this, "onLassoControlsStateUpdate", () => {
|
|
17
|
-
}), g(this, "calculatedData", null), this.settings = new b(e), this.chartRenderer = new
|
|
19
|
+
}), g(this, "calculatedData", null), this.settings = new b(e), this.chartRenderer = new T(), a && (this.onPolygonUpdate = a.onPolygonUpdate, this.onTooltipHintSwitch = a.onTooltipHintSwitch, this.onLassoControlsStateUpdate = a.onLassoControlsStateUpdate);
|
|
18
20
|
}
|
|
19
21
|
mount(t) {
|
|
20
22
|
try {
|
|
21
|
-
this.chartRenderer.init(t), this._updateData(), this._updateChart();
|
|
23
|
+
this.chartRenderer.init(t), this._updateData(), this._updateChart(), this.hasError = !1;
|
|
22
24
|
} catch (e) {
|
|
23
|
-
console.error(e), e instanceof Error && (this.chartRenderer.renderError(e.message), console.error(e));
|
|
25
|
+
this.hasError = !0, console.error(e), e instanceof Error && (this.chartRenderer.renderError(e.message), console.error(e));
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
unmount() {
|
|
@@ -28,29 +30,29 @@ class I extends _ {
|
|
|
28
30
|
}
|
|
29
31
|
updateSettingsAndData(t, e) {
|
|
30
32
|
try {
|
|
31
|
-
const a = this.settings,
|
|
32
|
-
this.settings = new b(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const a = this.settings, o = this.data;
|
|
34
|
+
this.settings = new b(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(o, this.data) ? this._updateData() : this._updateAesInData();
|
|
35
|
+
const n = a.layers.find((s) => s.type === "dots"), r = this.settings.layers.find((s) => s.type === "dots");
|
|
36
|
+
n && r && n.aes.dotSize !== r.aes.dotSize && typeof n.aes.dotSize == "number" && typeof r.aes.dotSize == "number" && this.chartRenderer.updatePointSize(), this._updateChart(), this.hasError = !1;
|
|
35
37
|
} catch (a) {
|
|
36
|
-
a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
|
|
38
|
+
this.hasError = !0, a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
updateChartState(t, e) {
|
|
40
|
-
if (t === "polygon" && (this.chartRenderer.polygons = e, this._updateChart()), t ===
|
|
41
|
-
const a = new CustomEvent(
|
|
42
|
+
if (t === "polygon" && (this.chartRenderer.polygons = e, this._updateChart()), t === m.delete && document) {
|
|
43
|
+
const a = new CustomEvent(m.delete);
|
|
42
44
|
document.dispatchEvent(a);
|
|
43
45
|
}
|
|
44
|
-
if (t ===
|
|
45
|
-
const a = new CustomEvent(
|
|
46
|
+
if (t === m.selectMode && document) {
|
|
47
|
+
const a = new CustomEvent(m.selectMode, { detail: e });
|
|
46
48
|
document.dispatchEvent(a);
|
|
47
49
|
}
|
|
48
|
-
if (t ===
|
|
49
|
-
const a = new CustomEvent(
|
|
50
|
+
if (t === m.forward && document) {
|
|
51
|
+
const a = new CustomEvent(m.forward);
|
|
50
52
|
document.dispatchEvent(a);
|
|
51
53
|
}
|
|
52
|
-
if (t ===
|
|
53
|
-
const a = new CustomEvent(
|
|
54
|
+
if (t === m.back && document) {
|
|
55
|
+
const a = new CustomEvent(m.back);
|
|
54
56
|
document.dispatchEvent(a);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -58,55 +60,57 @@ class I extends _ {
|
|
|
58
60
|
return console.warn("export not implemented"), "";
|
|
59
61
|
}
|
|
60
62
|
_needUpdateCalculatedDataBySettings(t, e) {
|
|
61
|
-
var a,
|
|
62
|
-
return
|
|
63
|
+
var a, o, n, r;
|
|
64
|
+
return S(
|
|
65
|
+
t.grouping.map((s) => s.columnName.value),
|
|
66
|
+
e.grouping.map((s) => s.columnName.value)
|
|
67
|
+
) || t.grouping.some((s, u) => {
|
|
63
68
|
var h;
|
|
64
|
-
return
|
|
65
|
-
}) || t.layers.length !== e.layers.length || t.layers.some((
|
|
69
|
+
return S(s.order, (h = e.grouping) == null ? void 0 : h[u].order);
|
|
70
|
+
}) || t.layers.length !== e.layers.length || t.layers.some((s, u) => s.type !== e.layers[u].type) || (((a = t.label) == null ? void 0 : a.value) || ((o = e.label) == null ? void 0 : o.value)) && ((n = t.label) == null ? void 0 : n.value) !== ((r = e.label) == null ? void 0 : r.value);
|
|
66
71
|
}
|
|
67
72
|
_needUpdateCalculatedDataByData(t, e) {
|
|
68
|
-
const a = Object.keys(t.data),
|
|
69
|
-
return t.id !== e.id || a.length !==
|
|
70
|
-
var
|
|
71
|
-
return t.data[
|
|
73
|
+
const a = Object.keys(t.data), o = Object.keys(e.data);
|
|
74
|
+
return t.id !== e.id || a.length !== o.length || a.some((n) => {
|
|
75
|
+
var r;
|
|
76
|
+
return t.data[n].length !== ((r = e.data[n]) == null ? void 0 : r.length);
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
79
|
_updateData() {
|
|
75
|
-
const { x: t, y: e, label: a, highlight:
|
|
80
|
+
const { x: t, y: e, label: a, highlight: o, grouping: n, layers: r } = this.settings, s = {
|
|
76
81
|
minX: 1 / 0,
|
|
77
82
|
maxX: -1 / 0,
|
|
78
83
|
minY: 1 / 0,
|
|
79
84
|
maxY: -1 / 0
|
|
80
|
-
},
|
|
85
|
+
}, u = r.some((i) => i.type === "curve"), h = /* @__PURE__ */ new Set(), d = {}, f = [], E = a != null && a.format ? P(a.format) : void 0;
|
|
81
86
|
for (let i = 0; i < this.data.rowsCount; i++) {
|
|
82
|
-
const
|
|
83
|
-
if (typeof
|
|
87
|
+
const c = this.data.getColumnValue(t.value, i), p = this.data.getColumnValue(e.value, i);
|
|
88
|
+
if (typeof c != "number" || typeof p != "number")
|
|
84
89
|
continue;
|
|
85
|
-
|
|
86
|
-
const w =
|
|
87
|
-
x:
|
|
88
|
-
y:
|
|
90
|
+
c < s.minX && (s.minX = c), c > s.maxX && (s.maxX = c), p < s.minY && (s.minY = p), p > s.maxY && (s.maxY = p);
|
|
91
|
+
const w = o ? !this.data.getColumnValue(o.value, i) : !1, C = {
|
|
92
|
+
x: c,
|
|
93
|
+
y: p,
|
|
89
94
|
idx: i,
|
|
90
95
|
label: A(this.data, i, a, E),
|
|
91
96
|
dimmed: w
|
|
92
97
|
};
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
|
|
98
|
+
if (u) {
|
|
99
|
+
const y = n.map(({ columnName: x }) => this.data.getColumnValue(x.value, i)).join("_");
|
|
100
|
+
h.add(y), d[y] || (d[y] = []), d[y].push(C);
|
|
96
101
|
}
|
|
97
|
-
|
|
102
|
+
f.push(C);
|
|
98
103
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const D = U(this.data, s, o, l);
|
|
104
|
+
const v = [...h];
|
|
105
|
+
u && v.forEach((i) => {
|
|
106
|
+
d[i].sort((c, p) => c.x - p.x);
|
|
107
|
+
}), R(this.data, f, n, o);
|
|
108
|
+
const D = U(this.data, n, r);
|
|
105
109
|
this.calculatedData = {
|
|
106
|
-
dots:
|
|
107
|
-
dotsByGrouping:
|
|
108
|
-
groupingKeys:
|
|
109
|
-
dotsExtents:
|
|
110
|
+
dots: f,
|
|
111
|
+
dotsByGrouping: d,
|
|
112
|
+
groupingKeys: v,
|
|
113
|
+
dotsExtents: s,
|
|
110
114
|
legendLabels: D
|
|
111
115
|
};
|
|
112
116
|
}
|
|
@@ -114,20 +118,20 @@ class I extends _ {
|
|
|
114
118
|
const t = this.calculatedData;
|
|
115
119
|
if (!t)
|
|
116
120
|
return;
|
|
117
|
-
const { layers: e,
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
e.forEach((
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
const { layers: e, grouping: a } = this.settings;
|
|
122
|
+
a.forEach(({ columnName: o, inheritedAes: n }) => {
|
|
123
|
+
const r = /* @__PURE__ */ new Set(), s = {};
|
|
124
|
+
e.forEach((u) => {
|
|
125
|
+
u.aes && Object.entries(u.aes).forEach(([h, d]) => {
|
|
126
|
+
O(d) && d.value === o.value && (r.add(h), d.palette && (s[h] = d.palette));
|
|
123
127
|
});
|
|
124
|
-
}), t.legendLabels[
|
|
128
|
+
}), t.legendLabels[o.value].usedAes = [...r], t.legendLabels[o.value].aesMap = L(o, s, n);
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
131
|
_updateChart() {
|
|
128
132
|
if (!this.calculatedData)
|
|
129
133
|
return;
|
|
130
|
-
const { id: t, chartSettings: e, keyColumn: a, layers:
|
|
134
|
+
const { id: t, chartSettings: e, keyColumn: a, layers: o, grouping: n } = this.settings;
|
|
131
135
|
this.chartRenderer.render(
|
|
132
136
|
this.data,
|
|
133
137
|
t,
|
|
@@ -136,9 +140,9 @@ class I extends _ {
|
|
|
136
140
|
this.calculatedData.dots,
|
|
137
141
|
this.calculatedData.dotsExtents,
|
|
138
142
|
this.calculatedData.dotsByGrouping,
|
|
139
|
-
|
|
143
|
+
o,
|
|
140
144
|
this.calculatedData.legendLabels,
|
|
141
|
-
|
|
145
|
+
n.map((r) => r.columnName),
|
|
142
146
|
this.onPolygonUpdate,
|
|
143
147
|
this.onTooltipHintSwitch,
|
|
144
148
|
this.onLassoControlsStateUpdate
|
|
@@ -146,6 +150,6 @@ class I extends _ {
|
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
export {
|
|
149
|
-
|
|
153
|
+
G as ChartScatterplotUmap
|
|
150
154
|
};
|
|
151
155
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot-umap/index.ts"],"sourcesContent":["import {format} from 'd3-format';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport { addPalettesToAesMapping, createLegendInfo } from '../scatterplot/utils/createLegendInfo';\nimport {formatColumnValue} from '../scatterplot/utils/formatColumnValue';\nimport type { AesItem, ContinuousAesFromColumn, InheritAesScatterplot, ScatterplotEventHandlers } from '../types';\nimport type { ScatterplotUmapLegendInfo, ScatterplotUmapSettings } from '../types/scatterplot-umap';\nimport ChartRenderer from './ChartRenderer';\nimport { SCATTERPLOT_LASSO_EVENTS } from './constants';\nimport type { DotsLayer } from './SettingsImpl';\nimport { ScatterplotUmapSettingsImpl } from './SettingsImpl';\nimport type { Dot, DotsExtents, LassoControlsState, LassoMode, Polygon } from './types';\n\nfunction isInheritMapping<T extends (string | number)>(value:T | InheritAesScatterplot | ContinuousAesFromColumn<T>):value is InheritAesScatterplot {\n return typeof value === 'object' && 'type' in value && value.type === 'grouping';\n}\n\nexport class ChartScatterplotUmap extends AbstractChart {\n settings: ScatterplotUmapSettingsImpl;\n chartRenderer: ChartRenderer;\n\n onPolygonUpdate: (data: number[], polygons: Polygon[]) => void = () => undefined; // dots indexes from input data\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n onLassoControlsStateUpdate: (v: LassoControlsState) => void = () => undefined;\n\n calculatedData: {\n dots: Dot[],\n groupingKeys: string[],\n dotsByGrouping: Record<string, Dot[]>,\n dotsExtents: DotsExtents,\n legendLabels: ScatterplotUmapLegendInfo\n } | null = null;\n\n constructor(data: DataFrame, settings: ScatterplotUmapSettings, eventHandlers?: ScatterplotEventHandlers) {\n super(data, settings);\n\n this.settings = new ScatterplotUmapSettingsImpl(settings);\n this.chartRenderer = new ChartRenderer();\n\n if (eventHandlers) {\n this.onPolygonUpdate = eventHandlers.onPolygonUpdate;\n this.onTooltipHintSwitch = eventHandlers.onTooltipHintSwitch;\n this.onLassoControlsStateUpdate = eventHandlers.onLassoControlsStateUpdate;\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n } catch (err) {\n console.error(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: ScatterplotUmapSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new ScatterplotUmapSettingsImpl(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\n // for some reason it's not enough for size updating to do like with fillColor\n const prevLayer = previousSettings.layers.find(l => l.type === 'dots') as DotsLayer;\n const currentLayer = this.settings.layers.find(l => l.type === 'dots') as DotsLayer;\n if (prevLayer && currentLayer && prevLayer.aes.dotSize !== currentLayer.aes.dotSize\n && typeof prevLayer.aes.dotSize === 'number' && typeof currentLayer.aes.dotSize === 'number') {\n this.chartRenderer.updatePointSize();\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 if (field === 'polygon') {\n this.chartRenderer.polygons = value as Polygon[];\n this._updateChart();\n }\n if (field === SCATTERPLOT_LASSO_EVENTS.delete) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.delete);\n document.dispatchEvent(event);\n }}\n if (field === SCATTERPLOT_LASSO_EVENTS.selectMode) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.selectMode, {detail: value as LassoMode});\n document.dispatchEvent(event);\n }\n }\n if (field === SCATTERPLOT_LASSO_EVENTS.forward) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.forward);\n document.dispatchEvent(event);\n }\n }\n if (field === SCATTERPLOT_LASSO_EVENTS.back) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.back);\n document.dispatchEvent(event);\n }\n }\n }\n\n export(): string {\n console.warn('export not implemented');\n return '';\n // this._updateChart();\n // return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: ScatterplotUmapSettingsImpl, settings: ScatterplotUmapSettingsImpl) {\n return (\n prevSettings.grouping.length !== settings.grouping.length ||\n prevSettings.grouping.some((el, idx) => el.value !== settings.grouping[idx]?.value) ||\n prevSettings.layers.length !== settings.layers.length ||\n prevSettings.layers.some((l, idx) => l.type !== settings.layers[idx].type) ||\n (prevSettings.label?.value || settings.label?.value) && prevSettings.label?.value !== settings.label?.value\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 {x, y, label, highlight, grouping, layers, inheritedAes} = this.settings;\n\n const dotsExtents = {\n minX: Infinity,\n maxX: -Infinity,\n minY: Infinity,\n maxY: -Infinity,\n };\n\n const hasCurve = layers.some(layer => layer.type === 'curve');\n const groupingKeysSet = new Set<string>();\n const dotsByGrouping:Record<string, Dot[]> = {};\n\n const dots: Dot[] = [];\n const labelFormatter = label?.format ? format(label.format) : undefined;\n\n for (let idx = 0; idx < this.data.rowsCount; idx++) {\n const xv = this.data.getColumnValue(x.value, idx);\n const yv = this.data.getColumnValue(y.value, idx);\n\n if (typeof xv !== 'number' || typeof yv !== 'number') {\n continue;\n }\n\n if (xv < dotsExtents.minX) {\n dotsExtents.minX = xv;\n }\n if (xv > dotsExtents.maxX) {\n dotsExtents.maxX = xv;\n }\n if (yv < dotsExtents.minY) {\n dotsExtents.minY = yv;\n }\n if (yv > dotsExtents.maxY) {\n dotsExtents.maxY = yv;\n }\n\n const dimmed = highlight ? !this.data.getColumnValue(highlight.value, idx) : false;\n const dot: Dot = {\n x: xv,\n y: yv,\n idx,\n label: formatColumnValue(this.data, idx, label, labelFormatter),\n dimmed\n };\n if (hasCurve) {\n const groupingKey = grouping.map(column => this.data.getColumnValue(column.value, idx)).join('_');\n groupingKeysSet.add(groupingKey);\n if (!dotsByGrouping[groupingKey]) {\n dotsByGrouping[groupingKey] = [];\n }\n dotsByGrouping[groupingKey].push(dot);\n\n }\n dots.push(dot);\n }\n\n if (highlight) {\n dots.sort((d1, d2) => {\n if (d2.dimmed === d1.dimmed) return 0;\n if (d2.dimmed) return 1;\n return -1;\n });\n }\n\n const groupingKeys = [...groupingKeysSet];\n if (hasCurve) {\n groupingKeys.forEach(key => {\n dotsByGrouping[key].sort((a, b) => a.x - b.x);\n });\n }\n const legendLabels = createLegendInfo(this.data, grouping, layers, inheritedAes);\n\n this.calculatedData = {\n dots,\n dotsByGrouping,\n groupingKeys,\n dotsExtents,\n legendLabels,\n };\n }\n\n _updateAesInData() {\n const calculated = this.calculatedData;\n if (!calculated) {\n return;\n }\n const {layers, inheritedAes, grouping} = this.settings;\n grouping.forEach(column => {\n const usedAes = new Set<keyof AesItem>();\n const usedAesFromPalettes:Partial<Record<keyof AesItem, string[]>> = {}; // if there is palette in mapping then\n layers.forEach(layer => {\n if (!layer.aes) return;\n \n Object.entries(layer.aes).forEach(([key, value]) => {\n if (!(isInheritMapping(value) && value.value === column.value)) return;\n usedAes.add(key as keyof AesItem);\n if (value.palette) {\n usedAesFromPalettes[key as keyof AesItem] = value.palette;\n }\n });\n });\n\n calculated.legendLabels[column.value].usedAes = [...usedAes];\n calculated.legendLabels[column.value].aesMap = addPalettesToAesMapping(column, usedAesFromPalettes, inheritedAes[column.value]);\n });\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {id, chartSettings, keyColumn, layers, grouping} = this.settings;\n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n keyColumn,\n this.calculatedData.dots,\n this.calculatedData.dotsExtents,\n this.calculatedData.dotsByGrouping,\n layers,\n this.calculatedData.legendLabels,\n grouping,\n this.onPolygonUpdate,\n this.onTooltipHintSwitch,\n this.onLassoControlsStateUpdate\n );\n }\n}\n"],"names":["isInheritMapping","value","ChartScatterplotUmap","AbstractChart","data","settings","eventHandlers","__publicField","ScatterplotUmapSettingsImpl","ChartRenderer","node","err","previousSettings","previousData","prevLayer","l","currentLayer","field","SCATTERPLOT_LASSO_EVENTS","event","prevSettings","el","idx","_a","_b","_c","_d","prevData","prevKeys","keys","n","key","x","y","label","highlight","grouping","layers","inheritedAes","dotsExtents","hasCurve","layer","groupingKeysSet","dotsByGrouping","dots","labelFormatter","format","xv","yv","dimmed","dot","formatColumnValue","groupingKey","column","d1","d2","groupingKeys","a","b","legendLabels","createLegendInfo","calculated","usedAes","usedAesFromPalettes","addPalettesToAesMapping","id","chartSettings","keyColumn"],"mappings":";;;;;;;;AAaA,SAASA,EAA8CC,GAA6F;AAChJ,SAAO,OAAOA,KAAU,YAAY,UAAUA,KAASA,EAAM,SAAS;AAC1E;AAEO,MAAMC,UAA6BC,EAAc;AAAA,EAgBpD,YAAYC,GAAiBC,GAAmCC,GAA0C;AACtG,UAAMF,GAAMC,CAAQ,GAhBxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,eAAA,GAEAA,EAAA,yBAAiE,MAAA;AAAA,IAAA,CAAA,GACjEA,EAAA,6BAA2C,MAAA;AAAA,IAAA,CAAA,GAC3CA,EAAA,oCAA8D,MAAA;AAAA,IAAA,CAAA,GAE9DA,EAAA,MAAA,kBAMW,IAAA,GAKP,KAAK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CAAAI,MAAS;AACfA,QAAAA,EAAM,OAEX,OAAO,QAAQA,EAAM,GAAG,EAAE,QAAQ,CAAC,CAACV,GAAK9B,CAAK,MAAM;AAC1CD,YAAiBC,CAAK,KAAKA,EAAM,UAAUoD,EAAO,UACxDS,EAAQ,IAAI/B,CAAoB,GAC5B9B,EAAM,YACN8D,EAAoBhC,CAAoB,IAAI9B,EAAM;AAAA,QAE1D,CAAC;AAAA,MACL,CAAC,GAED4D,EAAW,aAAaR,EAAO,KAAK,EAAE,UAAU,CAAC,GAAGS,CAAO,GAC3DD,EAAW,aAAaR,EAAO,KAAK,EAAE,SAASW,EAAwBX,GAAQU,GAAqBzB,EAAae,EAAO,KAAK,CAAC;AAAA,IAClI,CAAC;AAAA,EACL;AAAA,EAEA,eAAe;AACX,QAAI,CAAC,KAAK;AACN;AAEJ,UAAM,EAAC,IAAAY,GAAI,eAAAC,GAAe,WAAAC,GAAW,QAAA9B,GAAQ,UAAAD,EAAAA,IAAY,KAAK;AAC9D,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACL6B;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA,MACpB9B;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBD;AAAAA,MACA,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/scatterplot-umap/index.ts"],"sourcesContent":["import {format} from 'd3-format';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport { addPalettesToAesMapping, createLegendInfo } from '../scatterplot/utils/createLegendInfo';\nimport {formatColumnValue} from '../scatterplot/utils/formatColumnValue';\nimport {sortDotsByGrouping} from '../scatterplot/utils/sortDotsByGrouping';\nimport type { AesItem, ContinuousAesFromColumn, InheritAesScatterplot, ScatterplotEventHandlers } from '../types';\nimport type { ScatterplotUmapLegendInfo, ScatterplotUmapSettings } from '../types/scatterplot-umap';\nimport {arraysAreDifferent} from '../utils/arraysAreDifferent';\nimport ChartRenderer from './ChartRenderer';\nimport { SCATTERPLOT_LASSO_EVENTS } from './constants';\nimport type { DotsLayer } from './SettingsImpl';\nimport { ScatterplotUmapSettingsImpl } from './SettingsImpl';\nimport type { Dot, DotsExtents, LassoControlsState, LassoMode, Polygon } from './types';\n\nfunction isInheritMapping<T extends (string | number)>(value:T | InheritAesScatterplot | ContinuousAesFromColumn<T>):value is InheritAesScatterplot {\n return typeof value === 'object' && 'type' in value && value.type === 'grouping';\n}\n\nexport class ChartScatterplotUmap extends AbstractChart {\n settings: ScatterplotUmapSettingsImpl;\n chartRenderer: ChartRenderer;\n\n onPolygonUpdate: (data: number[], polygons: Polygon[]) => void = () => undefined; // dots indexes from input data\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n onLassoControlsStateUpdate: (v: LassoControlsState) => void = () => undefined;\n\n calculatedData: {\n dots: Dot[],\n groupingKeys: string[],\n dotsByGrouping: Record<string, Dot[]>,\n dotsExtents: DotsExtents,\n legendLabels: ScatterplotUmapLegendInfo\n } | null = null;\n\n constructor(data: DataFrame, settings: ScatterplotUmapSettings, eventHandlers?: ScatterplotEventHandlers) {\n super(data, settings);\n\n this.settings = new ScatterplotUmapSettingsImpl(settings);\n this.chartRenderer = new ChartRenderer();\n\n if (eventHandlers) {\n this.onPolygonUpdate = eventHandlers.onPolygonUpdate;\n this.onTooltipHintSwitch = eventHandlers.onTooltipHintSwitch;\n this.onLassoControlsStateUpdate = eventHandlers.onLassoControlsStateUpdate;\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 console.error(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: ScatterplotUmapSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new ScatterplotUmapSettingsImpl(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\n // for some reason it's not enough for size updating to do like with fillColor\n const prevLayer = previousSettings.layers.find(l => l.type === 'dots') as DotsLayer;\n const currentLayer = this.settings.layers.find(l => l.type === 'dots') as DotsLayer;\n if (prevLayer && currentLayer && prevLayer.aes.dotSize !== currentLayer.aes.dotSize\n && typeof prevLayer.aes.dotSize === 'number' && typeof currentLayer.aes.dotSize === 'number') {\n this.chartRenderer.updatePointSize();\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 if (field === 'polygon') {\n this.chartRenderer.polygons = value as Polygon[];\n this._updateChart();\n }\n if (field === SCATTERPLOT_LASSO_EVENTS.delete) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.delete);\n document.dispatchEvent(event);\n }}\n if (field === SCATTERPLOT_LASSO_EVENTS.selectMode) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.selectMode, {detail: value as LassoMode});\n document.dispatchEvent(event);\n }\n }\n if (field === SCATTERPLOT_LASSO_EVENTS.forward) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.forward);\n document.dispatchEvent(event);\n }\n }\n if (field === SCATTERPLOT_LASSO_EVENTS.back) {\n if (document) {\n const event = new CustomEvent(SCATTERPLOT_LASSO_EVENTS.back);\n document.dispatchEvent(event);\n }\n }\n }\n\n export(): string {\n console.warn('export not implemented');\n return '';\n // this._updateChart();\n // return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: ScatterplotUmapSettingsImpl, settings: ScatterplotUmapSettingsImpl) {\n return (\n arraysAreDifferent(\n prevSettings.grouping.map(v => v.columnName.value),\n settings.grouping.map(v => v.columnName.value),\n ) ||\n prevSettings.grouping.some((v, idx) => arraysAreDifferent(v.order, settings.grouping?.[idx].order)) ||\n prevSettings.layers.length !== settings.layers.length ||\n prevSettings.layers.some((l, idx) => l.type !== settings.layers[idx].type) ||\n (prevSettings.label?.value || settings.label?.value) && prevSettings.label?.value !== settings.label?.value\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 {x, y, label, highlight, grouping, layers} = this.settings;\n\n const dotsExtents = {\n minX: Infinity,\n maxX: -Infinity,\n minY: Infinity,\n maxY: -Infinity,\n };\n\n const hasCurve = layers.some(layer => layer.type === 'curve');\n const groupingKeysSet = new Set<string>();\n const dotsByGrouping:Record<string, Dot[]> = {};\n\n const dots: Dot[] = [];\n const labelFormatter = label?.format ? format(label.format) : undefined;\n\n for (let idx = 0; idx < this.data.rowsCount; idx++) {\n const xv = this.data.getColumnValue(x.value, idx);\n const yv = this.data.getColumnValue(y.value, idx);\n\n if (typeof xv !== 'number' || typeof yv !== 'number') {\n continue;\n }\n\n if (xv < dotsExtents.minX) {\n dotsExtents.minX = xv;\n }\n if (xv > dotsExtents.maxX) {\n dotsExtents.maxX = xv;\n }\n if (yv < dotsExtents.minY) {\n dotsExtents.minY = yv;\n }\n if (yv > dotsExtents.maxY) {\n dotsExtents.maxY = yv;\n }\n\n const dimmed = highlight ? !this.data.getColumnValue(highlight.value, idx) : false;\n const dot: Dot = {\n x: xv,\n y: yv,\n idx,\n label: formatColumnValue(this.data, idx, label, labelFormatter),\n dimmed\n };\n if (hasCurve) {\n const groupingKey = grouping.map(({columnName}) => this.data.getColumnValue(columnName.value, idx)).join('_');\n groupingKeysSet.add(groupingKey);\n if (!dotsByGrouping[groupingKey]) {\n dotsByGrouping[groupingKey] = [];\n }\n dotsByGrouping[groupingKey].push(dot);\n }\n dots.push(dot);\n }\n\n const groupingKeys = [...groupingKeysSet];\n if (hasCurve) {\n groupingKeys.forEach(key => {\n dotsByGrouping[key].sort((a, b) => a.x - b.x);\n });\n }\n sortDotsByGrouping(this.data, dots, grouping, highlight);\n const legendLabels = createLegendInfo(this.data, grouping, layers);\n\n this.calculatedData = {\n dots,\n dotsByGrouping,\n groupingKeys,\n dotsExtents,\n legendLabels,\n };\n }\n\n _updateAesInData() {\n const calculated = this.calculatedData;\n if (!calculated) {\n return;\n }\n const {layers, grouping} = this.settings;\n grouping.forEach(({columnName, inheritedAes}) => {\n const usedAes = new Set<keyof AesItem>();\n const usedAesFromPalettes:Partial<Record<keyof AesItem, string[]>> = {}; // if there is palette in mapping then\n layers.forEach(layer => {\n if (!layer.aes) return;\n \n Object.entries(layer.aes).forEach(([key, value]) => {\n if (!(isInheritMapping(value) && value.value === columnName.value)) return;\n usedAes.add(key as keyof AesItem);\n if (value.palette) {\n usedAesFromPalettes[key as keyof AesItem] = value.palette;\n }\n });\n });\n\n calculated.legendLabels[columnName.value].usedAes = [...usedAes];\n calculated.legendLabels[columnName.value].aesMap = addPalettesToAesMapping(columnName, usedAesFromPalettes, inheritedAes);\n });\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {id, chartSettings, keyColumn, layers, grouping} = this.settings;\n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n keyColumn,\n this.calculatedData.dots,\n this.calculatedData.dotsExtents,\n this.calculatedData.dotsByGrouping,\n layers,\n this.calculatedData.legendLabels,\n grouping.map(v => v.columnName),\n this.onPolygonUpdate,\n this.onTooltipHintSwitch,\n this.onLassoControlsStateUpdate\n );\n }\n}\n"],"names":["isInheritMapping","value","ChartScatterplotUmap","AbstractChart","data","settings","eventHandlers","__publicField","ScatterplotUmapSettingsImpl","ChartRenderer","node","err","previousSettings","previousData","prevLayer","l","currentLayer","field","SCATTERPLOT_LASSO_EVENTS","event","prevSettings","arraysAreDifferent","v","idx","_a","_b","_c","_d","prevData","prevKeys","keys","s","key","x","y","label","highlight","grouping","layers","dotsExtents","hasCurve","layer","groupingKeysSet","dotsByGrouping","dots","labelFormatter","format","xv","yv","dimmed","dot","formatColumnValue","groupingKey","columnName","groupingKeys","a","b","sortDotsByGrouping","legendLabels","createLegendInfo","calculated","inheritedAes","usedAes","usedAesFromPalettes","addPalettesToAesMapping","id","chartSettings","keyColumn"],"mappings":";;;;;;;;;;AAeA,SAASA,EAA8CC,GAA6F;AAChJ,SAAO,OAAOA,KAAU,YAAY,UAAUA,KAASA,EAAM,SAAS;AAC1E;AAEO,MAAMC,UAA6BC,EAAc;AAAA,EAgBpD,YAAYC,GAAiBC,GAAmCC,GAA0C;AACtG,UAAMF,GAAMC,CAAQ,GAhBxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,eAAA,GAEAA,EAAA,yBAAiE,MAAA;AAAA,IAAA,CAAA,GACjEA,EAAA,6BAA2C,MAAA;AAAA,IAAA,CAAA,GAC3CA,EAAA,oCAA8D,MAAA;AAAA,IAAA,CAAA,GAE9DA,EAAA,MAAA,kBAMW,IAAA,GAKP,KAAK,WAAW,IAAIC,EAA4BH,CAAQ,GACxD,KAAK,gBAAgB,IAAII,EAAAA,GAErBH,MACA,KAAK,kBAAkBA,EAAc,iBACrC,KAAK,sBAAsBA,EAAc,qBACzC,KAAK,6BAA6BA,EAAc;AAAA,EAExD;AAAA,EAEA,MAAMI,GAAmB;AACrB,QAAI;AACA,WAAK,cAAc,KAAKA,CAAI,GAC5B,KAAK,eACL,KAAK,aAAA,GACL,KAAK,WAAW;AAAA,IACpB,SAASC,GAAK;AACV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C5DS,EAAQ,IAAI9B,CAAoB,GAC5B/B,EAAM,YACN8D,EAAoB/B,CAAoB,IAAI/B,EAAM;AAAA,QAE1D,CAAC;AAAA,MACL,CAAC,GAED2D,EAAW,aAAaP,EAAW,KAAK,EAAE,UAAU,CAAC,GAAGS,CAAO,GAC/DF,EAAW,aAAaP,EAAW,KAAK,EAAE,SAASW,EAAwBX,GAAYU,GAAqBF,CAAY;AAAA,IAC5H,CAAC;AAAA,EACL;AAAA,EAEA,eAAe;AACX,QAAI,CAAC,KAAK;AACN;AAEJ,UAAM,EAAC,IAAAI,GAAI,eAAAC,GAAe,WAAAC,GAAW,QAAA7B,GAAQ,UAAAD,EAAAA,IAAY,KAAK;AAC9D,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACL4B;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA,MACpB7B;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBD,EAAS,IAAI,CAAAf,MAAKA,EAAE,UAAU;AAAA,MAC9B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import o from "../node_modules/zod/lib/index.js";
|
|
2
|
-
import { continuousAesMappingFromValueSchema as a, PointShapeSchema as n, LineShapeSchema as l, ColumnNameSchema as t, AesRecordSchema as p, AxisSettingsSchema as
|
|
3
|
-
const
|
|
2
|
+
import { continuousAesMappingFromValueSchema as a, PointShapeSchema as n, LineShapeSchema as l, ColumnNameSchema as t, AesRecordSchema as p, DataValueSchema as r, AxisSettingsSchema as i, FrameTypeSchema as s, LegendPositionSchema as m, TitlePositionSchema as c } from "./common.js";
|
|
3
|
+
const e = o.object({
|
|
4
4
|
type: o.literal("grouping"),
|
|
5
5
|
value: o.string(),
|
|
6
6
|
// link to aes mapped to column
|
|
7
7
|
palette: o.optional(o.array(o.string()))
|
|
8
8
|
// if defined we use palette to create mapping without inheritedAes field
|
|
9
|
-
}),
|
|
9
|
+
}), h = o.object({
|
|
10
10
|
type: o.literal("dots"),
|
|
11
11
|
aes: o.optional(
|
|
12
12
|
o.object({
|
|
13
13
|
dotFill: o.optional(
|
|
14
|
-
o.union([o.string(),
|
|
14
|
+
o.union([o.string(), e, a(o.string())])
|
|
15
15
|
),
|
|
16
|
-
dotShape: o.optional(o.union([n,
|
|
16
|
+
dotShape: o.optional(o.union([n, e])),
|
|
17
17
|
dotSize: o.optional(o.union([o.number(), a(o.number())]))
|
|
18
18
|
})
|
|
19
19
|
)
|
|
20
|
-
}),
|
|
20
|
+
}), b = o.object({
|
|
21
21
|
type: o.literal("curve"),
|
|
22
22
|
smoothing: o.optional(o.boolean()),
|
|
23
23
|
aes: o.optional(
|
|
24
24
|
o.object({
|
|
25
25
|
lineWidth: o.optional(o.number()),
|
|
26
26
|
lineShape: o.optional(l),
|
|
27
|
-
lineColor: o.optional(o.union([o.string(),
|
|
27
|
+
lineColor: o.optional(o.union([o.string(), e, a(o.string())])),
|
|
28
28
|
opacity: o.optional(o.number())
|
|
29
29
|
})
|
|
30
30
|
)
|
|
31
|
-
}),
|
|
31
|
+
}), u = o.union([h, b]), y = o.object({
|
|
32
32
|
type: o.literal("scatterplot-umap"),
|
|
33
33
|
title: o.object({
|
|
34
34
|
name: o.string(),
|
|
35
35
|
show: o.optional(o.boolean()),
|
|
36
|
-
position: o.optional(
|
|
36
|
+
position: o.optional(c)
|
|
37
37
|
}),
|
|
38
38
|
size: o.optional(
|
|
39
39
|
o.object({
|
|
@@ -44,7 +44,7 @@ const i = o.object({
|
|
|
44
44
|
legend: o.optional(
|
|
45
45
|
o.object({
|
|
46
46
|
show: o.optional(o.boolean()),
|
|
47
|
-
position: o.optional(
|
|
47
|
+
position: o.optional(m)
|
|
48
48
|
})
|
|
49
49
|
),
|
|
50
50
|
tooltips: o.optional(
|
|
@@ -53,19 +53,25 @@ const i = o.object({
|
|
|
53
53
|
content: o.optional(o.array(t))
|
|
54
54
|
})
|
|
55
55
|
),
|
|
56
|
-
frame: o.optional(o.object({ type: o.optional(
|
|
56
|
+
frame: o.optional(o.object({ type: o.optional(s) })),
|
|
57
57
|
keyColumn: o.optional(t),
|
|
58
58
|
x: t,
|
|
59
59
|
y: t,
|
|
60
|
-
xAxis: o.optional(
|
|
61
|
-
yAxis: o.optional(
|
|
62
|
-
grouping: o.optional(o.array(
|
|
60
|
+
xAxis: o.optional(i),
|
|
61
|
+
yAxis: o.optional(i),
|
|
62
|
+
grouping: o.optional(o.array(
|
|
63
|
+
o.object({
|
|
64
|
+
columnName: t,
|
|
65
|
+
order: o.optional(o.array(r)),
|
|
66
|
+
inheritedAes: o.optional(p),
|
|
67
|
+
allowNullGroup: o.optional(o.boolean())
|
|
68
|
+
})
|
|
69
|
+
)),
|
|
63
70
|
label: o.optional(t),
|
|
64
71
|
highlight: o.optional(t),
|
|
65
|
-
|
|
66
|
-
layers: o.array(b)
|
|
72
|
+
layers: o.array(u)
|
|
67
73
|
});
|
|
68
74
|
export {
|
|
69
|
-
|
|
75
|
+
y as ScatterplotUmapSettingsSchema
|
|
70
76
|
};
|
|
71
77
|
//# sourceMappingURL=scatterplot-umap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scatterplot-umap.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/types/scatterplot-umap.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { categoricalAesMappingFromValueSchema } from './common';\nimport {\n AesRecordSchema, AxisSettingsSchema,\n ColumnNameSchema, continuousAesMappingFromValueSchema, FrameTypeSchema,\n LegendPositionSchema, LineShapeSchema, PointShapeSchema,\n TitlePositionSchema
|
|
1
|
+
{"version":3,"file":"scatterplot-umap.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/types/scatterplot-umap.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { categoricalAesMappingFromValueSchema } from './common';\nimport {\n AesRecordSchema, AxisSettingsSchema,\n ColumnNameSchema, continuousAesMappingFromValueSchema, DataValueSchema, FrameTypeSchema,\n LegendPositionSchema, LineShapeSchema, PointShapeSchema,\n TitlePositionSchema,\n} from './common';\nimport type { ScatterplotLegendInfo } from './scatterplot';\n\ntype catAesFromColumn<ValueType extends z.ZodType> = ReturnType<typeof categoricalAesMappingFromValueSchema<ValueType>>;\ntype contAesFromColumn<ValueType extends z.ZodType> = ReturnType<typeof continuousAesMappingFromValueSchema<ValueType>>;\n\nexport type CategoricalAesFromColumn<ValueType> = z.infer<catAesFromColumn<z.ZodType<ValueType>>>;\nexport type ContinuousAesFromColumn<ValueType> = z.infer<contAesFromColumn<z.ZodType<ValueType>>>;\n\nconst InheritAesSchema = z.object({\n type: z.literal('grouping'),\n value: z.string(), // link to aes mapped to column\n palette: z.optional(z.array(z.string())) // if defined we use palette to create mapping without inheritedAes field\n});\nexport type InheritAesScatterplot = z.infer<typeof InheritAesSchema>;\n\nconst DotsUmapLayerSchema = z.object({\n type: z.literal('dots'),\n aes: z.optional(\n z.object({\n dotFill: z.optional(\n z.union([z.string(), InheritAesSchema, continuousAesMappingFromValueSchema(z.string())])\n ),\n dotShape: z.optional(z.union([PointShapeSchema, InheritAesSchema])),\n dotSize: z.optional(z.union([z.number(), continuousAesMappingFromValueSchema(z.number())])),\n })\n ),\n});\n\nconst CurveUmapLayerSchema = z.object({\n type: z.literal('curve'),\n smoothing: z.optional(z.boolean()),\n aes: z.optional(\n z.object({\n lineWidth: z.optional(z.number()),\n lineShape: z.optional(LineShapeSchema),\n lineColor: z.optional(z.union([z.string(), InheritAesSchema, continuousAesMappingFromValueSchema(z.string())])),\n opacity: z.optional(z.number()),\n })\n ),\n});\n\nconst ScatterplotUmapLayerSchema = z.union([DotsUmapLayerSchema, CurveUmapLayerSchema]);\n\nexport type DotsUmapLayer = z.infer<typeof DotsUmapLayerSchema>;\nexport type CurveUmapLayer = z.infer<typeof CurveUmapLayerSchema>;\nexport type ScatterplotUmapLayer = z.infer<typeof ScatterplotUmapLayerSchema>;\n\nexport const ScatterplotUmapSettingsSchema = z.object({\n type: z.literal('scatterplot-umap'),\n title: z.object({\n name: z.string(),\n show: z.optional(z.boolean()),\n position: z.optional(TitlePositionSchema),\n }),\n size: z.optional(\n z.object({\n width: z.optional(z.number()),\n height: z.optional(z.number()),\n })\n ),\n legend: z.optional(\n z.object({\n show: z.optional(z.boolean()),\n position: z.optional(LegendPositionSchema),\n })\n ),\n tooltips: z.optional(\n z.object({\n show: z.optional(z.boolean()),\n content: z.optional(z.array(ColumnNameSchema)),\n })\n ),\n frame: z.optional(z.object({type: z.optional(FrameTypeSchema)})),\n keyColumn: z.optional(ColumnNameSchema),\n x: ColumnNameSchema,\n y: ColumnNameSchema,\n xAxis: z.optional(AxisSettingsSchema),\n yAxis: z.optional(AxisSettingsSchema),\n grouping: z.optional(z.array(\n z.object({\n columnName: ColumnNameSchema,\n order: z.optional(z.array(DataValueSchema)),\n inheritedAes: z.optional(AesRecordSchema),\n allowNullGroup: z.optional(z.boolean())\n })\n )),\n label: z.optional(ColumnNameSchema),\n highlight: z.optional(ColumnNameSchema),\n layers: z.array(ScatterplotUmapLayerSchema)\n});\n\nexport type ScatterplotUmapSettings = z.infer<typeof ScatterplotUmapSettingsSchema>;\n\nexport type ScatterplotUmapLegendInfo = ScatterplotLegendInfo;\n"],"names":["InheritAesSchema","z","DotsUmapLayerSchema","continuousAesMappingFromValueSchema","PointShapeSchema","CurveUmapLayerSchema","LineShapeSchema","ScatterplotUmapLayerSchema","ScatterplotUmapSettingsSchema","TitlePositionSchema","LegendPositionSchema","ColumnNameSchema","FrameTypeSchema","AxisSettingsSchema","DataValueSchema","AesRecordSchema"],"mappings":";;AAgBA,MAAMA,IAAmBC,EAAE,OAAO;AAAA,EAC9B,MAAMA,EAAE,QAAQ,UAAU;AAAA,EAC1B,OAAOA,EAAE,OAAA;AAAA;AAAA,EACT,SAASA,EAAE,SAASA,EAAE,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AC;","x_google_ignoreList":[0]}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import o from "../node_modules/zod/lib/index.js";
|
|
2
|
-
import { continuousAesMappingFromValueSchema as
|
|
3
|
-
const
|
|
2
|
+
import { continuousAesMappingFromValueSchema as a, PointShapeSchema as i, LineShapeSchema as l, ColumnNameSchema as t, AesRecordSchema as p, DataValueSchema as r, AxisSettingsSchema as e, FrameTypeSchema as s, LegendPositionSchema as c, TitlePositionSchema as b } from "./common.js";
|
|
3
|
+
const n = o.object({
|
|
4
4
|
type: o.literal("grouping"),
|
|
5
5
|
value: o.string(),
|
|
6
6
|
// link to aes mapped to column
|
|
7
7
|
palette: o.optional(o.array(o.string()))
|
|
8
8
|
// if defined we use palette to create mapping without inheritedAes field
|
|
9
|
-
}),
|
|
9
|
+
}), m = o.object({
|
|
10
10
|
type: o.literal("dots"),
|
|
11
11
|
aes: o.optional(
|
|
12
12
|
o.object({
|
|
13
|
-
dotFill: o.optional(o.union([o.string(),
|
|
14
|
-
dotShape: o.optional(o.union([i,
|
|
15
|
-
dotSize: o.optional(o.union([o.number(),
|
|
13
|
+
dotFill: o.optional(o.union([o.string(), n, a(o.string())])),
|
|
14
|
+
dotShape: o.optional(o.union([i, n])),
|
|
15
|
+
dotSize: o.optional(o.union([o.number(), a(o.number())]))
|
|
16
16
|
})
|
|
17
17
|
)
|
|
18
|
-
}),
|
|
18
|
+
}), h = o.object({
|
|
19
19
|
type: o.literal("curve"),
|
|
20
20
|
smoothing: o.optional(o.boolean()),
|
|
21
21
|
aes: o.optional(
|
|
22
22
|
o.object({
|
|
23
23
|
lineWidth: o.optional(o.number()),
|
|
24
24
|
lineShape: o.optional(l),
|
|
25
|
-
lineColor: o.optional(o.union([o.string(),
|
|
25
|
+
lineColor: o.optional(o.union([o.string(), n, a(o.string())])),
|
|
26
26
|
opacity: o.optional(o.number())
|
|
27
27
|
})
|
|
28
28
|
)
|
|
29
|
-
}),
|
|
29
|
+
}), u = o.union([m, h]), y = o.object({
|
|
30
30
|
type: o.literal("scatterplot"),
|
|
31
31
|
title: o.object({
|
|
32
32
|
name: o.string(),
|
|
33
33
|
show: o.optional(o.boolean()),
|
|
34
|
-
position: o.optional(
|
|
34
|
+
position: o.optional(b)
|
|
35
35
|
}),
|
|
36
36
|
size: o.optional(
|
|
37
37
|
o.object({
|
|
@@ -42,7 +42,7 @@ const a = o.object({
|
|
|
42
42
|
legend: o.optional(
|
|
43
43
|
o.object({
|
|
44
44
|
show: o.optional(o.boolean()),
|
|
45
|
-
position: o.optional(
|
|
45
|
+
position: o.optional(c)
|
|
46
46
|
})
|
|
47
47
|
),
|
|
48
48
|
tooltips: o.optional(
|
|
@@ -51,7 +51,7 @@ const a = o.object({
|
|
|
51
51
|
content: o.optional(o.array(t))
|
|
52
52
|
})
|
|
53
53
|
),
|
|
54
|
-
frame: o.optional(o.object({ type: o.optional(
|
|
54
|
+
frame: o.optional(o.object({ type: o.optional(s) })),
|
|
55
55
|
facetSettings: o.optional(
|
|
56
56
|
o.object({
|
|
57
57
|
sharedX: o.optional(o.boolean()),
|
|
@@ -65,21 +65,27 @@ const a = o.object({
|
|
|
65
65
|
y: t,
|
|
66
66
|
xAxis: o.optional(e),
|
|
67
67
|
yAxis: o.optional(e),
|
|
68
|
-
grouping: o.optional(o.array(
|
|
68
|
+
grouping: o.optional(o.array(
|
|
69
|
+
o.object({
|
|
70
|
+
columnName: t,
|
|
71
|
+
order: o.optional(o.array(r)),
|
|
72
|
+
inheritedAes: o.optional(p),
|
|
73
|
+
allowNullGroup: o.optional(o.boolean())
|
|
74
|
+
})
|
|
75
|
+
)),
|
|
69
76
|
facetBy: o.optional(o.array(t)),
|
|
70
77
|
label: o.optional(t),
|
|
71
78
|
highlight: o.optional(t),
|
|
72
|
-
inheritedAes: o.optional(o.record(o.string(), p)),
|
|
73
79
|
trend: o.optional(
|
|
74
80
|
o.object({
|
|
75
|
-
color: o.optional(o.optional(o.union([o.string(),
|
|
81
|
+
color: o.optional(o.optional(o.union([o.string(), n, a(o.string())]))),
|
|
76
82
|
bounded: o.optional(o.boolean())
|
|
77
83
|
// if true: line and area bounded with min and max X value; else line bounded by chart bounds
|
|
78
84
|
})
|
|
79
85
|
),
|
|
80
|
-
layers: o.array(
|
|
86
|
+
layers: o.array(u)
|
|
81
87
|
});
|
|
82
88
|
export {
|
|
83
|
-
|
|
89
|
+
y as ScatterplotSettingsSchema
|
|
84
90
|
};
|
|
85
91
|
//# sourceMappingURL=scatterplot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scatterplot.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/types/scatterplot.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { AesItem, categoricalAesMappingFromValueSchema, Category, DataValue } from './common';\nimport {\n AesRecordSchema, AxisSettingsSchema,\n ColumnNameSchema,\n continuousAesMappingFromValueSchema,\n FrameTypeSchema,\n LegendPositionSchema,\n LineShapeSchema,\n PointShapeSchema,\n TitlePositionSchema
|
|
1
|
+
{"version":3,"file":"scatterplot.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/types/scatterplot.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { AesItem, categoricalAesMappingFromValueSchema, Category, DataValue } from './common';\nimport {\n AesRecordSchema, AxisSettingsSchema,\n ColumnNameSchema,\n continuousAesMappingFromValueSchema, DataValueSchema,\n FrameTypeSchema,\n LegendPositionSchema,\n LineShapeSchema,\n PointShapeSchema,\n TitlePositionSchema,\n} from './common';\n\ntype catAesFromColumn<ValueType extends z.ZodType> = ReturnType<typeof categoricalAesMappingFromValueSchema<ValueType>>;\ntype contAesFromColumn<ValueType extends z.ZodType> = ReturnType<typeof continuousAesMappingFromValueSchema<ValueType>>;\n\nexport type CategoricalAesFromColumn<ValueType> = z.infer<catAesFromColumn<z.ZodType<ValueType>>>;\nexport type ContinuousAesFromColumn<ValueType> = z.infer<contAesFromColumn<z.ZodType<ValueType>>>;\n\nconst InheritAesSchema = z.object({\n type: z.literal('grouping'),\n value: z.string(), // link to aes mapped to column\n palette: z.optional(z.array(z.string())) // if defined we use palette to create mapping without inheritedAes field\n});\nexport type InheritAesScatterplot = z.infer<typeof InheritAesSchema>;\n\nconst DotsLayerSchema = z.object({\n type: z.literal('dots'),\n aes: z.optional(\n z.object({\n dotFill: z.optional(z.union([z.string(), InheritAesSchema, continuousAesMappingFromValueSchema(z.string())])),\n dotShape: z.optional(z.union([PointShapeSchema, InheritAesSchema])),\n dotSize: z.optional(z.union([z.number(), continuousAesMappingFromValueSchema(z.number())])),\n })\n ),\n});\nconst CurveLayerSchema = z.object({\n type: z.literal('curve'),\n smoothing: z.optional(z.boolean()),\n aes: z.optional(\n z.object({\n lineWidth: z.optional(z.number()),\n lineShape: z.optional(LineShapeSchema),\n lineColor: z.optional(z.union([z.string(), InheritAesSchema, continuousAesMappingFromValueSchema(z.string())])),\n opacity: z.optional(z.number()),\n })\n ),\n});\nconst ScatterplotLayerSchema = z.union([DotsLayerSchema, CurveLayerSchema]);\n\nexport type DotsLayer = z.infer<typeof DotsLayerSchema>;\nexport type CurveLayer = z.infer<typeof CurveLayerSchema>;\nexport type ScatterplotLayer = z.infer<typeof ScatterplotLayerSchema>;\n\nexport const ScatterplotSettingsSchema = z.object({\n type: z.literal('scatterplot'),\n title: z.object({\n name: z.string(),\n show: z.optional(z.boolean()),\n position: z.optional(TitlePositionSchema),\n }),\n size: z.optional(\n z.object({\n width: z.optional(z.number()),\n height: z.optional(z.number()),\n })\n ),\n legend: z.optional(\n z.object({\n show: z.optional(z.boolean()),\n position: z.optional(LegendPositionSchema),\n })\n ),\n tooltips: z.optional(\n z.object({\n show: z.optional(z.boolean()),\n content: z.optional(z.array(ColumnNameSchema)),\n })\n ),\n frame: z.optional(z.object({type: z.optional(FrameTypeSchema)})),\n facetSettings: z.optional(\n z.object({\n sharedX: z.optional(z.boolean()),\n sharedY: z.optional(z.boolean()),\n nRows: z.optional(z.number()),\n nCols: z.optional(z.number()),\n })\n ),\n keyColumn: ColumnNameSchema,\n x: ColumnNameSchema,\n y: ColumnNameSchema,\n xAxis: z.optional(AxisSettingsSchema),\n yAxis: z.optional(AxisSettingsSchema),\n grouping: z.optional(z.array(\n z.object({\n columnName: ColumnNameSchema,\n order: z.optional(z.array(DataValueSchema)),\n inheritedAes: z.optional(AesRecordSchema),\n allowNullGroup: z.optional(z.boolean())\n })\n )),\n facetBy: z.optional(z.array(ColumnNameSchema)),\n label: z.optional(ColumnNameSchema),\n highlight: z.optional(ColumnNameSchema),\n trend: z.optional(\n z.object({\n color: z.optional(z.optional(z.union([z.string(), InheritAesSchema, continuousAesMappingFromValueSchema(z.string())]))),\n bounded: z.optional(z.boolean()), // if true: line and area bounded with min and max X value; else line bounded by chart bounds\n })\n ),\n layers: z.array(ScatterplotLayerSchema),\n});\n\nexport type ScatterplotSettings = z.infer<typeof ScatterplotSettingsSchema>;\n\nexport type ScatterplotLegendInfo = Record<\n string,\n {\n values: Category[];\n usedAes: (keyof AesItem)[];\n aesMap: (value: Category, field: keyof AesItem) => undefined | DataValue;\n labels: Record<Category, string>;\n }\n>;\n"],"names":["InheritAesSchema","z","DotsLayerSchema","continuousAesMappingFromValueSchema","PointShapeSchema","CurveLayerSchema","LineShapeSchema","ScatterplotLayerSchema","ScatterplotSettingsSchema","TitlePositionSchema","LegendPositionSchema","ColumnNameSchema","FrameTypeSchema","AxisSettingsSchema","DataValueSchema","AesRecordSchema"],"mappings":";;AAmBA,MAAMA,IAAmBC,EAAE,OAAO;AAAA,EAC9B,MAAMA,EAAE,QAAQ,UAAU;AAAA,EAC1B,OAAOA,EAAE,OAAA;AAAA;AAAA,EACT,SAASA,EAAE,SAASA,EAAE,MAAMA,EAAE,QAAQ,CAAC;AAAA;AAC3C,CAAC,GAGKC,IAAkBD,EAAE,OAAO;AAAA,EAC7B,MAAMA,EAAE,QAAQ,MAAM;AAAA,EACtB,KAAKA,EAAE;AAAA,IACHA,EAAE,OAAO;AAAA,MACL,SAASA,EAAE,SAASA,EAA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AOV,EAAE,SAASU,CAAgB;AAAA,EAClC,WAAWV,EAAE,SAASU,CAAgB;AAAA,EACtC,OAAOV,EAAE;AAAA,IACLA,EAAE,OAAO;AAAA,MACL,OAAOA,EAAE,SAASA,EAAE,SAASA,EAAE,MAAM,CAACA,EAAE,OAAA,GAAUD,GAAkBG,EAAoCF,EAAE,OAAA,CAAQ,CAAC,CAAC,CAAC,CAAC;AAAA,MACtH,SAASA,EAAE,SAASA,EAAE,QAAA,CAAS;AAAA;AAAA,IAAA,CAClC;AAAA,EAAA;AAAA,EAEL,QAAQA,EAAE,MAAMM,CAAsB;AAC1C,CAAC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function o(l, n) {
|
|
2
|
+
return !l && !n ? !1 : !l && n || !n && l || (l == null ? void 0 : l.length) !== (n == null ? void 0 : n.length) ? !0 : l == null ? void 0 : l.some((r, u) => r !== (n == null ? void 0 : n[u]));
|
|
3
|
+
}
|
|
4
|
+
export {
|
|
5
|
+
o as arraysAreDifferent
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=arraysAreDifferent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arraysAreDifferent.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/utils/arraysAreDifferent.ts"],"sourcesContent":["\nexport function arraysAreDifferent(arr1?:unknown[] | null, arr2?:unknown[] | null) {\n if (!arr1 && !arr2) {\n return false;\n }\n if (!arr1 && arr2 || !arr2 && arr1 || arr1?.length !== arr2?.length) {\n return true;\n }\n return arr1?.some((el, idx) => el !== arr2?.[idx]) as boolean;\n}"],"names":["arraysAreDifferent","arr1","arr2","el","idx"],"mappings":"AACO,SAASA,EAAmBC,GAAwBC,GAAwB;AAC/E,SAAI,CAACD,KAAQ,CAACC,IACH,KAEP,CAACD,KAAQC,KAAQ,CAACA,KAAQD,MAAQA,KAAA,gBAAAA,EAAM,aAAWC,KAAA,OAAA,SAAAA,EAAM,UAClD,KAEJD,KAAA,OAAA,SAAAA,EAAM,KAAK,CAACE,GAAIC,MAAQD,OAAOD,KAAA,gBAAAA,EAAOE,CAAAA,EAAAA;AACjD;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var l = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function t(o) {
|
|
3
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
l as commonjsGlobal,
|
|
7
|
+
t as getDefaultExportFromCjs
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as t } from "../node_modules/canonicalize/lib/canonicalize.js";
|
|
3
|
+
var o = t();
|
|
4
|
+
const m = /* @__PURE__ */ r(o);
|
|
5
|
+
export {
|
|
6
|
+
m as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=canonicalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalize.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|