import * as echarts from "echarts";

const getBarChart1 = (nameList, valueList) => {
  const option = {
    tooltip: {},
    grid: {
      top: '8%',
      right: '3%',
      bottom: '3%',
      left: '3%',
      containLabel: true
    },
    yAxis: {
      type: 'value',
      splitLine: {
        show: false
      },

    },
    xAxis: {
      type: 'category',
      data: nameList,
      splitLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLine: {
        show: false
      },
      axisLabel: {
        show: true
      }
    },
    series: [{
      type: 'bar',
      data: valueList,
      barWidth: 8,
      // label: {
      //   show: true,
      //   position: [350, 0],
      // },
      itemStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
          offset: 0,
          color: 'rgba(22,119,255,1)' // 起始颜色：深色
        }, {
          offset: 1,
          color: 'rgba(22,119,255,0)' // 结束颜色：浅色且透明度降低
        }]),
        barBorderRadius: 4,
      }
    }]
  }
  return option
}

export default getBarChart1