@milaboratories/miplots4 1.0.160 → 1.0.162

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 (32) hide show
  1. package/dist/DataFrame.d.ts +3 -3
  2. package/dist/DataFrame.js +3 -3
  3. package/dist/DataFrame.js.map +1 -1
  4. package/dist/_virtual/index10.js +2 -5
  5. package/dist/_virtual/index10.js.map +1 -1
  6. package/dist/_virtual/index5.js +5 -2
  7. package/dist/_virtual/index5.js.map +1 -1
  8. package/dist/_virtual/index6.js +4 -4
  9. package/dist/_virtual/index7.js +1 -1
  10. package/dist/_virtual/index8.js +4 -4
  11. package/dist/_virtual/index9.js +3 -3
  12. package/dist/bubble/ChartRenderer.js +55 -55
  13. package/dist/bubble/ChartRenderer.js.map +1 -1
  14. package/dist/constants.d.ts +2 -0
  15. package/dist/constants.js +9 -7
  16. package/dist/constants.js.map +1 -1
  17. package/dist/discrete/layers/stackedBar.js.map +1 -1
  18. package/dist/discrete/layers/stats/pValueCalculation.js +5 -5
  19. package/dist/heatmap/ChartRenderer.js +184 -181
  20. package/dist/heatmap/ChartRenderer.js.map +1 -1
  21. package/dist/heatmap/components/Captions/AxisCaptions.js +34 -34
  22. package/dist/heatmap/components/Captions/AxisCaptions.js.map +1 -1
  23. package/dist/heatmap/utils/calculateChartSideElementSizes.js +23 -23
  24. package/dist/heatmap/utils/calculateChartSideElementSizes.js.map +1 -1
  25. package/dist/node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/index.js +1 -1
  26. package/dist/scatterplot/ChartRenderer.js +179 -176
  27. package/dist/scatterplot/ChartRenderer.js.map +1 -1
  28. package/dist/scatterplot/dots.js +20 -20
  29. package/dist/scatterplot/dots.js.map +1 -1
  30. package/dist/scatterplot-umap/ChartRenderer.js +168 -165
  31. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  32. package/package.json +1 -1
