Ver Fonte

自定义刻度尺

zhengkaixin há 2 anos atrás
pai
commit
5e9e357fa9
1 ficheiros alterados com 67 adições e 24 exclusões
  1. 67 24
      pagesFinance/statistics/index.vue

+ 67 - 24
pagesFinance/statistics/index.vue

@@ -681,6 +681,16 @@
 			},
 
 			getPie() {
+				
+				var  dataInterval =null;
+				if (this.type_head == 1) {
+				
+					dataInterval= [0,50,100,150,200,300,400,500,800,1000,1500,
+					2000,2500,3000,3500,4000, 4500,5000,6000,7000,8000,9000, 10000, 20000, 30000, 40000, 60000,999999];
+				}else{
+					dataInterval= [0,500,1000,2000,5000, 10000, 20000, 30000, 40000,50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000,300000, 400000, 500000,999999];
+				}
+				
 				this.headitemby="";
 				var showkey = "";
 				var getData = this.indexData3.graphMap;
@@ -714,7 +724,6 @@
 						name: this.showlist1[j],
 						type: 'line',
 
-
 						// label: {
 						// 	show: true,
 						// 	position: 'top'
@@ -730,7 +739,23 @@
 						//var time=this.queryDate.replace("-","/").replace("-","/")
 						//time+' '+i
 						var obj = getData[i][sz2[j]];
-						
+						
+						//**********
+						if(true){
+							const min_v = Math.max(...dataInterval.filter((v) => v <= obj));
+							  // 2.寻找在数据间隔里大于amount的最小值
+							  const max_v = Math.min(...dataInterval.filter((v) => v > obj));
+							  //  3.寻找 min_v 所在的下标
+							  const index = dataInterval.findIndex((v) => v === min_v);
+							  //  4.计算该amount在y轴上应该展示的位置
+							  const y_value = ((obj - min_v) / (max_v - min_v)) * 10 + index * 10;
+							  
+							  
+							  obj = y_value;
+							 
+						}
+						
+						 //**********
 						//'todayAmount', 'todayProfit', 'todayEQNum'
 						if (getData[i].todayAmount == 0 && getData[i].todayProfit == 0 ) {
 							//&& &&getData[i].todayEQNum == 0
@@ -738,12 +763,9 @@
 						}
 						var time = i
 						if (this.type_head == 1) {
-							time = i.substring(5)
+							//time = i.substring(5)
 						} else {
 
-						}
-						if(j!=2){
-							obj=obj.toFixed(2)
 						}
 						
 						ap.data.push([time, obj]);
@@ -752,25 +774,31 @@
 
 
 				}
-				
+				var yshow=0;
 				// 指定图表的配置项和数据
 				var option = {
 
 					tooltip: {
 
 						formatter: (value) => {
-							var info = value;
-
-							var name = value[0].data[0];
+						
+							var name = value[0].data[0];
+							var info = getData[name];
+							
+							
 							var style = "float: right;margin-left: 3px;"
 							var text1 = ""
 							for (var i in value) {
-								var u = "元"
+								var u = "元"
+								var num=info[sz2[value[i].seriesIndex]];
+								
 								if (value[i].seriesName == '次数') {
 									u = '次'
+								}else{
+									num=num.toFixed(2)
 								}
 								text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
-									'">' + value[i].data[1] + u + '</span></p>';
+									'">' + num + u + '</span></p>';
 							}
 
 							return `<p>${name}</p>` + text1
@@ -810,24 +838,26 @@
  								if(this.headitemby==""){
 									this.headitemby=value
 								}
-								var i = 0
-								if (this.type_head == 1) {
-									i = 3;
-								} else {
-									i = 5;
-								}
+								var i = 5
+								// if (this.type_head == 1) {
+								// 	i = 3;
+								// } else {
+								// 	i = 5;
+								// }
 								var showvalue = "";
-								var key = value.substring(0, i);
+								var key = value.substring(0,8);
 								if (showkey == ""||value==this.headitemby) {
 									showkey = key
 								
-									showvalue = value
+									showvalue = value
+									showvalue = value.substring(5)
 								} else {
 									if (key != showkey) {
 										showkey = key
-										showvalue = value
+										showvalue = value
+										showvalue = value.substring(5)
 									} else {
-										showvalue = value.substring(i)
+										showvalue = value.substring(8)
 									}
 								}
  								return showvalue.replace("-",".");
@@ -847,10 +877,23 @@
 					},
 					yAxis: {
 						
-						type: 'log',
+						type: 'value',
 						//	name: '单位('+this.typeN+')',
 						axisLabel: {
-
+							formatter:(v,i)=>{
+								//console.log(v,i)
+								if(i==0){
+									yshow=0
+									return 0
+								}
+								if(yshow!=parseInt(v/10)){
+									yshow=parseInt(v/10);
+									return dataInterval[parseInt(v/10)]
+								}else{
+									return ''
+								}
+								
+							},
 							textStyle: {
 								color: "#333"
 							}