Pārlūkot izejas kodu

资金统计页调整

ellisran 7 mēneši atpakaļ
vecāks
revīzija
df81e655a7
1 mainītis faili ar 41 papildinājumiem un 2 dzēšanām
  1. 41 2
      app/public/js/financial_summary.js

+ 41 - 2
app/public/js/financial_summary.js

@@ -111,6 +111,8 @@ $(document).ready(function() {
 
             // 标段支出概况图表
             tenderOption.xAxis[0].data = _.map(tenders, 'name');
+            tenderOption.dataZoom[0].start = 0;
+            tenderOption.dataZoom[0].end = computedPosition(tenders.length);
             tenderOption.series[0].data = [];
             tenderOption.series[1].data = [];
             for (const t of tenders) {
@@ -149,6 +151,16 @@ $(document).ready(function() {
         paySeChart.resize();
     }
 
+    // 计算显示滚动条长度
+    function computedPosition(xArrayLength) {
+        if (xArrayLength >= 8) {
+            return Math.floor(8 / xArrayLength * 100) > 100 ? 100 : Math.floor(8 / xArrayLength * 100);
+            // return length <= 10 ? 35 : 100 - Math.floor(35 / length * 100);
+        } else {
+            return 100;
+        }
+    }
+
     //标段占比
     const tenderChart = echarts.init(document.getElementById('jlchart3'));
     const tenderOption = {
@@ -158,17 +170,44 @@ $(document).ready(function() {
                 type: 'shadow'
             }
         },
+        dataZoom: [
+            {
+                // brushSelect:false,
+                // zoomLock: false,
+                type: 'slider',
+                // show: true,
+                // realtime: true,
+                showdetail: false,
+                showDataShadow: false,
+                // // dataZoomIndex: 10,
+                start: 0,
+                end: 10,
+                height: 10,
+                bottom: '5%',
+            },
+        ],
         legend: {},
         grid: {
             left: '3%',
             right: '4%',
-            bottom: '3%',
+            bottom: '10%',
             containLabel: true
         },
         xAxis: [
             {
                 type: 'category',
-                data: []
+                data: [],
+                axisLabel: {
+                    show: true,
+                    interval: 0,
+                    formatter: function(value) {
+                        var res = value;
+                        if(res.length > 8) {
+                            res = res.substring(0, 7) + "..";
+                        }
+                        return res;
+                    }
+                }
             }
         ],
         yAxis: [