@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.
Files changed (27) hide show
  1. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.d.ts +1 -0
  2. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.d.ts.map +1 -1
  3. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.js +155 -121
  4. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.js.map +1 -1
  5. package/dist/GraphMaker/dataBindAes.d.ts +1 -0
  6. package/dist/GraphMaker/dataBindAes.d.ts.map +1 -1
  7. package/dist/GraphMaker/dataBindAes.js +73 -66
  8. package/dist/GraphMaker/dataBindAes.js.map +1 -1
  9. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.d.ts.map +1 -1
  10. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js +2 -0
  11. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
  12. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.d.ts.map +1 -1
  13. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +37 -36
  14. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
  15. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  16. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.js +31 -29
  17. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.js.map +1 -1
  18. package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts.map +1 -1
  19. package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js +6 -6
  20. package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
  21. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +102 -101
  22. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
  23. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +135 -135
  24. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  25. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js +10 -2
  26. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js.map +1 -1
  27. 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 E, TITLE_LINE_HEIGHT as Q, BLACK as $, TITLE_MARGIN as J } from "../constants.js";
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 C, DEFAULT_DOT_AES as M } from "../scatterplot/constants.js";
15
- import { createAesGetter as P } from "../scatterplot/utils/createAesGetter.js";
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 F } from "../types/common.js";
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 D, TITLE_LINE as I, LEGEND_OFFSET as ot } from "./constants.js";
30
- import lt from "../node_modules/@d3fc/d3fc-pointer/src/pointer.js";
31
- import rt from "../node_modules/kdbush/index.js";
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 { arrangeLegendParts as ht } from "../utils/arrangeLegendParts.js";
34
- import { stringToNumberRgba as W, getColorWithFakeOpacity as H, GET_BLACK as O } from "./colors.js";
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 dt from "../node_modules/d3-scale/src/ordinal.js";
39
- import ct from "../node_modules/d3-scale/src/symlog.js";
40
- import { sqrt as mt } from "../node_modules/d3-scale/src/pow.js";
41
- import pt from "../node_modules/d3-polygon/src/contains.js";
42
- var ut = Object.defineProperty, gt = (S, t, e) => t in S ? ut(S, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : S[t] = e, c = (S, t, e) => gt(S, typeof t != "symbol" ? t + "" : t, e);
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 && pt(s.points, [S, t]));
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"), l = e.find((a) => a.type === "curve");
51
+ const s = e.find((a) => a.type === "dots"), n = e.find((a) => a.type === "curve");
51
52
  return {
52
- dotFill: P(S, t, (s == null ? void 0 : s.aes.dotFill) ?? M.color, "dotFill"),
53
- dotSize: P(S, t, (s == null ? void 0 : s.aes.dotSize) ?? M.size, "dotSize"),
54
- lineType: P(S, t, (l == null ? void 0 : l.aes.lineShape) ?? "solid", "lineShape")
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 ie {
58
+ class oe {
58
59
  constructor() {
59
- c(this, "reactRoot", null), c(this, "parentNode", null), c(this, "rootNode", null), c(this, "canvasNode", null), c(this, "svgLayerElement", null), c(this, "svgLayerComponent", /* @__PURE__ */ b.jsx(b.Fragment, {})), c(this, "aesGetters", {
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
- }), c(this, "tools", null), c(this, "margins", {
64
- top: C,
65
- bottom: C,
66
- left: C,
67
- right: C
68
- }), c(this, "chartSizes", {
69
- chartWidth: E,
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: E,
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
- }), c(this, "scales", {
78
- x: T().domain([0, 10]).range([0, E]),
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, E]),
81
+ xOriginal: T().domain([0, 10]).range([0, D]),
81
82
  yOriginal: T().domain([0, 10]).range([w, 0])
82
- }), c(this, "polygons", []), c(this, "onPolygonUpdateOutside", () => {
83
- }), c(this, "onTooltipHintSwitch", () => {
84
- }), c(this, "onLassoControlsStateUpdate", () => {
85
- }), c(this, "zoomTransform", null), c(this, "zoomStateKey", ""), c(this, "selectedDot", null), c(this, "captionsSizes", {
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
- }), c(this, "mainTitle", []), c(this, "legend", { width: 0, height: 0, items: [] }), c(this, "notCalculatedProps", {}), c(this, "allDots", []), c(this, "visibleLabels", []), c(this, "onPolygonUpdate", (t) => {
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 l = t.scale === "log" ? _() : T();
109
- let { minX: a, minY: r, maxX: u, maxY: p } = s;
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 && (r = Math.max(r, e.lowerValue)), e.upperValue !== void 0 && (p = Math.min(p, e.upperValue)), t.symmetricRange !== 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 >= r && o <= p) {
120
- const y = Math.max(o - r, p - o);
121
- r = o - y, p = o + y;
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], x = l.copy().domain([a, u]).range([D.LEFT, this.chartSizes.chartWidth - D.RIGHT]);
125
- l.domain([x.invert(0), x.invert(this.chartSizes.chartWidth)]).range(f).nice(), this.scales.x = l, this.scales.xOriginal = l.copy();
126
- const d = e.scale === "log" ? _() : T(), n = [this.chartSizes.chartHeight, 0], g = d.copy().domain([r, p]).range([this.chartSizes.chartHeight - D.BOTTOM, D.TOP]);
127
- d.domain([g.invert(this.chartSizes.chartHeight), g.invert(0)]).range(n).nice(), this.scales.y = d, this.scales.yOriginal = d.copy();
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(r) {
132
- return Math.max(...r.map((u) => t.getTextWidth(u)));
132
+ function e(d) {
133
+ return Math.max(...d.map((u) => t.getTextWidth(u)));
133
134
  }
134
- const { ticks: s, format: l } = tt(this.scales.y, !1), a = e(s.map(l));
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, C),
151
- bottom: C + this.captionsSizes.xAxisCaptionsWidth + I,
152
- left: C + this.captionsSizes.yAxisCaptionsWidth + I,
153
- right: this.legend.width + C
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, l) {
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 = [], r = { width: 0, height: 0, left: 0, top: 0 };
162
- if (s.forEach((d) => {
163
- const n = e[d.value];
164
- if (n.usedAes.length === 0 || !n.aesMap)
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
- n.values.forEach((m) => {
168
- g[m] || (g[m] = { ...M }), n.usedAes.forEach((v) => {
169
- v === "dotFill" && (g[m].color = n.aesMap(m, v) ?? $), v === "dotSize" && (g[m].size = Number(n.aesMap(m, v) ?? 3));
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 = d.label ?? d.value, y = dt().domain(n.values).range(n.values.map((m) => g[m]));
173
- a.push({ ...r, id: d.value, type: "dots", title: o, scale: y, values: n.values, labels: n.labels });
174
- }), l.forEach((d) => {
175
- if (d.type === "dots" && F(d.aes.dotFill)) {
176
- const { domain: n, range: g, columnName: o, type: y = "linear" } = d.aes.dotFill, m = o.label ?? o.value, v = st(g, n, "linear"), i = (y === "log" ? ct() : T()).domain(n).range([this.chartSizes.chartHeight, 0]), h = it(i, n);
177
- a.push({ ...r, id: "dotFill", type: "continuous", title: m, scale: v, tickPositionScale: i, values: h });
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 (d.type === "dots" && F(d.aes.dotSize)) {
180
- const { columnName: n, domain: g, range: o } = d.aes.dotSize, y = n.label ?? n.value, m = mt(g, o), v = m.ticks(3), i = m.tickFormat(3), h = v.reduce((z, L) => (z[String(L)] = i(L), z), {});
181
- a.push({ ...r, id: n.value, type: "size", title: y, scale: m, values: v, labels: h });
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 = ht(a, this.chartSizes.chartHeight), p = u[u.length - 1], f = p.left + p.width + ot, x = this.chartSizes.chartHeight;
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: x,
191
+ height: v,
191
192
  items: u
192
193
  };
193
194
  }
194
- initSettings(t, e, s, l, a, r, u) {
195
- const { xAxis: p, yAxis: f, size: x, title: d, legend: n } = s;
196
- this.updateChartSizes(x), this.updateViewport(p, f, l), this.updateCaptionsSize(), this.updateLegendSize(n, a, u, r), this.createMainTitle(d), this.updateMargins(), this.aesGetters = k(t, a, r);
197
- const g = U().data(e).value((i) => {
198
- const h = W(this.aesGetters.dotFill(i.idx));
199
- return h[3] = !i.dimmed && A(i.x, i.y, this.polygons) ? 1 : 0.4, H(h, h);
200
- }), o = V().equals((i, h) => i === h).size((i) => R(this.aesGetters.dotSize(i.idx))).crossValue((i) => i.x).mainValue((i) => i.y).decorate((i) => g(i)), y = q().scaleExtent([0.1, 1e3]).filter((i) => i.type === "wheel" || i.metaKey || i.ctrlKey).on("start", () => {
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 h = i.transform, z = h.rescaleX(this.scales.xOriginal), L = h.rescaleY(this.scales.yOriginal);
204
- this.scales.x.domain(z.domain()), this.scales.y.domain(L.domain()), this.zoomTransform = h, this.zoomStateKey = `${h.x}_${h.y}_${h.k}`, this.updateLabelsPosition(this.visibleLabels), this.renderSvgLayer(t), this.renderWebglLayer();
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(t);
207
- }), m = lt().on("point", ([i]) => {
208
- var h;
209
- let z;
210
- i && (z = this.getClosestDot(i.x, i.y));
211
- const L = this.selectedDot && !z || !this.selectedDot && z || ((h = this.selectedDot) == null ? void 0 : h.idx) !== (z == null ? void 0 : z.idx);
212
- this.selectedDot = z ?? null, L && this.renderSvgLayer(t);
213
- }), v = B({
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([o]).mapping((i) => i)
219
+ j().series([g]).mapping((i) => i)
219
220
  ).decorate((i) => {
220
- const h = i.enter();
221
- h && !this.svgLayerElement && (h.style("grid-template-columns", "0 auto 1fr auto 0"), h.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = h.select(".svg-plot-area.plot-area svg").node()), h.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(y).call(m);
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: v,
225
- zoom: y,
226
- fillColor: g,
227
- pointSeries: o
228
- }, N(this.canvasNode).datum(e).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");
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, s) {
231
- this.tools !== null && (this.aesGetters = k(t, e, s), this.tools.fillColor.value((l) => {
232
- const a = this.aesGetters.dotFill ?? O, r = W(a(l.idx));
233
- return r[3] = !l.dimmed && A(l.x, l.y, this.polygons) ? 1 : 0.4, H(r, r);
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, l = W(s(e.idx));
243
- return l[3] = !e.dimmed && A(e.x, e.y, this.polygons) ? 1 : 0.4, H(l, l);
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 rt(t.length, 512);
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, l;
254
+ var s, n;
254
255
  const a = (s = this.tools) == null ? void 0 : s.qt;
255
256
  if (!a) return null;
256
- const r = this.allDots, u = this.scales.x.invert(t), p = this.scales.y.invert(e), f = 1 / (((l = this.zoomTransform) == null ? void 0 : l.k) || 1), x = u - f, d = u + f, n = p - f, g = p + f, o = a.range(x, n, d, g), y = o.reduce((m, v) => {
257
- const i = r[v], h = this.scales.x(i.x) - t, z = this.scales.y(i.y) - e, L = Math.hypot(h, z);
258
- return (m === null || L < m.distance) && (m.index = v, m.distance = L), m;
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 : r[y.index];
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, l, a, r, u, p, f, x, d, n, g) {
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
- r,
274
+ d,
275
275
  f,
276
276
  p,
277
- x
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, x, p), this.createMainTitle(o), this.updateMargins(), this.updateAes(t, f, p);
281
+ this.updateChartSizes(m), this.updateLegendSize(y, f, v, p), this.createMainTitle(o), this.updateMargins(), this.updateAes(f, p);
282
282
  }
283
- this.onPolygonUpdateOutside = d, this.onTooltipHintSwitch = n, this.onLassoControlsStateUpdate = g, this.allDots !== a && (this.updateDots(a), this.visibleLabels = this.computeLabels(a)), this.notCalculatedProps = {
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: l,
286
+ keyColumn: n,
287
287
  dotsByGrouping: u,
288
288
  layers: p
289
- }, this.renderWebglLayer(), this.renderSvgLayer(t);
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(t) {
296
- var e;
297
- const s = {
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: t, children: /* @__PURE__ */ b.jsx(at, { ...s }) }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
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), l = [];
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 r = t[a];
329
- if (r.label == null)
328
+ const d = t[a];
329
+ if (d.label == null)
330
330
  continue;
331
- const u = String(r.label), p = e.getTextMetrics(u), f = this.scales.x(r.x), x = this.scales.y(r.y), d = p.width, n = p.actualBoundingBoxAscent + p.actualBoundingBoxDescent, g = 10, o = s(f, x, d, n, g);
332
- o && l.push({
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: x,
335
- dot: r,
334
+ y: v,
335
+ dot: d,
336
336
  name: u,
337
- width: d,
338
- height: n,
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 l;
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
- ie as default
354
+ oe as default
355
355
  };
356
356
  //# sourceMappingURL=ChartRenderer.js.map