@milaboratories/graph-maker 1.1.92 → 1.1.93

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.
@@ -90371,7 +90371,7 @@ function M6t(e, t, n, r, a, i, o, s, c, f, A, p) {
90371
90371
  Ke || (H.meta.yDataByKeys[Ye][ce] = G[Ye]);
90372
90372
  }), H.facets[W].cells[Ce][ce] = { id: `${Ce}_${ce}`, x: Ce, y: ce, value: ge, normalizedValue: ge, data: G };
90373
90373
  }
90374
- }), _.forEach((G) => {
90374
+ }), H.meta.facetKeys = H.meta.facetKeys.filter((G) => H.facets[G]), H.meta.facetKeys.forEach((G) => {
90375
90375
  let W = H.facets[G];
90376
90376
  W.xKeys = Wr.uniq(W.xKeys), W.yKeys = Wr.uniq(W.yKeys), P.forEach((oe) => {
90377
90377
  H.facets[G].xKeysByGroups[oe] = Wr.uniq(H.facets[G].xKeysByGroups[oe]);
@@ -90380,7 +90380,7 @@ function M6t(e, t, n, r, a, i, o, s, c, f, A, p) {
90380
90380
  });
90381
90381
  }), A) {
90382
90382
  let G = [1 / 0, -1 / 0];
90383
- _.forEach((W) => {
90383
+ H.meta.facetKeys.forEach((W) => {
90384
90384
  let { xKeys: oe, yKeys: ve, cells: re } = H.facets[W], we = A.direction === "row" ? oe : ve, Ce = A.direction === "row" ? ve : oe, ce = A.direction === "row" ? (ge, Ye) => {
90385
90385
  var Oe;
90386
90386
  return (Oe = re[ge]) == null ? void 0 : Oe[Ye];
@@ -90403,7 +90403,7 @@ function M6t(e, t, n, r, a, i, o, s, c, f, A, p) {
90403
90403
  });
90404
90404
  }), H.meta.valueExtent = G;
90405
90405
  }
90406
- return H.meta.xKeysByGroups = P.reduce((G, W) => (G[W] = Wr.uniq(Wr.flatten(_.map((oe) => H.facets[oe].xKeysByGroups[W]))), G), {}), H.meta.yKeysByGroups = N.reduce((G, W) => (G[W] = Wr.uniq(Wr.flatten(_.map((oe) => H.facets[oe].yKeysByGroups[W]))), G), {}), H.meta.valueExtent[0] === 1 / 0 && (H.meta.valueExtent[0] = 0), H.meta.valueExtent[1] === -1 / 0 && (H.meta.valueExtent[1] = 0), H;
90406
+ return H.meta.xKeysByGroups = P.reduce((G, W) => (G[W] = Wr.uniq(Wr.flatten(H.meta.facetKeys.map((oe) => H.facets[oe].xKeysByGroups[W]))), G), {}), H.meta.yKeysByGroups = N.reduce((G, W) => (G[W] = Wr.uniq(Wr.flatten(H.meta.facetKeys.map((oe) => H.facets[oe].yKeysByGroups[W]))), G), {}), H.meta.valueExtent[0] === 1 / 0 && (H.meta.valueExtent[0] = 0), H.meta.valueExtent[1] === -1 / 0 && (H.meta.valueExtent[1] = 0), H;
90407
90407
  }
90408
90408
  function xte(e, t) {
90409
90409
  let n = 0;
@@ -92415,23 +92415,24 @@ function Wxt(e) {
92415
92415
  function Xxt(e, t) {
92416
92416
  return e === "standardScaling" ? Yxt(t) : e === "meanNormalization" ? Wxt(t) : (n) => n;
92417
92417
  }
92418
- function Kxt(e, t, n, r, a, i, o, s, c, f) {
92419
- let A = { meta: { facetKeys: o, xKeys: [], yKeys: [], xLabels: {}, yLabels: {}, facetKeyValues: o.reduce((w, x, B) => (w[x] = s[B], w), {}), valueExtentSize: [1 / 0, -1 / 0], valueExtentColor: [1 / 0, -1 / 0] }, facets: {} }, p = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), m = t.valueLabels ?? t.value, b = n.valueLabels ?? n.value;
92418
+ function Kxt(e, t, n, r, a, i, o, s, c) {
92419
+ let f = o.map((w) => w.join("_")), A = { meta: { facetKeys: f, xKeys: [], yKeys: [], xLabels: {}, yLabels: {}, facetKeyValues: f.reduce((w, x, B) => (w[x] = o[B], w), {}), valueExtentSize: [1 / 0, -1 / 0], valueExtentColor: [1 / 0, -1 / 0] }, facets: {} }, p = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), m = t.valueLabels ?? t.value, b = n.valueLabels ?? n.value;
92420
92420
  if (e.rows.forEach((w) => {
92421
- let x = i.length ? i.map((H) => w[H.value]).join("_") : "null", B = w[t.value], _ = w[n.value], P = w[r.value] ?? f, N = w[a.value] ?? f;
92421
+ let x = i.length ? i.map((H) => w[H.value]).join("_") : "null", B = w[t.value], _ = w[n.value], P = w[r.value] ?? c, N = w[a.value] ?? c;
92422
92422
  if (!(B === null || _ === null || P === null || N === null)) {
92423
92423
  if (A.facets[x] || (A.facets[x] = { xKeys: [], yKeys: [], cells: {} }), A.facets[x].xKeys.push(B), A.facets[x].yKeys.push(_), p.has(B) || (p.add(B), A.meta.xKeys.push(B)), h.has(_) || (h.add(_), A.meta.yKeys.push(_)), A.facets[x].cells[B] || (A.facets[x].cells[B] = {}), A.meta.valueExtentSize[0] = Math.min(P, A.meta.valueExtentSize[0]), A.meta.valueExtentSize[1] = Math.max(P, A.meta.valueExtentSize[1]), A.meta.valueExtentColor[0] = Math.min(N, A.meta.valueExtentColor[0]), A.meta.valueExtentColor[1] = Math.max(N, A.meta.valueExtentColor[1]), A.facets[x].cells[B][_]) throw Error(`More than 1 value for x=${B}, y=${_}`);
92424
92424
  if (A.meta.xLabels[B] && String(w[m]) !== A.meta.xLabels[B]) throw Error(`More than 1 x-label value for x=${B}`);
92425
92425
  if (A.meta.yLabels[_] && String(w[b]) !== A.meta.yLabels[_]) throw Error(`More than 1 y-label value for y=${_}`);
92426
92426
  A.meta.xLabels[B] = String(w[m]), A.meta.yLabels[_] = String(w[b]), A.meta && (A.facets[x].cells[B][_] = { id: `${B}_${_}`, x: B, y: _, sizeValue: P, normalizedSizeValue: P, colorValue: N, normalizedColorValue: N, data: w });
92427
92427
  }
92428
- }), o.forEach((w) => {
92428
+ }), A.meta.facetKeys = A.meta.facetKeys.filter((w) => A.facets[w]), A.meta.facetKeys.forEach((w) => {
92429
92429
  let x = A.facets[w];
92430
92430
  x.xKeys = Wr.uniq(x.xKeys), x.yKeys = Wr.uniq(x.yKeys);
92431
- }), c) {
92431
+ }), s) {
92432
92432
  let w = [1 / 0, -1 / 0];
92433
- o.forEach((x) => {
92434
- let { xKeys: B, yKeys: _, cells: P } = A.facets[x], N = c.direction === "row" ? B : _, H = c.direction === "row" ? _ : B, $ = c.direction === "row" ? (Q, q) => {
92433
+ A.meta.facetKeys.forEach((x) => {
92434
+ if (!A.facets[x]) return;
92435
+ let { xKeys: B, yKeys: _, cells: P } = A.facets[x], N = s.direction === "row" ? B : _, H = s.direction === "row" ? _ : B, $ = s.direction === "row" ? (Q, q) => {
92435
92436
  var X;
92436
92437
  return (X = P[Q]) == null ? void 0 : X[q];
92437
92438
  } : (Q, q) => {
@@ -92445,7 +92446,7 @@ function Kxt(e, t, n, r, a, i, o, s, c, f) {
92445
92446
  let z = (j = $(ne, Q)) == null ? void 0 : j.colorValue;
92446
92447
  z !== void 0 && q.push(z);
92447
92448
  });
92448
- let X = Xxt(c.method, q);
92449
+ let X = Xxt(s.method, q);
92449
92450
  N.forEach((ne) => {
92450
92451
  let z = $(ne, Q);
92451
92452
  z !== void 0 && (z.normalizedColorValue = X(z.colorValue), w[0] = Math.min(z.normalizedColorValue, w[0]), w[1] = Math.max(z.normalizedColorValue, w[1]));
@@ -92711,8 +92712,10 @@ var cSt = class {
92711
92712
  });
92712
92713
  }
92713
92714
  _updateData() {
92714
- let { facetBy: t, xColumn: n, yColumn: r, valueColumnSize: a, valueColumnColor: i, normalization: o, NAValueAs: s } = this.settings, c = t.map((p) => this.data.getColumnCategories(p.value)), f = (c.length ? Tte([...c]) : [["null"]]).map((p) => p.join(", ")), A = t.map((p) => p.value) ?? null;
92715
- this.data.setGrouping([...A]), this.calculatedData = { facetKeys: f, groupedCellsData: Kxt(this.data, n, r, a, i, t, f, c, o, s) };
92715
+ let { facetBy: t, xColumn: n, yColumn: r, valueColumnSize: a, valueColumnColor: i, normalization: o, NAValueAs: s } = this.settings, c = t.map((h) => this.data.getColumnCategories(h.value)), f = c.length ? Tte([...c]) : [["null"]], A = t.map((h) => h.value) ?? null;
92716
+ this.data.setGrouping([...A]);
92717
+ let p = Kxt(this.data, n, r, a, i, t, f, o, s);
92718
+ this.calculatedData = { facetKeys: p.meta.facetKeys, groupedCellsData: p };
92716
92719
  }
92717
92720
  _updateAesInData() {
92718
92721
  this.calculatedData;