0

There is a chart generated with billboard.js and I want to update the min/max values of Y-axis.

For doing this, I wrote in html:

<span>
    Max:</br>
    <input ng-change="$ctrl.updateY()" ng-model="$ctrl.maxValue"></br>
    Min:</br>
    <input ng-change="$ctrl.updateY()" ng-model="$ctrl.minValue"></br>
</span>

And in JS:

updateY() {
    this.lineView.chart.axis.max({y: this.maxValue});
    this.lineView.chart.axis.min({y: this.minValue});
}

It works fine for the min value but for max it doesn't.

For example if I set the maximum value to 100, on the Y-axis it is 1000.

For 1000 it is 100000.

For 10000 it is 1000000. I guess it adds an extra zero but didn't find out how and where. For min everything it's working fine. Is this a bug?

Any ideas?

Samurai Jack
  • 2,985
  • 8
  • 35
  • 58
  • You are going to need to provide a reproducible example. I tired to reproduce it [here](http://plnkr.co/edit/ChNSKoVENDXUEXwdF8Ye?p=preview) but was not able to. – Mark Feb 10 '18 at 13:48
  • Could you provide full generation option code? – Jae Sung Park Feb 12 '18 at 06:59
  • @JaeSungPark I think it's too complicated to put all the code here, I solved the problem by using `range()` instead of `min()` and `max()` – Samurai Jack Feb 12 '18 at 10:26

1 Answers1

1

This is issue is solved if it is used range() insted of min() and max(). For some reason it doesn't update correctly with the later methods.

updateY() {
    const maxNumber = Number(this.maxValue);
    const minNumber = Number(this.minValue);
    this.lineView.chart.axis.range({max: {y: maxNumber}, min: {y: minNumber}});
}
Samurai Jack
  • 2,985
  • 8
  • 35
  • 58