Newer
Older
dcms_front / src / views / otherComment / deptHandle / deptHandleChart4Sup.vue
TAN YUE on 10 May 2021 2 KB 20210510 图表样式调整
<template>
  <div class="chart-container">
    <div ref="chart" class="chart-body" />
  </div>
</template>

<script>
import echarts from 'echarts'
export default {
  name: 'DeptHandleChart4Sup',
  props: {
    list: {
      type: Array,
      default() {
        return []
      }
    }
  },
  watch: {
    list() {
      this.initChart()
    }
  },
  activated() {
    this.initChart()
  },
  methods: {
    initChart() {
      this.chart = echarts.init(this.$refs.chart)
      this.chart.setOption({
        grid: {
          left: '60px',
          top: '10px'
        },
        legend: {
          type: 'scroll',
          bottom: 0,
          textStyle: {
            color: '#333333'
          },
          pageTextStyle: {
            color: '#333333'
          },
          pageIconColor: '#333333'
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          }
        },
        yAxis: [
          {
            type: 'category',
            data: this.list[0],
            axisLine: {
              lineStyle: {
                color: '#333333'
              }
            },
            axisLabel: {
              // rotate: 90,
              fontSize: 10,
              color: '#333333'
            }
          }
        ],
        xAxis: [
          {
            type: 'value',
            axisLine: {
              lineStyle: {
                color: '#333333'
              }
            },
            axisLabel: {
              fontSize: 10,
              color: '#333333'
            },
            splitLine: {
              show: false
            }
          }
        ],
        color: [
          '#19d4ae', '#ffb980', '#5ab1ef',
          '#fa6e86', '#0067a6', '#c4b4e4',
          '#d87a80', '#9cbbff', '#d9d0c7',
          '#87a997', '#d49ea2', '#5b4947',
          '#7ba3a8'
        ],
        series: this.list[1]
      })
    }
  }
}
</script>

<style scoped>
.chart-container{
  /*text-align: center;*/
}
.chart-body{
  min-height: 240px;
  width: 90%;
  margin-right: auto;
  margin-left: auto;
}
</style>