<script>
  import { Doughnut } from "vue-chartjs";

  var doughnutOptions = {
    cutoutPercentage: 85,
    legend: {
      display: false
    },
    tooltips: {
      enabled: false,
      displayColors: false
    },
    responsive: false
  };

  export default {
    extends: Doughnut,
    props: ['chartData'],
    data() {
      return {
        data: this.chartData
      }
    },
    watch: {
      chartData(newval) {
        this.data = newval;
        this.setChartData();
      }
    },
    mounted() {
      this.setChartData();
    },
    methods: {
      setChartData() {
        this.renderChart(this.data, doughnutOptions);
      }
    }
  };
</script>

