import * as echarts from 'echarts'

const getMultiLineChart = (dataX, dataY1, dataY2) => {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    },
    grid: {
      top: '8%',
      right: '5%',
      bottom: '5%',
      left: '5%',
      containLabel: true
    },
    legend: {
      show: true,
      textStyle: {
        color: 'rgba(95, 101, 108, 1)',
        fontFamily: 'Microsoft YaHei',
        fontSize: '16px',
      }
    },
    color: ['rgba(5, 95, 194, 1)', 'rgba(206, 79, 81, 1)'],
    xAxis: [
      {
        type: 'category',
        boundaryGap: false,
        data: dataX
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: [
      {
        name: '提出法案',
        type: 'line',

        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0,
            color: 'rgba(5, 95, 194, 1)' // 起始颜色
          }, {
            offset: 1,
            color: 'rgba(5, 95, 194, 0)' // 结束颜色
          }])
        },
        emphasis: {
          focus: 'series'
        },
        data: dataY1
      },
      {
        name: '通过法案',
        type: 'line',
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0,
            color: 'rgba(206, 79, 81, 1)' // 起始颜色
          }, {
            offset: 1,
            color: 'rgba(206, 79, 81, 0.1)' // 结束颜色
          }])
        },
        emphasis: {
          focus: 'series'
        },
        data: dataY2
      }
    ]
  }
}

export default getMultiLineChart