fix: 修复自建台站交互分析弹窗peak未充值问题,左侧二维图表增加count和交叉轴上的energy

This commit is contained in:
Xu Zhimeng 2024-08-22 09:32:38 +08:00
parent 544f44066a
commit b7972ecd56
2 changed files with 57 additions and 7 deletions

View File

@ -1,6 +1,7 @@
<template>
<div class="beta-gamma-spectrum-chart">
<div class="beta-gamma-spectrum-chart-operators">
<span class="cnt">count: {{ axisInfo.c }}</span>
<span v-for="(item, index) in buttons" :key="item" @click="handleChange(index)">
{{ item }}
</span>
@ -74,16 +75,12 @@ const buttons = ['Gamma', 'Beta']
const TwoDOption = {
grid: {
top: 10,
left: 60,
left: 80,
right: 10,
bottom: 45,
},
tooltip: {
trigger: 'item',
formatter: (params) => {
const [b, g, c] = params.value
return `Beta: ${b}<br>Gamma: ${g}<br>Count: ${c}`
},
axisPointer: {
animation: false,
type: 'cross',
@ -92,6 +89,7 @@ const TwoDOption = {
},
label: {
backgroundColor: 'rgba(119, 181, 213, 1)',
formatter: null,
},
},
},
@ -134,7 +132,7 @@ const TwoDOption = {
fontSize: 16,
},
nameLocation: 'center',
nameGap: 40,
nameGap: 45,
axisLine: {
lineStyle: {
color: 'rgba(119, 181, 213, .3)',
@ -223,6 +221,7 @@ export default {
},
data() {
this.buttons = buttons
return {
showROI: true,
myChart: null,
@ -237,6 +236,13 @@ export default {
chartAxis: cloneDeep(ChartAxis),
boundary: [],
axisInfo: {
//
b: 0,
g: 0,
c: 0,
},
}
},
created() {
@ -248,10 +254,40 @@ export default {
this.$bus.$off('roiLimitItemChange', this.handleLimitItemChange)
},
mounted() {
this.setOption(cloneDeep(TwoDOption))
const newOption = cloneDeep(TwoDOption)
newOption.tooltip.axisPointer.label.formatter = this.axiosPointerFormatter
this.setOption(newOption)
},
methods: {
getAxiosCount(isBetaChannel, value) {
this.axisInfo[isBetaChannel ? 'b' : 'g'] = value
const { b, g } = this.axisInfo
if (this.histogramDataListMap) {
const find = this.histogramDataListMap.get(`${b}_${g}`)
if (find) {
this.axisInfo.c = find
} else {
this.axisInfo.c = 0
}
}
},
axiosPointerFormatter(params) {
const { axisDimension, value } = params
const isBetaChannel = axisDimension == 'x'
const fixedValue = value.toFixed()
this.getAxiosCount(isBetaChannel, fixedValue)
const energy = (isBetaChannel ? this.betaEnergyData : this.gammaEnergyData)[fixedValue]
return `c: ${fixedValue}\ne: ${energy ? energy.toFixed(3) : 0}`
},
setData(histogramDataList) {
const map = new Map()
histogramDataList.forEach(({ b, g, c }) => {
map.set(`${b}_${g}`, c)
})
this.histogramDataListMap = map
this.histogramDataList = histogramDataList
this.setVisialMapParams()
this.buildScatterList()
@ -620,6 +656,12 @@ export default {
justify-content: flex-end;
gap: 9px;
.cnt {
color: #ade6ee;
background: transparent;
cursor: auto;
}
.ant-space-item:first-child {
span {
width: 70px;

View File

@ -555,8 +555,12 @@ export default {
//
setInfoByType() {
this.opts.notMerge = true
const currROIItem = this.ROILists[this.currROIIndex] // ROI
const currRPIAnalyzeItem = this.ROIAnalyzeLists[this.currROIIndex] // ROI
this.selectedKeys = []
this.selectedTableItem = null
//
if (currRPIAnalyzeItem) {
const { allData, shadowChannelChart, shapeChannelData, peak, BaseCtrls, barChart } = currRPIAnalyzeItem
@ -600,6 +604,10 @@ export default {
this.list = []
}
this.$nextTick(() => {
this.resetChartOpts()
})
},
setChartOption(baseLine, count, peaks, baseCP, bar) {