瀏覽代碼

修改Y轴对数显示

liyongyong 1 年之前
父節點
當前提交
1b2fd06e2c
共有 2 個文件被更改,包括 128 次插入18 次删除
  1. 1 1
      manpower/index.html
  2. 127 17
      manpower/js/index.js

+ 1 - 1
manpower/index.html

@@ -28,7 +28,7 @@
   <div id="app">
     <header class="my-header">
       <span>数智人力&nbsp;&nbsp;智慧山西</span>
-      <span class="right">2023-1-16 10:23:00</span>
+      <span class="right">{{time}}</span>
     </header>
     <div class="main">
       <div class="left">

+ 127 - 17
manpower/js/index.js

@@ -4,6 +4,7 @@ let app = new Vue({
   el: '#app',
   data () {
     return {
+      time: '',
       year: '2022',
       config1: {
         number: [100],
@@ -79,7 +80,7 @@ let app = new Vue({
         xAxis: {
           data: companyList.map(item => item.name),
           axisLine: {
-            show: true, //隐藏X轴轴线
+            show: false, //隐藏X轴轴线
             lineStyle: {
               color: '#005094',
               width: 1,
@@ -376,6 +377,26 @@ let app = new Vue({
       }
       option.title.text = '各省属企业管理人员数'
       option.legend.data = ['当前管理人员数', '管理人员数占总人数比值']
+      option.yAxis[0] = {
+        type: 'log',
+        min:1,
+        logBase:10,
+        axisLine: {
+          show: false,
+        },
+        splitLine: {
+          show: false,
+        },
+        axisLabel: {
+          show: true,
+          formatter: function(value) {
+            return value === 1 ? 0 : value
+          },
+          textStyle: {
+            color: 'rgba(250,250,250,0.6)',
+          },
+        },
+      }
       option.yAxis.push({
         type: 'value',
         axisLine: {
@@ -507,6 +528,26 @@ let app = new Vue({
       option.title.text = '各省属企业总人数'
       option.legend.data = ['各省属企业总人数', '去年同期人数变化率']
       option.legend.show = true
+      option.yAxis[0] = {
+        type: 'log',
+        min: 1,
+        logBase: 10,
+        axisLine: {
+          show: false,
+        },
+        splitLine: {
+          show: false,
+        },
+        axisLabel: {
+          show: true,
+          formatter: function(value) {
+            return value === 1 ? 0 : value
+          },
+          textStyle: {
+            color: 'rgba(250,250,250,0.6)',
+          },
+        },
+      }
       option.yAxis.push({
         type: 'value',
         axisLine: {
@@ -738,6 +779,26 @@ let app = new Vue({
       option.title.text = '各省属企业人工成本利润率'
       option.legend.data = ['当前人工成本利润率', '人工成本利润率同比变化']
       option.legend.show = true
+      // option.yAxis[0] = {
+      //   type: 'log',
+      //   min: 1,
+      //   logBase: 2,
+      //   axisLine: {
+      //     show: false,
+      //   },
+      //   splitLine: {
+      //     show: false,
+      //   },
+      //   axisLabel: {
+      //     show: true,
+      //     formatter: function(value) {
+      //       return value === 1 ? 0 : value
+      //     },
+      //     textStyle: {
+      //       color: 'rgba(250,250,250,0.6)',
+      //     },
+      //   },
+      // }
       option.yAxis.push({
         splitLine: {
           show: false,
@@ -746,6 +807,7 @@ let app = new Vue({
           show: false,
         },
       })
+      console.log(option)
       myChart.setOption(option)
     },
     // 中间图表---------------------------------------------开始
@@ -1006,14 +1068,26 @@ let app = new Vue({
       option.title.text = '当前各省属企业招聘需求公示人次'
       option.legend.data = ['招聘需求公告次数', '招聘需求公告累计招聘人次']
       option.legend.show = true
-      option.yAxis.push({
-        splitLine: {
+      option.yAxis[0] = {
+        type: 'log',
+        min: 1,
+        logBase: 10,
+        axisLine: {
           show: false,
         },
-        axisLine: {
+        splitLine: {
           show: false,
         },
-      })
+        axisLabel: {
+          show: true,
+          formatter: function(value) {
+            return value === 1 ? 0 : value
+          },
+          textStyle: {
+            color: 'rgba(250,250,250,0.6)',
+          },
+        },
+      }
       myChart.setOption(option)
     },
     initChartR2 () {
@@ -1069,14 +1143,26 @@ let app = new Vue({
       option.title.text = '当前各省属企业录用结果公示人次'
       option.legend.data = ['录用结果公示次数', '录用结果公示累计公示人数']
       option.legend.show = true
-      option.yAxis.push({
-        splitLine: {
+      option.yAxis[0] = {
+        type: 'log',
+        min: 1,
+        logBase: 10,
+        axisLine: {
           show: false,
         },
-        axisLine: {
+        splitLine: {
           show: false,
         },
-      })
+        axisLabel: {
+          show: true,
+          formatter: function(value) {
+            return value === 1 ? 0 : value
+          },
+          textStyle: {
+            color: 'rgba(250,250,250,0.6)',
+          },
+        },
+      }
       myChart.setOption(option)
     },
     initChartR3 () {
@@ -1131,14 +1217,26 @@ let app = new Vue({
       option.title.text = '各省属企业年利润与"当年"招聘人数'
       option.legend.data = ['2022年利润(万)', '2022年累计招聘数']
       option.legend.show = true
-      option.yAxis.push({
-        splitLine: {
+      option.yAxis[0] = {
+        type: 'log',
+        min: 1,
+        logBase: 10,
+        axisLine: {
           show: false,
         },
-        axisLine: {
+        splitLine: {
           show: false,
         },
-      })
+        axisLabel: {
+          show: true,
+          formatter: function(value) {
+            return value === 1 ? 0 : value
+          },
+          textStyle: {
+            color: 'rgba(250,250,250,0.6)',
+          },
+        },
+      }
       myChart.setOption(option)
     },
     initChartR4 () {
@@ -1193,14 +1291,26 @@ let app = new Vue({
       option.title.text = '各省属企业"退二进一"完成情况'
       option.legend.data = ['2022年退出人数', '2022年累计招聘人数']
       option.legend.show = true
-      option.yAxis.push({
-        splitLine: {
+      option.yAxis[0] = {
+        type: 'log',
+        min: 1,
+        logBase: 10,
+        axisLine: {
           show: false,
         },
-        axisLine: {
+        splitLine: {
           show: false,
         },
-      })
+        axisLabel: {
+          show: true,
+          formatter: function(value) {
+            return value === 1 ? 0 : value
+          },
+          textStyle: {
+            color: 'rgba(250,250,250,0.6)',
+          },
+        },
+      }
       myChart.setOption(option)
     },
     initChartR5 () {