I have two textboxes in which I can write numerical values which are used to get the min and max value of Y axis in a chart.
For example, if I have the values set on min = 0
and max = 100
, the Y-axis of the chart will be from 0 to 100. If I change max = 50
, the chart is rendered for Y-axis from 0 to 50.
The problem is if I delete the value and don't write anything in place, the chart disappears. What I want to do is if the value is deleted and nothing is written after, to keep that value and don't do anything to the chart.
This is the html:
<span class="min-max">
Max:</br>
<input type="number" ng-change="$ctrl.updateY()" ng-model="$ctrl.maxValue"></br>
Min:</br>
<input type="number" ng-change="$ctrl.updateY()" ng-model="$ctrl.minValue"></br>
</span>
This is the js function:
updateY() {
const maxNumber = Number(this.maxValue);
const minNumber = Number(this.minValue);
this.lineView.chart.axis.range({max: {y: maxNumber}, min: {y: minNumber}});
}
Any suggestions?