diff --git a/src/plugins/plot/MctPlot.vue b/src/plugins/plot/MctPlot.vue index f7f743324b..ea5d8dd398 100644 --- a/src/plugins/plot/MctPlot.vue +++ b/src/plugins/plot/MctPlot.vue @@ -37,6 +37,7 @@ v-if="seriesModels.length > 0" :tick-width="tickWidth" :single-series="seriesModels.length === 1" + :has-same-range-value="hasSameRangeValue" :series-model="seriesModels[0]" :style="{ left: (plotWidth - tickWidth) + 'px' @@ -250,7 +251,8 @@ export default { loaded: false, isTimeOutOfSync: false, showLimitLineLabels: undefined, - isFrozenOnMouseDown: false + isFrozenOnMouseDown: false, + hasSameRangeValue: true }; }, computed: { @@ -362,6 +364,7 @@ export default { this.setDisplayRange(series, xKey); }, this); this.listenTo(series, 'change:yKey', () => { + this.checkSameRangeValue(); this.loadSeriesData(series); }, this); @@ -369,10 +372,18 @@ export default { this.loadSeriesData(series); }, this); + this.checkSameRangeValue(); this.loadSeriesData(series); }, + checkSameRangeValue() { + this.hasSameRangeValue = this.seriesModels.every((model) => { + return model.get('yKey') === this.seriesModels[0].get('yKey'); + }); + }, + removeSeries(plotSeries) { + this.checkSameRangeValue(); this.stopListening(plotSeries); }, @@ -488,7 +499,7 @@ export default { }, setDisplayRange(series, xKey) { - if (this.config.series.length !== 1) { + if (this.config.series.models.length !== 1) { return; } diff --git a/src/plugins/plot/axis/YAxis.vue b/src/plugins/plot/axis/YAxis.vue index 85f7946c18..9c18394a15 100644 --- a/src/plugins/plot/axis/YAxis.vue +++ b/src/plugins/plot/axis/YAxis.vue @@ -29,9 +29,9 @@ >