import * as echarts from "echarts";

export default function getData(params) {
    console.log(params)
    return {
        title: {
            show: true,
            text: "总数",
            left: "center",
            right: "center",
            bottom: "center",
            top: "52%",
            center: 20,
            textStyle: {
                color: "#FFF",
                fontSize: 18,
                align: "center",
                fontWeight: "100",
                fontFamily: '"DS", "DS-B", "DS-BB", "DS-BS"',
            },
        },
        series: [{
            type: "gauge",
            radius: document.body.clientHeight > 1000 ? '90%' : "100%",
            // center: ["50%","70%"],
            splitNumber: 5, //刻度数量
            startAngle: -260, //开始角度 左侧角度
            endAngle: 100, //结束角度 右侧
            z: 4,
            axisLine: {
                show: true,
                // roundCap: true,
                lineStyle: {
                    width: document.body.clientHeight > 1000 ? 20 : 15,
                    color: [
                        [
                            (params.using / params.toatl) > 1 ? 1 : (params.using / params.toatl).toFixed(8),
                            new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                                { offset: 0, color: "#ecc242" },
                                { offset: 1, color: "#FDC51A" },
                            ]),
                        ],
                        [1, "#1AF3FD"],
                    ],
                },
            },
            //分隔线样式。
            splitLine: {
                show: false,
            },
            axisLabel: {
                show: false,
            },
            axisTick: {
                show: false,
            },
            pointer: {
                show: false,
                length: "70%",
                width: "2%",
            },
            title: {
                show: false,
                offsetCenter: [0, 0], // x, y，单位px
                textStyle: {
                    fontWeight: "100",
                    color: "#0ab7ff",
                    fontSize: 30,
                },
            },
            //仪表盘详情，用于显示数据。
            detail: {
                show: true,
                offsetCenter: [0, "-20%"],
                color: "#ffffff",
                textStyle: {
                    fontSize: 36,
                    color: "#FF3A05",
                    fontWeight: "500",
                    fontFamily: 'Impact Regular, Impact Regular-Regular',
                },
                formatter: function() {
                    return params.toatl || 0;
                },
            },
            data: [{
                value: params,
            }, ],
        }, ]
    }
}