import * as echarts from "echarts";

export default function getData(params) {
	console.log(params)
	params = parmas.map(val=>{
		return {
			time:val.creatTime,
			num:val.tiatlFreeNum + Math.ceil(Math.random()*300)
		}
	})
	let resList = 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.time),
            axisLabel: {
                color: "#CCC",
            },
            axisTick: {
                show: false,
            },
            axisLine: {
                show: true
            },
        },
        yAxis: {
			min:0,
			max:300,
            type: 'value',
            axisLabel: {
                color: "#CCC",
            },
			
            axisLine: {
                show: true,
                lineStyle: {
                    color: "#CCC",
                },
            },
            splitLine: {
                show: false,
                //     lineStyle: {
                //         color: "#CCC",
                //     },
            },
        },
        series: [{
            //data: resList.map(val => val.totalUsingNum),
			data: resList.map(val => val.num),
            type: 'line',
			color:'red',
            smooth: 3,
            showSymbol: false,
            lineStyle: {
                width: 1
            },
			itemStyle:{
			  normal:{
				// 拐点上显示数值
				// label : {
				// show: true
				// },
				// borderColor:'red',  // 拐点边框颜色
				lineStyle:{                 
				  width:5,  // 设置线宽
				  // type:'dotted'  //'dotted'虚线 'solid'实线
				}
			  }
			},
            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)'
                }])
            },
        }]
    }
}