@milaboratories/miplots4 1.0.127 → 1.0.129
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/heatmap/ChartRenderer.d.ts.map +1 -1
- package/dist/heatmap/ChartRenderer.js +251 -233
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/components/Captions/GroupCaptions.d.ts.map +1 -1
- package/dist/heatmap/components/Captions/GroupCaptions.js +45 -36
- package/dist/heatmap/components/Captions/GroupCaptions.js.map +1 -1
- package/dist/heatmap/components/Chart.d.ts.map +1 -1
- package/dist/heatmap/components/Chart.js +71 -69
- package/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/heatmap/components/Dendrograms.d.ts +3 -1
- package/dist/heatmap/components/Dendrograms.d.ts.map +1 -1
- package/dist/heatmap/components/Dendrograms.js +54 -48
- package/dist/heatmap/components/Dendrograms.js.map +1 -1
- package/dist/heatmap/components/types.d.ts +2 -2
- package/dist/heatmap/components/types.d.ts.map +1 -1
- package/dist/heatmap/getDendrograms.d.ts +2 -2
- package/dist/heatmap/getDendrograms.d.ts.map +1 -1
- package/dist/heatmap/getDendrograms.js +36 -36
- package/dist/heatmap/getDendrograms.js.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.d.ts +2 -2
- package/dist/heatmap/utils/calculateCaptionTails.d.ts.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.js +89 -54
- package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/heatmap/utils/calculateChartSideElementSizes.js +19 -19
- package/dist/heatmap/utils/calculateChartSideElementSizes.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +191 -178
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.js +3 -3
- package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.d.ts +3 -9
- package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +183 -186
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/components/Lasso.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/Lasso.js +141 -117
- package/dist/scatterplot-umap/components/Lasso.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.d.ts +1 -5
- package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +59 -60
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.js +29 -31
- package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
- package/dist/scatterplot-umap/index.d.ts +0 -4
- package/dist/scatterplot-umap/index.d.ts.map +1 -1
- package/dist/scatterplot-umap/index.js +92 -97
- package/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/scatterplot-umap/types.d.ts +0 -4
- package/dist/scatterplot-umap/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { j as
|
|
5
|
-
import { Error as
|
|
6
|
-
import { DEFAULT_HEIGHT as
|
|
7
|
-
import { FACET_TITLE_LINE as
|
|
8
|
-
import { splitTextByWidth as
|
|
9
|
-
import { MIN_MARGIN as
|
|
10
|
-
import { createAesGetter as
|
|
11
|
-
import { getTicksAndFormat as
|
|
12
|
-
import { isContinuousAes as
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var J = (h, i, t) => i in h ? $(h, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[i] = t;
|
|
3
|
+
var E = (h, i, t) => J(h, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { j as L } from "../node_modules/react/jsx-runtime.js";
|
|
5
|
+
import { Error as k } from "../common/Error.js";
|
|
6
|
+
import { DEFAULT_HEIGHT as X, DEFAULT_WIDTH as G, TITLE_LINE_HEIGHT as K, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as y, BLACK as Z, TITLE_MARGIN as tt } from "../constants.js";
|
|
7
|
+
import { FACET_TITLE_LINE as it } from "../discrete/constants.js";
|
|
8
|
+
import { splitTextByWidth as U } from "../discrete/utils/splitTextByWidth.js";
|
|
9
|
+
import { MIN_MARGIN as W, PADDINGS as B, DEFAULT_DOT_AES as R, LEGEND_OFFSET as et, TICK_OFFSET as O, DEFAULT_TICKS_SIZE as j, MIN_PADDING as D, FACET_TITLE_OFFSET as st, FACET_AXIS_OFFSET as P, TITLE_LINE as V } from "./constants.js";
|
|
10
|
+
import { createAesGetter as _ } from "./utils/createAesGetter.js";
|
|
11
|
+
import { getTicksAndFormat as ot } from "./utils/getTicksAndFormat.js";
|
|
12
|
+
import { isContinuousAes as q } from "../types/common.js";
|
|
13
13
|
import "../types/discrete.js";
|
|
14
14
|
import "../types/scatterplot.js";
|
|
15
15
|
import "../types/heatmap.js";
|
|
16
16
|
import "../types/dendro.js";
|
|
17
17
|
import "../types/histogram.js";
|
|
18
18
|
import "../types/bubble.js";
|
|
19
|
-
import { getContinuousColorScale as
|
|
20
|
-
import { getContinuousLegendTicks as
|
|
21
|
-
import { TextMeasurer as
|
|
22
|
-
import { createRoot as
|
|
23
|
-
import { ChartsGroup as
|
|
24
|
-
import { arrangeLegendParts as
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import { sqrt as
|
|
30
|
-
function
|
|
19
|
+
import { getContinuousColorScale as nt } from "../utils/getContinuousColorScale.js";
|
|
20
|
+
import { getContinuousLegendTicks as at } from "../utils/getContinuousLegendTicks.js";
|
|
21
|
+
import { TextMeasurer as ht } from "../utils/TextMeasurer.js";
|
|
22
|
+
import { createRoot as rt } from "../node_modules/react-dom/client.js";
|
|
23
|
+
import { ChartsGroup as lt } from "./components/ChartsGroup.js";
|
|
24
|
+
import { arrangeLegendParts as ct } from "../utils/arrangeLegendParts.js";
|
|
25
|
+
import b from "../node_modules/d3-scale/src/linear.js";
|
|
26
|
+
import Q from "../node_modules/d3-scale/src/log.js";
|
|
27
|
+
import mt from "../node_modules/d3-scale/src/ordinal.js";
|
|
28
|
+
import dt from "../node_modules/d3-scale/src/symlog.js";
|
|
29
|
+
import { sqrt as pt } from "../node_modules/d3-scale/src/pow.js";
|
|
30
|
+
function ut(h, i, t, e) {
|
|
31
31
|
const s = [];
|
|
32
|
-
return
|
|
32
|
+
return h % t === t - 1 && s.push("right"), h % t === 0 && s.push("left"), h < t && s.push("top"), (Math.ceil((h + 1) / t) === e || Math.ceil((h + 1) / t) === e - 1 && h % t > (i - 1) % t) && s.push("bottom"), s;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const
|
|
34
|
+
function gt(h, i, t, e, s, a, p) {
|
|
35
|
+
const u = a.includes("left") || !(p != null && p.sharedY), F = a.includes("left") && i.title !== "", H = a.includes("bottom") || !(p != null && p.sharedX), N = a.includes("bottom") && h.title !== "", r = t.yAxisCaptionsWidth + 2 * O, o = (i.showTicks ? j : 0) + O, d = F ? V + D : 0, x = t.xAxisCaptionsWidth + 2 * O, z = h.showTicks ? j : 0, l = N ? V + D : 0, c = r + o + d + P, f = x + z + l + P, S = Math.max(...e.map((m) => s[m].length));
|
|
36
36
|
return {
|
|
37
|
-
left:
|
|
38
|
-
top:
|
|
39
|
-
bottom:
|
|
40
|
-
right:
|
|
37
|
+
left: u ? c : D,
|
|
38
|
+
top: S === 0 ? 0 : st * 2 + S * it,
|
|
39
|
+
bottom: H ? f + 8 : D,
|
|
40
|
+
right: D
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function ft(h, i, t) {
|
|
44
44
|
const e = [];
|
|
45
45
|
for (let s = 0; s < i; s++)
|
|
46
|
-
e.push(
|
|
46
|
+
e.push(h.slice(s * t, s * t + t));
|
|
47
47
|
return e;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const t = Math.floor(
|
|
49
|
+
function Tt(h, i) {
|
|
50
|
+
const t = Math.floor(h / i), e = h - t * i;
|
|
51
51
|
return [t, e];
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const e = i.find((
|
|
53
|
+
function St(h, i, t) {
|
|
54
|
+
const e = i.find((a) => a.type === "dots"), s = i.find((a) => a.type === "curve");
|
|
55
55
|
return {
|
|
56
|
-
dotShape:
|
|
57
|
-
dotColor:
|
|
58
|
-
dotSize:
|
|
59
|
-
lineShape:
|
|
60
|
-
lineColor:
|
|
61
|
-
trendColor:
|
|
56
|
+
dotShape: _(h, (e == null ? void 0 : e.aes.dotShape) ?? R.shape, "dotShape"),
|
|
57
|
+
dotColor: _(h, (e == null ? void 0 : e.aes.dotFill) ?? R.color, "dotFill"),
|
|
58
|
+
dotSize: _(h, (e == null ? void 0 : e.aes.dotSize) ?? R.size, "dotSize"),
|
|
59
|
+
lineShape: _(h, (s == null ? void 0 : s.aes.lineShape) ?? "solid", "lineShape"),
|
|
60
|
+
lineColor: _(h, (s == null ? void 0 : s.aes.lineColor) ?? Z, "lineColor"),
|
|
61
|
+
trendColor: _(h, (t == null ? void 0 : t.color) ?? R.color, "fillColor")
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
class
|
|
64
|
+
class qt {
|
|
65
65
|
constructor() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
top:
|
|
72
|
-
bottom:
|
|
73
|
-
left:
|
|
74
|
-
right:
|
|
66
|
+
E(this, "reactRoot", null);
|
|
67
|
+
E(this, "parentNode", null);
|
|
68
|
+
E(this, "rootNode", null);
|
|
69
|
+
E(this, "component", /* @__PURE__ */ L.jsx(L.Fragment, {}));
|
|
70
|
+
E(this, "margins", {
|
|
71
|
+
top: W,
|
|
72
|
+
bottom: W,
|
|
73
|
+
left: W,
|
|
74
|
+
right: W
|
|
75
75
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
chartWidth:
|
|
76
|
+
E(this, "chartsDimensions", {});
|
|
77
|
+
E(this, "chartSizes", {
|
|
78
|
+
chartWidth: G,
|
|
79
79
|
// width of single chart
|
|
80
|
-
chartHeight:
|
|
80
|
+
chartHeight: X,
|
|
81
81
|
// height of single chart
|
|
82
|
-
chartsWidth:
|
|
82
|
+
chartsWidth: G,
|
|
83
83
|
// width of all charts in charts row
|
|
84
|
-
chartsHeight:
|
|
84
|
+
chartsHeight: X,
|
|
85
85
|
// width of all charts in charts column, without axes
|
|
86
|
-
totalWidth:
|
|
86
|
+
totalWidth: G,
|
|
87
87
|
// width of all charts in charts row, plus left axis, plus legend
|
|
88
|
-
totalHeight:
|
|
88
|
+
totalHeight: X
|
|
89
89
|
// width of all charts in charts height, plus bottom axis, plus top title
|
|
90
90
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
x: { null:
|
|
95
|
-
y: { null:
|
|
91
|
+
E(this, "columnsCount", 1);
|
|
92
|
+
E(this, "rowsCount", 1);
|
|
93
|
+
E(this, "scales", {
|
|
94
|
+
x: { null: b().domain([0, 10]).range([0, G]) },
|
|
95
|
+
y: { null: b().domain([0, 10]).range([X, 0]) }
|
|
96
96
|
});
|
|
97
|
-
|
|
97
|
+
E(this, "captionsSizes", {
|
|
98
98
|
xAxisCaptionsWidth: 30,
|
|
99
99
|
yAxisCaptionsWidth: 100
|
|
100
100
|
});
|
|
101
|
-
|
|
101
|
+
E(this, "facetTitles", {});
|
|
102
102
|
// can be multiline
|
|
103
|
-
|
|
103
|
+
E(this, "mainTitle", []);
|
|
104
104
|
// can be multiline
|
|
105
|
-
|
|
105
|
+
E(this, "legend", { width: 0, height: 0, items: [] });
|
|
106
106
|
}
|
|
107
107
|
clear() {
|
|
108
108
|
var i;
|
|
@@ -112,94 +112,107 @@ class Ot {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
init(i) {
|
|
115
|
-
this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot =
|
|
115
|
+
this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = rt(this.rootNode));
|
|
116
116
|
}
|
|
117
117
|
updateChartSizes(i) {
|
|
118
118
|
this.chartSizes.chartWidth = i.width, this.chartSizes.chartHeight = i.height;
|
|
119
119
|
}
|
|
120
120
|
updateChartDimensions(i, t, e, s) {
|
|
121
|
-
const { chartWidth:
|
|
122
|
-
let
|
|
123
|
-
this.chartsDimensions = i.reduce((
|
|
124
|
-
const [
|
|
121
|
+
const { chartWidth: a, chartHeight: p } = this.chartSizes;
|
|
122
|
+
let u = 0, F = 0;
|
|
123
|
+
this.chartsDimensions = i.reduce((r, o, d) => {
|
|
124
|
+
const [x, z] = Tt(d, this.columnsCount), l = ut(d, i.length, this.columnsCount, this.rowsCount), c = gt(
|
|
125
125
|
e,
|
|
126
126
|
s,
|
|
127
127
|
this.captionsSizes,
|
|
128
|
-
|
|
128
|
+
ft(i, this.rowsCount, this.columnsCount)[x],
|
|
129
129
|
this.facetTitles,
|
|
130
|
-
|
|
130
|
+
l,
|
|
131
131
|
t
|
|
132
|
-
),
|
|
133
|
-
return
|
|
134
|
-
left:
|
|
135
|
-
top:
|
|
136
|
-
chartEdgeSides:
|
|
137
|
-
padding:
|
|
138
|
-
inner: { width:
|
|
139
|
-
outer: { width:
|
|
140
|
-
},
|
|
132
|
+
), f = a + c.left + c.right, S = p + c.top + c.bottom;
|
|
133
|
+
return r[o] = {
|
|
134
|
+
left: u,
|
|
135
|
+
top: F,
|
|
136
|
+
chartEdgeSides: l,
|
|
137
|
+
padding: c,
|
|
138
|
+
inner: { width: a, height: p },
|
|
139
|
+
outer: { width: f, height: S }
|
|
140
|
+
}, u += f, z === this.columnsCount - 1 && (u = 0, F += S), r;
|
|
141
141
|
}, {});
|
|
142
|
-
const
|
|
143
|
-
...i.map((
|
|
144
|
-
),
|
|
145
|
-
...i.map((
|
|
142
|
+
const H = Math.max(
|
|
143
|
+
...i.map((r) => this.chartsDimensions[r].outer.width + this.chartsDimensions[r].left)
|
|
144
|
+
), N = Math.max(
|
|
145
|
+
...i.map((r) => this.chartsDimensions[r].outer.height + this.chartsDimensions[r].top)
|
|
146
146
|
);
|
|
147
|
-
this.chartSizes.chartsWidth =
|
|
147
|
+
this.chartSizes.chartsWidth = H, this.chartSizes.chartsHeight = N;
|
|
148
148
|
}
|
|
149
|
-
updateViewport(i, t, e, s,
|
|
150
|
-
const
|
|
151
|
-
this.columnsCount = t.nRows ? Math.ceil(
|
|
152
|
-
let [
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
return
|
|
156
|
-
}, {});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
149
|
+
updateViewport(i, t, e, s, a, p) {
|
|
150
|
+
const u = i.length, F = Math.min(t.nRows ?? u, u), H = Math.min(t.nCols ?? u, u);
|
|
151
|
+
this.columnsCount = t.nRows ? Math.ceil(u / F) : H, this.rowsCount = Math.ceil(u / this.columnsCount);
|
|
152
|
+
let [N, r] = [1 / 0, -1 / 0], [o, d] = [1 / 0, -1 / 0];
|
|
153
|
+
const x = i.reduce((m, n) => {
|
|
154
|
+
const w = a[n], { minX: g, minY: T, maxX: Y, maxY: A } = w;
|
|
155
|
+
return N = Math.min(N, g), o = Math.min(o, T), r = Math.max(r, Y), d = Math.max(d, A), m[n] = { minX: g, maxX: Y, minY: T, maxY: A }, m;
|
|
156
|
+
}, {}), z = {}, l = {};
|
|
157
|
+
let c = !1, f = !1;
|
|
158
|
+
i.forEach((m) => {
|
|
159
|
+
const n = e.scale === "log" ? Q() : b(), w = x[m];
|
|
160
|
+
let g = e.lowerValue ? Number(e.lowerValue) : t.sharedX ? N : w.minX, T = e.upperValue ? Number(e.upperValue) : t.sharedX ? r : w.maxX;
|
|
160
161
|
if (typeof e.symmetricRange < "u") {
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
|
|
162
|
+
const M = e.symmetricRange;
|
|
163
|
+
if (M >= g && M <= T) {
|
|
164
|
+
const C = Math.max(M - g, T - M);
|
|
165
|
+
g = M - C, T = M + C;
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
|
-
const
|
|
168
|
-
|
|
168
|
+
const Y = [0, this.chartSizes.chartWidth], A = n.copy().domain([g, T]).range([B.LEFT, this.chartSizes.chartWidth - B.RIGHT]);
|
|
169
|
+
n.domain([A.invert(0), A.invert(this.chartSizes.chartWidth)]).range(Y).nice();
|
|
170
|
+
const I = this.scales.x[m];
|
|
171
|
+
if (I && !c) {
|
|
172
|
+
const M = I.domain(), C = I.domain();
|
|
173
|
+
(M[0] !== n.domain()[0] || M[1] !== n.domain()[1] || C[0] !== n.range()[0] || C[1] !== n.range()[1]) && (c = !0);
|
|
174
|
+
}
|
|
175
|
+
z[m] = n;
|
|
169
176
|
});
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
return n
|
|
173
|
-
(
|
|
174
|
-
const
|
|
175
|
-
return
|
|
177
|
+
const S = i.reduce((m, n) => {
|
|
178
|
+
const w = p ? p[n] : [];
|
|
179
|
+
return m[n] = w.reduce(
|
|
180
|
+
(g, T) => {
|
|
181
|
+
const Y = T.bounded ? T.xBounds : this.scales.x[n].domain(), A = T.getInterval(Y[0]), I = T.getInterval(Y[1]);
|
|
182
|
+
return g.minY = Math.min(g.minY, isNaN(A.left) ? g.minY : A.left, isNaN(I.left) ? g.minY : I.left), g.maxY = Math.max(g.maxY, isNaN(A.right) ? g.maxY : A.right, isNaN(I.right) ? g.maxY : I.right), g;
|
|
176
183
|
},
|
|
177
184
|
{ minY: 1 / 0, maxY: -1 / 0 }
|
|
178
|
-
),
|
|
185
|
+
), o = Math.min(o, m[n].minY), d = Math.max(d, m[n].maxY), m;
|
|
179
186
|
}, {});
|
|
180
|
-
i.forEach((
|
|
181
|
-
const
|
|
182
|
-
let
|
|
187
|
+
i.forEach((m) => {
|
|
188
|
+
const n = s.scale === "log" ? Q() : b(), w = x[m], g = S[m];
|
|
189
|
+
let T = s.lowerValue ? Number(s.lowerValue) : t.sharedY ? o : Math.min(w.minY, g.minY), Y = s.upperValue ? Number(s.upperValue) : t.sharedY ? d : Math.max(w.maxY, g.maxY);
|
|
183
190
|
if (typeof s.symmetricRange < "u") {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
|
|
191
|
+
const C = s.symmetricRange;
|
|
192
|
+
if (C >= T && C <= Y) {
|
|
193
|
+
const v = Math.max(C - T, Y - C);
|
|
194
|
+
T = C - v, Y = C + v;
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
const A = [this.chartSizes.chartHeight, 0], I = n.copy().domain([T, Y]).range([this.chartSizes.chartHeight - B.BOTTOM, B.TOP]);
|
|
198
|
+
n.domain([I.invert(this.chartSizes.chartHeight), I.invert(0)]).range(A).nice();
|
|
199
|
+
const M = this.scales.y[m];
|
|
200
|
+
if (M && !f) {
|
|
201
|
+
const C = M.domain(), v = M.domain();
|
|
202
|
+
(C[0] !== n.domain()[0] || C[1] !== n.domain()[1] || v[0] !== n.range()[0] || v[1] !== n.range()[1]) && (f = !0);
|
|
203
|
+
}
|
|
204
|
+
l[m] = n;
|
|
205
|
+
}), c && (this.scales.x = z), f && (this.scales.y = l);
|
|
193
206
|
}
|
|
194
207
|
updateCaptionsSize(i) {
|
|
195
|
-
const t = new
|
|
208
|
+
const t = new ht("600 14px Arial");
|
|
196
209
|
let e = 0;
|
|
197
|
-
function s(
|
|
198
|
-
return Math.max(...
|
|
210
|
+
function s(a) {
|
|
211
|
+
return Math.max(...a.map((p) => t.getTextWidth(p)));
|
|
199
212
|
}
|
|
200
|
-
Object.values(this.scales.y).forEach((
|
|
201
|
-
const { ticks:
|
|
202
|
-
e = Math.max(e, s(
|
|
213
|
+
Object.values(this.scales.y).forEach((a) => {
|
|
214
|
+
const { ticks: p, format: u } = ot(a, i);
|
|
215
|
+
e = Math.max(e, s(p.map(u)));
|
|
203
216
|
}), this.captionsSizes = {
|
|
204
217
|
xAxisCaptionsWidth: 20,
|
|
205
218
|
yAxisCaptionsWidth: e
|
|
@@ -207,22 +220,22 @@ class Ot {
|
|
|
207
220
|
}
|
|
208
221
|
createMainTitle(i, t) {
|
|
209
222
|
const e = this.chartsDimensions[i[0]], s = this.chartsDimensions[i[i.length - 1]];
|
|
210
|
-
this.mainTitle =
|
|
223
|
+
this.mainTitle = U(
|
|
211
224
|
t.name,
|
|
212
225
|
this.chartSizes.chartsWidth - e.padding.left - s.padding.right,
|
|
213
226
|
20
|
|
214
227
|
);
|
|
215
228
|
}
|
|
216
229
|
createFacetTitles(i, t) {
|
|
217
|
-
this.facetTitles = i.reduce((e, s,
|
|
230
|
+
this.facetTitles = i.reduce((e, s, a) => (t[a].length === 1 && t[a][0] === "null" ? e[s] = [] : e[s] = U(t[a].join(", "), this.chartSizes.chartWidth, 14), e), {});
|
|
218
231
|
}
|
|
219
232
|
updateMargins() {
|
|
220
|
-
const i =
|
|
233
|
+
const i = K * this.mainTitle.length, t = i > 0 ? i + tt * 2 : 0;
|
|
221
234
|
this.margins = {
|
|
222
|
-
top: Math.max(t,
|
|
223
|
-
bottom:
|
|
224
|
-
left:
|
|
225
|
-
right: this.legend.width +
|
|
235
|
+
top: Math.max(t, W),
|
|
236
|
+
bottom: W,
|
|
237
|
+
left: W,
|
|
238
|
+
right: this.legend.width + W
|
|
226
239
|
}, 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;
|
|
227
240
|
}
|
|
228
241
|
updateLegendSize(i, t, e, s) {
|
|
@@ -230,50 +243,50 @@ class Ot {
|
|
|
230
243
|
this.legend = { width: 0, height: 0, items: [] };
|
|
231
244
|
return;
|
|
232
245
|
}
|
|
233
|
-
const
|
|
234
|
-
if (e.forEach((
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
246
|
+
const a = [], p = { width: 0, height: 0, left: 0, top: 0 };
|
|
247
|
+
if (e.forEach((r) => {
|
|
248
|
+
const o = t[r.value];
|
|
249
|
+
if (o.usedAes.length === 0 || !o.aesMap)
|
|
237
250
|
return;
|
|
238
|
-
if (
|
|
239
|
-
console.warn(`Too many values for discrete legend (${
|
|
251
|
+
if (o.values.length > y) {
|
|
252
|
+
console.warn(`Too many values for discrete legend (${o.values.length})`);
|
|
240
253
|
return;
|
|
241
254
|
}
|
|
242
255
|
const d = {};
|
|
243
|
-
|
|
244
|
-
d[
|
|
245
|
-
var
|
|
246
|
-
(
|
|
256
|
+
o.values.forEach((l) => {
|
|
257
|
+
d[l] || (d[l] = { ...R }), o.usedAes.forEach((c) => {
|
|
258
|
+
var f, S, m;
|
|
259
|
+
(c === "dotFill" || c === "lineColor") && (d[l].color = ((f = o.aesMap[l]) == null ? void 0 : f[c]) ?? Z), c === "dotShape" && (d[l].shape = ((S = o.aesMap[l]) == null ? void 0 : S[c]) ?? "21"), c === "dotSize" && (d[l].size = ((m = o.aesMap[l]) == null ? void 0 : m[c]) ?? 3);
|
|
247
260
|
});
|
|
248
261
|
});
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
}), s.forEach((
|
|
252
|
-
if (
|
|
253
|
-
const { domain:
|
|
254
|
-
|
|
262
|
+
const x = r.label ?? r.value, z = mt().domain(o.values).range(o.values.map((l) => d[l])).unknown(R);
|
|
263
|
+
a.push({ ...p, id: r.value, type: "dots", title: x, scale: z, values: o.values, labels: o.labels });
|
|
264
|
+
}), s.forEach((r) => {
|
|
265
|
+
if (r.type === "dots" && q(r.aes.dotFill)) {
|
|
266
|
+
const { domain: o, range: d, columnName: x, type: z = "linear" } = r.aes.dotFill, l = x.label ?? x.value, c = nt(d, o, "linear"), f = (z === "log" ? dt() : b()).domain(o).range([this.chartSizes.chartHeight, 0]), S = at(f, o);
|
|
267
|
+
a.push({ ...p, id: "dotFill", type: "continuous", title: l, scale: c, tickPositionScale: f, values: S });
|
|
255
268
|
}
|
|
256
|
-
if (
|
|
257
|
-
const { columnName:
|
|
258
|
-
|
|
269
|
+
if (r.type === "dots" && q(r.aes.dotSize)) {
|
|
270
|
+
const { columnName: o, domain: d, range: x } = r.aes.dotSize, z = o.label ?? o.value, l = pt(d, x), c = l.ticks(3), f = l.tickFormat(3), S = c.reduce((m, n) => (m[String(n)] = f(n), m), {});
|
|
271
|
+
a.push({ ...p, id: o.value, type: "size", title: z, scale: l, values: c, labels: S });
|
|
259
272
|
}
|
|
260
|
-
}), !
|
|
273
|
+
}), !a.length) {
|
|
261
274
|
this.legend = { width: 0, height: 0, items: [] };
|
|
262
275
|
return;
|
|
263
276
|
}
|
|
264
|
-
const
|
|
277
|
+
const u = ct(a, this.chartSizes.chartHeight), F = u[u.length - 1], H = F.left + F.width + et, N = this.chartSizes.chartHeight;
|
|
265
278
|
this.legend = {
|
|
266
|
-
width:
|
|
267
|
-
height:
|
|
268
|
-
items:
|
|
279
|
+
width: H,
|
|
280
|
+
height: N,
|
|
281
|
+
items: u
|
|
269
282
|
};
|
|
270
283
|
}
|
|
271
|
-
render(i, t, e, s,
|
|
272
|
-
var
|
|
273
|
-
const { xAxis:
|
|
274
|
-
this.updateChartSizes(
|
|
275
|
-
const
|
|
276
|
-
|
|
284
|
+
render(i, t, e, s, a, p, u, F, H, N, r, o, d, x, z) {
|
|
285
|
+
var w;
|
|
286
|
+
const { xAxis: l, yAxis: c, size: f, title: S, legend: m } = t;
|
|
287
|
+
this.updateChartSizes(f), this.updateViewport(s, e, l, c, p, u), this.updateCaptionsSize(H.y), this.createFacetTitles(s, a), this.updateChartDimensions(s, e, l, c), this.updateLegendSize(m, N, o, d), this.createMainTitle(s, S), this.updateMargins();
|
|
288
|
+
const n = /* @__PURE__ */ L.jsx(
|
|
289
|
+
lt,
|
|
277
290
|
{
|
|
278
291
|
settingsId: i,
|
|
279
292
|
chartSettings: t,
|
|
@@ -282,29 +295,29 @@ class Ot {
|
|
|
282
295
|
chartSizes: this.chartSizes,
|
|
283
296
|
chartsDimensions: this.chartsDimensions,
|
|
284
297
|
scales: this.scales,
|
|
285
|
-
groupedDots:
|
|
286
|
-
trendsData:
|
|
298
|
+
groupedDots: p,
|
|
299
|
+
trendsData: u,
|
|
287
300
|
legendData: this.legend,
|
|
288
301
|
columnsCount: this.columnsCount,
|
|
289
302
|
margins: this.margins,
|
|
290
|
-
keyColumn:
|
|
303
|
+
keyColumn: F,
|
|
291
304
|
mainTitle: this.mainTitle,
|
|
292
305
|
facetTitles: this.facetTitles,
|
|
293
306
|
captionsSizes: this.captionsSizes,
|
|
294
|
-
onlyPositive:
|
|
295
|
-
layersData:
|
|
296
|
-
aesGetters:
|
|
297
|
-
onTooltipHintSwitch:
|
|
307
|
+
onlyPositive: H,
|
|
308
|
+
layersData: r,
|
|
309
|
+
aesGetters: St(N, d, x),
|
|
310
|
+
onTooltipHintSwitch: z
|
|
298
311
|
}
|
|
299
312
|
);
|
|
300
|
-
this.component =
|
|
313
|
+
this.component = n, (w = this.reactRoot) == null || w.render(n);
|
|
301
314
|
}
|
|
302
315
|
renderError(i) {
|
|
303
316
|
var t;
|
|
304
|
-
(t = this.reactRoot) == null || t.render(/* @__PURE__ */
|
|
317
|
+
(t = this.reactRoot) == null || t.render(/* @__PURE__ */ L.jsx(k, { message: i }));
|
|
305
318
|
}
|
|
306
319
|
}
|
|
307
320
|
export {
|
|
308
|
-
|
|
321
|
+
qt as default
|
|
309
322
|
};
|
|
310
323
|
//# sourceMappingURL=ChartRenderer.js.map
|