<template>
  <echarts-container style="width:100%" :options="options"></echarts-container>
</template>

<script>
import EchartsContainer from "../../components/echarts/echartsContainer";
import {getPvStatistic } from "@/api/school-center/analysisAPI"

export default {
  name: "pv",
  components: {EchartsContainer, getPvStatistic},
  data() {
    return {
      options: {
        title: {
          text: "页面访问量",
          left: '40%',
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        legend: {
          data:['销量']
        },
        color: ["#1090FF"],
        xAxis: {
          type: 'category',
          data: []
        },
        grid: {
          left: "8%",
          right: "6%",
          top: "15%",
          bottom: "10%"
        },

        yAxis: {
          type: 'value'
        },
        series: [{
          data: [],
          type: 'line'
        }]
      }
    }
  },
  methods: {
    getEchartsData: function(startDate, endDate, type) {
      let param = {
        startDate: startDate,
        endDate: endDate,
        type: type
      }

      getPvStatistic(param).then(res => {
        this.options.series[0].data = res.data.seriesData;
        this.options.xAxis.data = res.data.xAxisData;

        console.log(this.options);
      });

    }
  }
}
</script>

<style scoped>

</style>