import { PublicConfigClass } from '../../../../../utils/PublicConfigClass';

import { echartOptionProfixHandle, chartColorsSearch } from '../../../chart';
import { CurvesGradientSingleConfig } from './basis';
import { cloneDeep } from 'lodash-es';
import dataJson from './data.json';
import { graphic } from 'echarts/core';

export const includes = ['legend', 'xAxis', 'yAxis', 'grid'];

export const option = {
  tooltip: {
    show: true,
    trigger: 'axis',
    axisPointer: {
      type: 'line'
    }
  },
  xAxis: {
    show: true,
    type: 'category'
  },
  yAxis: {
    show: true,
    type: 'value'
  },
  dataset: { ...dataJson },
  series: [
    {
      type: 'line',
      smooth: true,
      symbolSize: 5, //设定实心点的大小
      label: {
        show: true,
        position: 'top',
        color: '#fff',
        fontSize: 12
      },
      lineStyle: {
        type: 'solid',
        width: 3
      },
      areaStyle: {
        opacity: 0.8,
        color: new graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: chartColorsSearch['dark'][3]
          },
          {
            offset: 1,
            color: 'rgba(0,0,0,0)'
          }
        ])
      }
    }
  ]
};

export default class Config extends PublicConfigClass {
  key = CurvesGradientSingleConfig.key;
  chartConfig = cloneDeep(CurvesGradientSingleConfig);
  // 图表配置项
  option = echartOptionProfixHandle(option, includes);
}
