import * as echarts from "echarts";

const getbarLineChart = (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: "#5bd4d5",
        },
        {
          offset: 1,
          color: "#5b9dd5",
        },
      ],
        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: '#5b9bd5',
        },
        label: {
          show: true,
          position: 'top'
        },
        data: data.datay1
      },
      {

        type: 'line',
        smooth: true,
        lineStyle: {
          color: '#fb5430' // 设置折线颜色
        },
        itemStyle: {
          color: '#fc3230'  // 设置折点颜色
        },
        data: data.datay2,
      }

    ],
  };
}

export default getbarLineChart;