@axdspub/axiom-charts 0.0.44 → 0.0.45

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.
@@ -199,6 +199,7 @@ class ChartRoot {
199
199
  this.plots = props.plots.map(p => (Object.assign({}, p)));
200
200
  this.settings = props.settings;
201
201
  this.element = props.element;
202
+ this.onChartDrew = props.onChartDrew;
202
203
  this.onPlotDataLoad = props.onPlotDataLoad;
203
204
  this.onPlotLegendReady = props.onPlotLegendReady;
204
205
  this.onPlotScrub = props.onPlotScrub;
@@ -427,6 +428,9 @@ class ChartRoot {
427
428
  yield Promise.all(plotImplementations.map((p) => __awaiter(this, void 0, void 0, function* () {
428
429
  yield p.draw();
429
430
  })));
431
+ if (this.onChartDrew !== undefined) {
432
+ this.onChartDrew();
433
+ }
430
434
  }
431
435
  });
432
436
  }
@@ -1738,8 +1742,9 @@ class AxiomRadialRose extends AxiomPlotRoot {
1738
1742
  const directionBinIndex = Math.floor(row.direction / degreesPerBin);
1739
1743
  const stack = stacks[directionBinIndex];
1740
1744
  const yValue = Number(yAccessor(row));
1741
- const speedBin = Math.ceil(yValue);
1742
- stack[speedBin] += 1;
1745
+ const speedBin = this.speedBins.find(bin => yValue < bin);
1746
+ if (speedBin !== undefined)
1747
+ stack[speedBin] += 1;
1743
1748
  });
1744
1749
  return stacks;
1745
1750
  }
@@ -1793,6 +1798,15 @@ class AxiomRadialRose extends AxiomPlotRoot {
1793
1798
  .scaleOrdinal()
1794
1799
  .range(fillColors);
1795
1800
  const data = d3.stack().keys(this.speedBins.map(bin => String(bin)))(this.stacks);
1801
+ data.forEach((bin, i) => {
1802
+ bin.forEach(direction => {
1803
+ // @ts-expect-error Append more data needed with each stack section
1804
+ direction.bin = {
1805
+ index: i,
1806
+ label: this.speedBins[i]
1807
+ };
1808
+ });
1809
+ });
1796
1810
  const chartOffset = chart.getChartOffset();
1797
1811
  const bandwidth = 2 * Math.PI / this.numBins;
1798
1812
  const getStartAngle = (direction) => {