管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2022-12-19 9c803f20cc05395bac2d3386accfe230210c07dc
src/components/echart15.vue
@@ -10,90 +10,93 @@
  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: {
            // Use axis to trigger tooltip
            type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
            type: 'shadow', // 'shadow' as default; can also be 'line' or 'shadow'
          },
        },
        legend: {
          textStyle: {
            color: "#fff",
            color: '#fff',
          },
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true,
        },
        xAxis: {
          type: "value",
          type: 'value',
          axisLabel: {
            color: "#fff",
            color: '#fff',
          },
        },
        yAxis: {
          axisLabel: {
            color: "#fff",
            color: '#fff',
          },
          type: "category",
          data: ["勘察数据", "岩土数据", "测量数据", "合规数据", "管理数据"],
          type: 'category',
          data: ['勘察数据', '岩土数据', '测量数据', '合规数据', '管理数据'],
        },
        series: [
          {
            name: "存儲量",
            type: "bar",
            stack: "total",
            name: '存儲量',
            type: 'bar',
            stack: 'total',
            label: {
              show: true,
              textStyle: {
                color: "#fff",
                color: '#fff',
              },
            },
            emphasis: {
              focus: "series",
              focus: 'series',
            },
            data: [122880, 40960, 153600, 5120, 28672],
          },
          {
            name: "总量",
            type: "bar",
            stack: "total",
            name: '总量',
            type: 'bar',
            stack: 'total',
            label: {
              show: true,
              textStyle: {
                color: "#fff",
                color: '#fff',
              },
            },
            emphasis: {
              focus: "series",
              focus: 'series',
            },
            data: [351232, 351232, 351232, 351232, 351232],
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("echart5"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      this.myChart = this.$echarts.init(document.getElementById('echart5'));
      this.myChart.setOption(option);
      window.addEventListener('resize', function () {
        this.myChart.resize();
      });
    },
  },