
import * as echarts from 'echarts'

const getLineChart = (dataX, dataY) => {
  return {
    grid: {
      left: '2%',
      top: '8%',
      right: '2%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      splitLine: {
        show: false
      },
      axisLine: {
        show: false
      },
      data: dataX
    },
    yAxis: {
      type: 'value',
      splitLine: {
        show: false
      },
      axisLine: {
        show: false
      },
    },
    series: [
      {
        data: dataY,
        type: 'line',
        showSymbol: false,
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0,
            color: 'rgba(22,119,255,0.5)' // 起始颜色：深色
          }, {
            offset: 1,
            color: 'rgba(22,119,255,0)' // 结束颜色：浅色且透明度降低
          }])
        },
      }
    ]
  }
}

export default getLineChart;