管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2022-12-19 9c803f20cc05395bac2d3386accfe230210c07dc
src/components/echart16.vue
@@ -10,32 +10,35 @@
  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: "cross",
            type: 'cross',
            label: {
              backgroundColor: "#FFFFFF",
              backgroundColor: '#FFFFFF',
            },
          },
        },
        legend: {
          data: ["增量", "总量"],
          data: ['增量', '总量'],
        },
        toolbox: {
          feature: {
@@ -43,25 +46,25 @@
          },
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true,
        },
        xAxis: [
          {
            axisLine: {
              lineStyle: {
                color: "#ccc",
                color: '#ccc',
              },
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: "#fff",
                color: '#fff',
              },
            },
            type: "category",
            type: 'category',
            boundaryGap: false,
            data: [2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022],
          },
@@ -70,48 +73,48 @@
          {
            axisLine: {
              lineStyle: {
                color: "#ccc",
                color: '#ccc',
              },
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: "#fff",
                color: '#fff',
              },
            },
            type: "value",
            type: 'value',
            boundaryGap: false,
          },
        ],
        series: [
          {
            name: "增量",
            type: "line",
            stack: "Total",
            name: '增量',
            type: 'line',
            stack: 'Total',
            areaStyle: {
              color: "#83bff6",
              color: '#83bff6',
              opacity: 0.5,
            },
            emphasis: {
              focus: "series",
              focus: 'series',
            },
            data: [5120, 3072, 2048, 7168, 3072, 4096, 2048, 3072, 500],
          },
          {
            name: "总量",
            type: "line",
            stack: "Total",
            name: '总量',
            type: 'line',
            stack: 'Total',
            label: {
              show: true,
              position: "top",
              position: 'top',
            },
            areaStyle: {
              color: "#188df0",
              color: '#188df0',
              opacity: 0.5,
            },
            emphasis: {
              focus: "series",
              focus: 'series',
            },
            data: [
              27750, 28262, 28569, 28774, 29491, 29798, 30208, 30412, 30720,
@@ -119,10 +122,10 @@
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("echart4"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      this.myChart = this.$echarts.init(document.getElementById('echart4'));
      this.myChart.setOption(option);
      window.addEventListener('resize', function () {
        this.myChart.resize();
      });
    },
  },