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