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