<template>
  <div class="bigscreen-echarts-pie-t">
    <div :id="eId" :style="styles"></div>
  </div>
</template>
<script>
import * as echarts from "echarts";
export default {
  name: "echartsRadarWrap",
  props: {
    eId: {
      type: String
    },
    styles: {
      type: String
    },
    colorList: {
      type: [Array, String],
      default: ""
    },
    option: {
      stype: Object,
      default: {}
    }
  },
  data() {
    return {
      chart: null
    };
  },
  created() {
    this.chart = null;
  },
  mounted() {
    this.drawLine();
  },
  methods: {
    updateEchart() {
      if (this.chart) {
        this.chart = null;
      }
      this.drawLine();
    },
    drawLine() {
      if (!this.chart) {
        this.chart = echarts.init(document.getElementById(this.eId));
      }
      this.chart.setOption(this.option);
    }
  },
  watch: {
    option(val, oldVal) {
      this.chart = null;
      this.drawLine();
    }
  }
};
</script>
<style lang="scss">
.bigscreen-echarts-pie-t {
  position: relative;
  height: 100%;
  top: 0px;
  width: 95%;
}
</style>
