浏览代码

解决投中气泡图问题

zhbyyy 2 年之前
父节点
当前提交
d3ac256a59
共有 1 个文件被更改,包括 62 次插入12 次删除
  1. 62 12
      investmentPort/js/investHomeGroup.js

+ 62 - 12
investmentPort/js/investHomeGroup.js

@@ -6228,6 +6228,34 @@ let app = new Vue({
     },
     initChartR2 () {
       let that = this
+      console.log('right5',right5)
+      // 计算y轴的最大最小值,来确定范围
+      let List = []
+      let maxVlaue = ''
+      let minVlaue = ''
+      let maxSize = ''
+      let sizeList = []
+      right5.forEach(item => {
+        item.forEach(item2 => {
+          List.push(item2[1])
+        })
+      })
+      right5.forEach(item => {
+        item.forEach(item2 => {
+          sizeList.push(item2[2])
+        })
+      })
+      maxSize =  sizeList.reduce((x, y) => {
+        return x > y ? x : y;
+      });
+      maxVlaue = List.reduce((x, y) => {
+        return x > y ? x : y;
+      });
+      minVlaue = List.reduce((x, y) => {
+        return x > y ? y : x;
+      });
+      maxVlaue < 100 && (maxVlaue = 100)
+      minVlaue > -100 && (minVlaue = -100)
       const itemStyle = {
         // opacity: 0.8,
         shadowBlur: 10,
@@ -6330,9 +6358,12 @@ let app = new Vue({
           bottom: '5%',
         },
         yAxis: {
-          boundaryGap:['50%', '50%'],
+          min: minVlaue - 10,
+          max: maxVlaue + 10,
+          maxInterval: 5,
           splitLine: {
-            show: true,
+            show: false,
+            // interval:,
             lineStyle: {
               color: '#68b4dd66',
               type: 'dashed',
@@ -6341,9 +6372,23 @@ let app = new Vue({
           axisLine: {
             show: false
           },
+          axisTick: {
+            show: false
+          },
           axisLabel: {
             show: true,
-            formatter: '{value}%',
+            // formatter: '{value}',
+            formatter (data) {
+              if (data == 100) {
+                return '100%'
+              } else if (data == -100) {
+                return '-100%'
+              } else if (data == -5) {
+                return '-5%'
+              } else if (data == 5) {
+                return '5%'
+              }
+            },
             textStyle: {
               color: '#fff',
               fontSize: '20',
@@ -6359,7 +6404,7 @@ let app = new Vue({
         xAxis: {
           data: commonCompany,
           axisLine: {
-            show: true, //隐藏X轴轴线
+            show: false, //隐藏X轴轴线
             lineStyle: {
               color: '#005094',
               width: 1,
@@ -6373,7 +6418,7 @@ let app = new Vue({
             },
           },
           axisTick: {
-            show: false, //隐藏X轴刻度
+            show: true, //隐藏X轴刻度
           },
           axisLabel: {
             show: true,
@@ -6393,17 +6438,19 @@ let app = new Vue({
             itemStyle: itemStyle,
             data: right5[0],
             symbolSize: function (data) {
-              return that.numMulti(Math.sqrt(Math.sqrt(data[2])), 40);
+              return that.numMulti(Math.sqrt(Math.sqrt(data[2])), 16400/maxSize);
             },
             markLine: {
+              symbol: 'none',
               data: [
                 {
                   name: '100%',
                   yAxis: 100,
                   lineStyle: {
-                    color: '#fff',
+                    // color: '#fff',
                   },
                   label: {
+                    show: false,
                     formatter: '{b}',
                     position: 'right',
                     color: '#fff',
@@ -6414,9 +6461,10 @@ let app = new Vue({
                   name: '5%',
                   yAxis: 5,
                   lineStyle: {
-                    color: '#fff',
+                    // color: '#fff',
                   },
                   label: {
+                    show: false,
                     formatter: '{b}',
                     position: 'right',
                     color: '#fff',
@@ -6427,9 +6475,10 @@ let app = new Vue({
                   name: '-5%',
                   yAxis: -5,
                   lineStyle: {
-                    color: '#fff',
+                    // color: '#fff',
                   },
                   label: {
+                    show: false,
                     formatter: '{b}',
                     position: 'right',
                     color: '#fff',
@@ -6440,9 +6489,10 @@ let app = new Vue({
                   name: '100%',
                   yAxis: -100,
                   lineStyle: {
-                    color: '#fff',
+                    // color: '#fff',
                   },
                   label: {
+                    show: false,
                     formatter: '{b}',
                     position: 'right',
                     color: '#fff',
@@ -6458,7 +6508,7 @@ let app = new Vue({
             itemStyle: itemStyle,
             data: right5[1],
             symbolSize: function (data) {
-              return that.numMulti(Math.sqrt(Math.sqrt(data[2])), 40);
+              return that.numMulti(Math.sqrt(Math.sqrt(data[2])), 16400/maxSize);
             },
           },
           {
@@ -6467,7 +6517,7 @@ let app = new Vue({
             itemStyle: itemStyle,
             data: right5[2],
             symbolSize: function (data) {
-              return that.numMulti(Math.sqrt(Math.sqrt(data[2])), 40);
+              return that.numMulti(Math.sqrt(Math.sqrt(data[2])), 16400/maxSize);
             },
           }
         ]