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

<script>
import Chart from "./chart.vue";
import { httpPost, httpGet } from "../../../../api";
export default {
  data() {
    return {
      cdata: {
        xData: [
          "电量(0-20%)",
          "电量(20-40%)",
          "电量(40-60%)",
          "电量(60-80%)",
          "电量(80-100%)",
        ],
        seriesData: [
          { value: 0, name: "电量(0-20%)" },
          { value: 0, name: "电量(20-40%)" },
          { value: 0, name: "电量(40-60%)" },
          { value: 0, name: "电量(60-80%)" },
          { value: 0, name: "电量(80-100%)" },
        ],
      },
    };
  },
  components: {
    Chart,
  },
  mounted() {
    this.getcard();
  },
  methods: {
    getcard() {
      httpGet("",`/v1/statistics/analysis/${-1}`).then((res) => {
        // var numberData=this.numberData
        this.$store.commit("setUser", res);
        this.cdata.seriesData[0].value = res.batteryLevel1;
        this.cdata.seriesData[1].value = res.batteryLevel2;
        this.cdata.seriesData[2].value = res.batteryLevel3;
        this.cdata.seriesData[3].value = res.batteryLevel4;
        this.cdata.seriesData[4].value = res.batteryLevel5;
      });
    },
  },
};
</script>

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