Jelajahi Sumber

图表修改1158

zhouna 6 tahun lalu
induk
melakukan
aa4830e018
1 mengubah file dengan 17 tambahan dan 7 penghapusan
  1. 17 7
      src/components/AssessResult/ChartItem/index.jsx

+ 17 - 7
src/components/AssessResult/ChartItem/index.jsx

@@ -62,7 +62,7 @@ class ChartItem extends Component {
     if(isHour){
       for(let i=0;i<24;i++){
         temp = hour-i>-1?hour-i:hour-i+24;
-        arr.unshift(str+" "+(temp<10?'0'+temp:temp));
+        arr.unshift(str+" "+(temp<10?'0'+temp:temp)+":00:00");
       }
       return arr;
     }else{
@@ -132,9 +132,10 @@ class Chart extends Component{
     const id = endDate?'chart'+endDate+index:'chart'+index;
     let series = [],names=[],inx=-1;
     let myChart = echarts.init(document.getElementById(id) ,null, {renderer: 'svg'});
+    let xAxisArr = [...xAxis];
 
     const interval = {
-      week:24,
+      week:23,
       month:4,
       sixMonth:9,
       year:60
@@ -145,9 +146,12 @@ class Chart extends Component{
       it&&it.creatTime.map((x,i)=>{
         inx=xAxis.findIndex((a)=>{
           name=type=='week'?x.substr(0,13):x.substr(0,10);
-          return a==name;
+          return a.substr(0,13)==name;
         });     //日期对应横坐标的位置
         if(inx!=-1){
+          if(type=='week'){
+            xAxisArr[inx] = x;
+          }
           values[inx] = it.indexValue[i];       //值对应横坐标的位置
         }
       });
@@ -162,7 +166,10 @@ class Chart extends Component{
     // 指定图表的配置项和数据
     var option = {
       tooltip: {
-        trigger: 'axis'
+        trigger: 'axis',
+        textStyle:{
+          fontSize:12
+        }
       },
       legend: {
         data:names,
@@ -174,9 +181,9 @@ class Chart extends Component{
       xAxis: {
         type: 'category',
         boundaryGap: false,
-        data: xAxis,
+        data: xAxisArr,
         splitLine:{
-          show:false
+          show:true
         },
         axisPointer:{
           //show:false
@@ -190,7 +197,10 @@ class Chart extends Component{
           showMaxLabel:true,
           interval:interval[type],
           rotate:65,
-          fontSize:10
+          fontSize:10,
+          formatter: function(value,index){
+            return value.substr(0,10);
+          }
         }
       },
       yAxis: {