import * as echarts from 'echarts'

const getMultiLineChart = (dataX, dataY1, dataY2) => {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    },
    grid: {
      top: 40,
      right: 24,
      bottom: 24,
      left: 24,
      containLabel: true
    },
    legend: {
      data: ['提出法案', '通过法案'],
      show: false
    },
    color: ['#1459bb', '#fa8c16'],
    xAxis: [
      {
        type: 'category',
        boundaryGap: false,
        data: dataX
      }
    ],
    yAxis: [
      {
        type: 'value',
        name: '数量',
        splitLine: {
          show: true,
          lineStyle: {
            type: 'dashed',    // 虚线类型
            color: 'rgb(231, 243, 255)',      // 灰色线条
            width: 1            // 线宽为1
          }
        }
      }
    ],
    series: [
      {
        name: '提出法案',
        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(22, 119, 255, 0)' // 结束颜色
          }])
        },
        emphasis: {
          focus: 'series'
        },
        data: dataY1
      },
      // {
      //   name: '通过法案',
      //   type: 'line',
      //   areaStyle: {
      //     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
      //       offset: 0,
      //       color: 'rgba(255, 172, 77, 1)' // 起始颜色
      //     }, {
      //       offset: 1,
      //       color: 'rgba(255, 172, 77, 0)' // 结束颜色
      //     }])
      //   },
      //   emphasis: {
      //     focus: 'series'
      //   },
      //   data: dataY2
      // }
    ]
  }
}

export default getMultiLineChart