import * as echarts from "echarts";
const getColumnChart = (nameList, series1, series2, isPer) => {
  // 两套渐变
  const gradBlue = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    { offset: 0, color: '#055FC2' },
    { offset: 1, color: '#BAE0FF' }
  ])
  const gradCyan = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    { offset: 0, color: '#CE4F51' },
    { offset: 1, color: '#FFA39E' }
  ])

  return {
    tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
    grid: { top: '10%', right: '3%', bottom: '0%', left: '3%', containLabel: true },
    legend: {
      data: ['研究型大学', '科技企业', '研究机构'], top: 0, icon: 'circle', textStyle: {
        color: "#757B82", //字体颜色
        fontSize: "15px",
      },
    },
    xAxis: {
      type: 'category',
      data: nameList,
      axisLine: { show: false },
      axisTick: { show: false },
      axisLabel: { color: '#666', fontSize: 12 }
    },
    yAxis: {
      type: 'value',
      axisLine: { show: false },
      axisTick: { show: false },
      axisLabel: { show: true, color: '#666' },
      splitLine: { show: true, lineStyle: { color: '#ebebeb' } }
    },
    series: [
      {
        name: '研究型大学',
        type: 'bar',
        data: series1,
        barWidth: 8,
        label: { show: false },
        itemStyle: { borderRadius: [8, 8, 0, 0], color: gradBlue }
      },
      {
        name: '科技企业',
        type: 'bar',
        data: series2,
        barWidth: 8,
        label: { show: false },
        itemStyle: { borderRadius: [8, 8, 0, 0], color: gradCyan }
      },
      {
        name: '研究机构',
        type: 'bar',
        data: series2,
        barWidth: 8,
        label: { show: false },
        itemStyle: { borderRadius: [8, 8, 0, 0], color: '#FFC63D' }
      }
    ]
  }
}

export default getColumnChart