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