/**
 * @author  daya
 * @createDate  2021/11/15 10:46
 * 备注:区分图标类型的 xAxis(越写越多再分js出来)
 **/
import { defaultColor, defaultFontSize, formatToMillion, labelStyle, fontSize } from '../../../charts'
import common from '../../../common'
// eslint-disable-next-line no-unused-vars
const fontStyle = {
  color: defaultColor,
  fontSize: defaultFontSize
}
const axisStyle = {
  splitLine: false,
  axisLine: false,
  axisTick: false,
  axisLabel: {
    color: defaultColor,
    fontSize: defaultFontSize,
    formatter: formatToMillion
  }
}
const xAxisStyle = {
  type: 'category',
  data: []
}
let commonXAxis = {
  /**
   * 全局通用开始
   **/
  xAxisStyle: {
    ...xAxisStyle
  },
  xAxisStyle1: {
    type: 'category',
    ...axisStyle,
    data: [],
    axisLabel: {
      ...labelStyle
    }
  },
  xAxisStyle2: {
    type: 'category',
    data: [],
    axisLine: {
      lineStyle: {
        color: 'rgba(255,255,255,0.13)',
        type: 'dashed'
      }
    },
    axisTick: 'none',
    axisLabel: {
      ...labelStyle,
      // interval: 0,
      rotate: 40
    },
    boundaryGap: true,
    splitLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255,255,255,0.13)'
      }
    }
  },
  xAxisStyle3: {
    type: 'category',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      interval: 0,
      rotate: 0,
      formatter: params => {
        return common.sentFontLenByNumber(4, params)
      }
    },
    data: []
  },
  xAxisStyle4: {
    minInterval: 1,
    splitLine: false,
    axisLine: false,
    axisTick: false,
    type: 'category',
    data: [],
    axisLabel: {
      interval: 0,
      rotate: 0,
      color: '#fff',
      formatter: function (params) {
        var newParamsName = ''
        var paramsNameNumber = params.length
        var provideNumber = 1
        var rowNumber = Math.ceil(paramsNameNumber / provideNumber)
        for (let row = 0; row < rowNumber; row++) {
          if ((row + 1) * provideNumber < 8) {
            newParamsName +=
              params.substring(
                row * provideNumber,
                (row + 1) * provideNumber
              ) + '\n'
          }
        }
        return newParamsName
      }
    }
  },
  xAxisStyle5: {
    type: 'category',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      interval: 0,
      rotate: 0,
      formatter: params => {
        return common.sentFontLenByNumber(4, params)
      }
    },
    data: []
  },
  xAxisStyle6: {
    type: 'category',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      interval: 0,
      formatter: function (params) {
        var newParamsName = ''
        var paramsNameNumber = params.length
        var provideNumber = 1
        var rowNumber = Math.ceil(paramsNameNumber / provideNumber)
        for (let row = 0; row < rowNumber; row++) {
          if ((row + 1) * provideNumber < 8) {
            newParamsName +=
              params.substring(
                row * provideNumber,
                (row + 1) * provideNumber
              ) + '\n'
          }
        }
        return newParamsName
      },
      rotate: 0
    },
    data: []
  },
  xAxisStyle7: {
    type: 'value',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      interval: 0
    }
  },
  xAxisStyle8: {
    type: 'category',
    data: ['点', '击', '柱', '子', '或', '者', '两', '指', '在', '触', '屏', '上', '滑', '动', '能', '够', '自', '动', '缩', '放'],
    axisLabel: {
      inside: true,
      color: '#fff'
    },
    axisTick: {
      show: false
    },
    axisLine: {
      show: false
    },
    z: 10
  },
  xAxisStyle9: {
    ...xAxisStyle
  },
  xAxisStyle10: {
    show: false,
    type: 'value',
    splitLine: false,
    axisLine: false,
    axisTick: false,
    axisLabel: {
      textStyle: {
        align: 'left', // 设置左对齐
        baseline: 'middle'
      },
      margin: 110
    }
  },
  xAxisStyle11: {
    ...axisStyle,
    axisLabel: {
      ...fontStyle
    }
  },
  xAxisStyle13: {
    name: '月数',
    axisTick: {
      alignWithLabel: true
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, .7)',
        width: 2
      }
    }
  },
  xAxisStyle31: {
    ...axisStyle,
    // axisLabel: {
    //   color: '#fff',
    //   fontSize: 15
    //
    // },
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle32: {
    ...axisStyle,
    // axisLabel: {
    //   color: '#fff',
    //   fontSize: 15
    //
    // },
    name: '年',
    nameTextStyle: {
      fontSize: fontSize(12),
      color: '#fff'
    },
    zlevel: 9,
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: '#7c8397'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle33: {
    ...axisStyle,
    // axisLabel: {
    //   color: '#fff',
    //   fontSize: 15
    //
    // },
    type: 'value',
    name: '个数',
    nameTextStyle: {
      fontSize: fontSize(12),
      color: '#fff'
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#7c8397',
        width: 2
      }
    },
    axisTick: false,
    splitLine: {
      show: true,
      lineStyle: {
        type: 'dashed',
        color: 'rgba(58, 205, 255, .4)'
      }
    }
  },
  xAxisStyle34: {
    ...axisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14),
      rotate: 30

    },

    zlevel: 9,
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: '#7c8397'
      }
    },

    axisTick: false,
    splitLine: false
  },
  xAxisStyle35: {
    ...axisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14),
      rotate: 30

    },
    name: '区县',
    nameTextStyle: {
      fontSize: fontSize(14),
      color: '#fff'
    },
    zlevel: 9,
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: '#7c8397'
      }
    },

    axisTick: false,
    splitLine: false
  },
  xAxisStyle36: {
    ...axisStyle,
    // axisLabel: {
    //   color: '#fff',
    //   fontSize: 15
    //
    // },
    name: '月',
    nameTextStyle: {
      fontSize: fontSize(12),
      color: '#fff'
    },
    zlevel: 9,
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: '#7c8397'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle37: {
    ...axisStyle,
    axisLabel: {
      formatter: function (params) {
        return params
      }

    },
    boundaryGap: false,
    axisLine: {
      show: true,
      width: 2,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle38: {
    ...axisStyle,
    axisLabel: {
      formatter: function (params) {
        return params
      }

    },
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle39: {
    ...axisStyle,
    name: '月数',
    axisLabel: {
      formatter: function (params) {
        return params
      }

    },
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle40: {
    ...axisStyle,
    name: '月份',
    axisLabel: {
      formatter: function (params) {
        return params
      }

    },
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle41: {
    ...axisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(15)
    },
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)'
      }
    },
    axisTick: false,
    splitLine: false
  },
  xAxisStyle42: {
    ...axisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(15)
    },
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)'
      }
    },
    axisTick: false,
    splitLine: false,
    boundaryGap: false
  }
}
export const lineXAxis = {
  ...commonXAxis
}
export const barXAxis = {
  ...commonXAxis
}
commonXAxis.lineXAxis = lineXAxis
commonXAxis.barXAxis = barXAxis
export const xAxis = {
  ...commonXAxis
}
export default xAxis
