import * as echarts from "echarts";

export default function getData(params) {
    let resList = params.map(val => {
        return {
            ...val,
            creatTime: new Date(val.creatTime).getDate()
        }
    }).reverse()
    return {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        grid: {
            top: 10,
            left: 0,
            right: 10,
            bottom: 0,
            containLabel: true,
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: resList.map(val => val.creatTime),
            axisLabel: {
                color: "#CCC",
            },
            axisTick: {
                show: false,
            },
            axisLine: {
                show: true
            },
        },
        yAxis: {
            type: 'value',
            axisLabel: {
                color: "#CCC",
            },
            axisLine: {
                show: true,
                lineStyle: {
                    color: "#CCC",
                },
            },
            splitLine: {
                show: false,
                //     lineStyle: {
                //         color: "#CCC",
                //     },
            },
        },
        series: [{
            data: resList.map(val => val.totalUsingNum),
            type: 'line',
            smooth: true,
            showSymbol: false,
            lineStyle: {
                width: 1
            },
            areaStyle: {
                opacity: 0.8,
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: 'rgba(73, 185, 245,1)'
                }, {
                    offset: 1,
                    color: 'rgba(73, 185, 245,.1)'
                }])
            },
        }]
    }
}