@milaboratories/miplots4 1.0.124 → 1.0.125
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/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/node_modules/d3-drag/src/constant.js +5 -0
- package/dist/node_modules/d3-drag/src/constant.js.map +1 -0
- package/dist/node_modules/d3-drag/src/drag.js +122 -0
- package/dist/node_modules/d3-drag/src/drag.js.map +1 -0
- package/dist/node_modules/d3-drag/src/event.js +34 -0
- package/dist/node_modules/d3-drag/src/event.js.map +1 -0
- package/dist/node_modules/d3-drag/src/noevent.js +10 -5
- package/dist/node_modules/d3-drag/src/noevent.js.map +1 -1
- package/dist/node_modules/react/index.js +1 -1
- package/dist/node_modules/react-dom/index.js +1 -1
- package/dist/scatterplot/index.js +27 -27
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.d.ts +8 -8
- package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +160 -151
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +0 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js +12 -13
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/components/Lasso.d.ts +6 -4
- package/dist/scatterplot-umap/components/Lasso.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/Lasso.js +212 -57
- package/dist/scatterplot-umap/components/Lasso.js.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.js +49 -46
- package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
- package/dist/scatterplot-umap/components/UpperSVG.d.ts +6 -4
- package/dist/scatterplot-umap/components/UpperSVG.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/UpperSVG.js +35 -30
- package/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
- package/dist/scatterplot-umap/constants.d.ts +6 -0
- package/dist/scatterplot-umap/constants.d.ts.map +1 -1
- package/dist/scatterplot-umap/constants.js +12 -6
- package/dist/scatterplot-umap/constants.js.map +1 -1
- package/dist/scatterplot-umap/index.d.ts +3 -2
- package/dist/scatterplot-umap/index.d.ts.map +1 -1
- package/dist/scatterplot-umap/index.js +90 -72
- package/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/scatterplot-umap/types.d.ts +14 -2
- package/dist/scatterplot-umap/types.d.ts.map +1 -1
- package/dist/types/bubble.d.ts +10 -10
- package/dist/types/common.d.ts +7 -4
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +22 -22
- package/dist/types/discrete.d.ts +14 -14
- package/dist/types/heatmap.d.ts +50 -50
- package/dist/types/histogram.d.ts +12 -12
- package/dist/types/scatterplot-umap.d.ts +8 -11
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +2 -3
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +36 -36
- package/package.json +3 -1
|
@@ -1,69 +1,72 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
1
|
+
var J = Object.defineProperty;
|
|
2
|
+
var Z = (n, t, e) => t in n ? J(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var a = (n, t, e) => Z(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { j as E } from "../node_modules/react/jsx-runtime.js";
|
|
5
|
-
import { Error as
|
|
6
|
-
import { BLACK as W, DEFAULT_HEIGHT as
|
|
7
|
-
import { splitTextByWidth as
|
|
8
|
-
import { SVGLayer as
|
|
9
|
-
import { MIN_MARGIN as
|
|
10
|
-
import { PADDINGS as
|
|
5
|
+
import { Error as tt } from "../common/Error.js";
|
|
6
|
+
import { BLACK as W, DEFAULT_HEIGHT as P, DEFAULT_WIDTH as w, TITLE_LINE_HEIGHT as et, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as st, TITLE_MARGIN as it } from "../constants.js";
|
|
7
|
+
import { splitTextByWidth as ot } from "../discrete/utils/splitTextByWidth.js";
|
|
8
|
+
import { SVGLayer as at } from "./components/SVGLayer.js";
|
|
9
|
+
import { MIN_MARGIN as C, DEFAULT_DOT_AES as R } from "../scatterplot/constants.js";
|
|
10
|
+
import { PADDINGS as H, TITLE_LINE as V, LEGEND_OFFSET as rt } from "./constants.js";
|
|
11
11
|
import { createAesGetter as D } from "../scatterplot/utils/createAesGetter.js";
|
|
12
|
-
import { getTicksAndFormat as
|
|
13
|
-
import { getFilteredLabels as
|
|
14
|
-
import { isContinuousAes as
|
|
12
|
+
import { getTicksAndFormat as lt } from "../scatterplot/utils/getTicksAndFormat.js";
|
|
13
|
+
import { getFilteredLabels as k, updateLabelsBBoxes as nt } from "../scatterplot/utils/getVisibleLabels.js";
|
|
14
|
+
import { isContinuousAes as q } from "../types/common.js";
|
|
15
15
|
import "../types/discrete.js";
|
|
16
16
|
import "../types/scatterplot.js";
|
|
17
17
|
import "../types/heatmap.js";
|
|
18
18
|
import "../types/dendro.js";
|
|
19
19
|
import "../types/histogram.js";
|
|
20
20
|
import "../types/bubble.js";
|
|
21
|
-
import { getContinuousColorScale as
|
|
22
|
-
import { getContinuousLegendTicks as
|
|
23
|
-
import { TextMeasurer as
|
|
24
|
-
import { createRoot as
|
|
25
|
-
import
|
|
21
|
+
import { getContinuousColorScale as ht } from "../utils/getContinuousColorScale.js";
|
|
22
|
+
import { getContinuousLegendTicks as ct } from "../utils/getContinuousLegendTicks.js";
|
|
23
|
+
import { TextMeasurer as dt } from "../utils/TextMeasurer.js";
|
|
24
|
+
import { createRoot as pt } from "../node_modules/react-dom/client.js";
|
|
25
|
+
import mt from "../node_modules/d3-zoom/src/zoom.js";
|
|
26
26
|
import "../node_modules/d3-zoom/src/transform.js";
|
|
27
|
-
import
|
|
27
|
+
import gt from "../node_modules/@d3fc/d3fc-chart/src/cartesian.js";
|
|
28
28
|
import "../node_modules/@d3fc/d3fc-webgl/src/scale/scaleMapper.js";
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { arrangeLegendParts as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
29
|
+
import ut from "../node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
|
|
30
|
+
import yt from "../node_modules/@d3fc/d3fc-series/src/webgl/point.js";
|
|
31
|
+
import ft from "../node_modules/@d3fc/d3fc-series/src/svg/multi.js";
|
|
32
|
+
import St from "../node_modules/@d3fc/d3fc-series/src/webgl/multi.js";
|
|
33
|
+
import vt from "../node_modules/@d3fc/d3fc-pointer/src/pointer.js";
|
|
34
|
+
import { arrangeLegendParts as xt } from "../utils/arrangeLegendParts.js";
|
|
35
|
+
import T from "../node_modules/d3-scale/src/linear.js";
|
|
36
|
+
import X from "../node_modules/d3-scale/src/log.js";
|
|
37
37
|
import N from "../node_modules/d3-selection/src/select.js";
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import { sqrt as
|
|
38
|
+
import zt from "../node_modules/d3-scale/src/ordinal.js";
|
|
39
|
+
import Lt from "../node_modules/d3-scale/src/symlog.js";
|
|
40
|
+
import { sqrt as bt } from "../node_modules/d3-scale/src/pow.js";
|
|
41
41
|
import { rgb as G } from "../node_modules/d3-color/src/color.js";
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
function
|
|
45
|
-
return
|
|
42
|
+
import Y from "../node_modules/d3-quadtree/src/quadtree.js";
|
|
43
|
+
import Ct from "../node_modules/d3-polygon/src/contains.js";
|
|
44
|
+
function K(n) {
|
|
45
|
+
return n / 2.35 * (n / 2.35) * 64;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function O(n, t) {
|
|
48
|
+
return n + (1 - n) * (1 - t);
|
|
49
49
|
}
|
|
50
|
-
function A(
|
|
50
|
+
function A(n, t) {
|
|
51
51
|
return [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
O(n.r / 255, t),
|
|
53
|
+
O(n.g / 255, t),
|
|
54
|
+
O(n.b / 255, t),
|
|
55
55
|
1
|
|
56
56
|
];
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
58
|
+
function M(n, t, e) {
|
|
59
|
+
return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && Ct(i.points, [n, t]));
|
|
60
|
+
}
|
|
61
|
+
function j(n, t) {
|
|
62
|
+
const e = t.find((h) => h.type === "dots"), i = t.find((h) => h.type === "curve");
|
|
60
63
|
return {
|
|
61
|
-
dotFill: D(
|
|
62
|
-
dotSize: D(
|
|
63
|
-
lineType: D(
|
|
64
|
+
dotFill: D(n, (e == null ? void 0 : e.aes.dotFill) ?? R.color, "dotFill"),
|
|
65
|
+
dotSize: D(n, (e == null ? void 0 : e.aes.dotSize) ?? R.size, "dotSize"),
|
|
66
|
+
lineType: D(n, (i == null ? void 0 : i.aes.lineShape) ?? "solid", "lineShape")
|
|
64
67
|
};
|
|
65
68
|
}
|
|
66
|
-
class
|
|
69
|
+
class me {
|
|
67
70
|
constructor() {
|
|
68
71
|
a(this, "reactRoot", null);
|
|
69
72
|
a(this, "parentNode", null);
|
|
@@ -78,32 +81,34 @@ class le {
|
|
|
78
81
|
});
|
|
79
82
|
a(this, "tools", null);
|
|
80
83
|
a(this, "margins", {
|
|
81
|
-
top:
|
|
82
|
-
bottom:
|
|
83
|
-
left:
|
|
84
|
-
right:
|
|
84
|
+
top: C,
|
|
85
|
+
bottom: C,
|
|
86
|
+
left: C,
|
|
87
|
+
right: C
|
|
85
88
|
});
|
|
86
89
|
a(this, "chartSizes", {
|
|
87
|
-
chartWidth:
|
|
90
|
+
chartWidth: w,
|
|
88
91
|
// width of single chart
|
|
89
|
-
chartHeight:
|
|
92
|
+
chartHeight: P,
|
|
90
93
|
// height of single chart
|
|
91
|
-
totalWidth:
|
|
94
|
+
totalWidth: w,
|
|
92
95
|
// width of all charts in charts row, plus left axis, plus legend
|
|
93
|
-
totalHeight:
|
|
96
|
+
totalHeight: P
|
|
94
97
|
// width of all charts in charts height, plus bottom axis, plus top title
|
|
95
98
|
});
|
|
96
99
|
a(this, "scales", {
|
|
97
|
-
x:
|
|
98
|
-
y:
|
|
99
|
-
xOriginal:
|
|
100
|
-
yOriginal:
|
|
100
|
+
x: T().domain([0, 10]).range([0, w]),
|
|
101
|
+
y: T().domain([0, 10]).range([P, 0]),
|
|
102
|
+
xOriginal: T().domain([0, 10]).range([0, w]),
|
|
103
|
+
yOriginal: T().domain([0, 10]).range([P, 0])
|
|
101
104
|
});
|
|
102
|
-
a(this, "
|
|
105
|
+
a(this, "polygons", []);
|
|
103
106
|
a(this, "onPolygonUpdateOutside", () => {
|
|
104
107
|
});
|
|
105
108
|
a(this, "onTooltipHintSwitch", () => {
|
|
106
109
|
});
|
|
110
|
+
a(this, "onLassoControlsStateUpdate", () => {
|
|
111
|
+
});
|
|
107
112
|
a(this, "zoomStateKey", "");
|
|
108
113
|
a(this, "selectedDot", null);
|
|
109
114
|
a(this, "captionsSizes", {
|
|
@@ -117,200 +122,203 @@ class le {
|
|
|
117
122
|
a(this, "allDots", []);
|
|
118
123
|
a(this, "allPossibleLabels", []);
|
|
119
124
|
a(this, "visibleLabels", []);
|
|
120
|
-
a(this, "lassoMode", !1);
|
|
121
125
|
a(this, "onPolygonUpdate", (t) => {
|
|
122
|
-
this.
|
|
123
|
-
const e = this.allDots.filter((
|
|
124
|
-
this.onPolygonUpdateOutside(e);
|
|
126
|
+
this.polygons = t, this.updateByLasso();
|
|
127
|
+
const e = this.allDots.filter((i) => M(i.x, i.y, this.polygons)).map((i) => i.idx);
|
|
128
|
+
this.onPolygonUpdateOutside(e, t);
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
131
|
clear() {
|
|
128
132
|
var t, e;
|
|
129
133
|
this.parentNode && this.rootNode && this.canvasNode && ((t = this.parentNode) == null || t.removeChild(this.rootNode), (e = this.parentNode) == null || e.removeChild(this.canvasNode), this.parentNode = null, this.rootNode = null, this.canvasNode = null, this.svgLayerElement = null, this.tools = null), setTimeout(() => {
|
|
130
|
-
var
|
|
131
|
-
(
|
|
134
|
+
var i;
|
|
135
|
+
(i = this.reactRoot) == null || i.unmount(), this.reactRoot = null;
|
|
132
136
|
});
|
|
133
137
|
}
|
|
134
138
|
init(t) {
|
|
135
|
-
this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.canvasNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.parentNode.appendChild(this.canvasNode), this.reactRoot =
|
|
139
|
+
this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.canvasNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.parentNode.appendChild(this.canvasNode), this.reactRoot = pt(this.rootNode));
|
|
136
140
|
}
|
|
137
141
|
updateChartSizes(t) {
|
|
138
142
|
this.chartSizes.chartWidth = t.width, this.chartSizes.chartHeight = t.height;
|
|
139
143
|
}
|
|
140
|
-
updateViewport(t, e,
|
|
141
|
-
const
|
|
142
|
-
let { minX: l, minY: m, maxX: f, maxY: g } =
|
|
144
|
+
updateViewport(t, e, i) {
|
|
145
|
+
const h = t.scale === "log" ? X() : T();
|
|
146
|
+
let { minX: l, minY: m, maxX: f, maxY: g } = i;
|
|
143
147
|
if (t.lowerValue !== void 0 && (l = Math.max(l, t.lowerValue)), t.upperValue !== void 0 && (f = Math.min(f, t.upperValue)), e.lowerValue !== void 0 && (m = Math.max(m, e.lowerValue)), e.upperValue !== void 0 && (g = Math.min(g, e.upperValue)), t.symmetricRange !== void 0) {
|
|
144
148
|
const r = t.symmetricRange;
|
|
145
149
|
if (r >= l && r <= f) {
|
|
146
|
-
const
|
|
147
|
-
l = r -
|
|
150
|
+
const c = Math.max(r - l, f - r);
|
|
151
|
+
l = r - c, f = r + c;
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
if (typeof e.symmetricRange < "u") {
|
|
151
155
|
const r = e.symmetricRange;
|
|
152
156
|
if (r >= m && r <= g) {
|
|
153
|
-
const
|
|
154
|
-
m = r -
|
|
157
|
+
const c = Math.max(r - m, g - r);
|
|
158
|
+
m = r - c, g = r + c;
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const d = e.scale === "log" ?
|
|
161
|
+
const x = [0, this.chartSizes.chartWidth], z = h.copy().domain([l, f]).range([H.LEFT, this.chartSizes.chartWidth - H.RIGHT]);
|
|
162
|
+
h.domain([z.invert(0), z.invert(this.chartSizes.chartWidth)]).range(x).nice(), this.scales.x = h, this.scales.xOriginal = h.copy();
|
|
163
|
+
const d = e.scale === "log" ? X() : T(), o = [this.chartSizes.chartHeight, 0], y = d.copy().domain([m, g]).range([this.chartSizes.chartHeight - H.BOTTOM, H.TOP]);
|
|
160
164
|
d.domain([y.invert(this.chartSizes.chartHeight), y.invert(0)]).range(o).nice(), this.scales.y = d, this.scales.yOriginal = d.copy();
|
|
161
165
|
}
|
|
162
166
|
updateCaptionsSize(t) {
|
|
163
|
-
const e = new
|
|
164
|
-
function
|
|
167
|
+
const e = new dt("600 14px Arial");
|
|
168
|
+
function i(f) {
|
|
165
169
|
return Math.max(...f.map((g) => e.getTextWidth(g)));
|
|
166
170
|
}
|
|
167
|
-
const { ticks:
|
|
171
|
+
const { ticks: h, format: l } = lt(this.scales.y, t), m = i(h.map(l));
|
|
168
172
|
this.captionsSizes = {
|
|
169
173
|
xAxisCaptionsWidth: 20,
|
|
170
174
|
yAxisCaptionsWidth: m
|
|
171
175
|
};
|
|
172
176
|
}
|
|
173
177
|
createMainTitle(t) {
|
|
174
|
-
this.mainTitle =
|
|
178
|
+
this.mainTitle = ot(
|
|
175
179
|
t.name,
|
|
176
180
|
this.chartSizes.totalWidth - this.margins.left - this.margins.right,
|
|
177
181
|
20
|
|
178
182
|
);
|
|
179
183
|
}
|
|
180
184
|
updateMargins() {
|
|
181
|
-
const t =
|
|
185
|
+
const t = et * this.mainTitle.length, e = t > 0 ? t + it * 2 : 0;
|
|
182
186
|
this.margins = {
|
|
183
|
-
top: Math.max(e,
|
|
184
|
-
bottom:
|
|
185
|
-
left:
|
|
186
|
-
right: this.legend.width +
|
|
187
|
+
top: Math.max(e, C),
|
|
188
|
+
bottom: C + this.captionsSizes.xAxisCaptionsWidth + V,
|
|
189
|
+
left: C + this.captionsSizes.yAxisCaptionsWidth + V,
|
|
190
|
+
right: this.legend.width + C
|
|
187
191
|
}, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartHeight, this.legend.height) + this.margins.bottom, N(this.canvasNode).style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
|
|
188
192
|
}
|
|
189
|
-
updateLegendSize(t, e,
|
|
193
|
+
updateLegendSize(t, e, i, h) {
|
|
190
194
|
if (!t.show) {
|
|
191
195
|
this.legend = { width: 0, height: 0, items: [] };
|
|
192
196
|
return;
|
|
193
197
|
}
|
|
194
198
|
const l = [], m = { width: 0, height: 0, left: 0, top: 0 };
|
|
195
|
-
if (
|
|
199
|
+
if (i.forEach((d) => {
|
|
196
200
|
const o = e[d.value];
|
|
197
201
|
if (o.usedAes.length === 0 || !o.aesMap)
|
|
198
202
|
return;
|
|
199
|
-
if (o.values.length >
|
|
203
|
+
if (o.values.length > st) {
|
|
200
204
|
console.warn(`Too many values for discrete legend (${o.values.length})`);
|
|
201
205
|
return;
|
|
202
206
|
}
|
|
203
207
|
const y = {};
|
|
204
208
|
o.values.forEach((u) => {
|
|
205
|
-
y[u] || (y[u] = { ...R }), o.usedAes.forEach((
|
|
206
|
-
var
|
|
207
|
-
|
|
209
|
+
y[u] || (y[u] = { ...R }), o.usedAes.forEach((v) => {
|
|
210
|
+
var L, s;
|
|
211
|
+
v === "dotFill" && (y[u].color = ((L = o.aesMap[u]) == null ? void 0 : L[v]) ?? W), v === "dotSize" && (y[u].size = ((s = o.aesMap[u]) == null ? void 0 : s[v]) ?? 3);
|
|
208
212
|
});
|
|
209
213
|
});
|
|
210
|
-
const r = d.label ?? d.value,
|
|
211
|
-
l.push({ ...m, id: d.value, type: "dots", title: r, scale:
|
|
212
|
-
}),
|
|
213
|
-
if (d.type === "dots" &&
|
|
214
|
-
const { domain: o, range: y, columnName: r, type:
|
|
215
|
-
l.push({ ...m, id: "dotFill", type: "continuous", title: u, scale:
|
|
214
|
+
const r = d.label ?? d.value, c = zt().domain(o.values).range(o.values.map((u) => y[u]));
|
|
215
|
+
l.push({ ...m, id: d.value, type: "dots", title: r, scale: c, values: o.values, labels: o.labels });
|
|
216
|
+
}), h.forEach((d) => {
|
|
217
|
+
if (d.type === "dots" && q(d.aes.dotFill)) {
|
|
218
|
+
const { domain: o, range: y, columnName: r, type: c = "linear" } = d.aes.dotFill, u = r.label ?? r.value, v = ht(y, o, "linear"), L = (c === "log" ? Lt() : T()).domain(o).range([this.chartSizes.chartHeight, 0]), s = ct(L, o);
|
|
219
|
+
l.push({ ...m, id: "dotFill", type: "continuous", title: u, scale: v, tickPositionScale: L, values: s });
|
|
216
220
|
}
|
|
217
|
-
if (d.type === "dots" &&
|
|
218
|
-
const { columnName: o, domain: y, range: r } = d.aes.dotSize,
|
|
219
|
-
l.push({ ...m, id: o.value, type: "size", title:
|
|
221
|
+
if (d.type === "dots" && q(d.aes.dotSize)) {
|
|
222
|
+
const { columnName: o, domain: y, range: r } = d.aes.dotSize, c = o.label ?? o.value, u = bt(y, r), v = u.ticks(3), L = u.tickFormat(3), s = v.reduce((p, b) => (p[String(b)] = L(b), p), {});
|
|
223
|
+
l.push({ ...m, id: o.value, type: "size", title: c, scale: u, values: v, labels: s });
|
|
220
224
|
}
|
|
221
225
|
}), !l.length) {
|
|
222
226
|
this.legend = { width: 0, height: 0, items: [] };
|
|
223
227
|
return;
|
|
224
228
|
}
|
|
225
|
-
const f =
|
|
229
|
+
const f = xt(l, this.chartSizes.chartHeight), g = f[f.length - 1], x = g.left + g.width + rt, z = this.chartSizes.chartHeight;
|
|
226
230
|
this.legend = {
|
|
227
|
-
width:
|
|
231
|
+
width: x,
|
|
228
232
|
height: z,
|
|
229
233
|
items: f
|
|
230
234
|
};
|
|
231
235
|
}
|
|
232
|
-
initSettings(t, e,
|
|
233
|
-
const { xAxis: g, yAxis:
|
|
234
|
-
this.updateChartSizes(z), this.updateViewport(g,
|
|
235
|
-
const y =
|
|
236
|
-
const p = G(this.aesGetters.dotFill(
|
|
236
|
+
initSettings(t, e, i, h, l, m, f) {
|
|
237
|
+
const { xAxis: g, yAxis: x, size: z, title: d, legend: o } = e;
|
|
238
|
+
this.updateChartSizes(z), this.updateViewport(g, x, i), this.updateCaptionsSize(h.y), this.updateLegendSize(o, l, f, m), this.createMainTitle(d), this.updateMargins(), this.aesGetters = j(l, m);
|
|
239
|
+
const y = ut().data(t).value((s) => {
|
|
240
|
+
const p = G(this.aesGetters.dotFill(s.data)), b = !s.dimmed && M(s.x, s.y, this.polygons) ? 1 : 0.4;
|
|
237
241
|
return A(p, b);
|
|
238
|
-
}), r =
|
|
242
|
+
}), r = yt().equals((s, p) => s === p).size((s) => K(this.aesGetters.dotSize(s.data))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => y(s)), c = mt().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey).on("start", () => {
|
|
239
243
|
this.selectedDot = null;
|
|
240
|
-
}).on("zoom", (
|
|
241
|
-
const p =
|
|
242
|
-
this.scales.x.domain(b.domain()), this.scales.y.domain(
|
|
244
|
+
}).on("zoom", (s) => {
|
|
245
|
+
const p = s.transform, b = p.rescaleX(this.scales.xOriginal), F = p.rescaleY(this.scales.yOriginal);
|
|
246
|
+
this.scales.x.domain(b.domain()), this.scales.y.domain(F.domain()), this.zoomStateKey = `${p.x}_${p.y}_${p.k}`, this.renderSvgLayer(), this.renderWebglLayer();
|
|
243
247
|
}).on("end", () => {
|
|
244
|
-
this.allPossibleLabels.forEach((
|
|
245
|
-
|
|
246
|
-
}), this.visibleLabels =
|
|
247
|
-
}), u =
|
|
248
|
-
var
|
|
249
|
-
if (!
|
|
248
|
+
this.allPossibleLabels.forEach((s) => {
|
|
249
|
+
s.x = this.scales.x(s.dot.x), s.y = this.scales.y(s.dot.y);
|
|
250
|
+
}), this.visibleLabels = k(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.renderSvgLayer();
|
|
251
|
+
}), u = Y().x((s) => this.scales.xOriginal(s.x)).y((s) => this.scales.yOriginal(s.y)).addAll(t), v = vt().on("point", ([s]) => {
|
|
252
|
+
var U, B;
|
|
253
|
+
if (!s) {
|
|
250
254
|
this.selectedDot = null, this.renderSvgLayer();
|
|
251
255
|
return;
|
|
252
256
|
}
|
|
253
|
-
const p = this.scales.x.invert(
|
|
254
|
-
|
|
255
|
-
|
|
257
|
+
const p = this.scales.x.invert(s.x), b = this.scales.y.invert(s.y), F = this.scales.xOriginal(p), $ = this.scales.yOriginal(b);
|
|
258
|
+
let S = (U = this.tools) == null ? void 0 : U.qt.find(F, $);
|
|
259
|
+
const _ = this.scales.x((S == null ? void 0 : S.x) ?? 0), I = this.scales.y((S == null ? void 0 : S.y) ?? 0);
|
|
260
|
+
(Math.abs(s.x - _) > 20 || Math.abs(s.y - I) > 20 || Math.sqrt((s.x - _) ** 2 + (s.y - I) ** 2) > 20) && (S = void 0);
|
|
261
|
+
const Q = this.selectedDot && !S || !this.selectedDot && S || ((B = this.selectedDot) == null ? void 0 : B.id) !== (S == null ? void 0 : S.id);
|
|
262
|
+
this.selectedDot = S ?? null, Q && this.renderSvgLayer();
|
|
263
|
+
}), L = gt({
|
|
256
264
|
xScale: this.scales.x,
|
|
257
265
|
yScale: this.scales.y
|
|
258
|
-
}).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(
|
|
266
|
+
}).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(ft()).webglPlotArea(
|
|
259
267
|
// only render the point series on the WebGL layer
|
|
260
|
-
|
|
261
|
-
).decorate((
|
|
262
|
-
const p =
|
|
263
|
-
p && !this.svgLayerElement && (p.style("grid-template-columns", "0 auto 1fr auto 0"), p.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = p.select(".svg-plot-area.plot-area svg").node()), p.select(".svg-plot-area.plot-area").call(
|
|
268
|
+
St().series([r]).mapping((s) => s)
|
|
269
|
+
).decorate((s) => {
|
|
270
|
+
const p = s.enter();
|
|
271
|
+
p && !this.svgLayerElement && (p.style("grid-template-columns", "0 auto 1fr auto 0"), p.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = p.select(".svg-plot-area.plot-area svg").node()), p.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(c).call(v);
|
|
264
272
|
});
|
|
265
273
|
this.tools = {
|
|
266
|
-
webglChart:
|
|
267
|
-
zoom:
|
|
274
|
+
webglChart: L,
|
|
275
|
+
zoom: c,
|
|
268
276
|
qt: u,
|
|
269
277
|
fillColor: y,
|
|
270
278
|
pointSeries: r
|
|
271
279
|
}, N(this.canvasNode).datum(t).style("position", "absolute").style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
|
|
272
280
|
}
|
|
273
281
|
updateAes(t, e) {
|
|
274
|
-
this.tools !== null && (this.aesGetters =
|
|
275
|
-
const
|
|
282
|
+
this.tools !== null && (this.aesGetters = j(t, e), this.tools.fillColor.value((i) => {
|
|
283
|
+
const h = this.aesGetters.dotFill ?? (() => W), l = G(h(i.data)), m = !i.dimmed && M(i.x, i.y, this.polygons) ? 1 : 0.4;
|
|
276
284
|
return A(l, m);
|
|
277
285
|
}));
|
|
278
286
|
}
|
|
279
287
|
updatePointSize() {
|
|
280
|
-
this.tools !== null && (N(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) =>
|
|
288
|
+
this.tools !== null && (N(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => K(this.aesGetters.dotSize(t.data))));
|
|
281
289
|
}
|
|
282
290
|
updateByLasso() {
|
|
283
291
|
var t;
|
|
284
292
|
this.tools !== null && ((t = this.tools) == null || t.fillColor.value((e) => {
|
|
285
|
-
const
|
|
286
|
-
return A(
|
|
293
|
+
const i = this.aesGetters.dotFill ?? (() => W), h = G(i(e.data)), l = !e.dimmed && M(e.x, e.y, this.polygons) ? 1 : 0.4;
|
|
294
|
+
return A(h, l);
|
|
287
295
|
}), this.renderWebglLayer());
|
|
288
296
|
}
|
|
289
297
|
updateData(t) {
|
|
290
|
-
this.tools !== null && (N(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt =
|
|
298
|
+
this.tools !== null && (N(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt = Y().x((e) => e.x).y((e) => e.y).addAll(t));
|
|
291
299
|
}
|
|
292
|
-
render(t, e,
|
|
293
|
-
if (this.
|
|
300
|
+
render(t, e, i, h, l, m, f, g, x, z, d, o, y, r) {
|
|
301
|
+
if (this.tools === null)
|
|
294
302
|
this.initSettings(
|
|
295
303
|
l,
|
|
296
304
|
e,
|
|
297
305
|
m,
|
|
298
|
-
|
|
299
|
-
|
|
306
|
+
h,
|
|
307
|
+
x,
|
|
300
308
|
g,
|
|
301
309
|
z
|
|
302
|
-
), this.onPolygonUpdateOutside = o, this.onTooltipHintSwitch = r;
|
|
310
|
+
), this.onPolygonUpdateOutside = o, this.onTooltipHintSwitch = y, this.onLassoControlsStateUpdate = r;
|
|
303
311
|
else {
|
|
304
|
-
const { title:
|
|
305
|
-
this.updateLegendSize(u,
|
|
312
|
+
const { title: c, legend: u } = e;
|
|
313
|
+
this.updateLegendSize(u, x, z, g), this.createMainTitle(c), this.updateMargins(), this.updateAes(x, g);
|
|
306
314
|
}
|
|
307
|
-
this.allDots = l, this.allPossibleLabels = d, this.allPossibleLabels.forEach((
|
|
308
|
-
|
|
309
|
-
}), this.visibleLabels =
|
|
315
|
+
this.allDots = l, this.allPossibleLabels = d, this.allPossibleLabels.forEach((c) => {
|
|
316
|
+
c.x = this.scales.x(c.dot.x), c.y = this.scales.y(c.dot.y);
|
|
317
|
+
}), this.visibleLabels = k(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.notCalculatedProps = {
|
|
310
318
|
settingsId: t,
|
|
311
319
|
chartSettings: e,
|
|
312
|
-
onlyPositive:
|
|
313
|
-
keyColumn:
|
|
320
|
+
onlyPositive: h,
|
|
321
|
+
keyColumn: i,
|
|
314
322
|
dotsByGrouping: f,
|
|
315
323
|
layers: g
|
|
316
324
|
}, this.renderWebglLayer(), this.renderSvgLayer();
|
|
@@ -321,9 +329,9 @@ class le {
|
|
|
321
329
|
}
|
|
322
330
|
renderSvgLayer() {
|
|
323
331
|
var e;
|
|
324
|
-
this.visibleLabels.forEach((
|
|
325
|
-
|
|
326
|
-
}),
|
|
332
|
+
this.visibleLabels.forEach((i) => {
|
|
333
|
+
i.x = this.scales.x(i.dot.x), i.y = this.scales.y(i.dot.y);
|
|
334
|
+
}), nt(this.visibleLabels);
|
|
327
335
|
const t = {
|
|
328
336
|
settingsId: this.notCalculatedProps.settingsId,
|
|
329
337
|
chartSettings: this.notCalculatedProps.chartSettings,
|
|
@@ -342,18 +350,19 @@ class le {
|
|
|
342
350
|
aesGetters: this.aesGetters,
|
|
343
351
|
legendData: this.legend,
|
|
344
352
|
labels: this.visibleLabels,
|
|
353
|
+
defaultPolygons: this.polygons,
|
|
345
354
|
onPolygonUpdate: this.onPolygonUpdate,
|
|
346
355
|
onTooltipHintSwitch: this.onTooltipHintSwitch,
|
|
347
|
-
|
|
356
|
+
onLassoControlsStateUpdate: this.onLassoControlsStateUpdate
|
|
348
357
|
};
|
|
349
|
-
this.svgLayerComponent = /* @__PURE__ */ E.jsx(
|
|
358
|
+
this.svgLayerComponent = /* @__PURE__ */ E.jsx(at, { ...t }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
|
|
350
359
|
}
|
|
351
360
|
renderError(t) {
|
|
352
361
|
var e;
|
|
353
|
-
(e = this.reactRoot) == null || e.render(/* @__PURE__ */ E.jsx(
|
|
362
|
+
(e = this.reactRoot) == null || e.render(/* @__PURE__ */ E.jsx(tt, { message: t }));
|
|
354
363
|
}
|
|
355
364
|
}
|
|
356
365
|
export {
|
|
357
|
-
|
|
366
|
+
me as default
|
|
358
367
|
};
|
|
359
368
|
//# sourceMappingURL=ChartRenderer.js.map
|