import * as echarts from 'echarts/core';

export const lineChartOption = {
  legend: { show: false },
  emphasis: { lineStyle: { width: 2 } },
  xAxis: {
    boundaryGap: false,
    type: 'value',
    axisLine: { lineStyle: { color: '#8C8C8C' } }
  },
  series: [
    {
      // name: '2011',
      type: 'bar',
      data: [0, 0, 0, 0],
      label: {
        show: true,
        position: 'right',
        fontSize: 10,
        color: '#777'
      },
      itemStyle: {
        normal: {
          color: (params: any) => {
            // 给出颜色组
            var colorList = ['#86BAFF', '#FFDB91', '#85DFCF', '#4E9BFF'];
            return colorList[params.dataIndex];
          }
        }
      }
      // itemStyle: {
      //   normal: {
      //     color: (params: any) => {
      //       // 给出颜色组
      //       let colorList = [
      //         new echarts.graphic.LinearGradient(0, 1, 0, 1, [
      //           { offset: 0, color: '#A1E8FF' },
      //           { offset: 1, color: '#86BAFF' }
      //         ]),
      //         new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      //           { offset: 0, color: '#69DCE8' },
      //           { offset: 1, color: '#58A2FF' }
      //         ]),
      //         new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      //           { offset: 0, color: '#69DCE8' },
      //           { offset: 1, color: '#58A2FF' }
      //         ]),
      //         new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      //           { offset: 0, color: '#69DCE8' },
      //           { offset: 1, color: '#58A2FF' }
      //         ])
      //       ];
      //       return colorList[params.dataIndex];
      //     }
      //   }
      // }
      // emphasis: {
      //   itemStyle: {
      //     color: (params: any) => {
      //       // 给出颜色组
      //       let colorList = [
      //         new echarts.graphic.LinearGradient(0, 0, 0, 0, [
      //           { offset: 0, color: '#A1E8FF' },
      //           { offset: 1, color: '#86BAFF' }
      //         ]),
      //         new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      //           { offset: 0, color: '#69DCE8' },
      //           { offset: 1, color: '#58A2FF' }
      //         ]),
      //         new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      //           { offset: 0, color: '#69DCE8' },
      //           { offset: 1, color: '#58A2FF' }
      //         ]),
      //         new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      //           { offset: 0, color: '#69DCE8' },
      //           { offset: 1, color: '#58A2FF' }
      //         ])
      //       ];
      //       return colorList[params.dataIndex];
      //     }
      //   }
      // }
    }
  ],
  title: { show: false },
  grid: {
    bottom: '3%',
    containLabel: true,
    left: '3%',
    right: '5%',
    top: '7%'
  },
  tooltip: {
    trigger: 'axis',
    confine: true
  },
  yAxis: {
    type: 'category',
    data: ['多选题', '排序题', '单选题', '连连看']
  },
  dataZoom: [{ type: 'inside', throttle: 100 }],
  toolbox: { feature: { saveAsImage: { show: false } } }
};
