@axdspub/axiom-charts 0.0.30 → 0.0.32

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.
@@ -71,6 +71,10 @@ class PlotRoot extends RequestItem {
71
71
  enabled: true,
72
72
  axis: EChartAxes.x
73
73
  };
74
+ this.legendSettingsDefaults = {
75
+ hide: false,
76
+ axis: EChartAxes.y
77
+ };
74
78
  this.id = props.id;
75
79
  this.type = props.type;
76
80
  this.chart = props.chart;
@@ -80,7 +84,7 @@ class PlotRoot extends RequestItem {
80
84
  this.onDataLoad = props.onDataLoad;
81
85
  this.axisSettings = props.axisSettings;
82
86
  this.scrubSettings = Object.assign(Object.assign({}, this.scrubSettingsDefaults), props.scrubSettings);
83
- this.legendSettings = Object.assign({ hide: false }, props.legendSettings);
87
+ this.legendSettings = Object.assign(Object.assign({}, this.legendSettingsDefaults), props.legendSettings);
84
88
  this.runtime = {};
85
89
  }
86
90
  getAxisSetting(axis) {
@@ -547,12 +551,17 @@ class AxiomLine extends AxiomPlotRoot {
547
551
  }
548
552
  line$1(this.parsedData);
549
553
  ctx.stroke();
550
- if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined && !((_o = this.legendSettings.hide) !== null && _o !== void 0 ? _o : false)) {
551
- _super.onLegendReady.call(this, [{
552
- id: this.axes.y.key,
553
- label: (_p = chart.getAxisLabel(this.axes.y, 'y')) !== null && _p !== void 0 ? _p : this.axes.y.key,
554
- style: { backgroundColor: ctx.strokeStyle }
555
- }]);
554
+ if (this.legendSettings.axis !== undefined &&
555
+ this.axes !== undefined &&
556
+ !((_m = this.legendSettings.hide) !== null && _m !== void 0 ? _m : false)) {
557
+ const legendAxis = this.axes[this.legendSettings.axis];
558
+ if (legendAxis !== undefined) {
559
+ _super.onLegendReady.call(this, [{
560
+ id: legendAxis.key,
561
+ label: (_p = (_o = chart.getAxisLabel(legendAxis, this.legendSettings.axis)) !== null && _o !== void 0 ? _o : legendAxis.label) !== null && _p !== void 0 ? _p : legendAxis.key,
562
+ style: { backgroundColor: ctx.strokeStyle }
563
+ }]);
564
+ }
556
565
  }
557
566
  this.setupScrubbing();
558
567
  });
@@ -1714,19 +1723,21 @@ class AxiomRadialRose extends AxiomPlotRoot {
1714
1723
  getStackedData(parsedData, yAccessor) {
1715
1724
  const degreesPerBin = 360 / this.numBins;
1716
1725
  const directionBins = d3.range(0, 360, degreesPerBin);
1717
- const speedBins = this.speedBins;
1726
+ // const speedBins = this.speedBins
1727
+ const values = parsedData.map(d => d.value);
1728
+ this.speedBins = d3.ticks(d3.min(values), d3.max(values), 5);
1718
1729
  const stacks = [];
1719
1730
  directionBins.forEach(direction => {
1720
1731
  const newBin = {
1721
1732
  minDirection: direction
1722
1733
  };
1723
- speedBins.forEach(bin => { newBin[bin] = 0; });
1734
+ this.speedBins.forEach(bin => { newBin[bin] = 0; });
1724
1735
  stacks.push(newBin);
1725
1736
  });
1726
1737
  parsedData.forEach(row => {
1727
1738
  const directionBinIndex = Math.floor(row.direction / degreesPerBin);
1728
1739
  const stack = stacks[directionBinIndex];
1729
- if (Number(yAccessor(row)) < speedBins[speedBins.length - 1]) {
1740
+ if (Number(yAccessor(row)) < this.speedBins[this.speedBins.length - 1]) {
1730
1741
  const speedBin = Math.floor(Number(yAccessor(row)));
1731
1742
  stack[speedBin] += 1;
1732
1743
  }