import * as echarts from 'echarts'
import { size, split } from 'lodash'

// data: [{ name: string, value: number[] }, ...]
const getMultiLineChart = (dataX, seriesData) => {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    },
    grid: {
      top: '15%',
      right: '5%',
      bottom: '5%',
      left: '5%',
      containLabel: true
    },
    legend: {
      icon:'circle',
      show: true,
      top: 10,
      left:'10%',
      textStyle: {
      fontSize: 16,
      fontFamily: 'Source Han Sans CN',
      fontWeight: 400,    
      lineHeight: 24,            
      letterSpacing: 0,                 
      align: 'left',       
      color:'rgb(95, 101, 108)'
      },
      itemWidth:12,
      itemHeight:12, 
    },
    xAxis: [
      {
        type: 'category',
        boundaryGap: false,
        data: dataX,
       axisLine: {
      lineStyle: {
        color: 'rgb(231, 243, 255)',
      },
      },
      axisLabel: {
      color: 'rgb(132, 136, 142)',
       fontFamily: 'Microsoft YaHei',
      fontWeight: 400,   
      fontSize:12,           
             
     
     
    },
 
    
      }
    ],
    yAxis: [
      {
        type: 'value',
        splitLine:{
          show:true,
          lineStyle:{
            color:"rgb(231, 243, 255)",
            type:'dashed'
          }
        }
      }
    ],
    series: (seriesData || []).map(item => ({
      name: item.name,
      type: 'line',
      emphasis: { focus: 'series' },
      data: item.value
    }))
  }
}

export default getMultiLineChart