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