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