@milaboratories/miplots4 1.0.134 → 1.0.136
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/{discrete/components → common}/BandAxis.d.ts +2 -2
- package/dist/common/BandAxis.d.ts.map +1 -0
- package/dist/{discrete/components → common}/BandAxis.js +3 -3
- package/dist/common/BandAxis.js.map +1 -0
- package/dist/common/ContinuousGrid.d.ts +3 -3
- package/dist/common/ContinuousGrid.d.ts.map +1 -1
- package/dist/common/ContinuousGrid.js.map +1 -1
- package/dist/discrete/ChartRenderer.d.ts.map +1 -1
- package/dist/discrete/ChartRenderer.js +192 -265
- package/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/discrete/components/Chart.js +1 -1
- package/dist/discrete/components/Chart.js.map +1 -1
- package/dist/discrete/components/Grid.d.ts +3 -3
- package/dist/discrete/components/Grid.d.ts.map +1 -1
- package/dist/discrete/components/Grid.js.map +1 -1
- package/dist/discrete/components/types.d.ts +5 -3
- package/dist/discrete/components/types.d.ts.map +1 -1
- package/dist/discrete/utils/index.d.ts +1 -1
- package/dist/discrete/utils/index.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +48 -48
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.js +28 -28
- package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/histogram/ChartRenderer.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/node_modules/d3-scale/src/band.js +45 -35
- package/dist/node_modules/d3-scale/src/band.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.d.ts +10 -5
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +276 -197
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +5 -3
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +53 -53
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/Chart.d.ts +3 -1
- package/dist/scatterplot/components/Chart.d.ts.map +1 -1
- package/dist/scatterplot/components/Chart.js +23 -19
- package/dist/scatterplot/components/Chart.js.map +1 -1
- package/dist/scatterplot/components/ChartAxis.d.ts +3 -1
- package/dist/scatterplot/components/ChartAxis.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartAxis.js +31 -27
- package/dist/scatterplot/components/ChartAxis.js.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.js +20 -17
- package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.d.ts +5 -1
- package/dist/scatterplot/components/ChartsGroup.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.js +49 -46
- package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/scatterplot/components/Grid.d.ts +3 -3
- package/dist/scatterplot/components/Grid.d.ts.map +1 -1
- package/dist/scatterplot/components/Grid.js +31 -27
- package/dist/scatterplot/components/Grid.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +15 -5
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot/dots.d.ts +2 -2
- package/dist/scatterplot/dots.d.ts.map +1 -1
- package/dist/scatterplot/dots.js.map +1 -1
- package/dist/scatterplot/getLayersData.d.ts +3 -2
- package/dist/scatterplot/getLayersData.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.js +29 -18
- package/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/scatterplot/index.d.ts +3 -0
- package/dist/scatterplot/index.d.ts.map +1 -1
- package/dist/scatterplot/index.js +73 -59
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot/linearRegression.d.ts +4 -6
- package/dist/scatterplot/linearRegression.d.ts.map +1 -1
- package/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/scatterplot/utils/isNumericScale.d.ts +6 -0
- package/dist/scatterplot/utils/isNumericScale.d.ts.map +1 -0
- package/dist/scatterplot/utils/isNumericScale.js +11 -0
- package/dist/scatterplot/utils/isNumericScale.js.map +1 -0
- package/dist/scatterplot-umap/ChartRenderer.js +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +7 -4
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +7 -7
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/types/bubble.d.ts +12 -12
- package/dist/types/common.d.ts +186 -21
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +36 -26
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +22 -22
- package/dist/types/discrete.d.ts +23 -53
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/discrete.js +35 -35
- package/dist/types/discrete.js.map +1 -1
- package/dist/types/heatmap.d.ts +12 -12
- package/dist/types/histogram.d.ts +4 -4
- package/dist/types/scatterplot-umap.d.ts +4 -34
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +1 -1
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +186 -32
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/utils/createMultilineDiscreteLabels.d.ts +4 -0
- package/dist/utils/createMultilineDiscreteLabels.d.ts.map +1 -0
- package/dist/utils/createMultilineDiscreteLabels.js +32 -0
- package/dist/utils/createMultilineDiscreteLabels.js.map +1 -0
- package/dist/utils/getFacetRowsColumns.d.ts +3 -0
- package/dist/utils/getFacetRowsColumns.d.ts.map +1 -0
- package/dist/utils/getFacetRowsColumns.js +18 -0
- package/dist/utils/getFacetRowsColumns.js.map +1 -0
- package/dist/utils/measureMultilineDiscreteLabels.d.ts +9 -0
- package/dist/utils/measureMultilineDiscreteLabels.d.ts.map +1 -0
- package/dist/utils/measureMultilineDiscreteLabels.js +63 -0
- package/dist/utils/measureMultilineDiscreteLabels.js.map +1 -0
- package/dist/utils/splitTextByWidth.d.ts.map +1 -0
- package/dist/{discrete/utils → utils}/splitTextByWidth.js +1 -1
- package/dist/utils/splitTextByWidth.js.map +1 -0
- package/package.json +1 -1
- package/dist/discrete/components/BandAxis.d.ts.map +0 -1
- package/dist/discrete/components/BandAxis.js.map +0 -1
- package/dist/discrete/utils/splitTextByWidth.d.ts.map +0 -1
- package/dist/discrete/utils/splitTextByWidth.js.map +0 -1
- package/dist/scatterplot/components/Axis.d.ts +0 -13
- package/dist/scatterplot/components/Axis.d.ts.map +0 -1
- package/dist/scatterplot/components/Axis.js +0 -59
- package/dist/scatterplot/components/Axis.js.map +0 -1
- /package/dist/{discrete/utils → utils}/splitTextByWidth.d.ts +0 -0
|
@@ -1,104 +1,96 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { j as
|
|
5
|
-
import
|
|
6
|
-
import { createRoot as
|
|
7
|
-
import { Error as
|
|
8
|
-
import { DataFrameProvider as
|
|
9
|
-
import { DEFAULT_HEIGHT as
|
|
10
|
-
import { DEFAULT_COMMON_AES as R, DEFAULT_TICKS_SIZE as
|
|
11
|
-
import { arrangeLegendParts as
|
|
12
|
-
import { TextMeasurer as
|
|
13
|
-
import { ChartsGroup as
|
|
14
|
-
import { DEFAULT_AES as
|
|
15
|
-
import { getChartStatsPadding as
|
|
16
|
-
import { splitTextByWidth as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
var S = Object.defineProperty;
|
|
2
|
+
var U = (c, i, t) => i in c ? S(c, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[i] = t;
|
|
3
|
+
var f = (c, i, t) => U(c, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { j as E } from "../node_modules/react/jsx-runtime.js";
|
|
5
|
+
import X from "../node_modules/lodash/lodash.js";
|
|
6
|
+
import { createRoot as k } from "../node_modules/react-dom/client.js";
|
|
7
|
+
import { Error as V } from "../common/Error.js";
|
|
8
|
+
import { DataFrameProvider as y } from "../common/useDataFrame.js";
|
|
9
|
+
import { DEFAULT_HEIGHT as z, DEFAULT_WIDTH as W, TITLE_LINE_HEIGHT as Z, TITLE_MARGIN as $ } from "../constants.js";
|
|
10
|
+
import { DEFAULT_COMMON_AES as R, DEFAULT_TICKS_SIZE as D } from "../scatterplot/constants.js";
|
|
11
|
+
import { arrangeLegendParts as q } from "../utils/arrangeLegendParts.js";
|
|
12
|
+
import { TextMeasurer as J } from "../utils/TextMeasurer/TextMeasurer.js";
|
|
13
|
+
import { ChartsGroup as Q } from "./components/ChartsGroup.js";
|
|
14
|
+
import { DEFAULT_AES as P, LEGEND_OFFSET as G, TICK_OFFSET as v, TITLE_LINE as _, MIN_PADDING as H, FACET_TITLE_OFFSET as K, FACET_TITLE_LINE as tt } from "./constants.js";
|
|
15
|
+
import { getChartStatsPadding as B } from "./utils/getChartStatsPadding.js";
|
|
16
|
+
import { splitTextByWidth as O } from "../utils/splitTextByWidth.js";
|
|
17
|
+
import { createMultilineDiscreteLabels as it } from "../utils/createMultilineDiscreteLabels.js";
|
|
18
|
+
import { measureMultilineDiscreteLabels as st } from "../utils/measureMultilineDiscreteLabels.js";
|
|
19
|
+
import { getFacetRows as et } from "../utils/getFacetRowsColumns.js";
|
|
20
|
+
import j from "../node_modules/d3-scale/src/ordinal.js";
|
|
21
|
+
import Y from "../node_modules/d3-scale/src/linear.js";
|
|
22
|
+
import F from "../node_modules/d3-scale/src/band.js";
|
|
23
|
+
import ot from "../node_modules/d3-scale/src/log.js";
|
|
24
|
+
function ht(c, i, t, s) {
|
|
25
|
+
const o = [];
|
|
26
|
+
return c % t === t - 1 && o.push("right"), c % t === 0 && o.push("left"), c < t && o.push("top"), (Math.ceil((c + 1) / t) === s || Math.ceil((c + 1) / t) === s - 1 && c % t > (i - 1) % t) && o.push("bottom"), o;
|
|
24
27
|
}
|
|
25
|
-
function nt(
|
|
26
|
-
const
|
|
28
|
+
function nt(c, i, t, s, o, h, r, e, l, p, u) {
|
|
29
|
+
const d = c === "vertical", T = r.includes("left") || d && !(e != null && e.sharedY) || !d && !(e != null && e.sharedX), a = r.includes("left") && t.title !== "", x = r.includes("bottom") || d && !(e != null && e.sharedX) || !d && !(e != null && e.sharedY), n = r.includes("bottom") && i.title !== "", A = s.leftAxisCaptionsWidth, C = (t.showTicks ? D : 0) + (t.hiddenLabels ? 0 : v), m = a ? _ : 0, g = d ? s.bottomAxisCaptionsWidthByRows[l] : s.leftAxisCaptionsWidthByColumns[p], b = (i.showTicks ? D : 0) + (i.hiddenLabels ? 0 : v), M = d && n || !d && a ? _ : 0, N = d ? A + C + m : g + b + M, I = d ? b + g + M : C + 2 * _, L = Math.max(...o.map((w) => h[w].length));
|
|
27
30
|
return {
|
|
28
|
-
left:
|
|
29
|
-
top:
|
|
30
|
-
bottom:
|
|
31
|
+
left: T ? N : H,
|
|
32
|
+
top: L === 0 ? 0 : K * 2 + L * tt,
|
|
33
|
+
bottom: x ? I : H,
|
|
31
34
|
right: u ? 0 : H
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
|
-
function at(
|
|
35
|
-
const
|
|
36
|
-
for (let e = 0; e < t; e++)
|
|
37
|
-
for (let r = 0; r < i; r++)
|
|
38
|
-
r * t + e < x.length && s[e].push(x[r * t + e]);
|
|
39
|
-
return s;
|
|
40
|
-
}
|
|
41
|
-
function U(x, i, t) {
|
|
42
|
-
const s = [];
|
|
43
|
-
for (let e = 0; e < i; e++)
|
|
44
|
-
s.push(x.slice(e * t, e * t + t));
|
|
45
|
-
return s;
|
|
46
|
-
}
|
|
47
|
-
function ht(x, i) {
|
|
48
|
-
const t = Math.floor(x / i), s = x - t * i;
|
|
37
|
+
function at(c, i) {
|
|
38
|
+
const t = Math.floor(c / i), s = c - t * i;
|
|
49
39
|
return [t, s];
|
|
50
40
|
}
|
|
51
|
-
function rt(
|
|
52
|
-
return typeof
|
|
41
|
+
function rt(c) {
|
|
42
|
+
return typeof c == "object" && "type" in c;
|
|
53
43
|
}
|
|
54
|
-
class
|
|
44
|
+
class It {
|
|
55
45
|
constructor() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
chartWidth:
|
|
46
|
+
f(this, "reactRoot", null);
|
|
47
|
+
f(this, "parentNode", null);
|
|
48
|
+
f(this, "rootNode", null);
|
|
49
|
+
f(this, "component", /* @__PURE__ */ E.jsx(E.Fragment, {}));
|
|
50
|
+
f(this, "chartsDimensions", {});
|
|
51
|
+
f(this, "chartSizes", {
|
|
52
|
+
chartWidth: W,
|
|
63
53
|
// width of single chart
|
|
64
|
-
chartHeight:
|
|
54
|
+
chartHeight: z,
|
|
65
55
|
// height of single chart
|
|
66
|
-
chartsWidth:
|
|
56
|
+
chartsWidth: W,
|
|
67
57
|
// width of all charts in charts row
|
|
68
|
-
chartsHeight:
|
|
58
|
+
chartsHeight: z,
|
|
69
59
|
// width of all charts in charts column, without axes
|
|
70
|
-
totalWidth:
|
|
60
|
+
totalWidth: W,
|
|
71
61
|
// width of all charts in charts row, plus left axis, plus legend
|
|
72
|
-
totalHeight:
|
|
62
|
+
totalHeight: z
|
|
73
63
|
// width of all charts in charts height, plus bottom axis, plus top title
|
|
74
64
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
f(this, "columnsCount", 1);
|
|
66
|
+
f(this, "rowsCount", 1);
|
|
67
|
+
f(this, "scales", {
|
|
78
68
|
// Scale from primary grouping categories to every category x coordinate
|
|
79
|
-
xPrimary: { null:
|
|
69
|
+
xPrimary: { null: F().range([0, W]).domain(["1"]) },
|
|
80
70
|
// Scale from secondary grouping categories to x shift inside corresponding primary group
|
|
81
|
-
xSecondary: { null:
|
|
71
|
+
xSecondary: { null: F().range([0, W]).domain(["1"]) },
|
|
82
72
|
// Scale from y value to y coordinate, by facet
|
|
83
|
-
y: { null:
|
|
73
|
+
y: { null: Y().domain([0, 10]).range([z, 0]).nice() },
|
|
84
74
|
// Scale for link primary grouping category and aesthetics
|
|
85
|
-
xPrimaryAes:
|
|
75
|
+
xPrimaryAes: j().unknown(P),
|
|
86
76
|
// Scale for link secondary grouping category and aesthetics
|
|
87
|
-
xSecondaryAes:
|
|
77
|
+
xSecondaryAes: j().unknown(P)
|
|
88
78
|
});
|
|
89
|
-
|
|
79
|
+
f(this, "facetTitles", {});
|
|
90
80
|
// can be multiline
|
|
91
|
-
|
|
81
|
+
f(this, "mainTitle", []);
|
|
92
82
|
// can be multiline
|
|
93
|
-
|
|
83
|
+
f(this, "axisLabelsX", {});
|
|
94
84
|
// can be multiline
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
f(this, "captionsSizes", {
|
|
86
|
+
bottomAxisCaptionsWidthByRows: [],
|
|
87
|
+
leftAxisCaptionsWidthByColumns: [],
|
|
88
|
+
bottomCaptionsTail: 0,
|
|
89
|
+
leftCaptionsTail: 0,
|
|
90
|
+
leftAxisCaptionsWidth: 100
|
|
99
91
|
});
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
f(this, "legend", { width: 0, height: 0, items: [] });
|
|
93
|
+
f(this, "margins", { left: 0, right: 0, top: 0, bottom: 0 });
|
|
102
94
|
}
|
|
103
95
|
clear() {
|
|
104
96
|
var i;
|
|
@@ -108,210 +100,145 @@ class Nt {
|
|
|
108
100
|
});
|
|
109
101
|
}
|
|
110
102
|
init(i) {
|
|
111
|
-
this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot =
|
|
103
|
+
this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = k(this.rootNode));
|
|
112
104
|
}
|
|
113
|
-
updateChartSize(i, t, s,
|
|
114
|
-
const
|
|
115
|
-
this.columnsCount = s != null && s.nRows ? Math.ceil(u /
|
|
116
|
-
let { width:
|
|
117
|
-
|
|
105
|
+
updateChartSize(i, t, s, o, h, r) {
|
|
106
|
+
const e = i.innerOffset, l = i.innerOffset, p = B(r, o, i.innerOffset), u = t.length, d = Math.min((s == null ? void 0 : s.nRows) ?? u, u), T = Math.min((s == null ? void 0 : s.nCols) ?? u, u);
|
|
107
|
+
this.columnsCount = s != null && s.nRows ? Math.ceil(u / d) : T, this.rowsCount = Math.ceil(u / this.columnsCount);
|
|
108
|
+
let { width: a, height: x } = i;
|
|
109
|
+
h === "vertical" && p > e && (x += p), h === "horizontal" && p > l && (a += p), this.chartSizes.chartWidth = a, this.chartSizes.chartHeight = x;
|
|
118
110
|
}
|
|
119
|
-
updateChartDimensions(i, t, s,
|
|
120
|
-
const { chartWidth:
|
|
121
|
-
let
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
updateChartDimensions(i, t, s, o, h) {
|
|
112
|
+
const { chartWidth: r, chartHeight: e } = this.chartSizes;
|
|
113
|
+
let l = 0, p = 0;
|
|
114
|
+
const u = et(i, this.rowsCount, this.columnsCount);
|
|
115
|
+
this.chartsDimensions = i.reduce((a, x, n) => {
|
|
116
|
+
const [A, C] = at(n, this.columnsCount), m = ht(n, i.length, this.columnsCount, this.rowsCount), g = nt(
|
|
124
117
|
s,
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
o,
|
|
119
|
+
h,
|
|
127
120
|
this.captionsSizes,
|
|
128
|
-
|
|
121
|
+
u[A],
|
|
129
122
|
this.facetTitles,
|
|
130
|
-
|
|
123
|
+
m,
|
|
131
124
|
t,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
),
|
|
136
|
-
return
|
|
137
|
-
left:
|
|
138
|
-
top:
|
|
139
|
-
chartEdgeSides:
|
|
140
|
-
padding:
|
|
141
|
-
inner: { width:
|
|
142
|
-
outer: { width:
|
|
143
|
-
},
|
|
125
|
+
A,
|
|
126
|
+
C,
|
|
127
|
+
C === this.columnsCount - 1
|
|
128
|
+
), b = r + g.left + g.right, M = e + g.top + g.bottom;
|
|
129
|
+
return a[x] = {
|
|
130
|
+
left: l,
|
|
131
|
+
top: p,
|
|
132
|
+
chartEdgeSides: m,
|
|
133
|
+
padding: g,
|
|
134
|
+
inner: { width: r, height: e },
|
|
135
|
+
outer: { width: b, height: M }
|
|
136
|
+
}, l += b, C === this.columnsCount - 1 && (l = 0, p += M), a;
|
|
144
137
|
}, {});
|
|
145
|
-
const
|
|
146
|
-
...i.map((
|
|
138
|
+
const d = Math.max(
|
|
139
|
+
...i.map((a) => this.chartsDimensions[a].outer.width + this.chartsDimensions[a].left)
|
|
147
140
|
), T = Math.max(
|
|
148
|
-
...i.map((
|
|
141
|
+
...i.map((a) => this.chartsDimensions[a].outer.height + this.chartsDimensions[a].top)
|
|
149
142
|
);
|
|
150
|
-
this.chartSizes.chartsWidth =
|
|
143
|
+
this.chartSizes.chartsWidth = d, this.chartSizes.chartsHeight = T;
|
|
151
144
|
}
|
|
152
|
-
updateViewport(i, t, s,
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const g =
|
|
156
|
-
|
|
145
|
+
updateViewport(i, t, s, o, h, r, e, l, p, u) {
|
|
146
|
+
const d = p.innerOffset, T = i === "vertical", a = B(l, t, p.innerOffset), x = h === null || h.sharedX, n = h === null || h.sharedY, { chartHeight: A, chartWidth: C } = this.chartSizes;
|
|
147
|
+
o.forEach((m) => {
|
|
148
|
+
const g = r.scale === "log" ? ot() : Y(), b = Math.min(...n ? e.map(({ meta: L }) => L.minY) : e.map(({ geoms: L }) => Math.min(...L[m].map(({ boundsY: w }) => w.min)))), M = Math.max(...n ? e.map(({ meta: L }) => L.maxY) : e.map(({ geoms: L }) => Math.max(...L[m].map(({ boundsY: w }) => w.max)))), N = g.copy().domain([b, M]).range(
|
|
149
|
+
T ? [A - d, a] : [d, C - a]
|
|
157
150
|
);
|
|
158
|
-
g.domain([N.invert(
|
|
159
|
-
const
|
|
160
|
-
this.scales.xPrimary[
|
|
151
|
+
g.domain([N.invert(T ? A : 0), N.invert(T ? 0 : C)]).range(T ? [A, 0] : [0, C]), this.scales.y[m] = g;
|
|
152
|
+
const I = x ? t : u[m];
|
|
153
|
+
this.scales.xPrimary[m] = F().domain(I).range(T ? [0, C] : [A, 0]), this.scales.xSecondary[m] = F().domain(s).range([0, this.scales.xPrimary[m].bandwidth()]);
|
|
161
154
|
});
|
|
162
155
|
}
|
|
163
156
|
createFacetTitles(i, t) {
|
|
164
|
-
this.facetTitles = i.reduce((s,
|
|
157
|
+
this.facetTitles = i.reduce((s, o, h) => (t[h].length === 1 && t[h][0] === "null" ? s[o] = [] : s[o] = O(t[h].join(", "), this.chartSizes.chartWidth, 14), s), {});
|
|
165
158
|
}
|
|
166
159
|
createMainTitle(i, t) {
|
|
167
|
-
const s = this.chartsDimensions[i[0]],
|
|
168
|
-
this.mainTitle =
|
|
160
|
+
const s = this.chartsDimensions[i[0]], o = this.chartsDimensions[i[i.length - 1]];
|
|
161
|
+
this.mainTitle = O(
|
|
169
162
|
t.name,
|
|
170
|
-
this.chartSizes.chartsWidth - s.padding.left -
|
|
163
|
+
this.chartSizes.chartsWidth - s.padding.left - o.padding.right,
|
|
171
164
|
20
|
|
172
165
|
);
|
|
173
166
|
}
|
|
174
|
-
createAxisLabels(i, t, s,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.axisLabelsX = i.reduce((c, d) => {
|
|
184
|
-
const u = this.scales.xPrimary[d], T = u.bandwidth(), m = r[t.labelsPosition], M = t.labelsPosition === "center" ? Math.min(m, T) : m, f = s.valueLabels;
|
|
185
|
-
return c[d] = u.domain().reduce((l, h) => {
|
|
186
|
-
if (t.hiddenLabels)
|
|
187
|
-
return l[h] = [], l;
|
|
188
|
-
const n = f[h];
|
|
189
|
-
if (!p)
|
|
190
|
-
l[h] = [n];
|
|
191
|
-
else {
|
|
192
|
-
const a = o(t.labelsPosition, T), g = D(n, M, 14);
|
|
193
|
-
l[h] = g.length > a ? [n] : g;
|
|
194
|
-
}
|
|
195
|
-
return l;
|
|
196
|
-
}, {}), c;
|
|
197
|
-
}, {});
|
|
167
|
+
createAxisLabels(i, t, s, o) {
|
|
168
|
+
this.axisLabelsX = it(
|
|
169
|
+
i,
|
|
170
|
+
t.labelsPosition,
|
|
171
|
+
s.valueLabels,
|
|
172
|
+
t.hiddenLabels,
|
|
173
|
+
o,
|
|
174
|
+
this.scales.xPrimary
|
|
175
|
+
);
|
|
198
176
|
}
|
|
199
177
|
updateAesScales(i, t) {
|
|
200
178
|
if (i.inheritedAes) {
|
|
201
|
-
const { inheritedAes: s, keys:
|
|
202
|
-
this.scales.xPrimaryAes.domain(
|
|
179
|
+
const { inheritedAes: s, keys: o } = i;
|
|
180
|
+
this.scales.xPrimaryAes.domain(o).range(o.map((h) => s[h] ?? R));
|
|
203
181
|
} else
|
|
204
182
|
this.scales.xPrimaryAes.domain([]).range([]);
|
|
205
183
|
if (t.inheritedAes) {
|
|
206
|
-
const { inheritedAes: s, keys:
|
|
207
|
-
this.scales.xSecondaryAes.domain(
|
|
184
|
+
const { inheritedAes: s, keys: o } = t;
|
|
185
|
+
this.scales.xSecondaryAes.domain(o).range(o.map((h) => s[h] ?? R));
|
|
208
186
|
} else
|
|
209
187
|
this.scales.xSecondaryAes.domain([]).range([]);
|
|
210
188
|
}
|
|
211
|
-
updateCaptionsSize(i, t, s,
|
|
212
|
-
const
|
|
213
|
-
function
|
|
214
|
-
return
|
|
189
|
+
updateCaptionsSize(i, t, s, o) {
|
|
190
|
+
const r = new J("600 14px Manrope");
|
|
191
|
+
function e(a) {
|
|
192
|
+
return a.length ? Math.max(...a.map((x) => r.getTextWidth(x))) : 0;
|
|
215
193
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
let u = [], T = 0;
|
|
220
|
-
const m = U(t, this.rowsCount, this.columnsCount), M = at(t, this.rowsCount, this.columnsCount);
|
|
221
|
-
if (!o)
|
|
222
|
-
u = M.map(
|
|
223
|
-
(h) => Math.max(
|
|
224
|
-
...h.map(
|
|
225
|
-
(n) => d(
|
|
226
|
-
this.scales.xPrimary[n].domain().map((a) => this.axisLabelsX[n][a])
|
|
227
|
-
)
|
|
228
|
-
)
|
|
229
|
-
)
|
|
230
|
-
);
|
|
231
|
-
else {
|
|
232
|
-
if (s.labelsPosition === "center" && (u = m.map(
|
|
233
|
-
(h) => Math.max(
|
|
234
|
-
...h.map(
|
|
235
|
-
(n) => Math.max(
|
|
236
|
-
...this.scales.xPrimary[n].domain().map(
|
|
237
|
-
(a) => a ? this.axisLabelsX[n][a].length * W : 0
|
|
238
|
-
)
|
|
239
|
-
)
|
|
240
|
-
)
|
|
241
|
-
)
|
|
242
|
-
)), s.labelsPosition === "45deg") {
|
|
243
|
-
const h = Math.sin(Math.PI / 4);
|
|
244
|
-
u = m.map((n) => Math.max(
|
|
245
|
-
...n.map((a) => {
|
|
246
|
-
const g = this.scales.xPrimary[a].domain().map((L) => this.axisLabelsX[a][L]), A = d(g);
|
|
247
|
-
return A > 0 ? A * h + 14 : 0;
|
|
248
|
-
})
|
|
249
|
-
)), T = Math.max(
|
|
250
|
-
...M[0].map((n) => {
|
|
251
|
-
const a = this.scales.xPrimary[n].domain(), g = this.axisLabelsX[n][a[0]];
|
|
252
|
-
return Math.max(
|
|
253
|
-
c(g) * h - this.scales.xPrimary[n].bandwidth() / 2 + 14,
|
|
254
|
-
0
|
|
255
|
-
);
|
|
256
|
-
})
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
s.labelsPosition === "90deg" && (u = m.map(
|
|
260
|
-
(h) => Math.max(
|
|
261
|
-
...h.map(
|
|
262
|
-
(n) => d(
|
|
263
|
-
this.scales.xPrimary[n].domain().map((a) => this.axisLabelsX[n][a])
|
|
264
|
-
)
|
|
265
|
-
)
|
|
266
|
-
)
|
|
267
|
-
));
|
|
268
|
-
}
|
|
269
|
-
const f = V.flatten(
|
|
270
|
-
t.map((h) => {
|
|
271
|
-
if (e.hiddenLabels)
|
|
194
|
+
const { xTail: l, yTail: p, axisCaptionsWidthByRows: u, axisCaptionsWidthByColumns: d } = st(t, this.rowsCount, this.columnsCount, s.labelsPosition, this.axisLabelsX, i, this.scales.xPrimary), T = X.flatten(
|
|
195
|
+
t.map((a) => {
|
|
196
|
+
if (o.hiddenLabels)
|
|
272
197
|
return [];
|
|
273
|
-
const
|
|
274
|
-
return
|
|
198
|
+
const x = this.scales.y[a], n = x.ticks(), A = n.some((m) => Math.abs(m) < 1e-4 && m !== 0 || m > 1e4) ? ",e" : ",f", C = x.tickFormat(10, A);
|
|
199
|
+
return n.map(C);
|
|
275
200
|
})
|
|
276
|
-
)
|
|
201
|
+
);
|
|
277
202
|
this.captionsSizes = {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
203
|
+
bottomCaptionsTail: l,
|
|
204
|
+
leftCaptionsTail: p,
|
|
205
|
+
bottomAxisCaptionsWidthByRows: u,
|
|
206
|
+
leftAxisCaptionsWidthByColumns: d,
|
|
207
|
+
leftAxisCaptionsWidth: e(T)
|
|
281
208
|
};
|
|
282
209
|
}
|
|
283
210
|
updateMargins(i, t, s) {
|
|
284
|
-
const
|
|
211
|
+
const o = this.chartsDimensions[t[0]], h = this.chartsDimensions[t[t.length - 1]], r = i === "vertical", e = this.mainTitle.length ? Z * this.mainTitle.length + $ * 2 : 0, l = s.outerOffset;
|
|
285
212
|
this.margins = {
|
|
286
|
-
left: Math.max(
|
|
287
|
-
right: this.legend.width +
|
|
288
|
-
top: Math.max(
|
|
289
|
-
bottom: Math.max(
|
|
213
|
+
left: Math.max(l, r ? this.captionsSizes.bottomCaptionsTail - o.padding.left : 0),
|
|
214
|
+
right: this.legend.width + l,
|
|
215
|
+
top: Math.max(e, l),
|
|
216
|
+
bottom: Math.max(l, r ? 0 : this.captionsSizes.leftCaptionsTail - h.padding.bottom)
|
|
290
217
|
}, 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;
|
|
291
218
|
}
|
|
292
|
-
updateLegendSize(i, t, s,
|
|
219
|
+
updateLegendSize(i, t, s, o) {
|
|
293
220
|
if (!i.show) {
|
|
294
221
|
this.legend = { width: 0, height: 0, items: [] };
|
|
295
222
|
return;
|
|
296
223
|
}
|
|
297
|
-
const
|
|
298
|
-
function
|
|
299
|
-
return
|
|
300
|
-
const
|
|
301
|
-
return
|
|
224
|
+
const h = this.chartSizes.chartHeight, r = { width: 0, height: 0, left: 0, top: 0 }, e = [];
|
|
225
|
+
function l(n, A) {
|
|
226
|
+
return o.some((C) => {
|
|
227
|
+
const m = C.aes[A];
|
|
228
|
+
return m && rt(m) && m.type === n;
|
|
302
229
|
});
|
|
303
230
|
}
|
|
304
|
-
function
|
|
231
|
+
function p(n) {
|
|
305
232
|
return {
|
|
306
|
-
dotFill:
|
|
307
|
-
fillColor:
|
|
308
|
-
lineColor:
|
|
309
|
-
dotShape:
|
|
310
|
-
lineShape:
|
|
233
|
+
dotFill: l(n, "dotFill"),
|
|
234
|
+
fillColor: l(n, "fillColor"),
|
|
235
|
+
lineColor: l(n, "lineColor"),
|
|
236
|
+
dotShape: l(n, "dotShape"),
|
|
237
|
+
lineShape: l(n, "lineShape")
|
|
311
238
|
};
|
|
312
239
|
}
|
|
313
|
-
const u =
|
|
314
|
-
if (Object.values(u).some((
|
|
240
|
+
const u = p("primaryGrouping"), d = p("secondaryGrouping");
|
|
241
|
+
if (Object.values(u).some((n) => n) && t.inheritedAes && e.push({
|
|
315
242
|
type: "discreteMulti",
|
|
316
243
|
id: "primary",
|
|
317
244
|
title: t.label,
|
|
@@ -319,74 +246,74 @@ class Nt {
|
|
|
319
246
|
values: t.keys,
|
|
320
247
|
labels: t.valueLabels,
|
|
321
248
|
usedAes: u,
|
|
322
|
-
...
|
|
323
|
-
}), Object.values(
|
|
249
|
+
...r
|
|
250
|
+
}), Object.values(d).some((n) => n) && s.inheritedAes && e.push({
|
|
324
251
|
type: "discreteMulti",
|
|
325
252
|
id: "secondary",
|
|
326
253
|
title: s.label,
|
|
327
254
|
scale: this.scales.xSecondaryAes,
|
|
328
255
|
values: s.keys,
|
|
329
256
|
labels: s.valueLabels,
|
|
330
|
-
usedAes:
|
|
331
|
-
...
|
|
332
|
-
}), !
|
|
257
|
+
usedAes: d,
|
|
258
|
+
...r
|
|
259
|
+
}), !e.length) {
|
|
333
260
|
this.legend = { width: 0, height: 0, items: [] };
|
|
334
261
|
return;
|
|
335
262
|
}
|
|
336
|
-
const
|
|
263
|
+
const T = q(e, this.chartSizes.chartHeight), a = T[T.length - 1], x = a.left + a.width + G;
|
|
337
264
|
this.legend = {
|
|
338
|
-
width:
|
|
339
|
-
height:
|
|
340
|
-
items:
|
|
265
|
+
width: x,
|
|
266
|
+
height: h,
|
|
267
|
+
items: T
|
|
341
268
|
};
|
|
342
269
|
}
|
|
343
|
-
render(i, t, s,
|
|
344
|
-
var
|
|
345
|
-
const { orientation:
|
|
346
|
-
this.updateChartSize(
|
|
347
|
-
l,
|
|
348
|
-
e.keys,
|
|
349
|
-
r.keys,
|
|
350
|
-
o,
|
|
351
|
-
p,
|
|
270
|
+
render(i, t, s, o, h, r, e, l, p, u, d, T, a, x) {
|
|
271
|
+
var b;
|
|
272
|
+
const { orientation: n, xAxis: A, yAxis: C, size: m } = s;
|
|
273
|
+
this.updateChartSize(m, e, r, o.keys, n, u), this.updateViewport(
|
|
352
274
|
n,
|
|
353
|
-
|
|
275
|
+
o.keys,
|
|
276
|
+
h.keys,
|
|
277
|
+
e,
|
|
278
|
+
r,
|
|
279
|
+
C,
|
|
280
|
+
p,
|
|
354
281
|
u,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
), this.createAxisLabels(
|
|
358
|
-
const g = /* @__PURE__ */
|
|
359
|
-
|
|
282
|
+
m,
|
|
283
|
+
T
|
|
284
|
+
), this.createAxisLabels(e, A, o, n), this.createFacetTitles(e, l), this.updateCaptionsSize(n, e, A, C), this.updateChartDimensions(e, r, n, A, C), this.updateLegendSize(s.legend, o, h, p), this.createMainTitle(e, s.title), this.updateMargins(n, e, m), this.updateAesScales(o, h);
|
|
285
|
+
const g = /* @__PURE__ */ E.jsx(y, { dataFrame: i, children: /* @__PURE__ */ E.jsx(
|
|
286
|
+
Q,
|
|
360
287
|
{
|
|
361
288
|
settingsId: t,
|
|
362
289
|
chartSettings: s,
|
|
363
|
-
facetKeys:
|
|
364
|
-
facetSettings:
|
|
290
|
+
facetKeys: e,
|
|
291
|
+
facetSettings: r,
|
|
365
292
|
facetTitles: this.facetTitles,
|
|
366
293
|
chartSizes: this.chartSizes,
|
|
367
294
|
chartsDimensions: this.chartsDimensions,
|
|
368
295
|
scales: this.scales,
|
|
369
|
-
layersData:
|
|
296
|
+
layersData: p,
|
|
370
297
|
statsData: u,
|
|
371
298
|
legendData: this.legend,
|
|
372
299
|
margins: this.margins,
|
|
373
300
|
columnsCount: this.columnsCount,
|
|
374
|
-
keyColumn:
|
|
301
|
+
keyColumn: d,
|
|
375
302
|
xLabels: this.axisLabelsX,
|
|
376
303
|
chartTitle: this.mainTitle,
|
|
377
|
-
onlyPositive:
|
|
378
|
-
secondaryGrouping:
|
|
379
|
-
onTooltipHintSwitch:
|
|
304
|
+
onlyPositive: a,
|
|
305
|
+
secondaryGrouping: h,
|
|
306
|
+
onTooltipHintSwitch: x
|
|
380
307
|
}
|
|
381
308
|
) });
|
|
382
|
-
this.component = g, (
|
|
309
|
+
this.component = g, (b = this.reactRoot) == null || b.render(g);
|
|
383
310
|
}
|
|
384
311
|
renderError(i) {
|
|
385
312
|
var t;
|
|
386
|
-
(t = this.reactRoot) == null || t.render(/* @__PURE__ */
|
|
313
|
+
(t = this.reactRoot) == null || t.render(/* @__PURE__ */ E.jsx(V, { message: i }));
|
|
387
314
|
}
|
|
388
315
|
}
|
|
389
316
|
export {
|
|
390
|
-
|
|
317
|
+
It as default
|
|
391
318
|
};
|
|
392
319
|
//# sourceMappingURL=ChartRenderer.js.map
|