Browse Source

Merge remote-tracking branch 'origin/master'

liu.shiyi 1 year ago
parent
commit
630d180211

+ 0 - 34
data-room-ui/packages/Echarts/3D图/3D分组柱状图.js

@@ -692,23 +692,6 @@ const option = {
       barGap: '20%',
       barWidth: 30,
       color: '#115ba6',
-      // itemStyle: {
-      //   normal: {
-      //     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-      //       {
-      //         offset: 0,
-      //         color: '#115ba6'
-      //       },
-      //       {
-      //         offset: 1,
-      //         color: '#1db0dd'
-      //       }
-      //     ]),
-      //     opacity: 0.8,
-      //     shadowColor: 'rgba(0, 0, 0, 0.5)', // 阴影颜色
-      //     shadowBlur: 0 // 阴影模糊值
-      //   }
-      // },
       label: {
         show: true,
         position: 'inside',
@@ -724,23 +707,6 @@ const option = {
       // barGap: '60%',
       barWidth: 30,
       color: '#73eccd',
-      // itemStyle: {
-      //   normal: {
-      //     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-      //       {
-      //         offset: 0,
-      //         color: '#73eccd'
-      //       },
-      //       {
-      //         offset: 1,
-      //         color: '#4dd9e5'
-      //       }
-      //     ]),
-      //     opacity: 0.8,
-      //     shadowColor: 'rgba(0, 0, 0, 0.5)', // 阴影颜色
-      //     shadowBlur: 0 // 阴影模糊值
-      //   }
-      // },
       label: {
         show: true,
         position: 'inside',

+ 0 - 17
data-room-ui/packages/Echarts/3D图/3D基础柱状图.js

@@ -673,23 +673,6 @@ const option = {
       barWidth: 30,
       z: 10,
       color: '#115ba6',
-      // itemStyle: {
-      //   normal: {
-      //     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-      //       {
-      //         offset: 0,
-      //         color: '#115ba6'
-      //       },
-      //       {
-      //         offset: 1,
-      //         color: '#1db0dd'
-      //       }
-      //     ]),
-      //     opacity: 0.8,
-      //     shadowColor: 'rgba(0, 0, 0, 0.5)', // 阴影颜色
-      //     shadowBlur: 0 // 阴影模糊值
-      //   }
-      // },
       label: {
         show: true,
         position: 'inside',

+ 14 - 15
data-room-ui/packages/EchartsRender/index.vue

@@ -82,7 +82,6 @@ export default {
         config = this.seriesStyle(config)
         config.option && this.chart.setOption(config.option)
       }
-      // const config = this.observeChart(entries)
     })
     resizeObserver.observe(dragSelect)
   },
@@ -133,8 +132,6 @@ export default {
      * 控制底部阴影大小
      */
     observeChart (entries) {
-      // entries[0].contentRect.width:此时监测的盒子的宽度
-      // entries[0].contentRect.height:此时监测的盒子的高度
       const width = entries[0].contentRect.width
       const height = entries[0].contentRect.height
       const option = this.config.option
@@ -216,6 +213,7 @@ export default {
               }
             )
           } else if (optionField[0] === 'graphic') {
+            // 配置底部阴影颜色
             option.graphic.children.forEach(item => {
               item.style.fill = set.value
             })
@@ -233,7 +231,6 @@ export default {
           }
         }
       })
-      config.option = { ...config.option, ...option }
       return config
     },
     dataFormatting (config, data) {
@@ -262,21 +259,23 @@ export default {
       return config
     },
     getxDataAndYData (xField, yField, data) {
-      let list = []
       let xData = []
       let yData = []
 
-      const uniqueData = {}
-
-      // 遍历原始数据数组
-      data.forEach((item) => {
-        // 使用城市名称作为键,覆盖旧数据,始终保留最后一条数据
-        uniqueData[item[xField]] = item
+      // 获取所有x轴的分类
+      data.forEach(item => {
+        xData.push(item[xField])
+      })
+      xData = [...new Set(xData)]
+      xData.forEach(x => {
+        let max = 0
+        data.forEach(item => {
+          if (item[xField] === x) {
+            max = item[yField] > max ? item[yField] : max
+          }
+        })
+        yData.push(max)
       })
-      // 将唯一数据对象的值(即去重后的数据)转换回数组
-      list = Object.values(uniqueData)
-      xData = list.map(item => item[xField])
-      yData = list.map(item => item[yField])
       return { xData, yData }
     },
     // 格式化echarts的配置