@milaboratories/graph-maker 1.1.156 → 1.1.158
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/Chart.vue.d.ts.map +1 -1
- package/dist/GraphMaker/components/Chart.vue.js +20 -16
- package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
- package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.d.ts.map +1 -1
- package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.js +24 -23
- package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.js.map +1 -1
- package/dist/GraphMaker/constantsCommon.d.ts +1 -0
- package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
- package/dist/GraphMaker/constantsCommon.js +17 -16
- 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 +104 -93
- package/dist/GraphMaker/forms/AxesSettingsForm/HeatmapAxesSettingsForm.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/composeHeatmapSettings.d.ts +1 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js +11 -11
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +136 -135
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +2 -2
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +115 -107
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js +99 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/AnnotationCellsSvg.js +57 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/AnnotationCellsSvg.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js +43 -43
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/CanvasCells.js +85 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/CanvasCells.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Captions/AxisCaptions.js +5 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Captions/GroupCaptions.js +16 -16
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +191 -197
- 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 +29 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/SvgCells.js +38 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/SvgCells.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/tooltipUtils.js +44 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/tooltipUtils.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/constants.js +16 -15
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/constants.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +63 -66
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +64 -62
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateChartSideElementSizes.js +9 -9
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/ChartsGroup.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +5 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +10 -8
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +21 -21
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +19 -19
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +8 -8
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +9 -9
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +7 -7
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +2 -2
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +59 -57
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +13 -13
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +137 -133
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +74 -74
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { j } from "../node_modules/react/jsx-runtime.js";
|
|
1
|
+
import { j as I } from "../node_modules/react/jsx-runtime.js";
|
|
2
2
|
import ot from "../node_modules/lodash/lodash.js";
|
|
3
3
|
import { createRoot as at } from "../node_modules/react-dom/client.js";
|
|
4
4
|
import { Error as rt } from "../common/Error.js";
|
|
5
5
|
import { DataFrameProvider as nt } from "../common/useDataFrame.js";
|
|
6
|
-
import { TITLE_LINE_HEIGHT as
|
|
6
|
+
import { TITLE_LINE_HEIGHT as lt, TITLE_MARGIN as ht, DEFAULT_HEIGHT as X, DEFAULT_WIDTH as V } from "../constants.js";
|
|
7
7
|
import { arrangeLegendParts as ct } from "../utils/arrangeLegendParts.js";
|
|
8
8
|
import { getChartEdgeSides as ut } from "../utils/getChartEdgeSides.js";
|
|
9
9
|
import { getContinuousLegendTicks as J } from "../utils/getContinuousLegendTicks.js";
|
|
10
10
|
import { TextMeasurer as dt } from "../utils/TextMeasurer/TextMeasurer.js";
|
|
11
11
|
import { ChartsGroup as pt } from "./components/ChartsGroup.js";
|
|
12
|
-
import { LEGEND_OFFSET as mt, DEFAULT_AES as Q, CHART_SIDE_ELEMENTS as gt, TITLE_LINE as Y, MIN_MARGIN as
|
|
13
|
-
import { calculateChartSideElementSizes as
|
|
14
|
-
import { calculateSideElementsBBoxes as
|
|
15
|
-
import { createDiscreteColorScale as Z, createContinuousColorScale as
|
|
16
|
-
import { calculateAnnotationTitleSizes as
|
|
12
|
+
import { LEGEND_OFFSET as mt, DEFAULT_AES as Q, CHART_SIDE_ELEMENTS as gt, TITLE_LINE as Y, MIN_MARGIN as j } from "./constants.js";
|
|
13
|
+
import { calculateChartSideElementSizes as ft } from "./utils/calculateChartSideElementSizes.js";
|
|
14
|
+
import { calculateSideElementsBBoxes as yt } from "./utils/calculateSideElementsBBoxes.js";
|
|
15
|
+
import { createDiscreteColorScale as Z, createContinuousColorScale as St } from "./utils/createColorScales.js";
|
|
16
|
+
import { calculateAnnotationTitleSizes as xt } from "./utils/calculateAnnotationTitleSizes.js";
|
|
17
17
|
import { calculateCaptionTails as Ct } from "./utils/calculateCaptionTails.js";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
18
|
+
import W from "../node_modules/d3-scale/src/ordinal.js";
|
|
19
|
+
import N from "../node_modules/d3-scale/src/linear.js";
|
|
20
20
|
import bt from "../node_modules/d3-array/src/extent.js";
|
|
21
21
|
import tt from "../node_modules/d3-hierarchy/src/cluster.js";
|
|
22
|
-
var At = Object.defineProperty,
|
|
23
|
-
const
|
|
22
|
+
var At = Object.defineProperty, Gt = (m, s, e) => s in m ? At(m, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[s] = e, A = (m, s, e) => Gt(m, typeof s != "symbol" ? s + "" : s, e);
|
|
23
|
+
const zt = Math.cos(Math.PI / 4), Et = 5;
|
|
24
24
|
function et(m, s, e) {
|
|
25
25
|
function t(r) {
|
|
26
26
|
r[e] = s(r.data.height), r.children && r.children.forEach(t);
|
|
@@ -37,8 +37,8 @@ const Lt = (m, s) => {
|
|
|
37
37
|
const e = Math.min(...s), t = Math.max(...s);
|
|
38
38
|
if (e === t) {
|
|
39
39
|
const n = m % 2 === 0 ? [] : [e];
|
|
40
|
-
for (let
|
|
41
|
-
n.push(e +
|
|
40
|
+
for (let l = 1; l < m / 2 + 1; l++)
|
|
41
|
+
n.push(e + l), n.unshift(e - l);
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
if (m < 2)
|
|
@@ -52,7 +52,7 @@ function it(m, s, e) {
|
|
|
52
52
|
let t = e;
|
|
53
53
|
return m && (m.colorRange && (t = m.colorRange), m.method === "standardScaling" && (t = [-2, 2]), m.method === "meanNormalization" && (t = [-0.75, 0.75])), Lt(s, t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function k(m, s, e) {
|
|
56
56
|
let t = 0;
|
|
57
57
|
for (const r of m) {
|
|
58
58
|
if (s[r] === void 0) continue;
|
|
@@ -62,11 +62,11 @@ function $(m, s, e) {
|
|
|
62
62
|
return t;
|
|
63
63
|
}
|
|
64
64
|
function F(m, s) {
|
|
65
|
-
return s === 90 ? m : s === 45 ? m *
|
|
65
|
+
return s === 90 ? m : s === 45 ? m * zt + (m > 0 ? 2 * Et : 0) : Y;
|
|
66
66
|
}
|
|
67
67
|
class Yt {
|
|
68
68
|
constructor() {
|
|
69
|
-
A(this, "reactRoot", null), A(this, "parentNode", null), A(this, "rootNode", null), A(this, "component", /* @__PURE__ */
|
|
69
|
+
A(this, "reactRoot", null), A(this, "parentNode", null), A(this, "rootNode", null), A(this, "component", /* @__PURE__ */ I.jsx(I.Fragment, {})), A(this, "chartsDimensions", {}), A(this, "chartSizes", {
|
|
70
70
|
chartWidth: V,
|
|
71
71
|
// width of single chart
|
|
72
72
|
chartHeight: X,
|
|
@@ -80,10 +80,10 @@ class Yt {
|
|
|
80
80
|
totalHeight: X
|
|
81
81
|
// width of all charts in charts height, plus bottom axis, plus top title
|
|
82
82
|
}), A(this, "margins", {
|
|
83
|
-
top:
|
|
84
|
-
bottom:
|
|
85
|
-
left:
|
|
86
|
-
right:
|
|
83
|
+
top: j,
|
|
84
|
+
bottom: j,
|
|
85
|
+
left: j,
|
|
86
|
+
right: j
|
|
87
87
|
}), A(this, "captionsSizes", {
|
|
88
88
|
xAxisCaptions: 100,
|
|
89
89
|
yAxisCaptions: 100,
|
|
@@ -98,9 +98,9 @@ class Yt {
|
|
|
98
98
|
yGroupLabels: 0
|
|
99
99
|
}), A(this, "columnsCount", 1), A(this, "rowsCount", 1), A(this, "scales", {
|
|
100
100
|
// scales grouped by facet
|
|
101
|
-
x: { null:
|
|
102
|
-
y: { null:
|
|
103
|
-
}), A(this, "step", { x: {}, y: {} }), A(this, "colorScale",
|
|
101
|
+
x: { null: W().domain(["null"]).range([1]) },
|
|
102
|
+
y: { null: W().domain(["null"]).range([1]) }
|
|
103
|
+
}), A(this, "step", { x: {}, y: {} }), A(this, "colorScale", N().domain([0, 1]).range(["white", "black"])), A(this, "annotationColorScales", {}), A(this, "dendrogramAesScales", {}), A(this, "legend", {
|
|
104
104
|
width: 0,
|
|
105
105
|
height: 0,
|
|
106
106
|
items: []
|
|
@@ -118,7 +118,7 @@ class Yt {
|
|
|
118
118
|
}
|
|
119
119
|
updateMargins(s, e) {
|
|
120
120
|
this.margins = {
|
|
121
|
-
top: s.show ?
|
|
121
|
+
top: s.show ? lt + ht * 2 : e.outerOffset,
|
|
122
122
|
bottom: e.outerOffset,
|
|
123
123
|
left: e.outerOffset,
|
|
124
124
|
right: this.legend.width + e.outerOffset
|
|
@@ -129,52 +129,52 @@ class Yt {
|
|
|
129
129
|
this.legend = { width: 0, height: 0, items: [] };
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
const n = this.chartSizes.chartHeight,
|
|
132
|
+
const n = this.chartSizes.chartHeight, l = [], u = { width: 0, height: 0, left: 0, top: 0 }, f = (c) => c.reduce((h, i) => (h[i] = String(i), h), {});
|
|
133
133
|
if (s === "continuous") {
|
|
134
|
-
const c = this.colorScale,
|
|
135
|
-
|
|
134
|
+
const c = this.colorScale, h = J(c, o), i = N([h[0], h[h.length - 1]], [n, 0]), a = r.label ?? r.value;
|
|
135
|
+
l.push({
|
|
136
136
|
...u,
|
|
137
137
|
type: "continuous",
|
|
138
138
|
id: "heatmapValue",
|
|
139
139
|
scale: c,
|
|
140
|
-
values:
|
|
140
|
+
values: h,
|
|
141
141
|
title: a,
|
|
142
142
|
tickPositionScale: i
|
|
143
143
|
});
|
|
144
144
|
} else if (s === "discrete") {
|
|
145
|
-
const c = this.colorScale,
|
|
146
|
-
|
|
145
|
+
const c = this.colorScale, h = r.label ?? r.value, i = c.domain(), a = f(i);
|
|
146
|
+
l.push({ ...u, type: "discreteColor", id: "heatmapValue", title: h, scale: c, values: i, labels: a });
|
|
147
147
|
}
|
|
148
148
|
if (t.forEach((c) => {
|
|
149
|
-
const
|
|
149
|
+
const h = c.valueColumn.label ?? c.valueColumn.value;
|
|
150
150
|
if (c.type === "continuous") {
|
|
151
|
-
const i = this.annotationColorScales[c.id].scale, a = J(i, o), y =
|
|
152
|
-
|
|
151
|
+
const i = this.annotationColorScales[c.id].scale, a = J(i, o), y = N([a[0], a[a.length - 1]], [n, 0]);
|
|
152
|
+
l.push({ ...u, type: "continuous", id: c.id, tickPositionScale: y, title: h, scale: i, values: a });
|
|
153
153
|
}
|
|
154
154
|
if (c.type === "discrete") {
|
|
155
155
|
const i = this.annotationColorScales[c.id].scale, a = i.domain(), y = f(a);
|
|
156
|
-
|
|
156
|
+
l.push({ ...u, type: "discreteColor", id: c.id, title: h, scale: i, values: a, labels: y });
|
|
157
157
|
}
|
|
158
|
-
}), !
|
|
158
|
+
}), !l.length) {
|
|
159
159
|
this.legend = { width: 0, height: 0, items: [] };
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const d = ct(
|
|
162
|
+
const d = ct(l, this.chartSizes.chartHeight), p = d[d.length - 1], E = p.left + p.width + mt;
|
|
163
163
|
this.legend = {
|
|
164
|
-
width:
|
|
164
|
+
width: E,
|
|
165
165
|
height: n,
|
|
166
166
|
items: d
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
updateCaptionsSize(s, e, t, r) {
|
|
170
|
-
const o = new dt("bold 16px Manrope"), { xGroupKeys: n, yGroupKeys:
|
|
170
|
+
const o = new dt("bold 16px Manrope"), { xGroupKeys: n, yGroupKeys: l, xGroupLabels: u, yGroupLabels: f, xKeysByGroups: d, yKeysByGroups: p, xLabels: E, yLabels: c } = s.meta;
|
|
171
171
|
this.labelAngles = {
|
|
172
172
|
xAxisLabels: e.axisLabelsAngle,
|
|
173
173
|
yAxisLabels: t.axisLabelsAngle,
|
|
174
174
|
xGroupLabels: e.groupLabelsAngle,
|
|
175
175
|
yGroupLabels: t.groupLabelsAngle
|
|
176
176
|
};
|
|
177
|
-
const
|
|
177
|
+
const h = n.reduce((C, g) => Math.max(C, k(d[g], E, o)), 0), i = l.reduce((C, g) => Math.max(C, k(p[g], c, o)), 0), a = k(n, u, o), y = k(l, f, o), { xCaptionTail: x, yCaptionTail: T } = Ct(
|
|
178
178
|
this.labelAngles,
|
|
179
179
|
r,
|
|
180
180
|
this.scales,
|
|
@@ -183,70 +183,70 @@ class Yt {
|
|
|
183
183
|
o
|
|
184
184
|
);
|
|
185
185
|
this.captionsSizes = {
|
|
186
|
-
xCaptionTail:
|
|
187
|
-
yCaptionTail:
|
|
186
|
+
xCaptionTail: x,
|
|
187
|
+
yCaptionTail: T,
|
|
188
188
|
xGroupCaptions: F(a, this.labelAngles.xGroupLabels),
|
|
189
189
|
yGroupCaptions: F(y, this.labelAngles.yGroupLabels),
|
|
190
|
-
xAxisCaptions: F(
|
|
190
|
+
xAxisCaptions: F(h, this.labelAngles.xAxisLabels),
|
|
191
191
|
yAxisCaptions: F(i, this.labelAngles.yAxisLabels)
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
updateChartDimensions(s, e, t, r, o, n,
|
|
195
|
-
const p = e.length,
|
|
196
|
-
this.columnsCount = o.nRows ? Math.ceil(p /
|
|
197
|
-
const { sharedX:
|
|
194
|
+
updateChartDimensions(s, e, t, r, o, n, l, u, f, d) {
|
|
195
|
+
const p = e.length, E = Math.min(o.nRows ?? p, p), c = Math.min(o.nCols ?? p, p);
|
|
196
|
+
this.columnsCount = o.nRows ? Math.ceil(p / E) : c, this.rowsCount = Math.ceil(p / this.columnsCount);
|
|
197
|
+
const { sharedX: h, sharedY: i } = o;
|
|
198
198
|
this.chartsDimensions = {};
|
|
199
199
|
let a = 0, y = 0;
|
|
200
|
-
e.forEach((
|
|
201
|
-
const b = g % this.columnsCount + 1,
|
|
200
|
+
e.forEach((C, g) => {
|
|
201
|
+
const b = g % this.columnsCount + 1, S = ut(g, e.length, this.columnsCount, this.rowsCount), G = this.step.x[C], M = this.step.y[C], w = ft(
|
|
202
202
|
n,
|
|
203
|
-
|
|
203
|
+
l,
|
|
204
204
|
this.captionsSizes,
|
|
205
205
|
u,
|
|
206
206
|
f,
|
|
207
207
|
d,
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
S,
|
|
209
|
+
h,
|
|
210
210
|
i,
|
|
211
211
|
e,
|
|
212
212
|
t,
|
|
213
213
|
r,
|
|
214
|
-
|
|
214
|
+
G,
|
|
215
215
|
M
|
|
216
|
-
),
|
|
217
|
-
function
|
|
216
|
+
), H = xt(u, S, h, i);
|
|
217
|
+
function v(B) {
|
|
218
218
|
return Math.max(
|
|
219
|
-
gt[
|
|
220
|
-
|
|
219
|
+
gt[B].reduce((O, $) => O + w[B][$], 0),
|
|
220
|
+
H[B],
|
|
221
221
|
s.innerOffset
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
const L = {
|
|
225
|
-
left:
|
|
226
|
-
right:
|
|
227
|
-
top:
|
|
228
|
-
bottom:
|
|
225
|
+
left: v("left"),
|
|
226
|
+
right: v("right"),
|
|
227
|
+
top: v("top"),
|
|
228
|
+
bottom: v("bottom")
|
|
229
229
|
};
|
|
230
230
|
L.left < this.captionsSizes.xCaptionTail && (L.left = this.captionsSizes.xCaptionTail), L.bottom < this.captionsSizes.yCaptionTail && (L.bottom = this.captionsSizes.yCaptionTail);
|
|
231
|
-
const
|
|
232
|
-
this.chartsDimensions[
|
|
231
|
+
const D = yt(w, this.chartSizes.chartWidth, this.chartSizes.chartHeight), R = this.chartSizes.chartWidth + L.left + L.right, _ = this.chartSizes.chartHeight + L.top + L.bottom;
|
|
232
|
+
this.chartsDimensions[C] = {
|
|
233
233
|
left: a,
|
|
234
234
|
top: y,
|
|
235
235
|
inner: { width: this.chartSizes.chartWidth, height: this.chartSizes.chartHeight },
|
|
236
|
-
outer: { width:
|
|
236
|
+
outer: { width: R, height: _ },
|
|
237
237
|
padding: L,
|
|
238
|
-
sideElementBBoxes:
|
|
239
|
-
chartEdgeSides:
|
|
240
|
-
}, a +=
|
|
238
|
+
sideElementBBoxes: D,
|
|
239
|
+
chartEdgeSides: S
|
|
240
|
+
}, a += R, b === this.columnsCount && (a = 0, y += _);
|
|
241
241
|
});
|
|
242
|
-
const
|
|
243
|
-
this.chartSizes.chartsWidth =
|
|
242
|
+
const x = e.slice(0, this.columnsCount).reduce((C, g) => C + this.chartsDimensions[g].outer.width, 0), T = e.filter((C, g) => g % this.columnsCount === 0).reduce((C, g) => C + this.chartsDimensions[g].outer.height, 0);
|
|
243
|
+
this.chartSizes.chartsWidth = x, this.chartSizes.chartsHeight = T;
|
|
244
244
|
}
|
|
245
245
|
updateChartsSizes(s, e, t, r) {
|
|
246
|
-
const { width: o, height: n, cellWidth:
|
|
247
|
-
if (
|
|
246
|
+
const { width: o, height: n, cellWidth: l, cellHeight: u } = s, f = t.meta.facetKeys[0];
|
|
247
|
+
if (l && e.sharedX && f) {
|
|
248
248
|
const d = t.facets[f].xKeys.length, p = t.meta.xGroupKeys.length;
|
|
249
|
-
this.chartSizes.chartWidth = d *
|
|
249
|
+
this.chartSizes.chartWidth = d * l + r * (p - 1);
|
|
250
250
|
} else
|
|
251
251
|
this.chartSizes.chartWidth = o;
|
|
252
252
|
if (u && e.sharedY && f) {
|
|
@@ -256,42 +256,42 @@ class Yt {
|
|
|
256
256
|
this.chartSizes.chartHeight = n;
|
|
257
257
|
}
|
|
258
258
|
// update scales for cell positions, x and y for each facet
|
|
259
|
-
updateScales(s, e, t, r, o, n,
|
|
260
|
-
const { width: p, height:
|
|
261
|
-
(
|
|
262
|
-
),
|
|
263
|
-
(
|
|
259
|
+
updateScales(s, e, t, r, o, n, l, u, f, d) {
|
|
260
|
+
const { width: p, height: E, cellWidth: c, cellHeight: h } = o, { meta: i, facets: a } = e, { sharedX: y, sharedY: x } = r, T = (g, b = {}) => g.sort(
|
|
261
|
+
(S, G) => n.sorting === "asc" ? (b[S] ?? S).localeCompare(b[G] ?? G, "en", { numeric: !0 }) : (b[G] ?? G).localeCompare(b[S] ?? S, "en", { numeric: !0 })
|
|
262
|
+
), C = (g, b = {}) => g.sort(
|
|
263
|
+
(S, G) => l.sorting === "asc" ? (b[S] ?? S).localeCompare(b[G] ?? G, "en", { numeric: !0 }) : (b[G] ?? G).localeCompare(b[S] ?? S, "en", { numeric: !0 })
|
|
264
264
|
);
|
|
265
265
|
s.forEach((g) => {
|
|
266
|
-
const b = a[g],
|
|
267
|
-
let
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}),
|
|
266
|
+
const b = a[g], S = d.xGroup ? i.xGroupKeys : T(i.xGroupKeys), G = d.yGroup ? i.yGroupKeys : C(i.yGroupKeys), { xKeysByGroups: M } = y ? i : b, { yKeysByGroups: w } = x ? i : b, H = S.map((z) => M[z].length), v = G.map((z) => w[z].length), L = H.reduce((z, K) => z + K, 0), D = v.reduce((z, K) => z + K, 0), R = y && c ? c : (p - (H.filter((z) => z > 0).length - 1) * t) / L, _ = x && h ? h : (E - (v.filter((z) => z > 0).length - 1) * t) / D, B = [], O = [];
|
|
267
|
+
let $ = 0;
|
|
268
|
+
S.forEach((z) => {
|
|
269
|
+
const K = u || d.x ? M[z] : T(M[z], i.xLabels);
|
|
270
|
+
O.push(...K), K.forEach(() => {
|
|
271
|
+
B.push($), $ += R;
|
|
272
|
+
}), K.length > 0 && ($ += t);
|
|
273
273
|
});
|
|
274
274
|
const U = [], q = [];
|
|
275
275
|
let P = 0;
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
q.push(...
|
|
279
|
-
U.push(P), P +=
|
|
280
|
-
}),
|
|
281
|
-
}), this.scales.x[g] =
|
|
276
|
+
G.forEach((z) => {
|
|
277
|
+
const K = f || d.y ? w[z] : C(w[z], i.yLabels);
|
|
278
|
+
q.push(...K), K.forEach(() => {
|
|
279
|
+
U.push(P), P += _;
|
|
280
|
+
}), K.length > 0 && (P += t);
|
|
281
|
+
}), this.scales.x[g] = W().domain(O).range(B), this.scales.y[g] = W().domain(q).range(U), this.step.x[g] = R, this.step.y[g] = _;
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
|
-
updateAesScale(s, e, t, r, o, n,
|
|
284
|
+
updateAesScale(s, e, t, r, o, n, l) {
|
|
285
285
|
if (s === "continuous")
|
|
286
|
-
t.valueColors ? this.colorScale =
|
|
286
|
+
t.valueColors ? this.colorScale = N().domain(t.valuesByColors ?? it(l, t.valueColors.length, e)).range(t.valueColors) : t.colorsList && (this.colorScale = N().domain(it(l, t.colorsList.length, e)).range(t.colorsList));
|
|
287
287
|
else if (t.colorsMap) {
|
|
288
288
|
const d = Object.entries(t.colorsMap);
|
|
289
|
-
this.colorScale =
|
|
289
|
+
this.colorScale = W().domain(d.map((p) => p[0])).range(d.map((p) => p[1])).unknown("#ccc");
|
|
290
290
|
} else t.colorsList && (this.colorScale = Z(t.colorsList, n.map(String)));
|
|
291
291
|
const { xDataByKeys: u, yDataByKeys: f } = o.meta;
|
|
292
292
|
r.forEach((d) => {
|
|
293
|
-
const { colors: p, type:
|
|
294
|
-
if (
|
|
293
|
+
const { colors: p, type: E, axis: c, valueColumn: h } = d, i = (c === "x" ? u : f)[h.value];
|
|
294
|
+
if (E === "discrete") {
|
|
295
295
|
const a = ot.uniq(Object.values(i).map(String)).sort();
|
|
296
296
|
this.annotationColorScales[d.id] = {
|
|
297
297
|
type: "discrete",
|
|
@@ -301,45 +301,45 @@ class Yt {
|
|
|
301
301
|
const a = Object.values(i).map(Number);
|
|
302
302
|
if (!a.length)
|
|
303
303
|
return;
|
|
304
|
-
const [y = a[0],
|
|
304
|
+
const [y = a[0], x = a[0]] = bt(a);
|
|
305
305
|
this.annotationColorScales[d.id] = {
|
|
306
306
|
type: "continuous",
|
|
307
|
-
scale:
|
|
307
|
+
scale: St(p, y, x, 0, 0.5, 1)
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
|
-
updateDendrogram(s, e, t, r, o, n,
|
|
312
|
+
updateDendrogram(s, e, t, r, o, n, l) {
|
|
313
313
|
s.forEach((u) => {
|
|
314
|
-
this.dendrograms[u] = { x: { treesByGroupKey: {}, data: n }, y: { treesByGroupKey: {}, data:
|
|
315
|
-
const { xKeysByGroups: f, yKeysByGroups: d } = r[u], { hierarchyByGroupX: p, hierarchyByGroupY:
|
|
314
|
+
this.dendrograms[u] = { x: { treesByGroupKey: {}, data: n }, y: { treesByGroupKey: {}, data: l } };
|
|
315
|
+
const { xKeysByGroups: f, yKeysByGroups: d } = r[u], { hierarchyByGroupX: p, hierarchyByGroupY: E } = o[u];
|
|
316
316
|
if (n) {
|
|
317
|
-
const c = e.reduce((
|
|
317
|
+
const c = e.reduce((h, i) => {
|
|
318
318
|
var a;
|
|
319
|
-
return Math.max(
|
|
319
|
+
return Math.max(h, (a = p[i]) == null ? void 0 : a.data.height);
|
|
320
320
|
}, 0);
|
|
321
|
-
this.dendrograms[u].x.treesByGroupKey = e.reduce((
|
|
321
|
+
this.dendrograms[u].x.treesByGroupKey = e.reduce((h, i) => {
|
|
322
322
|
const a = p[i], y = f[i];
|
|
323
323
|
tt().separation(() => 1).size([y.length * this.step.x[u], n.size])(
|
|
324
324
|
a
|
|
325
325
|
);
|
|
326
|
-
const
|
|
327
|
-
return et(
|
|
326
|
+
const x = a, T = N().domain(n.position === "top" ? [0, c] : [c, 0]).range([n.size, 0]);
|
|
327
|
+
return et(x, T, "y"), st(x, this.scales.x[u](y[0]), "x"), h[i] = x, h;
|
|
328
328
|
}, {}), this.dendrograms[u].x.data = n;
|
|
329
329
|
}
|
|
330
|
-
if (
|
|
331
|
-
const c = t.reduce((
|
|
330
|
+
if (l) {
|
|
331
|
+
const c = t.reduce((h, i) => {
|
|
332
332
|
var a;
|
|
333
|
-
return Math.max(
|
|
333
|
+
return Math.max(h, (a = E[i]) == null ? void 0 : a.data.height);
|
|
334
334
|
}, 0);
|
|
335
|
-
this.dendrograms[u].y.treesByGroupKey = t.reduce((
|
|
336
|
-
const a =
|
|
337
|
-
tt().separation(() => 1).size([y.length * this.step.y[u],
|
|
335
|
+
this.dendrograms[u].y.treesByGroupKey = t.reduce((h, i) => {
|
|
336
|
+
const a = E[i], y = d[i];
|
|
337
|
+
tt().separation(() => 1).size([y.length * this.step.y[u], l.size])(
|
|
338
338
|
a
|
|
339
339
|
);
|
|
340
|
-
const
|
|
341
|
-
return st(
|
|
342
|
-
}, {}), this.dendrograms[u].y.data =
|
|
340
|
+
const x = a, T = N().domain(l.position === "left" ? [0, c] : [c, 0]).range([l.size, 0]);
|
|
341
|
+
return st(x, this.scales.y[u](y[0]), "x", "y"), et(x, T, "x"), h[i] = x, h;
|
|
342
|
+
}, {}), this.dendrograms[u].y.data = l;
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
}
|
|
@@ -349,37 +349,37 @@ class Yt {
|
|
|
349
349
|
const e = Object.keys(s);
|
|
350
350
|
this.dendrogramAesScales = e.reduce((t, r) => {
|
|
351
351
|
const o = s[r], n = Object.keys(o);
|
|
352
|
-
return t[r] =
|
|
353
|
-
n.map((
|
|
352
|
+
return t[r] = W().domain(n).range(
|
|
353
|
+
n.map((l) => ({
|
|
354
354
|
...Q,
|
|
355
|
-
...o[
|
|
355
|
+
...o[l]
|
|
356
356
|
}))
|
|
357
357
|
).unknown(Q), t;
|
|
358
358
|
}, {});
|
|
359
359
|
}
|
|
360
|
-
render(s, e, t, r, o, n,
|
|
361
|
-
var
|
|
362
|
-
const { meta:
|
|
363
|
-
this.updateChartsSizes(
|
|
364
|
-
|
|
365
|
-
x,
|
|
360
|
+
render(s, e, t, r, o, n, l, u, f, d, p, E, c, h, i, a, y) {
|
|
361
|
+
var x;
|
|
362
|
+
const { meta: T, facets: C } = n, { facetKeys: g, xGroupKeys: b, yGroupKeys: S, valueExtent: G } = T, { xAxis: M, yAxis: w, title: H, size: v, valueType: L } = t;
|
|
363
|
+
this.updateChartsSizes(v, r, n, o.groupGap), this.updateAesScale(L, G, o, l, n, c, h), this.updateScales(g, n, o.groupGap, r, v, t.xAxis, t.yAxis, f, d, a), this.updateCaptionsSize(n, M, w, r), this.updateChartDimensions(
|
|
364
|
+
v,
|
|
366
365
|
g,
|
|
367
366
|
b,
|
|
367
|
+
S,
|
|
368
368
|
r,
|
|
369
|
-
E,
|
|
370
369
|
M,
|
|
371
|
-
|
|
370
|
+
w,
|
|
371
|
+
l,
|
|
372
372
|
f,
|
|
373
373
|
d
|
|
374
|
-
), this.updateLegendSize(
|
|
375
|
-
const
|
|
374
|
+
), this.updateLegendSize(L, t.legend, l, u, G), this.updateMargins(H, v), this.updateDendrogram(g, b, S, C, p, f, d), this.updateDendrogramAesScales(E);
|
|
375
|
+
const D = /* @__PURE__ */ I.jsx(nt, { dataFrame: s, children: /* @__PURE__ */ I.jsx(
|
|
376
376
|
pt,
|
|
377
377
|
{
|
|
378
378
|
aes: o,
|
|
379
|
-
annotations:
|
|
379
|
+
annotations: l,
|
|
380
380
|
annotationColorScales: this.annotationColorScales,
|
|
381
381
|
captionsSizes: this.captionsSizes,
|
|
382
|
-
cellsMeta:
|
|
382
|
+
cellsMeta: T,
|
|
383
383
|
columnsCount: this.columnsCount,
|
|
384
384
|
chartsDimensions: this.chartsDimensions,
|
|
385
385
|
chartSettings: t,
|
|
@@ -387,25 +387,26 @@ class Yt {
|
|
|
387
387
|
colorScale: this.colorScale,
|
|
388
388
|
dendrogramAesScales: this.dendrogramAesScales,
|
|
389
389
|
dendrograms: this.dendrograms,
|
|
390
|
-
facetKeys:
|
|
390
|
+
facetKeys: g,
|
|
391
391
|
facetSettings: r,
|
|
392
|
-
groupedCells:
|
|
392
|
+
groupedCells: C,
|
|
393
393
|
labelAngles: this.labelAngles,
|
|
394
394
|
legend: this.legend,
|
|
395
395
|
margins: this.margins,
|
|
396
396
|
scales: this.scales,
|
|
397
397
|
settingsId: e,
|
|
398
398
|
step: this.step,
|
|
399
|
-
xGroupKeys:
|
|
400
|
-
yGroupKeys:
|
|
401
|
-
onTooltipHintSwitch: i
|
|
399
|
+
xGroupKeys: b,
|
|
400
|
+
yGroupKeys: S,
|
|
401
|
+
onTooltipHintSwitch: i,
|
|
402
|
+
cellsRenderingMode: y
|
|
402
403
|
}
|
|
403
404
|
) });
|
|
404
|
-
this.component =
|
|
405
|
+
this.component = D, (x = this.reactRoot) == null || x.render(D);
|
|
405
406
|
}
|
|
406
407
|
renderError(s) {
|
|
407
408
|
var e;
|
|
408
|
-
(e = this.reactRoot) == null || e.render(/* @__PURE__ */
|
|
409
|
+
(e = this.reactRoot) == null || e.render(/* @__PURE__ */ I.jsx(rt, { message: s }));
|
|
409
410
|
}
|
|
410
411
|
}
|
|
411
412
|
export {
|