Plot y axis label fix (#2437)

* set yAxis label if none is set yet

* remove empty listener
This commit is contained in:
Deep Tailor 2019-07-31 10:24:27 -07:00 committed by Pegah Sarram
parent e6a7b4ed6c
commit 3b094e43e3
2 changed files with 10 additions and 2 deletions

View File

@ -124,7 +124,7 @@
ng-model="yAxisLabel" ng-change="plot.toggleYAxisLabel(yAxisLabel, yKeyOptions, series[0])">
<option ng-repeat="option in yKeyOptions"
value="{{option.name}}"
ng-selected="option.name == yAxisLabel">
ng-selected="option.name === yAxisLabel">
{{option.name}}
</option>
</select>
@ -177,7 +177,7 @@
<div class="gl-plot__local-controls h-local-controls h-local-controls--overlay-content c-local-controls--show-on-hover">
<div class="c-button-set c-button-set--strip-h">
<button class="c-button icon-minus"
ng-click="plot.toggleYAxis()"
ng-click="plot.zoom('out', 0.2)"
title="Zoom out">
</button>
<button class="c-button icon-plus"

View File

@ -123,6 +123,14 @@ define([
key: o.key
};
});
// set yAxisLabel if none is set yet
if (this.$scope.yAxisLabel === 'none') {
let yKey = this.$scope.series[0].model.yKey,
yKeyModel = this.$scope.yKeyOptions.filter(o => o.key === yKey)[0];
this.$scope.yAxisLabel = yKeyModel.name;
}
} else {
this.$scope.yKeyOptions = undefined;
}