@@ -1,71 +1,71 @@
1
- var B = Object.defineProperty;
2
- var k = (S, t, e) => t in S ? B(S, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : S[t] = e;
3
- var h = (S, t, e) => k(S, typeof t != "symbol" ? t + "" : t, e);
4
- import { j as T } from "../_virtual/jsx-runtime.js";
1
+ var k = Object.defineProperty;
2
+ var X = (f, t, e) => t in f ? k(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
3
+ var h = (f, t, e) => X(f, typeof t != "symbol" ? t + "" : t, e);
4
+ import { j as b } from "../_virtual/jsx-runtime.js";
5
5
  import K from "../node_modules/.pnpm/@d3fc_d3fc-chart@5.1.9_d3-array@3.2.4_d3-path@3.1.0_d3-scale-chromatic@3.1.0_d3-scale@4.0.2_d_kyhwsugamw24x7v3obvyiw5jfe/node_modules/@d3fc/d3fc-chart/src/cartesian.js";
6
- import { seriesWebglPoint as X, seriesSvgMulti as Y, seriesWebglMulti as j } from "@d3fc/d3fc-series";
7
- import q from "../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/zoom.js";
6
+ import { seriesWebglPoint as Y, seriesSvgMulti as j, seriesWebglMulti as q } from "@d3fc/d3fc-series";
7
+ import $ from "../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/zoom.js";
8
8
  import "../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
9
- import { c as $ } from "../_virtual/client.js";
10
- import { Error as Q } from "../common/Error.js";
11
- import { BLACK as G, DEFAULT_HEIGHT as w, DEFAULT_WIDTH as D, TITLE_LINE_HEIGHT as J, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as Z, TITLE_MARGIN as tt } from "../constants.js";
12
- import { splitTextByWidth as et } from "../utils/splitTextByWidth.js";
13
- import { MIN_MARGIN as L, DEFAULT_DOT_AES as F } from "../scatterplot/constants.js";
14
- import { createAesGetter as H } from "../scatterplot/utils/createAesGetter.js";
15
- import { getTicksAndFormat as it } from "../scatterplot/utils/getTicksAndFormat.js";
16
- import { createLabelPositioner as st } from "../scatterplot/utils/getVisibleLabels.js";
17
- import { isContinuousAes as A } from "../types/common.js";
9
+ import { c as Q } from "../_virtual/client.js";
10
+ import { Error as J } from "../common/Error.js";
11
+ import { BLACK as A, DEFAULT_HEIGHT as E, DEFAULT_WIDTH as w, TITLE_LINE_HEIGHT as Z, MIN_LEGEND_GRADIENT_HEIGHT as tt, MAX_LEGEND_GRADIENT_HEIGHT as et, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as it, TITLE_MARGIN as st } from "../constants.js";
12
+ import { splitTextByWidth as ot } from "../utils/splitTextByWidth.js";
13
+ import { MIN_MARGIN as L, DEFAULT_DOT_AES as P } from "../scatterplot/constants.js";
14
+ import { createAesGetter as M } from "../scatterplot/utils/createAesGetter.js";
15
+ import { getTicksAndFormat as at } from "../scatterplot/utils/getTicksAndFormat.js";
16
+ import { createLabelPositioner as nt } from "../scatterplot/utils/getVisibleLabels.js";
17
+ import { isContinuousAes as R } from "../types/common.js";
18
18
  import "../types/discrete.js";
19
19
  import "../types/scatterplot.js";
20
20
  import "../types/heatmap.js";
21
21
  import "../types/dendro.js";
22
22
  import "../types/histogram.js";
23
23
  import "../types/bubble.js";
24
- import { getContinuousColorScale as ot } from "../utils/getContinuousColorScale.js";
25
- import { getContinuousLegendTicks as at } from "../utils/getContinuousLegendTicks.js";
26
- import { TextMeasurer as R } from "../utils/TextMeasurer/TextMeasurer.js";
27
- import { SVGLayer as nt } from "./components/SVGLayer.js";
28
- import { PADDINGS as E, TITLE_LINE as I, LEGEND_OFFSET as rt } from "./constants.js";
24
+ import { getContinuousColorScale as rt } from "../utils/getContinuousColorScale.js";
25
+ import { getContinuousLegendTicks as lt } from "../utils/getContinuousLegendTicks.js";
26
+ import { TextMeasurer as I } from "../utils/TextMeasurer/TextMeasurer.js";
27
+ import { SVGLayer as ht } from "./components/SVGLayer.js";
28
+ import { PADDINGS as D, TITLE_LINE as _, LEGEND_OFFSET as ct } from "./constants.js";
29
29
  import "../node_modules/.pnpm/@d3fc_d3fc-webgl@3.2.1_d3-scale@4.0.2_d3-shape@3.2.0/node_modules/@d3fc/d3fc-webgl/src/scale/scaleMapper.js";
30
- import lt from "../node_modules/.pnpm/@d3fc_d3fc-webgl@3.2.1_d3-scale@4.0.2_d3-shape@3.2.0/node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
31
- import ht from "../node_modules/.pnpm/@d3fc_d3fc-pointer@3.0.3_d3-dispatch@3.0.1_d3-selection@3.0.0/node_modules/@d3fc/d3fc-pointer/src/pointer.js";
32
- import ct from "../node_modules/.pnpm/kdbush@4.0.2/node_modules/kdbush/index.js";
33
- import { DataFrameProvider as dt } from "../common/useDataFrame.js";
34
- import { DataFrame as mt } from "../DataFrame.js";
35
- import { arrangeLegendParts as pt } from "../utils/arrangeLegendParts.js";
36
- import { stringToNumberRgba as M, getColorWithFakeOpacity as P, GET_BLACK as O } from "./colors.js";
37
- import C from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
30
+ import dt from "../node_modules/.pnpm/@d3fc_d3fc-webgl@3.2.1_d3-scale@4.0.2_d3-shape@3.2.0/node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
31
+ import mt from "../node_modules/.pnpm/@d3fc_d3fc-pointer@3.0.3_d3-dispatch@3.0.1_d3-selection@3.0.0/node_modules/@d3fc/d3fc-pointer/src/pointer.js";
32
+ import pt from "../node_modules/.pnpm/kdbush@4.0.2/node_modules/kdbush/index.js";
33
+ import { DataFrameProvider as gt } from "../common/useDataFrame.js";
34
+ import { DataFrame as ut } from "../DataFrame.js";
35
+ import { arrangeLegendParts as ft } from "../utils/arrangeLegendParts.js";
36
+ import { stringToNumberRgba as W, getColorWithFakeOpacity as G, GET_BLACK as O } from "./colors.js";
37
+ import T from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
38
38
  import U from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/log.js";
39
39
  import N from "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js";
40
- import gt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
41
- import ut from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/symlog.js";
42
- import { sqrt as ft } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/pow.js";
43
- import St from "../node_modules/.pnpm/d3-polygon@3.0.1/node_modules/d3-polygon/src/contains.js";
44
- function _(S) {
45
- return S / 2.35 * (S / 2.35) * 64;
40
+ import yt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
41
+ import St from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/symlog.js";
42
+ import { sqrt as xt } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/pow.js";
43
+ import vt from "../node_modules/.pnpm/d3-polygon@3.0.1/node_modules/d3-polygon/src/contains.js";
44
+ function V(f) {
45
+ return f / 2.35 * (f / 2.35) * 64;
46
46
  }
47
- function W(S, t, e) {
48
- return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && St(i.points, [S, t]));
47
+ function H(f, t, e) {
48
+ return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && vt(i.points, [f, t]));
49
49
  }
50
- function V(S, t, e) {
51
- const i = e.find((o) => o.type === "dots"), l = e.find((o) => o.type === "curve");
50
+ function B(f, t, e) {
51
+ const i = e.find((a) => a.type === "dots"), l = e.find((a) => a.type === "curve");
52
52
  return {
53
- dotFill: H(S, t, (i == null ? void 0 : i.aes.dotFill) ?? F.color, "dotFill"),
54
- dotSize: H(S, t, (i == null ? void 0 : i.aes.dotSize) ?? F.size, "dotSize"),
55
- lineType: H(S, t, (l == null ? void 0 : l.aes.lineShape) ?? "solid", "lineShape")
53
+ dotFill: M(f, t, (i == null ? void 0 : i.aes.dotFill) ?? P.color, "dotFill"),
54
+ dotSize: M(f, t, (i == null ? void 0 : i.aes.dotSize) ?? P.size, "dotSize"),
55
+ lineType: M(f, t, (l == null ? void 0 : l.aes.lineShape) ?? "solid", "lineShape")
56
56
  };
57
57
  }
58
- class ae {
58
+ class le {
59
59
  constructor() {
60
60
  h(this, "reactRoot", null);
61
61
  h(this, "parentNode", null);
62
62
  h(this, "rootNode", null);
63
63
  h(this, "canvasNode", null);
64
64
  h(this, "svgLayerElement", null);
65
- h(this, "svgLayerComponent", /* @__PURE__ */ T.jsx(T.Fragment, {}));
65
+ h(this, "svgLayerComponent", /* @__PURE__ */ b.jsx(b.Fragment, {}));
66
66
  h(this, "aesGetters", {
67
67
  dotSize: () => 2,
68
- dotFill: () => G,
68
+ dotFill: () => A,
69
69
  lineType: () => "solid"
70
70
  });
71
71
  h(this, "tools", null);
@@ -76,20 +76,20 @@ class ae {
76
76
  right: L
77
77
  });
78
78
  h(this, "chartSizes", {
79
- chartWidth: D,
79
+ chartWidth: w,
80
80
  // width of single chart
81
- chartHeight: w,
81
+ chartHeight: E,
82
82
  // height of single chart
83
- totalWidth: D,
83
+ totalWidth: w,
84
84
  // width of all charts in charts row, plus left axis, plus legend
85
- totalHeight: w
85
+ totalHeight: E
86
86
  // width of all charts in charts height, plus bottom axis, plus top title
87
87
  });
88
88
  h(this, "scales", {
89
- x: C().domain([0, 10]).range([0, D]),
90
- y: C().domain([0, 10]).range([w, 0]),
91
- xOriginal: C().domain([0, 10]).range([0, D]),
92
- yOriginal: C().domain([0, 10]).range([w, 0])
89
+ x: T().domain([0, 10]).range([0, w]),
90
+ y: T().domain([0, 10]).range([E, 0]),
91
+ xOriginal: T().domain([0, 10]).range([0, w]),
92
+ yOriginal: T().domain([0, 10]).range([E, 0])
93
93
  });
94
94
  h(this, "polygons", []);
95
95
  h(this, "onPolygonUpdateOutside", () => {
@@ -111,10 +111,10 @@ class ae {
111
111
  h(this, "notCalculatedProps", {});
112
112
  h(this, "allDots", []);
113
113
  h(this, "visibleLabels", []);
114
- h(this, "dataFrame", new mt("", {}));
114
+ h(this, "dataFrame", new ut("", {}));
115
115
  h(this, "onPolygonUpdate", (t) => {
116
116
  this.polygons = t, this.updateByLasso();
117
- const e = this.allDots.filter((i) => W(i.x, i.y, this.polygons)).map((i) => i.idx);
117
+ const e = this.allDots.filter((i) => H(i.x, i.y, this.polygons)).map((i) => i.idx);
118
118
  this.onPolygonUpdateOutside(e, t);
119
119
  });
120
120
  }
@@ -126,57 +126,57 @@ class ae {
126
126
  });
127
127
  }
128
128
  init(t) {
129
- 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 = $.createRoot(this.rootNode));
129
+ 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.createRoot(this.rootNode));
130
130
  }
131
131
  updateChartSizes(t) {
132
132
  (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]));
133
133
  }
134
134
  updateViewport(t, e, i) {
135
- const l = t.scale === "log" ? U() : C();
136
- let { minX: o, minY: c, maxX: m, maxY: u } = i;
137
- if (t.lowerValue !== void 0 && (o = Math.max(o, t.lowerValue)), t.upperValue !== void 0 && (m = Math.min(m, t.upperValue)), e.lowerValue !== void 0 && (c = Math.max(c, e.lowerValue)), e.upperValue !== void 0 && (u = Math.min(u, e.upperValue)), t.symmetricRange !== void 0) {
138
- const r = t.symmetricRange;
139
- if (r >= o && r <= m) {
140
- const f = Math.max(r - o, m - r);
141
- o = r - f, m = r + f;
135
+ const l = t.scale === "log" ? U() : T();
136
+ let { minX: a, minY: c, maxX: d, maxY: p } = i;
137
+ if (t.lowerValue !== void 0 && (a = Math.max(a, t.lowerValue)), t.upperValue !== void 0 && (d = Math.min(d, t.upperValue)), e.lowerValue !== void 0 && (c = Math.max(c, e.lowerValue)), e.upperValue !== void 0 && (p = Math.min(p, e.upperValue)), t.symmetricRange !== void 0) {
138
+ const n = t.symmetricRange;
139
+ if (n >= a && n <= d) {
140
+ const g = Math.max(n - a, d - n);
141
+ a = n - g, d = n + g;
142
142
  }
143
143
  }
144
144
  if (typeof e.symmetricRange < "u") {
145
- const r = e.symmetricRange;
146
- if (r >= c && r <= u) {
147
- const f = Math.max(r - c, u - r);
148
- c = r - f, u = r + f;
145
+ const n = e.symmetricRange;
146
+ if (n >= c && n <= p) {
147
+ const g = Math.max(n - c, p - n);
148
+ c = n - g, p = n + g;
149
149
  }
150
150
  }
151
- const y = [0, this.chartSizes.chartWidth], x = l.copy().domain([o, m]).range([E.LEFT, this.chartSizes.chartWidth - E.RIGHT]);
152
- l.domain([x.invert(0), x.invert(this.chartSizes.chartWidth)]).range(y).nice(), this.scales.x = l, this.scales.xOriginal = l.copy();
153
- const d = e.scale === "log" ? U() : C(), n = [this.chartSizes.chartHeight, 0], g = d.copy().domain([c, u]).range([this.chartSizes.chartHeight - E.BOTTOM, E.TOP]);
154
- d.domain([g.invert(this.chartSizes.chartHeight), g.invert(0)]).range(n).nice(), this.scales.y = d, this.scales.yOriginal = d.copy();
151
+ const u = [0, this.chartSizes.chartWidth], y = l.copy().domain([a, d]).range([D.LEFT, this.chartSizes.chartWidth - D.RIGHT]);
152
+ l.domain([y.invert(0), y.invert(this.chartSizes.chartWidth)]).range(u).nice(), this.scales.x = l, this.scales.xOriginal = l.copy();
153
+ const S = e.scale === "log" ? U() : T(), m = [this.chartSizes.chartHeight, 0], r = S.copy().domain([c, p]).range([this.chartSizes.chartHeight - D.BOTTOM, D.TOP]);
154
+ S.domain([r.invert(this.chartSizes.chartHeight), r.invert(0)]).range(m).nice(), this.scales.y = S, this.scales.yOriginal = S.copy();
155
155
  }
156
156
  updateCaptionsSize() {
157
- const t = new R("600 14px Arial");
157
+ const t = new I("600 14px Arial");
158
158
  function e(c) {
159
- return Math.max(...c.map((m) => t.getTextWidth(m)));
159
+ return Math.max(...c.map((d) => t.getTextWidth(d)));
160
160
  }
161
- const { ticks: i, format: l } = it(this.scales.y, !1), o = e(i.map(l));
161
+ const { ticks: i, format: l } = at(this.scales.y, !1), a = e(i.map(l));
162
162
  this.captionsSizes = {
163
163
  xAxisCaptionsWidth: 20,
164
- yAxisCaptionsWidth: o
164
+ yAxisCaptionsWidth: a
165
165
  };
166
166
  }
167
167
  createMainTitle(t) {
168
- this.mainTitle = et(
168
+ this.mainTitle = ot(
169
169
  t.name,
170
170
  this.chartSizes.totalWidth - this.margins.left - this.margins.right,
171
171
  20
172
172
  );
173
173
  }
174
174
  updateMargins() {
175
- const t = J * this.mainTitle.length, e = t > 0 ? t + tt * 2 : 0;
175
+ const t = Z * this.mainTitle.length, e = t > 0 ? t + st * 2 : 0;
176
176
  this.margins = {
177
177
  top: Math.max(e, L),
178
- bottom: L + this.captionsSizes.xAxisCaptionsWidth + I,
179
- left: L + this.captionsSizes.yAxisCaptionsWidth + I,
178
+ bottom: L + this.captionsSizes.xAxisCaptionsWidth + _,
179
+ left: L + this.captionsSizes.yAxisCaptionsWidth + _,
180
180
  right: this.legend.width + L
181
181
  }, 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");
182
182
  }
@@ -185,139 +185,142 @@ class ae {
185
185
  this.legend = { width: 0, height: 0, items: [] };
186
186
  return;
187
187
  }
188
- const o = [], c = { width: 0, height: 0, left: 0, top: 0 };
189
- if (i.forEach((d) => {
190
- const n = e[d.value];
191
- if (n.usedAes.length === 0 || !n.aesMap)
188
+ const a = [], c = { width: 0, height: 0, left: 0, top: 0 }, d = Math.min(
189
+ Math.max(this.chartSizes.chartHeight, tt),
190
+ et
191
+ ), p = Math.max(this.chartSizes.chartHeight, d);
192
+ if (i.forEach((m) => {
193
+ const r = e[m.value];
194
+ if (r.usedAes.length === 0 || !r.aesMap)
192
195
  return;
193
- if (n.values.length > Z) {
194
- console.warn(`Too many values for discrete legend (${n.values.length})`);
196
+ if (r.values.length > it) {
197
+ console.warn(`Too many values for discrete legend (${r.values.length})`);
195
198
  return;
196
199
  }
197
- const g = {};
198
- n.values.forEach((p) => {
199
- g[p] || (g[p] = { ...F }), n.usedAes.forEach((s) => {
200
- s === "dotFill" && (g[p].color = n.aesMap(p, s) ?? G), s === "dotSize" && (g[p].size = Number(n.aesMap(p, s) ?? 3));
200
+ const n = {};
201
+ r.values.forEach((s) => {
202
+ n[s] || (n[s] = { ...P }), r.usedAes.forEach((o) => {
203
+ o === "dotFill" && (n[s].color = r.aesMap(s, o) ?? A), o === "dotSize" && (n[s].size = Number(r.aesMap(s, o) ?? 3));
201
204
  });
202
205
  });
203
- const r = d.label ?? d.value, f = gt().domain(n.values).range(n.values.map((p) => g[p]));
204
- o.push({ ...c, id: d.value, type: "dots", title: r, scale: f, values: n.values, labels: n.labels });
205
- }), l.forEach((d) => {
206
- if (d.type === "dots" && A(d.aes.dotFill)) {
207
- const { domain: n, range: g, columnName: r, type: f = "linear" } = d.aes.dotFill, p = r.label ?? r.value, s = ot(g, n, "linear"), a = (f === "log" ? ut() : C()).domain(n).range([this.chartSizes.chartHeight, 0]), z = at(a, n);
208
- o.push({ ...c, id: "dotFill", type: "continuous", title: p, scale: s, tickPositionScale: a, values: z });
206
+ const g = m.label ?? m.value, x = yt().domain(r.values).range(r.values.map((s) => n[s]));
207
+ a.push({ ...c, id: m.value, type: "dots", title: g, scale: x, values: r.values, labels: r.labels });
208
+ }), l.forEach((m) => {
209
+ if (m.type === "dots" && R(m.aes.dotFill)) {
210
+ const { domain: r, range: n, columnName: g, type: x = "linear" } = m.aes.dotFill, s = g.label ?? g.value, o = rt(n, r, "linear"), v = (x === "log" ? St() : T()).domain(r).range([d, 0]), z = lt(v, r);
211
+ a.push({ ...c, id: "dotFill", type: "continuous", title: s, scale: o, tickPositionScale: v, values: z });
209
212
  }
210
- if (d.type === "dots" && A(d.aes.dotSize)) {
211
- const { columnName: n, domain: g, range: r } = d.aes.dotSize, f = n.label ?? n.value, p = ft(g, r), s = p.ticks(3), a = p.tickFormat(3), z = s.reduce((v, b) => (v[String(b)] = a(b), v), {});
212
- o.push({ ...c, id: n.value, type: "size", title: f, scale: p, values: s, labels: z });
213
+ if (m.type === "dots" && R(m.aes.dotSize)) {
214
+ const { columnName: r, domain: n, range: g } = m.aes.dotSize, x = r.label ?? r.value, s = xt(n, g), o = s.ticks(3), v = s.tickFormat(3), z = o.reduce((C, F) => (C[String(F)] = v(F), C), {});
215
+ a.push({ ...c, id: r.value, type: "size", title: x, scale: s, values: o, labels: z });
213
216
  }
214
- }), !o.length) {
217
+ }), !a.length) {
215
218
  this.legend = { width: 0, height: 0, items: [] };
216
219
  return;
217
220
  }
218
- const m = pt(o, this.chartSizes.chartHeight), u = m[m.length - 1], y = u.left + u.width + rt, x = this.chartSizes.chartHeight;
221
+ const u = ft(a, p, d), y = u[u.length - 1], S = y.left + y.width + ct;
219
222
  this.legend = {
220
- width: y,
221
- height: x,
222
- items: m
223
+ width: S,
224
+ height: p,
225
+ items: u
223
226
  };
224
227
  }
225
- initSettings(t, e, i, l, o, c) {
226
- const { xAxis: m, yAxis: u, size: y, title: x, legend: d } = e;
227
- this.updateChartSizes(y), this.updateViewport(m, u, i), this.updateCaptionsSize(), this.updateLegendSize(d, l, c, o), this.createMainTitle(x), this.updateMargins(), this.aesGetters = V(this.dataFrame, l, o);
228
- const n = lt().data(t).value((s) => {
229
- const a = M(this.aesGetters.dotFill(s.idx));
230
- return a[3] = !s.dimmed && W(s.x, s.y, this.polygons) ? 1 : 0.4, P(a, a);
231
- }), g = X().equals((s, a) => s === a).size((s) => _(this.aesGetters.dotSize(s.idx))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => n(s)), r = q().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey || s.ctrlKey).on("start", () => {
228
+ initSettings(t, e, i, l, a, c) {
229
+ const { xAxis: d, yAxis: p, size: u, title: y, legend: S } = e;
230
+ this.updateChartSizes(u), this.updateViewport(d, p, i), this.updateCaptionsSize(), this.updateLegendSize(S, l, c, a), this.createMainTitle(y), this.updateMargins(), this.aesGetters = B(this.dataFrame, l, a);
231
+ const m = dt().data(t).value((s) => {
232
+ const o = W(this.aesGetters.dotFill(s.idx));
233
+ return o[3] = !s.dimmed && H(s.x, s.y, this.polygons) ? 1 : 0.4, G(o, o);
234
+ }), r = Y().equals((s, o) => s === o).size((s) => V(this.aesGetters.dotSize(s.idx))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => m(s)), n = $().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey || s.ctrlKey).on("start", () => {
232
235
  this.selectedDot = null;
233
236
  }).on("zoom", (s) => {
234
- const a = s.transform, z = a.rescaleX(this.scales.xOriginal), v = a.rescaleY(this.scales.yOriginal);
235
- this.scales.x.domain(z.domain()), this.scales.y.domain(v.domain()), this.zoomTransform = a, this.zoomStateKey = `${a.x}_${a.y}_${a.k}`, this.updateLabelsPosition(this.visibleLabels), this.renderSvgLayer(), this.renderWebglLayer();
237
+ const o = s.transform, v = o.rescaleX(this.scales.xOriginal), z = o.rescaleY(this.scales.yOriginal);
238
+ this.scales.x.domain(v.domain()), this.scales.y.domain(z.domain()), this.zoomTransform = o, this.zoomStateKey = `${o.x}_${o.y}_${o.k}`, this.updateLabelsPosition(this.visibleLabels), this.renderSvgLayer(), this.renderWebglLayer();
236
239
  }).on("end", () => {
237
240
  this.visibleLabels = this.computeLabels(this.allDots), this.renderSvgLayer();
238
- }), f = ht().on("point", ([s]) => {
239
- var v;
240
- let a;
241
- s && (a = this.getClosestDot(s.x, s.y));
242
- const z = this.selectedDot && !a || !this.selectedDot && a || ((v = this.selectedDot) == null ? void 0 : v.idx) !== (a == null ? void 0 : a.idx);
243
- this.selectedDot = a ?? null, z && this.renderSvgLayer();
244
- }), p = K({
241
+ }), g = mt().on("point", ([s]) => {
242
+ var z;
243
+ let o;
244
+ s && (o = this.getClosestDot(s.x, s.y));
245
+ const v = this.selectedDot && !o || !this.selectedDot && o || ((z = this.selectedDot) == null ? void 0 : z.idx) !== (o == null ? void 0 : o.idx);
246
+ this.selectedDot = o ?? null, v && this.renderSvgLayer();
247
+ }), x = K({
245
248
  xScale: this.scales.x,
246
249
  yScale: this.scales.y
247
- }).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(Y()).webglPlotArea(
250
+ }).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(j()).webglPlotArea(
248
251
  // only render the point series on the WebGL layer
249
- j().series([g]).mapping((s) => s)
252
+ q().series([r]).mapping((s) => s)
250
253
  ).decorate((s) => {
251
- const a = s.enter();
252
- a && !this.svgLayerElement && (a.style("grid-template-columns", "0 auto 1fr auto 0"), a.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = a.select(".svg-plot-area.plot-area svg").node()), a.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(r).call(f);
254
+ const o = s.enter();
255
+ o && !this.svgLayerElement && (o.style("grid-template-columns", "0 auto 1fr auto 0"), o.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = o.select(".svg-plot-area.plot-area svg").node()), o.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(n).call(g);
253
256
  });
254
257
  this.tools = {
255
- webglChart: p,
256
- zoom: r,
257
- fillColor: n,
258
- pointSeries: g
258
+ webglChart: x,
259
+ zoom: n,
260
+ fillColor: m,
261
+ pointSeries: r
259
262
  }, 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");
260
263
  }
261
264
  updateAes(t, e) {
262
- this.tools !== null && (this.aesGetters = V(this.dataFrame, t, e), this.tools.fillColor.value((i) => {
263
- const l = this.aesGetters.dotFill ?? O, o = M(l(i.idx));
264
- return o[3] = !i.dimmed && W(i.x, i.y, this.polygons) ? 1 : 0.4, P(o, o);
265
+ this.tools !== null && (this.aesGetters = B(this.dataFrame, t, e), this.tools.fillColor.value((i) => {
266
+ const l = this.aesGetters.dotFill ?? O, a = W(l(i.idx));
267
+ return a[3] = !i.dimmed && H(i.x, i.y, this.polygons) ? 1 : 0.4, G(a, a);
265
268
  }));
266
269
  }
267
270
  updatePointSize() {
268
- this.tools !== null && (N(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => _(this.aesGetters.dotSize(t.data))));
271
+ this.tools !== null && (N(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => V(this.aesGetters.dotSize(t.data))));
269
272
  }
270
273
  updateByLasso() {
271
274
  var t;
272
275
  this.tools !== null && ((t = this.tools) == null || t.fillColor.value((e) => {
273
- const i = this.aesGetters.dotFill ?? O, l = M(i(e.idx));
274
- return l[3] = !e.dimmed && W(e.x, e.y, this.polygons) ? 1 : 0.4, P(l, l);
276
+ const i = this.aesGetters.dotFill ?? O, l = W(i(e.idx));
277
+ return l[3] = !e.dimmed && H(e.x, e.y, this.polygons) ? 1 : 0.4, G(l, l);
275
278
  }), this.renderWebglLayer());
276
279
  }
277
280
  createQuadtree(t) {
278
- const e = new ct(t.length, 512);
281
+ const e = new pt(t.length, 512);
279
282
  for (let i = 0; i < t.length; i++)
280
283
  e.add(t[i].x, t[i].y);
281
284
  return e.finish();
282
285
  }
283
286
  getClosestDot(t, e) {
284
- var r, f;
285
- const i = (r = this.tools) == null ? void 0 : r.qt;
287
+ var n, g;
288
+ const i = (n = this.tools) == null ? void 0 : n.qt;
286
289
  if (!i) return null;
287
- const l = this.allDots, o = this.scales.x.invert(t), c = this.scales.y.invert(e), m = 1 / (((f = this.zoomTransform) == null ? void 0 : f.k) || 1), u = o - m, y = o + m, x = c - m, d = c + m, n = i.range(u, x, y, d), g = n.reduce((p, s) => {
288
- const a = l[s], z = this.scales.x(a.x) - t, v = this.scales.y(a.y) - e, b = Math.hypot(z, v);
289
- return (p === null || b < p.distance) && (p.index = s, p.distance = b), p;
290
+ const l = this.allDots, a = this.scales.x.invert(t), c = this.scales.y.invert(e), d = 1 / (((g = this.zoomTransform) == null ? void 0 : g.k) || 1), p = a - d, u = a + d, y = c - d, S = c + d, m = i.range(p, y, u, S), r = m.reduce((x, s) => {
291
+ const o = l[s], v = this.scales.x(o.x) - t, z = this.scales.y(o.y) - e, C = Math.hypot(v, z);
292
+ return (x === null || C < x.distance) && (x.index = s, x.distance = C), x;
290
293
  }, {
291
294
  index: -1,
292
295
  distance: 1 / 0
293
296
  });
294
- return n.length === 0 || g.index === -1 ? null : l[g.index];
297
+ return m.length === 0 || r.index === -1 ? null : l[r.index];
295
298
  }
296
299
  updateDots(t) {
297
300
  this.tools !== null && (N(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt = this.createQuadtree(t), this.allDots = t);
298
301
  }
299
- render(t, e, i, l, o, c, m, u, y, x, d, n, g) {
302
+ render(t, e, i, l, a, c, d, p, u, y, S, m, r) {
300
303
  this.dataFrame = t;
301
- const r = i.size.width !== this.chartSizes.chartWidth || i.size.height !== this.chartSizes.chartHeight;
304
+ const n = i.size.width !== this.chartSizes.chartWidth || i.size.height !== this.chartSizes.chartHeight;
302
305
  if (this.tools === null)
303
306
  this.initSettings(
304
- o,
307
+ a,
305
308
  i,
306
309
  c,
307
- y,
308
310
  u,
309
- x
311
+ p,
312
+ y
310
313
  );
311
314
  else {
312
- const { title: f, legend: p, size: s } = i;
313
- this.updateChartSizes(s), this.updateLegendSize(p, y, x, u), this.createMainTitle(f), this.updateMargins(), this.updateAes(y, u);
315
+ const { title: g, legend: x, size: s } = i;
316
+ this.updateChartSizes(s), this.updateLegendSize(x, u, y, p), this.createMainTitle(g), this.updateMargins(), this.updateAes(u, p);
314
317
  }
315
- this.onPolygonUpdateOutside = d, this.onTooltipHintSwitch = n, this.onLassoControlsStateUpdate = g, this.allDots !== o ? (this.updateDots(o), this.visibleLabels = this.computeLabels(o)) : r && (this.visibleLabels = this.computeLabels(o)), this.notCalculatedProps = {
318
+ this.onPolygonUpdateOutside = S, this.onTooltipHintSwitch = m, this.onLassoControlsStateUpdate = r, this.allDots !== a ? (this.updateDots(a), this.visibleLabels = this.computeLabels(a)) : n && (this.visibleLabels = this.computeLabels(a)), this.notCalculatedProps = {
316
319
  settingsId: e,
317
320
  chartSettings: i,
318
321
  keyColumn: l,
319
- dotsByGrouping: m,
320
- layers: u
322
+ dotsByGrouping: d,
323
+ layers: p
321
324
  }, this.renderWebglLayer(), this.renderSvgLayer();
322
325
  }
323
326
  renderWebglLayer() {
@@ -348,29 +351,29 @@ class ae {
348
351
  onTooltipHintSwitch: this.onTooltipHintSwitch,
349
352
  onLassoControlsStateUpdate: this.onLassoControlsStateUpdate
350
353
  };
351
- this.svgLayerComponent = /* @__PURE__ */ T.jsx(dt, { dataFrame: this.dataFrame, children: /* @__PURE__ */ T.jsx(nt, { ...t }) }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
354
+ this.svgLayerComponent = /* @__PURE__ */ b.jsx(gt, { dataFrame: this.dataFrame, children: /* @__PURE__ */ b.jsx(ht, { ...t }) }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
352
355
  }
353
356
  renderError(t) {
354
357
  var e;
355
- (e = this.reactRoot) == null || e.render(/* @__PURE__ */ T.jsx(Q, { message: t }));
358
+ (e = this.reactRoot) == null || e.render(/* @__PURE__ */ b.jsx(J, { message: t }));
356
359
  }
357
360
  computeLabels(t) {
358
- const e = new R("16px Manrope"), i = st(this.chartSizes.chartWidth, this.chartSizes.chartHeight), l = [];
359
- for (let o = 0; o < t.length; o++) {
360
- const c = t[o];
361
+ const e = new I("16px Manrope"), i = nt(this.chartSizes.chartWidth, this.chartSizes.chartHeight), l = [];
362
+ for (let a = 0; a < t.length; a++) {
363
+ const c = t[a];
361
364
  if (c.label == null)
362
365
  continue;
363
- const m = String(c.label), u = e.getTextMetrics(m), y = this.scales.x(c.x), x = this.scales.y(c.y), d = u.width, n = u.actualBoundingBoxAscent + u.actualBoundingBoxDescent, g = 10, r = i(y, x, d, n, g);
364
- r && l.push({
365
- x: y,
366
- y: x,
366
+ const d = String(c.label), p = e.getTextMetrics(d), u = this.scales.x(c.x), y = this.scales.y(c.y), S = p.width, m = p.actualBoundingBoxAscent + p.actualBoundingBoxDescent, r = 10, n = i(u, y, S, m, r);
367
+ n && l.push({
368
+ x: u,
369
+ y,
367
370
  dot: c,
368
- name: m,
369
- width: d,
370
- height: n,
371
- padding: g,
372
- xPosition: r[0],
373
- yPosition: r[1]
371
+ name: d,
372
+ width: S,
373
+ height: m,
374
+ padding: r,
375
+ xPosition: n[0],
376
+ yPosition: n[1]
374
377
  });
375
378
  }
376
379
  return l;
@@ -383,6 +386,6 @@ class ae {
383
386
  }
384
387
  }
385
388
  export {
386
- ae as default
389
+ le as default
387
390
  };
388
391
  //# sourceMappingURL=ChartRenderer.js.map