@milaboratories/miplots4 1.0.171 → 1.0.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bubble/ChartRenderer.js +143 -146
- package/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/dendro/ChartRenderer.js +175 -174
- package/dist/dendro/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +149 -152
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +152 -155
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/utils/arrangeLegendParts.js +35 -35
- package/dist/utils/arrangeLegendParts.js.map +1 -1
- package/dist/utils/getContinuousLegendTicks.js +5 -8
- package/dist/utils/getContinuousLegendTicks.js.map +1 -1
- package/dist/utils/getSizeLegendItem.d.ts +3 -0
- package/dist/utils/getSizeLegendItem.js +15 -0
- package/dist/utils/getSizeLegendItem.js.map +1 -0
- package/dist/utils/numberFormat.d.ts +1 -0
- package/dist/utils/numberFormat.js +9 -4
- package/dist/utils/numberFormat.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var st = Object.defineProperty;
|
|
2
2
|
var ot = (a, t, i) => t in a ? st(a, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[t] = i;
|
|
3
|
-
var
|
|
4
|
-
import { j as
|
|
3
|
+
var M = (a, t, i) => ot(a, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import { j as F } from "../_virtual/jsx-runtime.js";
|
|
5
5
|
import { c as nt } from "../_virtual/client.js";
|
|
6
6
|
import { Error as at } from "../common/Error.js";
|
|
7
7
|
import { DataFrameProvider as ht } from "../common/useDataFrame.js";
|
|
8
8
|
import { DEFAULT_HEIGHT as X, DEFAULT_WIDTH as G, TITLE_LINE_HEIGHT as rt, MIN_LEGEND_GRADIENT_HEIGHT as lt, MAX_LEGEND_GRADIENT_HEIGHT as ct, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as mt, BLACK as et, TITLE_MARGIN as dt } from "../constants.js";
|
|
9
9
|
import { FACET_TITLE_LINE as pt } from "../discrete/constants.js";
|
|
10
10
|
import { splitTextByWidth as V } from "../utils/splitTextByWidth.js";
|
|
11
|
-
import { isContinuousAes as
|
|
11
|
+
import { isContinuousAes as Q } from "../types/common.js";
|
|
12
12
|
import "../types/discrete.js";
|
|
13
13
|
import "../types/scatterplot.js";
|
|
14
14
|
import "../types/heatmap.js";
|
|
@@ -16,28 +16,28 @@ import "../types/dendro.js";
|
|
|
16
16
|
import "../types/histogram.js";
|
|
17
17
|
import "../types/bubble.js";
|
|
18
18
|
import { arrangeLegendParts as ut } from "../utils/arrangeLegendParts.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
19
|
+
import { getSizeLegendItem as gt } from "../utils/getSizeLegendItem.js";
|
|
20
|
+
import { getContinuousColorScale as ft } from "../utils/getContinuousColorScale.js";
|
|
21
|
+
import { getContinuousLegendTicks as Tt } from "../utils/getContinuousLegendTicks.js";
|
|
22
|
+
import { TextMeasurer as Ct } from "../utils/TextMeasurer/TextMeasurer.js";
|
|
23
|
+
import { ChartsGroup as Et } from "./components/ChartsGroup.js";
|
|
24
|
+
import { MIN_MARGIN as H, PADDINGS as P, DEFAULT_DOT_AES as Y, LEGEND_OFFSET as Mt, TICK_OFFSET as v, DEFAULT_TICKS_SIZE as Z, MIN_PADDING as U, FACET_TITLE_OFFSET as xt, TITLE_LINE as O, FACET_AXIS_OFFSET as $ } from "./constants.js";
|
|
25
|
+
import { createAesGetter as D } from "./utils/createAesGetter.js";
|
|
26
|
+
import { getTicksAndFormat as St } from "./utils/getTicksAndFormat.js";
|
|
27
|
+
import { isContinuousAxis as q } from "./utils/isNumericScale.js";
|
|
27
28
|
import { createMultilineDiscreteLabels as J } from "../utils/createMultilineDiscreteLabels.js";
|
|
28
29
|
import { measureMultilineDiscreteLabels as k } from "../utils/measureMultilineDiscreteLabels.js";
|
|
29
30
|
import B from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
|
|
30
31
|
import { point as y } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js";
|
|
31
32
|
import K from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/log.js";
|
|
32
|
-
import
|
|
33
|
+
import Nt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js";
|
|
33
34
|
import bt from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/symlog.js";
|
|
34
|
-
import { sqrt as Nt } from "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/pow.js";
|
|
35
35
|
function tt(a, t) {
|
|
36
36
|
if (a === void 0)
|
|
37
37
|
return !0;
|
|
38
38
|
{
|
|
39
39
|
const i = a.domain(), s = a.range(), e = t.domain(), o = t.range();
|
|
40
|
-
if (i.length !== e.length || i.some((
|
|
40
|
+
if (i.length !== e.length || i.some((g, f) => g !== e[f]) || s[0] !== o[0] || s[1] !== o[1])
|
|
41
41
|
return !0;
|
|
42
42
|
}
|
|
43
43
|
return !1;
|
|
@@ -46,13 +46,13 @@ function zt(a, t, i, s) {
|
|
|
46
46
|
const e = [];
|
|
47
47
|
return a % i === i - 1 && e.push("right"), a % i === 0 && e.push("left"), a < i && e.push("top"), (Math.ceil((a + 1) / i) === s || Math.ceil((a + 1) / i) === s - 1 && a % i > (t - 1) % i) && e.push("bottom"), e;
|
|
48
48
|
}
|
|
49
|
-
function wt(a, t, i, s, e, o,
|
|
50
|
-
const I = a.scale === "discrete", w = t.scale === "discrete", h = o.includes("left") || !(
|
|
49
|
+
function wt(a, t, i, s, e, o, g, f, C, c) {
|
|
50
|
+
const I = a.scale === "discrete", w = t.scale === "discrete", h = o.includes("left") || !(c != null && c.sharedY), n = o.includes("left") && t.title !== "", r = o.includes("bottom") || !(c != null && c.sharedX), T = o.includes("bottom") && a.title !== "", x = t.hiddenLabels ? 0 : w ? i.leftAxisCaptionsWidthByColumns[f] + 2 * v : i.yAxisCaptionsWidth + 2 * v, m = (t.showTicks ? Z : 0) + v, p = n ? O : 0, E = a.hiddenLabels ? 0 : I ? i.bottomAxisCaptionsWidthByRows[g] + 2 * v : i.xAxisCaptionsWidth + 2 * v, S = a.showTicks ? Z : 0, A = T ? O : 0, u = x + m + p + $, l = E + S + A + $, W = Math.max(...s.map((d) => e[d].length));
|
|
51
51
|
return {
|
|
52
|
-
left: h ?
|
|
53
|
-
top: W === 0 ? 0 :
|
|
54
|
-
bottom: r ?
|
|
55
|
-
right:
|
|
52
|
+
left: h ? u : U,
|
|
53
|
+
top: W === 0 ? 0 : xt * 2 + W * pt,
|
|
54
|
+
bottom: r ? l + 8 : U,
|
|
55
|
+
right: C ? 0 : U
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
function Wt(a, t, i) {
|
|
@@ -66,14 +66,14 @@ function It(a, t) {
|
|
|
66
66
|
return [i, s];
|
|
67
67
|
}
|
|
68
68
|
function Lt(a, t, i, s) {
|
|
69
|
-
const e = i.find((
|
|
69
|
+
const e = i.find((g) => g.type === "dots"), o = i.find((g) => g.type === "curve");
|
|
70
70
|
return {
|
|
71
|
-
dotShape:
|
|
72
|
-
dotColor:
|
|
73
|
-
dotSize:
|
|
74
|
-
lineShape:
|
|
75
|
-
lineColor:
|
|
76
|
-
trendColor:
|
|
71
|
+
dotShape: D(a, t, (e == null ? void 0 : e.aes.dotShape) ?? Y.shape, "dotShape"),
|
|
72
|
+
dotColor: D(a, t, (e == null ? void 0 : e.aes.dotFill) ?? Y.color, "dotFill"),
|
|
73
|
+
dotSize: D(a, t, (e == null ? void 0 : e.aes.dotSize) ?? Y.size, "dotSize"),
|
|
74
|
+
lineShape: D(a, t, (o == null ? void 0 : o.aes.lineShape) ?? "solid", "lineShape"),
|
|
75
|
+
lineColor: D(a, t, (o == null ? void 0 : o.aes.lineColor) ?? et, "lineColor"),
|
|
76
|
+
trendColor: D(a, t, (s == null ? void 0 : s.color) ?? Y.color, "fillColor")
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
const Rt = Math.cos(Math.PI / 4), _t = 5;
|
|
@@ -82,18 +82,18 @@ function it(a, t) {
|
|
|
82
82
|
}
|
|
83
83
|
class ci {
|
|
84
84
|
constructor() {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
top:
|
|
91
|
-
bottom:
|
|
92
|
-
left:
|
|
93
|
-
right:
|
|
85
|
+
M(this, "reactRoot", null);
|
|
86
|
+
M(this, "parentNode", null);
|
|
87
|
+
M(this, "rootNode", null);
|
|
88
|
+
M(this, "component", /* @__PURE__ */ F.jsx(F.Fragment, {}));
|
|
89
|
+
M(this, "margins", {
|
|
90
|
+
top: H,
|
|
91
|
+
bottom: H,
|
|
92
|
+
left: H,
|
|
93
|
+
right: H
|
|
94
94
|
});
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
M(this, "chartsDimensions", {});
|
|
96
|
+
M(this, "chartSizes", {
|
|
97
97
|
chartWidth: G,
|
|
98
98
|
// width of single chart
|
|
99
99
|
chartHeight: X,
|
|
@@ -107,13 +107,13 @@ class ci {
|
|
|
107
107
|
totalHeight: X
|
|
108
108
|
// width of all charts in charts height, plus bottom axis, plus top title
|
|
109
109
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
M(this, "columnsCount", 1);
|
|
111
|
+
M(this, "rowsCount", 1);
|
|
112
|
+
M(this, "scales", {
|
|
113
113
|
x: { null: B().domain([0, 1]).range([0, G]) },
|
|
114
114
|
y: { null: B().domain([0, 1]).range([X, 0]) }
|
|
115
115
|
});
|
|
116
|
-
|
|
116
|
+
M(this, "captionsSizes", {
|
|
117
117
|
xAxisCaptionsWidth: 30,
|
|
118
118
|
yAxisCaptionsWidth: 100,
|
|
119
119
|
bottomAxisCaptionsWidthByRows: [],
|
|
@@ -121,13 +121,13 @@ class ci {
|
|
|
121
121
|
bottomCaptionsTail: 0,
|
|
122
122
|
leftCaptionsTail: 0
|
|
123
123
|
});
|
|
124
|
-
|
|
124
|
+
M(this, "facetTitles", {});
|
|
125
125
|
// can be multiline
|
|
126
|
-
|
|
126
|
+
M(this, "mainTitle", []);
|
|
127
127
|
// can be multiline
|
|
128
|
-
|
|
128
|
+
M(this, "discreteAxesLabels", { x: {}, y: {} });
|
|
129
129
|
// only for discrete axes, by facets, can be multiline
|
|
130
|
-
|
|
130
|
+
M(this, "legend", { width: 0, height: 0, items: [] });
|
|
131
131
|
}
|
|
132
132
|
clear() {
|
|
133
133
|
var t;
|
|
@@ -143,30 +143,30 @@ class ci {
|
|
|
143
143
|
this.chartSizes.chartWidth = t.width, this.chartSizes.chartHeight = t.height;
|
|
144
144
|
}
|
|
145
145
|
updateChartDimensions(t, i, s, e) {
|
|
146
|
-
const { chartWidth: o, chartHeight:
|
|
147
|
-
let
|
|
148
|
-
const
|
|
146
|
+
const { chartWidth: o, chartHeight: g } = this.chartSizes;
|
|
147
|
+
let f = 0, C = 0;
|
|
148
|
+
const c = Wt(t, this.rowsCount, this.columnsCount);
|
|
149
149
|
this.chartsDimensions = t.reduce((h, n, r) => {
|
|
150
|
-
const [
|
|
150
|
+
const [T, x] = It(r, this.columnsCount), m = zt(r, t.length, this.columnsCount, this.rowsCount), p = wt(
|
|
151
151
|
s,
|
|
152
152
|
e,
|
|
153
153
|
this.captionsSizes,
|
|
154
|
-
|
|
154
|
+
c[T],
|
|
155
155
|
this.facetTitles,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
m,
|
|
157
|
+
T,
|
|
158
|
+
x,
|
|
159
|
+
x === this.columnsCount - 1,
|
|
160
160
|
i
|
|
161
|
-
),
|
|
161
|
+
), E = o + p.left + p.right, S = g + p.top + p.bottom;
|
|
162
162
|
return h[n] = {
|
|
163
|
-
left:
|
|
164
|
-
top:
|
|
165
|
-
chartEdgeSides:
|
|
166
|
-
padding:
|
|
167
|
-
inner: { width: o, height:
|
|
168
|
-
outer: { width:
|
|
169
|
-
},
|
|
163
|
+
left: f,
|
|
164
|
+
top: C,
|
|
165
|
+
chartEdgeSides: m,
|
|
166
|
+
padding: p,
|
|
167
|
+
inner: { width: o, height: g },
|
|
168
|
+
outer: { width: E, height: S }
|
|
169
|
+
}, f += E, x === this.columnsCount - 1 && (f = 0, C += S), h;
|
|
170
170
|
}, {});
|
|
171
171
|
const I = Math.max(
|
|
172
172
|
...t.map((h) => this.chartsDimensions[h].outer.width + this.chartsDimensions[h].left)
|
|
@@ -175,74 +175,74 @@ class ci {
|
|
|
175
175
|
);
|
|
176
176
|
this.chartSizes.chartsWidth = I, this.chartSizes.chartsHeight = w;
|
|
177
177
|
}
|
|
178
|
-
updateViewport(t, i, s, e, o,
|
|
179
|
-
const
|
|
180
|
-
this.columnsCount = i.nRows ? Math.ceil(
|
|
181
|
-
let [h, n] = [1 / 0, -1 / 0], [r,
|
|
182
|
-
const
|
|
183
|
-
const W =
|
|
184
|
-
return h = Math.min(h,
|
|
185
|
-
}, {}),
|
|
186
|
-
let
|
|
187
|
-
t.forEach((
|
|
188
|
-
let
|
|
189
|
-
if (
|
|
190
|
-
|
|
178
|
+
updateViewport(t, i, s, e, o, g, f, C) {
|
|
179
|
+
const c = t.length, I = Math.min(i.nRows ?? c, c), w = Math.min(i.nCols ?? c, c);
|
|
180
|
+
this.columnsCount = i.nRows ? Math.ceil(c / I) : w, this.rowsCount = Math.ceil(c / this.columnsCount);
|
|
181
|
+
let [h, n] = [1 / 0, -1 / 0], [r, T] = [1 / 0, -1 / 0];
|
|
182
|
+
const x = t.reduce((u, l) => {
|
|
183
|
+
const W = f[l], { minX: d, minY: N, maxX: b, maxY: z } = W;
|
|
184
|
+
return h = Math.min(h, d), r = Math.min(r, N), n = Math.max(n, b), T = Math.max(T, z), u[l] = { minX: d, maxX: b, minY: N, maxY: z }, u;
|
|
185
|
+
}, {}), m = {}, p = {};
|
|
186
|
+
let E = !1, S = !1;
|
|
187
|
+
t.forEach((u) => {
|
|
188
|
+
let l;
|
|
189
|
+
if (!q(s))
|
|
190
|
+
l = y().range([0, this.chartSizes.chartWidth]).domain(o.keys ?? []).padding(0.5);
|
|
191
191
|
else {
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
let
|
|
192
|
+
l = s.scale === "log" ? K() : B();
|
|
193
|
+
const d = x[u];
|
|
194
|
+
let N = s.lowerValue ? Number(s.lowerValue) : i.sharedX ? h : d.minX, b = s.upperValue ? Number(s.upperValue) : i.sharedX ? n : d.maxX;
|
|
195
195
|
if (typeof s.symmetricRange < "u") {
|
|
196
196
|
const R = s.symmetricRange;
|
|
197
|
-
if (R >=
|
|
198
|
-
const _ = Math.max(R -
|
|
199
|
-
|
|
197
|
+
if (R >= N && R <= b) {
|
|
198
|
+
const _ = Math.max(R - N, b - R);
|
|
199
|
+
N = R - _, b = R + _;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const z = [0, this.chartSizes.chartWidth], L =
|
|
203
|
-
|
|
202
|
+
const z = [0, this.chartSizes.chartWidth], L = l.copy().domain([N, b]).range([P.LEFT, this.chartSizes.chartWidth - P.RIGHT]);
|
|
203
|
+
l.domain([L.invert(0), L.invert(this.chartSizes.chartWidth)]).range(z).nice();
|
|
204
204
|
}
|
|
205
|
-
const W = this.scales.x[
|
|
206
|
-
|
|
205
|
+
const W = this.scales.x[u];
|
|
206
|
+
m[u] = l, E = E || tt(W, l);
|
|
207
207
|
});
|
|
208
|
-
const
|
|
209
|
-
const W =
|
|
210
|
-
return
|
|
211
|
-
(
|
|
212
|
-
const
|
|
213
|
-
return
|
|
208
|
+
const A = t.reduce((u, l) => {
|
|
209
|
+
const W = C ? C[l] : [];
|
|
210
|
+
return u[l] = W.reduce(
|
|
211
|
+
(d, N) => {
|
|
212
|
+
const b = N.bounded ? N.xBounds : this.scales.x[l].domain(), z = N.getInterval(b[0]), L = N.getInterval(b[1]);
|
|
213
|
+
return d.minY = Math.min(d.minY, isNaN(z.left) ? d.minY : z.left, isNaN(L.left) ? d.minY : L.left), d.maxY = Math.max(d.maxY, isNaN(z.right) ? d.maxY : z.right, isNaN(L.right) ? d.maxY : L.right), d;
|
|
214
214
|
},
|
|
215
215
|
{ minY: 1 / 0, maxY: -1 / 0 }
|
|
216
|
-
), r = Math.min(r,
|
|
216
|
+
), r = Math.min(r, u[l].minY), T = Math.max(T, u[l].maxY), u;
|
|
217
217
|
}, {});
|
|
218
|
-
t.forEach((
|
|
219
|
-
let
|
|
220
|
-
if (
|
|
221
|
-
|
|
218
|
+
t.forEach((u) => {
|
|
219
|
+
let l;
|
|
220
|
+
if (!q(e))
|
|
221
|
+
l = y().range([this.chartSizes.chartHeight, 0]).domain(g.keys ?? []).padding(0.5);
|
|
222
222
|
else {
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
let
|
|
223
|
+
l = e.scale === "log" ? K() : B();
|
|
224
|
+
const d = x[u], N = A[u];
|
|
225
|
+
let b = e.lowerValue ? Number(e.lowerValue) : i.sharedY ? r : Math.min(d.minY, N.minY), z = e.upperValue ? Number(e.upperValue) : i.sharedY ? T : Math.max(d.maxY, N.maxY);
|
|
226
226
|
if (typeof e.symmetricRange < "u") {
|
|
227
227
|
const _ = e.symmetricRange;
|
|
228
|
-
if (_ >=
|
|
229
|
-
const j = Math.max(_ -
|
|
230
|
-
|
|
228
|
+
if (_ >= b && _ <= z) {
|
|
229
|
+
const j = Math.max(_ - b, z - _);
|
|
230
|
+
b = _ - j, z = _ + j;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
const L = [this.chartSizes.chartHeight, 0], R =
|
|
234
|
-
|
|
233
|
+
const L = [this.chartSizes.chartHeight, 0], R = l.copy().domain([b, z]).range([this.chartSizes.chartHeight - P.BOTTOM, P.TOP]);
|
|
234
|
+
l.domain([R.invert(this.chartSizes.chartHeight), R.invert(0)]).range(L).nice();
|
|
235
235
|
}
|
|
236
|
-
const W = this.scales.y[
|
|
237
|
-
|
|
238
|
-
}),
|
|
236
|
+
const W = this.scales.y[u];
|
|
237
|
+
p[u] = l, S = S || tt(W, l);
|
|
238
|
+
}), E && (this.scales.x = m), S && (this.scales.y = p);
|
|
239
239
|
}
|
|
240
240
|
updateCaptionsSize(t, i, s, e) {
|
|
241
|
-
const o = new
|
|
242
|
-
function
|
|
241
|
+
const o = new Ct("600 14px Manrope");
|
|
242
|
+
function g(n) {
|
|
243
243
|
return Math.max(...n.map((r) => o.getTextWidth(r)));
|
|
244
244
|
}
|
|
245
|
-
let
|
|
245
|
+
let f = 0, C = 0, c = [], I = [], w = 0, h = 0;
|
|
246
246
|
if (i.scale === "discrete") {
|
|
247
247
|
const n = k(
|
|
248
248
|
t,
|
|
@@ -253,7 +253,7 @@ class ci {
|
|
|
253
253
|
"vertical",
|
|
254
254
|
this.scales.x
|
|
255
255
|
);
|
|
256
|
-
|
|
256
|
+
f = n.xTail, c = n.axisCaptionsWidthByRows;
|
|
257
257
|
} else
|
|
258
258
|
w = 20;
|
|
259
259
|
if (s.scale === "discrete") {
|
|
@@ -266,19 +266,19 @@ class ci {
|
|
|
266
266
|
"horizontal",
|
|
267
267
|
this.scales.y
|
|
268
268
|
);
|
|
269
|
-
|
|
269
|
+
C = n.yTail, I = n.axisCaptionsWidthByColumns;
|
|
270
270
|
} else
|
|
271
271
|
Object.values(this.scales.y).forEach((n) => {
|
|
272
|
-
const { ticks: r, format:
|
|
273
|
-
h = Math.max(h,
|
|
272
|
+
const { ticks: r, format: T } = St(n, e);
|
|
273
|
+
h = Math.max(h, g(r.map(T)));
|
|
274
274
|
});
|
|
275
275
|
this.captionsSizes = {
|
|
276
276
|
xAxisCaptionsWidth: i.hiddenLabels ? 0 : it(w, i),
|
|
277
277
|
yAxisCaptionsWidth: s.hiddenLabels ? 0 : it(h, s),
|
|
278
|
-
bottomAxisCaptionsWidthByRows:
|
|
278
|
+
bottomAxisCaptionsWidthByRows: c,
|
|
279
279
|
leftAxisCaptionsWidthByColumns: I,
|
|
280
|
-
bottomCaptionsTail:
|
|
281
|
-
leftCaptionsTail:
|
|
280
|
+
bottomCaptionsTail: f,
|
|
281
|
+
leftCaptionsTail: C
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
createMainTitle(t, i) {
|
|
@@ -315,10 +315,10 @@ class ci {
|
|
|
315
315
|
updateMargins(t) {
|
|
316
316
|
const i = rt * this.mainTitle.length, s = i > 0 ? i + dt * 2 : 0, e = this.chartsDimensions[t[0]], o = this.chartsDimensions[t[t.length - 1]];
|
|
317
317
|
this.margins = {
|
|
318
|
-
top: Math.max(s,
|
|
319
|
-
bottom: Math.max(
|
|
320
|
-
left: Math.max(
|
|
321
|
-
right: this.legend.width +
|
|
318
|
+
top: Math.max(s, H),
|
|
319
|
+
bottom: Math.max(H, this.captionsSizes.leftCaptionsTail - o.padding.bottom),
|
|
320
|
+
left: Math.max(H, this.captionsSizes.bottomCaptionsTail - e.padding.left),
|
|
321
|
+
right: this.legend.width + H
|
|
322
322
|
}, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartsHeight, this.legend.height) + this.margins.bottom;
|
|
323
323
|
}
|
|
324
324
|
updateLegendSize(t, i, s, e) {
|
|
@@ -326,10 +326,10 @@ class ci {
|
|
|
326
326
|
this.legend = { width: 0, height: 0, items: [] };
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
|
-
const o = [],
|
|
329
|
+
const o = [], g = { width: 0, height: 0, left: 0, top: 0 }, f = Math.min(
|
|
330
330
|
Math.max(this.chartSizes.chartHeight, lt),
|
|
331
331
|
ct
|
|
332
|
-
),
|
|
332
|
+
), C = Math.max(this.chartSizes.chartHeight, f);
|
|
333
333
|
if (s.forEach((h) => {
|
|
334
334
|
const n = i[h.value];
|
|
335
335
|
if (n.usedAes.length === 0 || !n.aesMap)
|
|
@@ -339,39 +339,36 @@ class ci {
|
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
341
|
const r = {};
|
|
342
|
-
n.values.forEach((
|
|
343
|
-
r[
|
|
344
|
-
(
|
|
342
|
+
n.values.forEach((m) => {
|
|
343
|
+
r[m] || (r[m] = { ...Y }), n.usedAes.forEach((p) => {
|
|
344
|
+
(p === "dotFill" || p === "lineColor") && (r[m].color = n.aesMap(m, p) ?? et), p === "dotShape" && (r[m].shape = n.aesMap(m, p) ?? "21"), p === "dotSize" && (r[m].size = n.aesMap(m, p) ?? 3);
|
|
345
345
|
});
|
|
346
346
|
});
|
|
347
|
-
const
|
|
348
|
-
o.push({ ...
|
|
347
|
+
const T = h.label ?? h.value, x = Nt().domain(n.values).range(n.values.map((m) => r[m])).unknown(Y);
|
|
348
|
+
o.push({ ...g, id: h.value, type: "dots", title: T, scale: x, values: n.values, labels: n.labels });
|
|
349
349
|
}), e.forEach((h) => {
|
|
350
|
-
if (h.type === "dots" &&
|
|
351
|
-
const { domain: n, range: r, columnName:
|
|
352
|
-
o.push({ ...
|
|
353
|
-
}
|
|
354
|
-
if (h.type === "dots" && q(h.aes.dotSize)) {
|
|
355
|
-
const { columnName: n, domain: r, range: g } = h.aes.dotSize, E = n.label ?? n.value, l = Nt(r, g), m = l.ticks(3), C = l.tickFormat(3), M = m.reduce((H, p) => (H[String(p)] = C(p), H), {});
|
|
356
|
-
o.push({ ...f, id: n.value, type: "size", title: E, scale: l, values: m, labels: M });
|
|
350
|
+
if (h.type === "dots" && Q(h.aes.dotFill)) {
|
|
351
|
+
const { domain: n, range: r, columnName: T, type: x = "linear" } = h.aes.dotFill, m = T.label ?? T.value, p = ft(r, n, "linear"), E = (x === "log" ? bt() : B()).domain(n).range([f, 0]), S = Tt(E, n);
|
|
352
|
+
o.push({ ...g, id: "dotFill", type: "continuous", title: m, scale: p, tickPositionScale: E, values: S });
|
|
357
353
|
}
|
|
354
|
+
h.type === "dots" && Q(h.aes.dotSize) && o.push(gt(h.aes.dotSize));
|
|
358
355
|
}), !o.length) {
|
|
359
356
|
this.legend = { width: 0, height: 0, items: [] };
|
|
360
357
|
return;
|
|
361
358
|
}
|
|
362
|
-
const
|
|
359
|
+
const c = ut(o, C, f), w = c.reduce((h, n) => Math.max(h, n.left + n.width), 0) + Mt;
|
|
363
360
|
this.legend = {
|
|
364
361
|
width: w,
|
|
365
|
-
height:
|
|
366
|
-
items:
|
|
362
|
+
height: C,
|
|
363
|
+
items: c
|
|
367
364
|
};
|
|
368
365
|
}
|
|
369
|
-
render(t, i, s, e, o,
|
|
370
|
-
var
|
|
371
|
-
const { xAxis:
|
|
372
|
-
this.updateChartSizes(
|
|
373
|
-
const W = /* @__PURE__ */
|
|
374
|
-
|
|
366
|
+
render(t, i, s, e, o, g, f, C, c, I, w, h, n, r, T, x, m, p) {
|
|
367
|
+
var d;
|
|
368
|
+
const { xAxis: E, yAxis: S, size: A, title: u, legend: l } = s;
|
|
369
|
+
this.updateChartSizes(A), this.updateViewport(o, e, E, S, x, m, f, C), this.createAxisLabels(o, E, S, x, m), this.updateCaptionsSize(o, E, S, I.y), this.createFacetTitles(o, g), this.updateChartDimensions(o, e, E, S), this.updateLegendSize(l, w, n, r), this.createMainTitle(o, u), this.updateMargins(o);
|
|
370
|
+
const W = /* @__PURE__ */ F.jsx(ht, { dataFrame: t, children: /* @__PURE__ */ F.jsx(
|
|
371
|
+
Et,
|
|
375
372
|
{
|
|
376
373
|
settingsId: i,
|
|
377
374
|
chartSettings: s,
|
|
@@ -380,27 +377,27 @@ class ci {
|
|
|
380
377
|
chartSizes: this.chartSizes,
|
|
381
378
|
chartsDimensions: this.chartsDimensions,
|
|
382
379
|
scales: this.scales,
|
|
383
|
-
groupedDots:
|
|
384
|
-
trendsData:
|
|
380
|
+
groupedDots: f,
|
|
381
|
+
trendsData: C,
|
|
385
382
|
legendData: this.legend,
|
|
386
383
|
columnsCount: this.columnsCount,
|
|
387
384
|
margins: this.margins,
|
|
388
|
-
keyColumn:
|
|
385
|
+
keyColumn: c,
|
|
389
386
|
mainTitle: this.mainTitle,
|
|
390
387
|
facetTitles: this.facetTitles,
|
|
391
388
|
captionsSizes: this.captionsSizes,
|
|
392
389
|
onlyPositive: I,
|
|
393
390
|
layersData: h,
|
|
394
|
-
aesGetters: Lt(t, w, r,
|
|
395
|
-
onTooltipHintSwitch:
|
|
391
|
+
aesGetters: Lt(t, w, r, T),
|
|
392
|
+
onTooltipHintSwitch: p,
|
|
396
393
|
discreteAxesLabels: this.discreteAxesLabels
|
|
397
394
|
}
|
|
398
395
|
) });
|
|
399
|
-
this.component = W, (
|
|
396
|
+
this.component = W, (d = this.reactRoot) == null || d.render(W);
|
|
400
397
|
}
|
|
401
398
|
renderError(t) {
|
|
402
399
|
var i;
|
|
403
|
-
(i = this.reactRoot) == null || i.render(/* @__PURE__ */
|
|
400
|
+
(i = this.reactRoot) == null || i.render(/* @__PURE__ */ F.jsx(at, { message: t }));
|
|
404
401
|
}
|
|
405
402
|
}
|
|
406
403
|
export {
|