管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-01-16 21ddc9ec1b1b76d2ce20e512328e65acaf1af2bf
src/components/echart44.vue
@@ -10,46 +10,50 @@
  components: {},
  data() {
    //这里存放数据
    return {};
    return { myChart:null };
  },
  mounted() {
    this.lineChart();
    this.$bus.$on('resizeEchart', (res) => {
      this.myChart.resize();
    });
  },
  //方法集合
  methods: {
    lineChart() {
      let option = {
        title: {
          text: "各项目总体进度",
          text: '各项目总体进度',
          top:15,
          textStyle: {
            color: "#fff",
            color: '#fff',
          },
        },
        tooltip: {
          trigger: "item",
          trigger: 'item',
        },
        // legend: {},
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true,
        },
        series: [
          {
            name: "各项目总体进度",
            type: "pie",
            radius: ["40%", "70%"],
            roseType: "radius",
            color: ["#03effb", "#00bec4", "#3a82ab"],
            name: '各项目总体进度',
            type: 'pie',
            radius: ['40%', '68%'],
            roseType: 'radius',
            color: ['#03effb', '#00bec4', '#3a82ab'],
            avoidLabelOverlap: false,
            itemStyle: {
              fontColor: "fff",
              borderColor: "#fff",
              fontColor: 'fff',
              borderColor: '#fff',
            },
            label: {
              show: false,
              position: "center",
              position: 'center',
            },
            emphasis: {
              // label: {
@@ -61,17 +65,17 @@
              show: false,
            },
            data: [
              { value: 4, name: "已完成" },
              { value: 7, name: "进行中" },
              { value: 8, name: "未开始" },
              { value: 4, name: '已完成' },
              { value: 7, name: '进行中' },
              { value: 8, name: '未开始' },
            ],
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("echart44"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      this.myChart = this.$echarts.init(document.getElementById('echart44'));
      this.myChart.setOption(option);
      window.addEventListener('resize', function () {
        this.myChart.resize();
      });
    },
  },
@@ -82,10 +86,11 @@
//@import url(); 引入公共css类
.echart44_box {
  padding: 20px;
  // background: rgba(0, 0, 0, 0.6);
}
#echart44 {
  width: 100%;
  height: 100%;
}
#echart44 {
  width: calc(100% - 40px);
  height: calc(100% - 40px);
}
</style>