<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        rateData:[
        ]
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    //this.setData();
  },
  beforeDestroy () {
    clearInterval(this.intervalId);
    this.chart.dispose()
    this.chart.clear()
    this.chart=null
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length -1; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
      console.log(this)
    },
  }
};
</script>

<style lang="scss" scoped>
</style>