联动表问题修复
This commit is contained in:
		@@ -31,7 +31,7 @@ export default {
 | 
			
		||||
      this.handleChangeChart()
 | 
			
		||||
    },
 | 
			
		||||
    handleChangeChart() {
 | 
			
		||||
      const series = Array(this.plot.dimensions.length - 1).fill(this.tpl.daemon)
 | 
			
		||||
      const series = this.tpl.series || Array(this.plot.dimensions.length - 1).fill(this.tpl.daemon)
 | 
			
		||||
      this.chart.setOption({
 | 
			
		||||
        tooltip: {},
 | 
			
		||||
        xAxis: {
 | 
			
		||||
@@ -73,11 +73,20 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    getChartData() {
 | 
			
		||||
      return new DvCompData(this.plot.dataType, this.plot, this.instance).getData().then(source => {
 | 
			
		||||
        const dataset = {
 | 
			
		||||
          source,
 | 
			
		||||
          dimensions: this.plot.dimensions.filter(Boolean) || []
 | 
			
		||||
        if (this.tpl.series?.type == 'pie') {
 | 
			
		||||
          let data
 | 
			
		||||
          if (source?.length == 1) {
 | 
			
		||||
            data = this.plot.dimensions.filter(Boolean).map(name => ({name, value: source[0][name]}))
 | 
			
		||||
          } else {
 | 
			
		||||
            const ds = this.plot.dimensions.filter(Boolean)
 | 
			
		||||
            data = source.map(e => ({name: e[ds[0]], value: e[ds[1]]}))
 | 
			
		||||
          }
 | 
			
		||||
          this.chart.setOption({series: {data}})
 | 
			
		||||
        } else {
 | 
			
		||||
          const dataset = {source}
 | 
			
		||||
          dataset.dimensions = this.plot.dimensions.filter(Boolean) || []
 | 
			
		||||
          this.chart.setOption({dataset})
 | 
			
		||||
        }
 | 
			
		||||
        this.chart.setOption({dataset})
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user