fix: 解决scatterGL在各种情况下取值导致的渲染问题
This commit is contained in:
parent
c81923e744
commit
90017662ed
|
@ -17,7 +17,7 @@
|
||||||
v-if="!isLoading"
|
v-if="!isLoading"
|
||||||
slot="content"
|
slot="content"
|
||||||
@change="handleGraphAssistanceChange"
|
@change="handleGraphAssistanceChange"
|
||||||
@reset="handleReset"
|
@reset="handleResetChart"
|
||||||
/>
|
/>
|
||||||
</pop-over-with-icon>
|
</pop-over-with-icon>
|
||||||
<a-popover
|
<a-popover
|
||||||
|
@ -344,7 +344,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
|
|
||||||
this.reset()
|
this.handleResetState()
|
||||||
|
|
||||||
// const { success, result, message } = Response
|
// const { success, result, message } = Response
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ export default {
|
||||||
const { inputFileName: fileName } = this.sample
|
const { inputFileName: fileName } = this.sample
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.reset()
|
this.handleResetState()
|
||||||
// const { success, result, message } = Response
|
// const { success, result, message } = Response
|
||||||
const { success, result, message } = await getAction('/gamma/gammaByFile', {
|
const { success, result, message } = await getAction('/gamma/gammaByFile', {
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -458,7 +458,6 @@ export default {
|
||||||
this.shapeChannelData = shapeChannelData
|
this.shapeChannelData = shapeChannelData
|
||||||
this.shapeEnergyData = shapeEnergyData
|
this.shapeEnergyData = shapeEnergyData
|
||||||
|
|
||||||
this.option.yAxis.max = 'dataMax'
|
|
||||||
this.resetThumbnailChartDataMax()
|
this.resetThumbnailChartDataMax()
|
||||||
const series = []
|
const series = []
|
||||||
|
|
||||||
|
@ -625,19 +624,19 @@ export default {
|
||||||
case 'Linear':
|
case 'Linear':
|
||||||
this.option.yAxis.type = 'value'
|
this.option.yAxis.type = 'value'
|
||||||
this.thumbnailOption.yAxis.type = 'value'
|
this.thumbnailOption.yAxis.type = 'value'
|
||||||
this.handleReset()
|
this.handleResetChart()
|
||||||
break
|
break
|
||||||
case 'Log10':
|
case 'Log10':
|
||||||
this.option.yAxis.type = 'log'
|
this.option.yAxis.type = 'log'
|
||||||
this.thumbnailOption.yAxis.type = 'log'
|
this.thumbnailOption.yAxis.type = 'log'
|
||||||
this.handleReset()
|
this.handleResetChart()
|
||||||
break
|
break
|
||||||
case 'Channel':
|
case 'Channel':
|
||||||
case 'Energy':
|
case 'Energy':
|
||||||
this.graphAssistance.axisType = label
|
this.graphAssistance.axisType = label
|
||||||
this.option.xAxis.name = label
|
this.option.xAxis.name = label
|
||||||
|
|
||||||
this.handleReset()
|
this.handleResetChart()
|
||||||
|
|
||||||
this.redrawLineBySeriesName(
|
this.redrawLineBySeriesName(
|
||||||
'BaseLine',
|
'BaseLine',
|
||||||
|
@ -659,7 +658,9 @@ export default {
|
||||||
|
|
||||||
this.redrawThumbnailChart()
|
this.redrawThumbnailChart()
|
||||||
|
|
||||||
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
|
if (this.channelCompareLine) {
|
||||||
|
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'Lines':
|
case 'Lines':
|
||||||
this.graphAssistance.spectrumType = 'Lines'
|
this.graphAssistance.spectrumType = 'Lines'
|
||||||
|
@ -674,7 +675,10 @@ export default {
|
||||||
compareLineSeries.symbol = 'none'
|
compareLineSeries.symbol = 'none'
|
||||||
|
|
||||||
this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart)
|
this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart)
|
||||||
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
|
|
||||||
|
if (this.channelCompareLine) {
|
||||||
|
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'Scatter':
|
case 'Scatter':
|
||||||
this.graphAssistance.spectrumType = 'Scatter'
|
this.graphAssistance.spectrumType = 'Scatter'
|
||||||
|
@ -807,7 +811,7 @@ export default {
|
||||||
|
|
||||||
// 双击还原
|
// 双击还原
|
||||||
handleChartDblClick() {
|
handleChartDblClick() {
|
||||||
this.handleReset()
|
this.handleResetChart()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取 Nuclide Library 数据
|
// 获取 Nuclide Library 数据
|
||||||
|
@ -955,12 +959,16 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
handleMouseUp() {
|
handleMouseUp() {
|
||||||
setTimeout(() => {
|
if (this.timer) {
|
||||||
this.clearBrush(this.getChart())
|
window.clearTimeout(this.timer)
|
||||||
|
}
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
|
this.clearBrush()
|
||||||
}, 0)
|
}, 0)
|
||||||
},
|
},
|
||||||
|
|
||||||
clearBrush(chart) {
|
clearBrush() {
|
||||||
|
const chart = this.getChart()
|
||||||
// 清理刷选的范围
|
// 清理刷选的范围
|
||||||
chart.dispatchAction({
|
chart.dispatchAction({
|
||||||
type: 'brush',
|
type: 'brush',
|
||||||
|
@ -970,6 +978,7 @@ export default {
|
||||||
// 改为不可刷选状态
|
// 改为不可刷选状态
|
||||||
chart.dispatchAction({
|
chart.dispatchAction({
|
||||||
type: 'takeGlobalCursor',
|
type: 'takeGlobalCursor',
|
||||||
|
brushOption: false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -986,13 +995,18 @@ export default {
|
||||||
const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map((num) => parseInt(num.toFixed()))
|
const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map((num) => parseInt(num.toFixed()))
|
||||||
const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map((num) => parseInt(num.toFixed()))
|
const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map((num) => parseInt(num.toFixed()))
|
||||||
|
|
||||||
|
// 拿到之前的最大值
|
||||||
const xAxisMax = getAxisMax(chart, 'xAxis')
|
const xAxisMax = getAxisMax(chart, 'xAxis')
|
||||||
const yAxisMax = this.option.yAxis.max
|
const yAxisMax = getAxisMax(chart, 'yAxis')
|
||||||
|
|
||||||
|
// 拿到之前的最小值
|
||||||
|
const xAxisMin = this.option.xAxis.min
|
||||||
|
const yAxisMin = this.option.yAxis.min
|
||||||
|
|
||||||
let [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围
|
let [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围
|
||||||
|
|
||||||
const xAxisLimit = rangeNumber(1, xAxisMax)
|
const xAxisLimit = rangeNumber(xAxisMin, xAxisMax)
|
||||||
const yAxisLimit = rangeNumber(1, yAxisMax)
|
const yAxisLimit = rangeNumber(yAxisMin, yAxisMax)
|
||||||
|
|
||||||
x1 = xAxisLimit(x1)
|
x1 = xAxisLimit(x1)
|
||||||
x2 = xAxisLimit(x2)
|
x2 = xAxisLimit(x2)
|
||||||
|
@ -1020,8 +1034,6 @@ export default {
|
||||||
this.halfHeightPixel = rectHeightPixel / 2
|
this.halfHeightPixel = rectHeightPixel / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearBrush(chart)
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.rangeScatter()
|
this.rangeScatter()
|
||||||
})
|
})
|
||||||
|
@ -1029,12 +1041,9 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 因scatterGL 不受axis中max和min的控制,手动处理溢出部分
|
* 因scatterGL 不受axis中max和min的控制,手动处理溢出部分
|
||||||
* @param {*} x1 xAxis min
|
* @param {Boolean} isReset 是否重置到初始状态
|
||||||
* @param {*} x2 xAxis max
|
|
||||||
* @param {*} y1 yAxis min
|
|
||||||
* @param {*} y2 yAxis max
|
|
||||||
*/
|
*/
|
||||||
rangeScatter() {
|
rangeScatter(isReset) {
|
||||||
if (!this.isScatter()) {
|
if (!this.isScatter()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1050,23 +1059,33 @@ export default {
|
||||||
|
|
||||||
const channelSpectrumData = {
|
const channelSpectrumData = {
|
||||||
...this.shadowChannelChart,
|
...this.shadowChannelChart,
|
||||||
pointlist: this.pointlistLimit(this.shadowChannelChart.pointlist, x1, x2, y1, y2),
|
pointlist: isReset
|
||||||
|
? this.pointlistLimitY(this.shadowChannelChart.pointlist)
|
||||||
|
: this.pointlistLimit(this.shadowChannelChart.pointlist, x1, x2, y1, y2),
|
||||||
}
|
}
|
||||||
const energySpectrumData = {
|
const energySpectrumData = {
|
||||||
...this.shadowEnergyChart,
|
...this.shadowEnergyChart,
|
||||||
pointlist: this.pointlistLimit(this.shadowEnergyChart.pointlist, x1, x2, y1, y2),
|
pointlist: isReset
|
||||||
|
? this.pointlistLimitY(this.shadowEnergyChart.pointlist)
|
||||||
|
: this.pointlistLimit(this.shadowEnergyChart.pointlist, x1, x2, y1, y2),
|
||||||
}
|
}
|
||||||
this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData)
|
this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData)
|
||||||
|
|
||||||
const channelCompareLine = {
|
if (this.channelCompareLine) {
|
||||||
...this.channelCompareLine,
|
const channelCompareLine = {
|
||||||
pointlist: this.pointlistLimit(this.channelCompareLine.pointlist, x1, x2, y1, y2),
|
...this.channelCompareLine,
|
||||||
|
pointlist: isReset
|
||||||
|
? this.pointlistLimitY(this.channelCompareLine.pointlist)
|
||||||
|
: this.pointlistLimit(this.channelCompareLine.pointlist, x1, x2, y1, y2),
|
||||||
|
}
|
||||||
|
const energyCompareLine = {
|
||||||
|
...this.energyCompareLine,
|
||||||
|
pointlist: isReset
|
||||||
|
? this.pointlistLimitY(this.energyCompareLine.pointlist)
|
||||||
|
: this.pointlistLimit(this.energyCompareLine.pointlist, x1, x2, y1, y2),
|
||||||
|
}
|
||||||
|
this.redrawLineBySeriesName('Compare', energyCompareLine, channelCompareLine)
|
||||||
}
|
}
|
||||||
const energyCompareLine = {
|
|
||||||
...this.energyCompareLine,
|
|
||||||
pointlist: this.pointlistLimit(this.energyCompareLine.pointlist, x1, x2, y1, y2),
|
|
||||||
}
|
|
||||||
this.redrawLineBySeriesName('Compare', energyCompareLine, channelCompareLine)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1081,6 +1100,10 @@ export default {
|
||||||
return pointlist.filter(({ x, y }) => x >= x1 && x <= x2 && y >= y1 && y <= y2)
|
return pointlist.filter(({ x, y }) => x >= x1 && x <= x2 && y >= y1 && y <= y2)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
pointlistLimitY(pointlist) {
|
||||||
|
return pointlist.filter(({ y }) => y >= 1)
|
||||||
|
},
|
||||||
|
|
||||||
// 在右上角缩略图中设置范围
|
// 在右上角缩略图中设置范围
|
||||||
setThumbnailChartRect(x1, y2, x2, y1) {
|
setThumbnailChartRect(x1, y2, x2, y1) {
|
||||||
this.thumbnailChartRect = [x1, y2, x2, y1]
|
this.thumbnailChartRect = [x1, y2, x2, y1]
|
||||||
|
@ -1121,7 +1144,11 @@ export default {
|
||||||
const [x1, y2, x2, y1] = this.thumbnailChartRect
|
const [x1, y2, x2, y1] = this.thumbnailChartRect
|
||||||
const halfWidth = Math.ceil((x2 - x1) / 2)
|
const halfWidth = Math.ceil((x2 - x1) / 2)
|
||||||
|
|
||||||
const [, maxYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, this.thumbnailOption.yAxis.max]) // 缩略图最大值转为pix
|
// 缩略图最大值转为pix
|
||||||
|
const [, maxYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [
|
||||||
|
0,
|
||||||
|
getAxisMax(thumbnailChart, 'yAxis'),
|
||||||
|
])
|
||||||
const [, minYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, 1])
|
const [, minYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, 1])
|
||||||
|
|
||||||
let [xAxis, yAxis] = point
|
let [xAxis, yAxis] = point
|
||||||
|
@ -1156,18 +1183,19 @@ export default {
|
||||||
|
|
||||||
this.option.yAxis.min = minYAxis
|
this.option.yAxis.min = minYAxis
|
||||||
this.option.yAxis.max = maxYAxis
|
this.option.yAxis.max = maxYAxis
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.rangeScatter()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 重置
|
// 重置
|
||||||
handleReset() {
|
handleResetChart() {
|
||||||
const spectrumLineMaxX = Math.max(...this.shadowChannelChart.pointlist.map(({ x }) => x))
|
|
||||||
const spectrumLineMaxY = Math.max(...this.shadowChannelChart.pointlist.map(({ y }) => y))
|
|
||||||
|
|
||||||
this.option.xAxis.min = 1
|
this.option.xAxis.min = 1
|
||||||
this.option.xAxis.max = spectrumLineMaxX
|
this.option.xAxis.max = 'dataMax'
|
||||||
this.option.yAxis.min = 1
|
this.option.yAxis.min = 1
|
||||||
this.option.yAxis.max = spectrumLineMaxY
|
this.option.yAxis.max = 'dataMax'
|
||||||
|
|
||||||
const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
|
const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
|
||||||
thumbnailSpectrumLineSeries.markLine.data = []
|
thumbnailSpectrumLineSeries.markLine.data = []
|
||||||
|
@ -1175,13 +1203,13 @@ export default {
|
||||||
this.closePeakInfomationTooltip()
|
this.closePeakInfomationTooltip()
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.rangeScatter()
|
this.rangeScatter(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 从分析工具刷新部分数据
|
// 从分析工具刷新部分数据
|
||||||
handleRefresh(data) {
|
handleRefresh(data) {
|
||||||
this.reset()
|
this.handleResetState()
|
||||||
data.DetailedInformation = this.detailedInfomation
|
data.DetailedInformation = this.detailedInfomation
|
||||||
this.dataProsess(data)
|
this.dataProsess(data)
|
||||||
},
|
},
|
||||||
|
@ -1198,6 +1226,7 @@ export default {
|
||||||
this.$message.warn('Sample is Loading')
|
this.$message.warn('Sample is Loading')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.handleResetChart()
|
||||||
this.clearCompareLine()
|
this.clearCompareLine()
|
||||||
this.compareFileListModalVisible = true
|
this.compareFileListModalVisible = true
|
||||||
},
|
},
|
||||||
|
@ -1213,8 +1242,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const yAxisMax = getAxisMax(this.getChart(), 'yAxis')
|
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
|
||||||
this.thumbnailOption.yAxis.max = yAxisMax
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1225,8 +1253,8 @@ export default {
|
||||||
compareLine.data = []
|
compareLine.data = []
|
||||||
this.resetThumbnailChartDataMax()
|
this.resetThumbnailChartDataMax()
|
||||||
}
|
}
|
||||||
this.channelCompareLine = []
|
this.channelCompareLine = undefined
|
||||||
this.energyCompareLine = []
|
this.energyCompareLine = undefined
|
||||||
},
|
},
|
||||||
|
|
||||||
// 重新分析
|
// 重新分析
|
||||||
|
@ -1242,7 +1270,7 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.reset()
|
this.handleResetState()
|
||||||
|
|
||||||
const { inputFileName: fileName } = this.sample
|
const { inputFileName: fileName } = this.sample
|
||||||
const { success, result, message } = await postAction(`/gamma/Reprocessing?fileName=${fileName}`)
|
const { success, result, message } = await postAction(`/gamma/Reprocessing?fileName=${fileName}`)
|
||||||
|
@ -1308,7 +1336,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 重置页面信息
|
// 重置页面信息
|
||||||
reset() {
|
handleResetState() {
|
||||||
this.selectedChannel = -1
|
this.selectedChannel = -1
|
||||||
this.nuclideLibraryList = []
|
this.nuclideLibraryList = []
|
||||||
this.closePeakInfomationTooltip()
|
this.closePeakInfomationTooltip()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user