@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
@@ -12,27 +12,27 @@ class h {
12
12
  constructor(t) {
13
13
  i(this, "node"), i(this, "chart"), this.chart = t;
14
14
  }
15
- static createChart(t, r, e) {
16
- const { type: a } = r;
17
- if (a === "discrete")
18
- return new c(t, r, e);
19
- if (a === "dendro")
20
- return new n(t, r, e);
21
- if (a === "scatterplot")
22
- return new p(t, r, e);
23
- if (a === "scatterplot-umap")
24
- return new f(t, r, e);
25
- if (a === "heatmap")
26
- return new u(t, r, e);
27
- if (a === "histogram")
28
- return new m(t, r, e);
29
- if (a === "bubble")
30
- return new d(t, r, e);
31
- l(a, `Unknown chart type: ${a}`);
15
+ static createChart(t, r, a) {
16
+ const { type: e } = r;
17
+ if (e === "discrete")
18
+ return new c(t, r, a);
19
+ if (e === "dendro")
20
+ return new n(t, r, a);
21
+ if (e === "scatterplot")
22
+ return new p(t, r, a);
23
+ if (e === "scatterplot-umap")
24
+ return new f(t, r, a);
25
+ if (e === "heatmap")
26
+ return new u(t, r, a);
27
+ if (e === "histogram")
28
+ return new m(t, r, a);
29
+ if (e === "bubble")
30
+ return new d(t, r, a);
31
+ l(e, `Unknown chart type: ${e}`);
32
32
  }
33
- static newPlot(t, r, e) {
34
- const a = s.from(t);
35
- return new this(h.createChart(a, r, e));
33
+ static newPlot(t, r, a) {
34
+ const e = s.from(t);
35
+ return new this(h.createChart(e, r, a));
36
36
  }
37
37
  get calculatedData() {
38
38
  return this.chart.calculatedData;
@@ -48,8 +48,8 @@ class h {
48
48
  }
49
49
  updateSettingsAndData(t, r) {
50
50
  if (r.type !== this.chart.settings.type) {
51
- const e = h.createChart(this.chart.data, r);
52
- this.node ? (this.chart.unmount(), this.chart = e, this.chart.mount(this.node)) : this.chart = e;
51
+ const a = h.createChart(this.chart.data, r);
52
+ this.node ? (this.chart.unmount(), this.chart = a, this.chart.mount(this.node)) : this.chart = a;
53
53
  } else
54
54
  this.chart.updateSettingsAndData(s.from(t), r);
55
55
  }
@@ -1,9 +1,9 @@
1
- import { j as k } from "../node_modules/react/jsx-runtime.js";
1
+ import { j as B } from "../node_modules/react/jsx-runtime.js";
2
2
  import { createRoot as U } from "../node_modules/react-dom/client.js";
3
3
  import { Error as X } from "../common/Error.js";
4
4
  import { BLACK as Q } from "../constants.js";
5
5
  import { DEFAULT_DOT_AES as Y, LEGEND_OFFSET as J } from "../scatterplot/constants.js";
6
- import { isCategoricalAes as V, isContinuousAes as j } from "../types/common.js";
6
+ import { isCategoricalAes as V, isContinuousAes as $ } from "../types/common.js";
7
7
  import "../types/discrete.js";
8
8
  import "../types/scatterplot.js";
9
9
  import "../types/heatmap.js";
@@ -14,70 +14,74 @@ import { getContinuousLegendTicks as Z } from "../utils/getContinuousLegendTicks
14
14
  import { getContinuousLegendWidth as ee, getDiscreteLegendWidth as te } from "../utils/getLegendWidth.js";
15
15
  import { TextMeasurer as G } from "../utils/TextMeasurer/TextMeasurer.js";
16
16
  import { Chart as ae } from "./components/Chart.js";
17
- import { MAX_HEATMAP_WIDTH as ie, COLOR_NULL as F, MAX_LEGEND_HEIGHT as se, MARGIN as y, HEATMAP_LEFT_OFFSET as $, HEIGHT as P, WIDTH as D } from "./constants.js";
18
- import { updateLinksHeight as oe, updateNodesHorizontalPosition as he } from "./getHierarchyData.js";
19
- import W from "../node_modules/d3-scale/src/ordinal.js";
20
- import le from "../node_modules/d3-scale/src/linear.js";
21
- import { sqrt as q } from "../node_modules/d3-scale/src/pow.js";
22
- import re from "../node_modules/d3-hierarchy/src/cluster.js";
23
- var ne = Object.defineProperty, de = (h, e, t) => e in h ? ne(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, z = (h, e, t) => de(h, typeof e != "symbol" ? e + "" : e, t);
24
- function K(h, e) {
17
+ import { MAX_HEATMAP_WIDTH as ie, COLOR_NULL as F, MAX_LEGEND_HEIGHT as se, HEATMAP_LEFT_OFFSET as I, MARGIN as E, HEIGHT as P, WIDTH as K } from "./constants.js";
18
+ import { updateLinksHeight as he, updateNodesHorizontalPosition as oe } from "./getHierarchyData.js";
19
+ import H from "../node_modules/d3-scale/src/ordinal.js";
20
+ import re from "../node_modules/d3-scale/src/linear.js";
21
+ import { sqrt as j } from "../node_modules/d3-scale/src/pow.js";
22
+ import le from "../node_modules/d3-hierarchy/src/cluster.js";
23
+ var ne = Object.defineProperty, me = (o, e, t) => e in o ? ne(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, L = (o, e, t) => me(o, typeof e != "symbol" ? e + "" : e, t);
24
+ function _(o, e) {
25
25
  if (V(e))
26
- return (t) => e.valuesMap[String(h.getColumnValue(e.columnName.value, t))];
27
- if (j(e)) {
28
- const { domain: t, range: i } = e, n = q().domain(t).range(i);
29
- return (l) => {
30
- const s = n(Number(h.getColumnValue(e.columnName.value, l)));
26
+ return (t) => e.valuesMap[String(o.getColumnValue(e.columnName.value, t))];
27
+ if ($(e)) {
28
+ const { domain: t, range: i } = e, n = j().domain(t).range(i);
29
+ return (r) => {
30
+ const s = n(Number(o.getColumnValue(e.columnName.value, r)));
31
31
  return Math.max(1, s);
32
32
  };
33
33
  }
34
34
  return (t) => e;
35
35
  }
36
- function pe(h, e) {
36
+ function pe(o, e) {
37
37
  return {
38
- nodeShape: K(h, e.nodeShape),
39
- nodeColor: K(h, e.nodeColor),
40
- nodeSize: K(h, e.nodeSize),
41
- lineShape: K(h, e.lineShape),
42
- lineColor: K(h, e.lineColor)
38
+ nodeShape: _(o, e.nodeShape),
39
+ nodeColor: _(o, e.nodeColor),
40
+ nodeSize: _(o, e.nodeSize),
41
+ lineShape: _(o, e.lineShape),
42
+ lineColor: _(o, e.lineColor)
43
43
  };
44
44
  }
45
- const me = (h, e) => {
45
+ const ce = (o, e) => {
46
46
  const t = Math.min(...e), i = Math.max(...e);
47
47
  if (t === i) {
48
- const s = h % 2 === 0 ? [] : [t];
49
- for (let c = 1; c < h / 2 + 1; c++)
50
- s.push(t + c), s.unshift(t - c);
48
+ const s = o % 2 === 0 ? [] : [t];
49
+ for (let d = 1; d < o / 2 + 1; d++)
50
+ s.push(t + d), s.unshift(t - d);
51
51
  return s;
52
52
  }
53
- if (h < 2)
53
+ if (o < 2)
54
54
  return [t, i];
55
- const n = (i - t) / (h - 1), l = [];
56
- for (let s = 0; s < h - 1; s++)
57
- l.push(t + n * s);
58
- return l.push(i), l;
55
+ const n = (i - t) / (o - 1), r = [];
56
+ for (let s = 0; s < o - 1; s++)
57
+ r.push(t + n * s);
58
+ return r.push(i), r;
59
59
  };
60
- function ce(h, e = 1, t, i) {
61
- const n = (h < 16 ? 40 : h < 49 ? 32 : 24) * e;
60
+ function de(o, e = 1, t, i) {
61
+ const n = (o < 16 ? 40 : o < 49 ? 32 : 24) * e;
62
62
  return Math.max(Math.min(n, i ?? 1 / 0), t ?? -1 / 0);
63
63
  }
64
- class Ke {
64
+ class _e {
65
65
  constructor() {
66
- z(this, "component", /* @__PURE__ */ k.jsx(k.Fragment, {})), z(this, "reactRoot", null), z(this, "parentNode", null), z(this, "rootNode", null), z(this, "chartSizes", {
67
- treeWidth: D,
66
+ L(this, "component", /* @__PURE__ */ B.jsx(B.Fragment, {})), L(this, "reactRoot", null), L(this, "parentNode", null), L(this, "rootNode", null), L(this, "chartSizes", {
67
+ treeWidth: K,
68
68
  treeHeight: P,
69
69
  heatmapWidth: 0,
70
70
  heatmapHeight: 0,
71
- totalWidth: D + D + y.LEFT + y.RIGHT,
72
- totalHeight: P + y.TOP + y.BOTTOM,
73
- labelsOffset: 0
74
- }), z(this, "legend", { width: 0, height: 0, items: [] }), z(this, "heatmapScales", {
75
- x: W().domain(["null"]).range([1]),
76
- y: W().domain(["null"]).range([1])
77
- }), z(this, "heatmapStep", { x: 0, y: 0 }), z(this, "heatmapColorScale", {
78
- scale: W([]),
71
+ totalWidth: K + K + E.LEFT + E.RIGHT,
72
+ totalHeight: P + E.TOP + E.BOTTOM,
73
+ labelsOffset: 0,
74
+ marginLeft: E.LEFT,
75
+ marginRight: E.RIGHT,
76
+ marginTop: E.TOP,
77
+ marginBottom: E.BOTTOM
78
+ }), L(this, "legend", { width: 0, height: 0, items: [] }), L(this, "heatmapScales", {
79
+ x: H().domain(["null"]).range([1]),
80
+ y: H().domain(["null"]).range([1])
81
+ }), L(this, "heatmapStep", { x: 0, y: 0 }), L(this, "heatmapColorScale", {
82
+ scale: H([]),
79
83
  getter: () => "white"
80
- }), z(this, "heatmapLabels", []);
84
+ }), L(this, "heatmapLabels", []);
81
85
  }
82
86
  clear() {
83
87
  var e;
@@ -94,51 +98,51 @@ class Ke {
94
98
  this.chartSizes.heatmapWidth = 0;
95
99
  return;
96
100
  }
97
- const { xKeysByGroups: n, xGroupKeys: l, xKeys: s, yKeys: c } = e, T = 5, x = l.map((o) => n[o].length), A = x.reduce((o, a) => o + a, 0), L = this.chartSizes.treeHeight / c.length, w = Math.min(
101
+ const { xKeysByGroups: n, xGroupKeys: r, xKeys: s, yKeys: d } = e, z = 5, v = r.map((h) => n[h].length), A = v.reduce((h, a) => h + a, 0), y = this.chartSizes.treeHeight / d.length, w = Math.min(
98
102
  Math.max(
99
- (ie - (x.filter((o) => o > 0).length - 1) * T) / A,
103
+ (ie - (v.filter((h) => h > 0).length - 1) * z) / A,
100
104
  i.minCellWidth
101
105
  ),
102
106
  i.maxCellWidth
103
- ), H = [];
104
- let v = 0;
105
- l.forEach((o) => {
106
- const a = n[o];
107
+ ), C = [];
108
+ let T = 0;
109
+ r.forEach((h) => {
110
+ const a = n[h];
107
111
  a.forEach(() => {
108
- H.push(v), v += w;
109
- }), a.length > 0 && (v += T);
110
- }), this.heatmapScales.x = W().domain(s).range(H), this.heatmapScales.y = W().domain(c).range(c.map((o, a) => a * L)), this.heatmapStep.x = w, this.heatmapStep.y = L;
112
+ C.push(T), T += w;
113
+ }), a.length > 0 && (T += z);
114
+ }), this.heatmapScales.x = H().domain(s).range(C), this.heatmapScales.y = H().domain(d).range(d.map((h, a) => a * y)), this.heatmapStep.x = w, this.heatmapStep.y = y;
111
115
  const { colorsList: S, colorsMap: f } = t.aes;
112
116
  if (t.valueType === "continuous" && S) {
113
- const o = le().domain(me(S.length, e.meta.valueExtent)).range(S);
117
+ const h = re().domain(ce(S.length, e.meta.valueExtent)).range(S);
114
118
  this.heatmapColorScale = {
115
- scale: o,
116
- getter: (a) => o(a)
119
+ scale: h,
120
+ getter: (a) => h(a)
117
121
  };
118
122
  }
119
123
  if (t.valueType === "discrete" && f) {
120
- const o = Object.keys(f).filter((a) => e.meta.uniqueValues.has(a));
124
+ const h = Object.keys(f).filter((a) => e.meta.uniqueValues.has(a));
121
125
  this.heatmapColorScale = {
122
- scale: W(
123
- o,
124
- o.map((a) => f[a])
126
+ scale: H(
127
+ h,
128
+ h.map((a) => f[a])
125
129
  ).unknown(F),
126
130
  getter: (a) => a ? f[a] ?? F : F
127
131
  };
128
132
  }
129
133
  if (t.valueType === "stringSource" && S) {
130
- const o = [...e.meta.uniqueValues], a = W(
131
- o,
132
- o.map((E, O) => S[O % S.length])
134
+ const h = [...e.meta.uniqueValues], a = H(
135
+ h,
136
+ h.map((W, R) => S[R % S.length])
133
137
  ).unknown(F);
134
138
  this.heatmapColorScale = {
135
139
  scale: a,
136
- getter: (E) => E ? a(E) : F
140
+ getter: (W) => W ? a(W) : F
137
141
  };
138
142
  }
139
143
  this.chartSizes.heatmapWidth = this.heatmapScales.x(e.xKeys[e.xKeys.length - 1]) + this.heatmapStep.x;
140
144
  }
141
- updateLegendSize(e, t, i, n, l, s) {
145
+ updateLegendSize(e, t, i, n, r, s) {
142
146
  if (!e.show) {
143
147
  this.legend = {
144
148
  width: 0,
@@ -147,99 +151,99 @@ class Ke {
147
151
  };
148
152
  return;
149
153
  }
150
- const c = new G("600 14px Arial"), T = 16, x = 48, A = 20, L = 24;
151
- function w(d, r) {
154
+ const d = new G("600 14px Arial"), z = 16, v = 48, A = 20, y = 24;
155
+ function w(m, l) {
152
156
  return Math.max(
153
- ...d.map((p) => c.getTextWidth(String(p)) + A),
154
- c.getTextWidth(r)
157
+ ...m.map((p) => d.getTextWidth(String(p)) + A),
158
+ d.getTextWidth(l)
155
159
  );
156
160
  }
157
- const H = [];
158
- [i.nodeColor, i.nodeShape, i.lineColor].filter(V).map((d) => d.columnName).forEach((d) => {
159
- const r = t[d.value];
160
- if (r.usedAes.length === 0 || !r.aesMap)
161
+ const C = [];
162
+ [i.nodeColor, i.nodeShape, i.lineColor].filter(V).map((m) => m.columnName).forEach((m) => {
163
+ const l = t[m.value];
164
+ if (l.usedAes.length === 0 || !l.aesMap)
161
165
  return;
162
- const p = d.label ?? d.value, b = r.values, m = {};
163
- b.forEach((u) => {
164
- m[u] || (m[u] = { ...Y }), r.usedAes.forEach((g) => {
165
- var M, N, C;
166
- (g === "dotFill" || g === "lineColor") && (m[u].color = ((M = r.aesMap[u]) == null ? void 0 : M[g]) ?? Q), g === "dotShape" && (m[u].shape = ((N = r.aesMap[u]) == null ? void 0 : N[g]) ?? "21"), g === "dotSize" && (m[u].size = ((C = r.aesMap[u]) == null ? void 0 : C[g]) ?? 3);
166
+ const p = m.label ?? m.value, x = l.values, c = {};
167
+ x.forEach((u) => {
168
+ c[u] || (c[u] = { ...Y }), l.usedAes.forEach((g) => {
169
+ var M, N, b;
170
+ (g === "dotFill" || g === "lineColor") && (c[u].color = ((M = l.aesMap[u]) == null ? void 0 : M[g]) ?? Q), g === "dotShape" && (c[u].shape = ((N = l.aesMap[u]) == null ? void 0 : N[g]) ?? "21"), g === "dotSize" && (c[u].size = ((b = l.aesMap[u]) == null ? void 0 : b[g]) ?? 3);
167
171
  });
168
- }), H.push({
172
+ }), C.push({
169
173
  columnKey: p,
170
- data: m,
171
- values: r.values,
172
- labels: r.labels
174
+ data: c,
175
+ values: l.values,
176
+ labels: l.labels
173
177
  });
174
178
  });
175
- const v = [];
176
- let S = 0, f = 0, o = 0, a = Math.min(this.chartSizes.treeHeight, se);
177
- if (n && l) {
178
- const d = s.valueType, r = n.label ?? n.value;
179
- if (d === "continuous") {
180
- const p = this.heatmapColorScale.scale, b = Z(p, l.meta.valueExtent, 4), m = {
179
+ const T = [];
180
+ let S = 0, f = 0, h = 0, a = Math.min(this.chartSizes.treeHeight, se);
181
+ if (n && r) {
182
+ const m = s.valueType, l = n.label ?? n.value;
183
+ if (m === "continuous") {
184
+ const p = this.heatmapColorScale.scale, x = Z(p, r.meta.valueExtent, 4), c = {
181
185
  id: "heatmapValue",
182
186
  type: "continuous",
183
- width: ee(b, r),
187
+ width: ee(x, l),
184
188
  height: a,
185
189
  left: 0,
186
190
  top: 0,
187
- title: r,
191
+ title: l,
188
192
  scale: p,
189
- values: b,
193
+ values: x,
190
194
  labels: {}
191
195
  };
192
- v.push(m), f = m.height + x, S = m.width;
196
+ T.push(c), f = c.height + v, S = c.width;
193
197
  } else {
194
- const p = this.heatmapColorScale.scale, b = te(p, r), m = p.domain(), u = m.length * T, g = {
198
+ const p = this.heatmapColorScale.scale, x = te(p, l), c = p.domain(), u = c.length * z, g = {
195
199
  id: "heatmapValue",
196
200
  type: "discrete",
197
- width: b,
201
+ width: x,
198
202
  height: u,
199
203
  left: 0,
200
204
  top: 0,
201
- title: r,
205
+ title: l,
202
206
  scale: p,
203
- values: m,
207
+ values: c,
204
208
  labels: {}
205
209
  };
206
- v.push(g), f = g.height + x, S = g.width;
210
+ T.push(g), f = g.height + v, S = g.width;
207
211
  }
208
212
  }
209
- if (H.map(({ columnKey: d, labels: r, values: p, data: b }) => {
210
- f > a && (f = 0, o += S + L);
211
- const m = d, u = w(
212
- p.map((_) => r[_]),
213
- m
214
- ), g = p.length * T;
213
+ if (C.map(({ columnKey: m, labels: l, values: p, data: x }) => {
214
+ f > a && (f = 0, h += S + y);
215
+ const c = m, u = w(
216
+ p.map((O) => l[O]),
217
+ c
218
+ ), g = p.length * z;
215
219
  g > a && (a = g);
216
- const M = W().domain(p).range(p.map((_) => b[_])), N = o, C = f;
217
- v.push({ id: d, type: "nodes", width: u, height: g, left: N, top: C, title: m, scale: M, values: p, labels: r }), S = u, f += g + x;
218
- }), j(i.nodeSize)) {
219
- f > a && (f = 0, o += S + L);
220
- const { columnName: d, domain: r, range: p } = i.nodeSize, b = d.label ?? d.value, m = q(r, p), u = m.ticks(3), g = m.tickFormat(3), M = u.reduce((R, I) => (R[String(I)] = g(I), R), {}), N = w(
221
- u.map((R) => M[R]),
222
- b
223
- ), C = (m(Math.max(...u)) * 2 + 4) * u.length;
224
- C > a && (a = C);
225
- const _ = o, B = f;
226
- v.push({ id: d.value, type: "size", width: N, height: C, left: _, top: B, title: b, scale: m, values: u, labels: M }), S = N, f += C + x;
220
+ const M = H().domain(p).range(p.map((O) => x[O])), N = h, b = f;
221
+ T.push({ id: m, type: "nodes", width: u, height: g, left: N, top: b, title: c, scale: M, values: p, labels: l }), S = u, f += g + v;
222
+ }), $(i.nodeSize)) {
223
+ f > a && (f = 0, h += S + y);
224
+ const { columnName: m, domain: l, range: p } = i.nodeSize, x = m.label ?? m.value, c = j(l, p), u = c.ticks(3), g = c.tickFormat(3), M = u.reduce((k, D) => (k[String(D)] = g(D), k), {}), N = w(
225
+ u.map((k) => M[k]),
226
+ x
227
+ ), b = (c(Math.max(...u)) * 2 + 4) * u.length;
228
+ b > a && (a = b);
229
+ const O = h, q = f;
230
+ T.push({ id: m.value, type: "size", width: N, height: b, left: O, top: q, title: x, scale: c, values: u, labels: M }), S = N, f += b + v;
227
231
  }
228
- const E = o + S + 2 * J, O = a;
232
+ const W = h + S + 2 * J, R = a;
229
233
  this.legend = {
230
- width: E,
231
- height: O,
232
- items: v
234
+ width: W,
235
+ height: R,
236
+ items: T
233
237
  };
234
238
  }
235
239
  updateChartSizes(e, t, i) {
236
240
  const n = i.leaves().length;
237
241
  this.chartSizes.treeWidth = t ? e.width / 2 : e.width;
238
- const l = ce(n, e.scale, e.minCellHeight, e.maxCellHeight) * n;
239
- this.chartSizes.treeHeight = l, this.chartSizes.heatmapHeight = l;
242
+ const r = de(n, e.scale, e.minCellHeight, e.maxCellHeight) * n;
243
+ this.chartSizes.treeHeight = r, this.chartSizes.heatmapHeight = r, this.chartSizes.marginLeft = e.marginLeft, this.chartSizes.marginRight = e.marginRight, this.chartSizes.marginBottom = e.marginBottom, this.chartSizes.marginTop = e.marginTop;
240
244
  }
241
245
  updateTotalSizes(e) {
242
- this.chartSizes.totalWidth = this.chartSizes.treeWidth + this.chartSizes.heatmapWidth + this.legend.width + y.LEFT + y.RIGHT, e && (this.chartSizes.totalWidth += $), this.legend.width > 0 && (this.chartSizes.totalWidth += $), this.chartSizes.totalHeight = Math.max(this.chartSizes.treeHeight, this.legend.height) + y.TOP + y.BOTTOM;
246
+ this.chartSizes.totalWidth = this.chartSizes.treeWidth + this.chartSizes.heatmapWidth + this.legend.width + this.chartSizes.marginLeft + this.chartSizes.marginRight, e && (this.chartSizes.totalWidth += I), this.legend.width > 0 && (this.chartSizes.totalWidth += I), this.chartSizes.totalHeight = Math.max(this.chartSizes.treeHeight, this.legend.height) + this.chartSizes.marginTop + this.chartSizes.marginBottom;
243
247
  }
244
248
  prepareTableLabels(e) {
245
249
  const t = new G("bold 14px Arial"), i = "…";
@@ -248,57 +252,57 @@ class Ke {
248
252
  return;
249
253
  }
250
254
  const n = this.heatmapStep.x - 4;
251
- this.heatmapLabels = e.xKeys.map((l) => {
252
- const s = e.meta.xLabels[l];
253
- let c = t.getTextWidth(s);
254
- if (c < n)
255
+ this.heatmapLabels = e.xKeys.map((r) => {
256
+ const s = e.meta.xLabels[r];
257
+ let d = t.getTextWidth(s);
258
+ if (d < n)
255
259
  return s;
256
- let T = s, x = T == null ? void 0 : T.length;
257
- for (; c > n && x > 0; )
258
- x--, T = (s == null ? void 0 : s.substring(0, x)) + i, c = t.getTextWidth(T);
259
- return x > 0 ? T : "";
260
+ let z = s, v = z == null ? void 0 : z.length;
261
+ for (; d > n && v > 0; )
262
+ v--, z = (s == null ? void 0 : s.substring(0, v)) + i, d = t.getTextWidth(z);
263
+ return v > 0 ? z : "";
260
264
  });
261
265
  }
262
266
  addLabelsWidthToTreeArea(e, t) {
263
267
  if (!t)
264
268
  return;
265
269
  const i = e.leaves(), n = new G("bold 14px Manrope");
266
- let l = 0;
270
+ let r = 0;
267
271
  i.forEach((s) => {
268
272
  if (!s.data.label)
269
273
  return;
270
- const c = n.getTextWidth(s.data.label), T = s.y + c - this.chartSizes.treeWidth + 8;
271
- T > l && (l = T);
272
- }), this.chartSizes.treeWidth += l;
274
+ const d = n.getTextWidth(s.data.label), z = s.y + d - this.chartSizes.treeWidth + 8;
275
+ z > r && (r = z);
276
+ }), this.chartSizes.treeWidth += r;
273
277
  }
274
- render(e, t, i, n, l, s, c, T, x, A, L, w, H, v, S, f, o, a) {
275
- var E;
276
- this.updateChartSizes(t.size, v, i), this.updateHeatmapScales(v, S, t.size), this.updateLegendSize(t.legend, f, L, H, v, S), this.prepareTableLabels(v);
277
- const O = l === "top" ? [this.chartSizes.treeWidth, this.chartSizes.treeHeight] : [this.chartSizes.treeHeight, this.chartSizes.treeWidth];
278
- re().size(O).separation(() => 1)(i);
279
- const d = i;
280
- oe(
281
- d,
282
- l === "top" ? this.chartSizes.treeHeight : this.chartSizes.treeWidth,
283
- o === "alignLeavesToLine"
284
- ), he(d), this.addLabelsWidthToTreeArea(d, x), this.updateTotalSizes(v);
285
- const r = pe(e, L), p = /* @__PURE__ */ k.jsx(
278
+ render(e, t, i, n, r, s, d, z, v, A, y, w, C, T, S, f, h, a) {
279
+ var W;
280
+ this.updateChartSizes(t.size, T, i), this.updateHeatmapScales(T, S, t.size), this.updateLegendSize(t.legend, f, y, C, T, S), this.prepareTableLabels(T);
281
+ const R = r === "top" ? [this.chartSizes.treeWidth, this.chartSizes.treeHeight] : [this.chartSizes.treeHeight, this.chartSizes.treeWidth];
282
+ le().size(R).separation(() => 1)(i);
283
+ const m = i;
284
+ he(
285
+ m,
286
+ r === "top" ? this.chartSizes.treeHeight : this.chartSizes.treeWidth,
287
+ h === "alignLeavesToLine"
288
+ ), oe(m), this.addLabelsWidthToTreeArea(m, v), this.updateTotalSizes(T);
289
+ const l = pe(e, y), p = /* @__PURE__ */ B.jsx(
286
290
  ae,
287
291
  {
288
292
  chartSizes: this.chartSizes,
289
293
  chartSettings: t,
290
- nodes: d.descendants(),
291
- links: d.links(),
294
+ nodes: m.descendants(),
295
+ links: m.links(),
292
296
  connectionType: n,
293
- rootPosition: l,
297
+ rootPosition: r,
294
298
  edgeInheritance: s,
295
- showNodes: c,
296
- showEdges: T,
297
- showLeavesLabels: x,
299
+ showNodes: d,
300
+ showEdges: z,
301
+ showLeavesLabels: v,
298
302
  showNodesLabels: A,
299
- aesGetters: r,
303
+ aesGetters: l,
300
304
  labels: w,
301
- heatmapData: v,
305
+ heatmapData: T,
302
306
  heatmapScales: this.heatmapScales,
303
307
  heatmapStep: this.heatmapStep,
304
308
  heatmapColor: this.heatmapColorScale.getter,
@@ -307,14 +311,14 @@ class Ke {
307
311
  onClick: a
308
312
  }
309
313
  );
310
- this.component = p, (E = this.reactRoot) == null || E.render(p);
314
+ this.component = p, (W = this.reactRoot) == null || W.render(p);
311
315
  }
312
316
  renderError(e) {
313
317
  var t;
314
- (t = this.reactRoot) == null || t.render(/* @__PURE__ */ k.jsx(X, { message: e }));
318
+ (t = this.reactRoot) == null || t.render(/* @__PURE__ */ B.jsx(X, { message: e }));
315
319
  }
316
320
  }
317
321
  export {
318
- Ke as default
322
+ _e as default
319
323
  };
320
324
  //# sourceMappingURL=ChartRenderer.js.map