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