@milaboratories/graph-maker 1.1.135 → 1.1.137

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