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: '15%',
      left: '5%',
      containLabel: true
    },
    // legend: {
    //   data: ['中国', '美国'],
    //   show: true
    // },
    color: ['#0958D9', '#FF7875'],
    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: '#0958D9' // 起始颜色
          }, {
            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: '#FF7875' // 起始颜色
          }, {
            offset: 1,
            color: 'rgba(255, 172, 77, 0)' // 结束颜色
          }])
        },
        emphasis: {
          focus: 'series'
        },
        data: dataY2
      }
    ]
  }
}

export default getMultiLineChart