import * as echarts from 'echarts'

const getLineChart = (dataX, dataY) => {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    },
    grid: {
      top: '8%',
      right: '5%',
      bottom: '5%',
      left: '5%',
      containLabel: true
    },
    legend: {
      data: ['提出法案', '通过法案'],
      show: false
    },
    color: ['#1459bb', '#fa8c16'],
    xAxis: [
      {
        type: 'category',
        boundaryGap: false,
        data: dataX
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: [
      {
        name: '301调查',
        type: 'line',
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0,
            color: 'rgba(22, 119, 255, 0.5)' // 起始颜色
          }, {
            offset: 1,
            color: 'rgba(5, 95, 194, 0)' // 结束颜色
          }])
        },
        lineStyle: {
          color: '#055FC2',
          width: 1
        },
        emphasis: {
          focus: 'series'
        },
        data: dataY
      },
    ]
  }
}

export default getLineChart