@milaboratories/graph-maker 1.1.154 → 1.1.156

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