@axdspub/axiom-charts 0.0.24 → 0.0.26

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.
@@ -1660,15 +1660,16 @@ class AxiomRadialRose extends AxiomPlotRoot {
1660
1660
  this.stacks = undefined;
1661
1661
  }
1662
1662
  setStackedData() {
1663
- var _a, _b;
1663
+ var _a, _b, _c;
1664
1664
  return __awaiter(this, void 0, void 0, function* () {
1665
1665
  let parsedData = [];
1666
1666
  if (this.data === undefined) {
1667
1667
  this.data = yield this.getData();
1668
1668
  parsedData = (_b = (_a = this.data.parsed) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : [];
1669
1669
  }
1670
- if (this.stacks === undefined) {
1671
- this.stacks = this.getStackedData(parsedData);
1670
+ const y = (_c = this.data.parsed) === null || _c === void 0 ? void 0 : _c.accessors.y;
1671
+ if (this.stacks === undefined && y !== undefined) {
1672
+ this.stacks = this.getStackedData(parsedData, y);
1672
1673
  }
1673
1674
  });
1674
1675
  }
@@ -1680,7 +1681,7 @@ class AxiomRadialRose extends AxiomPlotRoot {
1680
1681
  return [0, this.getMaxStackTotal(this.stacks)];
1681
1682
  });
1682
1683
  }
1683
- getStackedData(parsedData) {
1684
+ getStackedData(parsedData, yAccessor) {
1684
1685
  const degreesPerBin = 360 / this.numBins;
1685
1686
  const directionBins = d3.range(0, 360, degreesPerBin);
1686
1687
  const speedBins = this.speedBins;
@@ -1695,8 +1696,8 @@ class AxiomRadialRose extends AxiomPlotRoot {
1695
1696
  parsedData.forEach(row => {
1696
1697
  const directionBinIndex = Math.floor(row.direction / degreesPerBin);
1697
1698
  const stack = stacks[directionBinIndex];
1698
- if (row.speed < speedBins[speedBins.length - 1]) {
1699
- const speedBin = Math.floor(row.speed);
1699
+ if (Number(yAccessor(row)) < speedBins[speedBins.length - 1]) {
1700
+ const speedBin = Math.floor(Number(yAccessor(row)));
1700
1701
  stack[speedBin] += 1;
1701
1702
  }
1702
1703
  });
@@ -1714,9 +1715,6 @@ class AxiomRadialRose extends AxiomPlotRoot {
1714
1715
  });
1715
1716
  var _a, _b, _c, _d, _e, _f;
1716
1717
  return __awaiter(this, void 0, void 0, function* () {
1717
- yield this.setStackedData();
1718
- if (this.stacks === undefined || this.speedBins === undefined)
1719
- return;
1720
1718
  const xAccessors = this.getAccessorsAtAxis('x');
1721
1719
  const xAccessor = this.getAccessorAtAxis('x');
1722
1720
  const x0Accessor = xAccessors.x0;
@@ -1725,6 +1723,7 @@ class AxiomRadialRose extends AxiomPlotRoot {
1725
1723
  const yAccessor = this.getAccessorAtAxis('y');
1726
1724
  const y0Accessor = yAccessors.y0;
1727
1725
  const y1Accessor = yAccessors.y1;
1726
+ yield this.setStackedData();
1728
1727
  const chart = this.chart;
1729
1728
  const chartElements = chart.getChartElements();
1730
1729
  if (chartElements === undefined || chartElements.svg === null) {
@@ -1740,6 +1739,8 @@ class AxiomRadialRose extends AxiomPlotRoot {
1740
1739
  console.log('Missing one of: xAxisScale, yAxisScale, parsedData, xAccessor(s), yAccessor(s)');
1741
1740
  return undefined;
1742
1741
  }
1742
+ if (this.stacks === undefined || this.speedBins === undefined)
1743
+ return;
1743
1744
  const maxStackTotal = this.getMaxStackTotal(this.stacks);
1744
1745
  const xScale = d3.scaleBand()
1745
1746
  .domain(d3.range(0, 360, 360 / this.numBins))