fix: 修复切换Peak切页时barChart未移动的问题

This commit is contained in:
Xu Zhimeng 2023-11-02 16:49:55 +08:00
parent ad36a1f289
commit 481fcf99c3

View File

@ -550,9 +550,7 @@ export default {
this.option.series = series
this.thumbnailOption.series = this.buildBarChart(bar)
const thumbnailYMax = this.getThumbnailYMax(0, bar.length)
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
this.setThumbnailRange(1, bar.length)
},
reset() {
@ -712,6 +710,8 @@ export default {
let nextMin = xAxis - halfDiff
chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax
chartXAxisOption.min = nextMin < 1 ? 1 : nextMin
this.setThumbnailRange(chartXAxisOption.min, chartXAxisOption.max)
}
},
@ -960,6 +960,8 @@ export default {
let nextMin = channel - halfDiff
chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax
chartXAxisOption.min = nextMin < 1 ? 1 : nextMin
this.setThumbnailRange(chartXAxisOption.min, chartXAxisOption.max)
}
this.getSelPosNuclide(row)
@ -1030,12 +1032,7 @@ export default {
this.option.yAxis.min = y1
this.option.yAxis.max = y2
const thumbnailYMax = this.getThumbnailYMax(x1 - 1, x2)
this.thumbnailOption.xAxis.min = x1
this.thumbnailOption.xAxis.max = x2
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
this.setThumbnailRange(x1, x2)
if (this.btnGroupType == 2) {
this.buildRect()
}
@ -1044,12 +1041,17 @@ export default {
},
// barChart
getThumbnailYMax(minIndex, maxIndex) {
const slicedArr = this.barChart.slice(minIndex, maxIndex)
setThumbnailRange(x1, x2) {
const slicedArr = this.barChart.slice(x1 - 1, x2)
const yData = slicedArr.map(({ y }) => y)
const max = Math.max(...yData)
const min = Math.min(...yData)
return Math.max(Math.abs(max), Math.abs(min))
const thumbnailYMax = Math.max(Math.abs(max), Math.abs(min))
this.thumbnailOption.xAxis.min = x1
this.thumbnailOption.xAxis.max = x2
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
},
handleResetChart() {
@ -1058,11 +1060,7 @@ export default {
this.option.yAxis.min = 0.1
this.option.yAxis.max = 'dataMax'
const thumbnailYMax = this.getThumbnailYMax(0, this.barChart.length)
this.thumbnailOption.xAxis.min = 1
this.thumbnailOption.xAxis.max = 'dataMax'
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
this.setThumbnailRange(1, this.barChart.length)
if (this.btnGroupType == 2) {
this.buildRect()