管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2022-12-19 9c803f20cc05395bac2d3386accfe230210c07dc
src/components/echart35.vue
@@ -10,68 +10,71 @@
  components: {},
  data() {
    //这里存放数据
    return {};
    return { myChart };
  },
  mounted() {
    this.lineChart();
    this.$bus.$on('resizeEchart', (res) => {
      this.myChart.resize();
    });
  },
  //方法集合
  methods: {
    lineChart() {
      let option = {
        title: {
          text: "人员构成",
          text: '人员构成',
          textStyle: {
            color: "#fff",
            color: '#fff',
          },
        },
        tooltip: {
          trigger: "axis",
          trigger: 'axis',
          axisPointer: {
            type: "shadow",
            type: 'shadow',
          },
        },
        // legend: {},
        grid: {
          left: "0%",
          right: "4%",
          bottom: "0%",
          left: '0%',
          right: '4%',
          bottom: '0%',
          containLabel: true,
        },
        xAxis: {
          type: "value",
          type: 'value',
          boundaryGap: [0, 0.01],
          axisLine: {
            lineStyle: {
              color: "#ccc",
              color: '#ccc',
            },
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
              color: '#fff',
            },
          },
        },
        yAxis: {
          type: "category",
          data: ["专科", "本科", "硕士", "博士及以上", "其他"],
          type: 'category',
          data: ['专科', '本科', '硕士', '博士及以上', '其他'],
          axisLine: {
            lineStyle: {
              color: "#ccc",
              color: '#ccc',
            },
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
              color: '#fff',
            },
          },
        },
        series: [
          {
            name: "人员构成",
            type: "bar",
            name: '人员构成',
            type: 'bar',
            // barWidth: 20,
            data: [15, 120, 50, 40, 20],
            itemStyle: {
@@ -80,12 +83,12 @@
                barBorderRadius: [0, 10, 10, 0],
                color: (params) => {
                  var colorList = [
                    ["#00FCFF", "#008297"],
                    ["#0091FF", "#005EA4"],
                    ["#901698", "#F157EE"],
                    ["#40FBCB", "#009871"],
                    ["#FF515A", "#FFDD53"],
                    ["#6574E2", "#261164"],
                    ['#00FCFF', '#008297'],
                    ['#0091FF', '#005EA4'],
                    ['#901698', '#F157EE'],
                    ['#40FBCB', '#009871'],
                    ['#FF515A', '#FFDD53'],
                    ['#6574E2', '#261164'],
                  ];
                  var colorItem = colorList[params.dataIndex];
                  return new this.$echarts.graphic.LinearGradient(
@@ -111,10 +114,10 @@
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("echart35"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      this.myChart = this.$echarts.init(document.getElementById('echart35'));
      this.myChart.setOption(option);
      window.addEventListener('resize', function () {
        this.myChart.resize();
      });
    },
  },