import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { RightBox04Config } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { chartInitConfig, requestSqlConfig } from '@/settings/designSetting'
import { graphic } from 'echarts/core'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'

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

const option = {
  textBtnArr: [
    { label: '按日', value: '1' },
    { label: '按月', value: '2' },
    { label: '按年', value: '3' },
  ],
  color: [],
  legend: {
    left: 'right',
    data: ['特大火灾', '重大火灾'],
    textStyle:{
      fontSize: 12
    }
  },
  tooltip: {
    show: true,
    trigger: 'axis',
    axisPointer: {
      type: 'line'
    }
  },
  xAxis: {
    show: true,
    type: 'category'
  },
  yAxis: {
    show: true,
    type: 'value'
  },
  dataset: { ...dataJson },
  series: [
    {
      type: 'line',
      name: '特大火灾',
      smooth: false,
      symbolSize: 10, //设定实心点的大小
      itemStyle: {
        // 设置symbol的颜色
        normal: {
          color: '#FFC600'
        }
      },
      label: {
        show: true,
        position: 'top',
        color: '#fff',
        fontSize: 12
      },
      lineStyle: {
        width: 3,
        type: 'solid',
        color: '#FFC600'
      },
    },
    {
      type: 'line',
      name: '重大火灾',
      smooth: false,
      symbolSize: 10, //设定实心点的大小
      itemStyle: {
        // 设置symbol的颜色
        normal: {
          color: '#0FD985'
        }
      },
      label: {
        show: true,
        position: 'top',
        color: '#fff',
        fontSize: 12
      },
      lineStyle: {
        width: 3,
        type: 'solid',
        color: '#0FD985'
      },
    },
    
  ]
}

export default class Config extends PublicConfigClass implements CreateComponentType {
  public key: string = RightBox04Config.key
  public chartConfig = cloneDeep(RightBox04Config)
  // 图表配置项
  public option = echartOptionProfixHandle(option, includes)
  public request = { ...requestSqlConfig, requestSQLContent: { sql: 'select * from ' }, }
  public filter = "return res.result;"
}
