<template>
  <div
    :id="chartId"
    :style="{ width: '100%', height: chartSettingData.height }"
  ></div>
</template>
      
<script>
import echartMixins from "@/utils/resizeMixins";
export default {
  props: {
    chartId: { type: String, default: "pieChart" },
    chartSettingData: { type: Object, default: () => {} },
    chartVData: {
      type: Number,
      default:0.04,
    },
   
  },
  data() {
    return { chart: null };
  },
  mixins: [echartMixins],
  mounted() {
    this.draw();
  },
  watch: {
    chartVData(val) {
      console.log(val, "val");

        this.draw();
      
    },
  },
  methods: {
    draw() {
      this.chart = this.$echarts.init(document.getElementById(this.chartId));
      let option = {
        series: [
          {
            type: "gauge",
            progress: {
              show: true,
              width: 10,
            },
            axisLine: {
              lineStyle: {
                width: 10,
              },
            },
            axisTick: {
              show: false,
            },
            splitLine: {
              length: 15,
              lineStyle: {
                width: 2,
                color: "#999",
              },
            },
            axisLabel: {
              distance: 6,
              color: "#999",
              fontSize: 12,
            },
            anchor: {
              show: true,
              showAbove: true,
              size: 30,
              itemStyle: {
                borderWidth: 10,
              },
            },
            title: {
              show: false,
            },
            detail: {
              valueAnimation: true,
              fontSize: 18,
              offsetCenter: [0, "80%"],
            },
            data: [
              {
                value: this.chartVData,
              },
            ],
          },
        ],
      };
      this.chart.setOption(option);
    },
  },
};
</script>
      <style lang="scss" scoped></style>
      