import * as echarts from "echarts";

const getbarChart = (data) => {
    return {
        legend: {
            show: true,
            top: "5%",
            right: "10%",
            //   right: "top",
            textStyle: {
                color: "#D9F7FF", //字体颜色
                fontSize: "23.9982px",
            },
        },
        tooltip: {
            trigger: "axis",
            textStyle: {
                // color: '#17d3ff',
                color: "#fff",
                fontSize: 24,
            },
            backgroundColor: new echarts.graphic.LinearGradient(
                0,
                0,
                0,
                1, [{
                        offset: 0,
                        color: "#3e7697",
                    },
                    {
                        offset: 1,
                        color: "#152d47",
                    },
                ],
                false
            ),
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: {
            type: "category",
            axisLine: {
                lineStyle: {
                    color: "#ccc",
                },
            },
            axisLabel: {
                color: "#777",
                fontSize: "14px",
            },
            data: data.datax
        },
        yAxis: {
            type: "value",
            nameTextStyle: { fontSize: "14px" },
            show: false,
            axisLine: {
                lineStyle: {
                    color: "#ccc",
                },
                show: false,
            },
            splitLine: {
                lineStyle: {
                    color: "#888",
                },
                show: false,

            },
        },
        series: [
          {
                type: "bar",
                barWidth: "36px",
                itemStyle: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                        { offset: 0, color: "rgba(67,188,255,1)" },
                        { offset: 1, color: "rgba(67,188,255,0.5)" },
                    ]),
                },
                label: {
                    show: true,
                    position: 'top'
                },
                data: data.datay
            }
           
        ],
    };
}

export default getbarChart;