Form file选择能谱文件之后,曲线图没渲染数据
This commit is contained in:
		
							parent
							
								
									60c2ed556e
								
							
						
					
					
						commit
						1b80817da3
					
				| 
						 | 
				
			
			@ -263,238 +263,7 @@ export default {
 | 
			
		|||
        })
 | 
			
		||||
        console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
 | 
			
		||||
        if (success) {
 | 
			
		||||
          this.isLoading = false
 | 
			
		||||
 | 
			
		||||
          const {
 | 
			
		||||
            dead_time,
 | 
			
		||||
            live_time,
 | 
			
		||||
            real_time,
 | 
			
		||||
            start_time,
 | 
			
		||||
 | 
			
		||||
            DetailedInformation,
 | 
			
		||||
            QCFlag,
 | 
			
		||||
 | 
			
		||||
            allData,
 | 
			
		||||
 | 
			
		||||
            shadowChannelChart,
 | 
			
		||||
            shadowEnergyChart,
 | 
			
		||||
 | 
			
		||||
            shapeChannelData,
 | 
			
		||||
            shapeEnergyData
 | 
			
		||||
          } = result
 | 
			
		||||
 | 
			
		||||
          this.detailedInfomation = DetailedInformation
 | 
			
		||||
          this.qcFlags = QCFlag
 | 
			
		||||
 | 
			
		||||
          const channelPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'channel')
 | 
			
		||||
          const energyPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          const channelBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'channel')
 | 
			
		||||
          const energyBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          const channelLcLine = allData.find(item => item.name == 'Lc' && item.group == 'channel')
 | 
			
		||||
          const energyLcLine = allData.find(item => item.name == 'Lc' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          const channelScacLine = allData.find(item => item.name == 'Scac' && item.group == 'channel')
 | 
			
		||||
          const energyScacLine = allData.find(item => item.name == 'Scac' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          this.allEnergy = allData.find(item => item.name == 'Energy' && item.group == 'energy')
 | 
			
		||||
          this.allChannel = allData.find(item => item.name == 'Count' && item.group == 'channel')
 | 
			
		||||
 | 
			
		||||
          // 保存Peak Line
 | 
			
		||||
          this.channelPeakGroup = channelPeakGroup
 | 
			
		||||
          this.energyPeakGroup = energyPeakGroup
 | 
			
		||||
 | 
			
		||||
          // 保存 Spectrum Line
 | 
			
		||||
          this.shadowChannelChart = shadowChannelChart
 | 
			
		||||
          this.shadowEnergyChart = shadowEnergyChart
 | 
			
		||||
 | 
			
		||||
          // 保存基线
 | 
			
		||||
          this.channelBaseLine = channelBaseLine
 | 
			
		||||
          this.energyBaseLine = energyBaseLine
 | 
			
		||||
 | 
			
		||||
          // 保存Lc
 | 
			
		||||
          this.channelLcLine = channelLcLine
 | 
			
		||||
          this.energyLcLine = energyLcLine
 | 
			
		||||
 | 
			
		||||
          // 保存Scac
 | 
			
		||||
          this.channelScacLine = channelScacLine
 | 
			
		||||
          this.energyScacLine = energyScacLine
 | 
			
		||||
 | 
			
		||||
          // 保存 基线控制点
 | 
			
		||||
          this.shapeChannelData = shapeChannelData
 | 
			
		||||
          this.shapeEnergyData = shapeEnergyData
 | 
			
		||||
 | 
			
		||||
          this.option.yAxis.max = Math.ceil(Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1)
 | 
			
		||||
          this.thumbnailOption.yAxis.max = Math.ceil(
 | 
			
		||||
            Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1
 | 
			
		||||
          )
 | 
			
		||||
 | 
			
		||||
          const series = []
 | 
			
		||||
 | 
			
		||||
          // 推入Spectrum Line
 | 
			
		||||
          series.push({
 | 
			
		||||
            name: 'Spectrum',
 | 
			
		||||
            type: 'line',
 | 
			
		||||
            data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              color: `rgb(${shadowChannelChart.color})`
 | 
			
		||||
            },
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              width: 1
 | 
			
		||||
            },
 | 
			
		||||
            symbol: 'none',
 | 
			
		||||
            symbolSize: 1,
 | 
			
		||||
            emphasis: {
 | 
			
		||||
              disabled: true
 | 
			
		||||
            },
 | 
			
		||||
            markLine: {
 | 
			
		||||
              silent: true,
 | 
			
		||||
              symbol: 'none',
 | 
			
		||||
              label: {
 | 
			
		||||
                show: false
 | 
			
		||||
              },
 | 
			
		||||
              lineStyle: {
 | 
			
		||||
                color: 'red',
 | 
			
		||||
                width: 1
 | 
			
		||||
              },
 | 
			
		||||
              data: [{ xAxis: -1 }]
 | 
			
		||||
            },
 | 
			
		||||
            animation: false
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          // 右上角缩略图推入Spectrum Line
 | 
			
		||||
          this.thumbnailOption.series.push({
 | 
			
		||||
            name: 'Spectrum',
 | 
			
		||||
            type: 'line',
 | 
			
		||||
            data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              color: `rgb(${shadowChannelChart.color})`
 | 
			
		||||
            },
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              width: 1
 | 
			
		||||
            },
 | 
			
		||||
            symbol: 'none',
 | 
			
		||||
            symbolSize: 1,
 | 
			
		||||
            emphasis: {
 | 
			
		||||
              disabled: true
 | 
			
		||||
            },
 | 
			
		||||
            silent: true,
 | 
			
		||||
            markLine: {
 | 
			
		||||
              silent: true,
 | 
			
		||||
              symbol: 'none',
 | 
			
		||||
              label: {
 | 
			
		||||
                show: false
 | 
			
		||||
              },
 | 
			
		||||
              lineStyle: {
 | 
			
		||||
                type: 'solid',
 | 
			
		||||
                color: '#1397a3',
 | 
			
		||||
                width: 1
 | 
			
		||||
              },
 | 
			
		||||
              data: []
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          // 推入BaseLine
 | 
			
		||||
          series.push({
 | 
			
		||||
            name: 'BaseLine',
 | 
			
		||||
            type: 'line',
 | 
			
		||||
            data: channelBaseLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              color: `rgb(${channelBaseLine.color})`
 | 
			
		||||
            },
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              width: 1
 | 
			
		||||
            },
 | 
			
		||||
            symbol: 'none',
 | 
			
		||||
            emphasis: {
 | 
			
		||||
              disabled: true
 | 
			
		||||
            },
 | 
			
		||||
            animation: false,
 | 
			
		||||
            zlevel: 2
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          // 推入LcLine线
 | 
			
		||||
          series.push({
 | 
			
		||||
            name: 'LcLine',
 | 
			
		||||
            type: 'line',
 | 
			
		||||
            data: channelLcLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              color: `rgb(${channelLcLine.color})`
 | 
			
		||||
            },
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              width: 1
 | 
			
		||||
            },
 | 
			
		||||
            symbol: 'none',
 | 
			
		||||
            emphasis: {
 | 
			
		||||
              disabled: true
 | 
			
		||||
            },
 | 
			
		||||
            animation: false,
 | 
			
		||||
            zlevel: 3
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          // 推入Scac线
 | 
			
		||||
          series.push({
 | 
			
		||||
            name: 'ScacLine',
 | 
			
		||||
            type: 'line',
 | 
			
		||||
            data: channelScacLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              color: `rgb(${channelScacLine.color})`
 | 
			
		||||
            },
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              width: 1
 | 
			
		||||
            },
 | 
			
		||||
            symbol: 'none',
 | 
			
		||||
            emphasis: {
 | 
			
		||||
              disabled: true
 | 
			
		||||
            },
 | 
			
		||||
            animation: false,
 | 
			
		||||
            zlevel: 4
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          // 推入基线控制点
 | 
			
		||||
          series.push({
 | 
			
		||||
            name: 'BaseLine_Ctrl_Point',
 | 
			
		||||
            type: 'scatter',
 | 
			
		||||
            data: shapeChannelData.map(({ size, color, point: { x, y } }) => {
 | 
			
		||||
              return {
 | 
			
		||||
                value: [x, y],
 | 
			
		||||
                itemStyle: {
 | 
			
		||||
                  color: 'transparent',
 | 
			
		||||
                  borderColor: color,
 | 
			
		||||
                  borderWidth: size / 2
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            }),
 | 
			
		||||
            emphasis: {
 | 
			
		||||
              disabled: true
 | 
			
		||||
            },
 | 
			
		||||
            animation: false,
 | 
			
		||||
            zlevel: 5
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          // 推入Peak Line
 | 
			
		||||
          const peakLines = []
 | 
			
		||||
          channelPeakGroup.forEach((item, index) => {
 | 
			
		||||
            peakLines.push({
 | 
			
		||||
              name: `Peak_${index}`,
 | 
			
		||||
              type: 'line',
 | 
			
		||||
              data: item.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
              itemStyle: {
 | 
			
		||||
                color: `rgb(${item.color})`
 | 
			
		||||
              },
 | 
			
		||||
              lineStyle: {
 | 
			
		||||
                width: 1
 | 
			
		||||
              },
 | 
			
		||||
              symbol: 'none',
 | 
			
		||||
              animation: false,
 | 
			
		||||
              zlevel: 6
 | 
			
		||||
            })
 | 
			
		||||
          })
 | 
			
		||||
          series.push(...peakLines)
 | 
			
		||||
          this.option.series = series
 | 
			
		||||
 | 
			
		||||
          this.option.tooltip.formatter = this.tooltipFormatter
 | 
			
		||||
          this.dataProsess(result)
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$message.error(message)
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -502,6 +271,7 @@ export default {
 | 
			
		|||
        console.error(error)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    
 | 
			
		||||
    async getSampleDetail_file() {
 | 
			
		||||
      const { inputFileName: fileName } = this.sample
 | 
			
		||||
      try {
 | 
			
		||||
| 
						 | 
				
			
			@ -514,6 +284,16 @@ export default {
 | 
			
		|||
        })
 | 
			
		||||
        console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
 | 
			
		||||
        if (success) {
 | 
			
		||||
          this.dataProsess(result)
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$message.error(message)
 | 
			
		||||
        }
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error(error)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    dataProsess(result) {
 | 
			
		||||
      this.isLoading = false
 | 
			
		||||
 | 
			
		||||
      const {
 | 
			
		||||
| 
						 | 
				
			
			@ -540,16 +320,16 @@ export default {
 | 
			
		|||
      const channelPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'channel')
 | 
			
		||||
      const energyPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          const channelBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'channel')
 | 
			
		||||
      const channelBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'channel')||{}
 | 
			
		||||
      const energyBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          const channelLcLine = allData.find(item => item.name == 'Lc' && item.group == 'channel')
 | 
			
		||||
      const channelLcLine = allData.find(item => item.name == 'Lc' && item.group == 'channel')||{}
 | 
			
		||||
      const energyLcLine = allData.find(item => item.name == 'Lc' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          const channelScacLine = allData.find(item => item.name == 'Scac' && item.group == 'channel')
 | 
			
		||||
      const channelScacLine = allData.find(item => item.name == 'Scac' && item.group == 'channel')||{}
 | 
			
		||||
      const energyScacLine = allData.find(item => item.name == 'Scac' && item.group == 'energy')
 | 
			
		||||
 | 
			
		||||
          this.allEnergy = allData.find(item => item.name == 'Energy' && item.group == 'energy')
 | 
			
		||||
      this.allEnergy = allData.find(item => item.name == 'Energy' && item.group == 'energy')||{}
 | 
			
		||||
      this.allChannel = allData.find(item => item.name == 'Count' && item.group == 'channel')
 | 
			
		||||
 | 
			
		||||
      // 保存Peak Line
 | 
			
		||||
| 
						 | 
				
			
			@ -576,8 +356,8 @@ export default {
 | 
			
		|||
      this.shapeChannelData = shapeChannelData
 | 
			
		||||
      this.shapeEnergyData = shapeEnergyData
 | 
			
		||||
 | 
			
		||||
          this.option.yAxis.max = Math.ceil(Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1)
 | 
			
		||||
          this.thumbnailOption.yAxis.max = Math.ceil(
 | 
			
		||||
      this.option.yAxis.max = shadowChannelChart.pointlist&&Math.ceil(Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1)
 | 
			
		||||
      this.thumbnailOption.yAxis.max = shadowChannelChart.pointlist&&Math.ceil(
 | 
			
		||||
        Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -587,7 +367,7 @@ export default {
 | 
			
		|||
      series.push({
 | 
			
		||||
        name: 'Spectrum',
 | 
			
		||||
        type: 'line',
 | 
			
		||||
            data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        data: shadowChannelChart.pointlist&&shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        itemStyle: {
 | 
			
		||||
          color: `rgb(${shadowChannelChart.color})`
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -618,7 +398,7 @@ export default {
 | 
			
		|||
      this.thumbnailOption.series.push({
 | 
			
		||||
        name: 'Spectrum',
 | 
			
		||||
        type: 'line',
 | 
			
		||||
            data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        data: shadowChannelChart.pointlist&&shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        itemStyle: {
 | 
			
		||||
          color: `rgb(${shadowChannelChart.color})`
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -645,12 +425,11 @@ export default {
 | 
			
		|||
          data: []
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      // 推入BaseLine
 | 
			
		||||
      series.push({
 | 
			
		||||
        name: 'BaseLine',
 | 
			
		||||
        type: 'line',
 | 
			
		||||
            data: channelBaseLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        data: channelBaseLine.pointlist&&channelBaseLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        itemStyle: {
 | 
			
		||||
          color: `rgb(${channelBaseLine.color})`
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -669,7 +448,7 @@ export default {
 | 
			
		|||
      series.push({
 | 
			
		||||
        name: 'LcLine',
 | 
			
		||||
        type: 'line',
 | 
			
		||||
            data: channelLcLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        data: channelLcLine.pointlist&&channelLcLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        itemStyle: {
 | 
			
		||||
          color: `rgb(${channelLcLine.color})`
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -688,7 +467,7 @@ export default {
 | 
			
		|||
      series.push({
 | 
			
		||||
        name: 'ScacLine',
 | 
			
		||||
        type: 'line',
 | 
			
		||||
            data: channelScacLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        data: channelScacLine.pointlist&&channelScacLine.pointlist.map(({ x, y }) => [x, y]),
 | 
			
		||||
        itemStyle: {
 | 
			
		||||
          color: `rgb(${channelScacLine.color})`
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -746,12 +525,6 @@ export default {
 | 
			
		|||
      this.option.series = series
 | 
			
		||||
 | 
			
		||||
      this.option.tooltip.formatter = this.tooltipFormatter
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$message.error(message)
 | 
			
		||||
        }
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error(error)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    tooltipFormatter(params) {
 | 
			
		||||
| 
						 | 
				
			
			@ -763,7 +536,7 @@ export default {
 | 
			
		|||
              <div class="energy">Energy: ${energy.toFixed(2)}</div>`
 | 
			
		||||
      } else {
 | 
			
		||||
        const channel = parseInt(params[0].value[0].toFixed())
 | 
			
		||||
        const energy = this.allEnergy.pointlist[channel - 1]
 | 
			
		||||
        const energy = this.allEnergy.pointlist&&this.allEnergy.pointlist[channel - 1]
 | 
			
		||||
        return energy
 | 
			
		||||
          ? `<div class="channel">Channel: ${channel}</div>
 | 
			
		||||
              <div class="energy">Energy: ${energy.x.toFixed(2)}</div>`
 | 
			
		||||
| 
						 | 
				
			
			@ -925,7 +698,7 @@ export default {
 | 
			
		|||
        this.option.series[0].markLine.data[0].xAxis = xAxis
 | 
			
		||||
 | 
			
		||||
        const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
 | 
			
		||||
        const energy = this.isEnergy() ? xAxis.toFixed(2) : this.allEnergy.pointlist[channel - 1].x.toFixed(2)
 | 
			
		||||
        const energy = this.isEnergy() ? xAxis.toFixed(2) : this.allEnergy.pointlist&&this.allEnergy.pointlist[channel - 1].x.toFixed(2)
 | 
			
		||||
        const counts = this.isEnergy() ? this.allEnergy.pointlist[channel - 1] : this.allChannel.pointlist[channel - 1]
 | 
			
		||||
        this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}`
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user