liyongli hai 8 meses
pai
achega
ab374a19ba
Modificáronse 3 ficheiros con 34 adicións e 2 borrados
  1. 31 1
      src/views/Portrait/Index.vue
  2. 1 1
      src/views/Portrait/config.js
  3. 2 0
      src/views/Portrait/tool.js

+ 31 - 1
src/views/Portrait/Index.vue

@@ -119,7 +119,7 @@ import {
 } from '@/api/portrait.js';
 import { ref, onMounted } from 'vue';
 
-import { createChart, numform } from './tool';
+import { createChart, numform, chart } from './tool';
 import config from './config';
 
 const appList = ref([]);
@@ -311,6 +311,21 @@ const createPublisher = (list = []) => {
   };
   p.xAxis[0].data = keys;
   p.series[0].data = values;
+  p.series[0].itemStyle = {
+    normal: {
+      borderRadius: [5, 5, 0, 0],
+      color: new chart.graphic.LinearGradient(0, 0, 1, 0, [
+        {
+          offset: 0,
+          color: '#8ba6d6'
+        },
+        {
+          offset: 1,
+          color: '#a085ee'
+        }
+      ])
+    }
+  };
   publisherChart = createChart(
     publisher.value,
     publisher.value.offsetWidth,
@@ -350,6 +365,21 @@ const createProgram = (list = []) => {
   p.series[0].label.offset = [50, 0];
   p.series[0].label.position = 'right';
   p.series[0].label.align = 'right';
+  p.series[0].itemStyle = {
+    normal: {
+      borderRadius: [0, 5, 5, 0],
+      color: new chart.graphic.LinearGradient(0, 0, 1, 0, [
+        {
+          offset: 0,
+          color: '#8ba6d6'
+        },
+        {
+          offset: 1,
+          color: '#a085ee'
+        }
+      ])
+    }
+  };
   p.series[0].label.formatter = data => {
     if (isNaN(data.value)) return '';
     return numform(data.value);

+ 1 - 1
src/views/Portrait/config.js

@@ -349,7 +349,6 @@ export default {
     series: [
       {
         type: 'bar',
-        barWidth: 20,
         label: {
           show: true,
           offset: [-10, -10],
@@ -359,6 +358,7 @@ export default {
           position: 'top',
           align: 'top',
           formatter: function(params) {
+            if (isNaN(params.value)) return '';
             return numform(params.value);
           }
         },

+ 2 - 0
src/views/Portrait/tool.js

@@ -33,6 +33,8 @@ echarts.use([
 // 陕西地图引入
 echarts.registerMap('ShanXi', shanxi);
 
+export const chart = echarts;
+
 export const numform = n => {
   let num = n;
   if (isNaN(n)) num = '0';