@milaboratories/graph-maker 1.1.133 → 1.1.134

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