import * as echarts from "echarts";

export const trunEchatConfig = (data) => {
    return {
        xAxis: {
            type: "category",
            data: data.map((item) => item.name),
            axisLabel: {
                show: true,
                interval: 0,
                rotate: 30,
            },
        },
        grid: { top: "10%", bottom: "40%", right: "5%" },
        yAxis: {
            type: "value",
            splitLine: {
                show: false, // 去除网格线
            },
        },
        series: [
            {
                data: data.map((item) => item.count),
                type: "line",
                smooth: true,
                areaStyle: {
                    opacity: 0.1,
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                        {
                            offset: 0,
                            color: "rgb(128, 255, 165)",
                        },
                        {
                            offset: 1,
                            color: "rgb(1, 191, 236)",
                        },
                    ]),
                },
            },
        ],
    };
}