/**
 * @author  daya
 * @createDate  2021/11/15 10:46
 * 备注:区分图标类型的 yAxis(越写越多再分js出来, 到时候看看想，坐标要不要合并)
 **/
import { defaultColor, defaultFontSize, formatToMillion, labelStyle, fontSize } from '../../../charts'
// eslint-disable-next-line no-unused-vars
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: {
    ...fontStyle,
    formatter: formatToMillion
  }
}
const yAxisStyle = {
  type: 'value',
  data: []
}
let commonYAxis = {
  /**
   * 全局通用开始
   **/
  yAxisStyle: {
    ...yAxisStyle
  },
  yAxisStyle1: {
    type: 'value',
    ...labelStyle,
    ...axisStyle,
    axisLabel: {
      ...labelStyle
    },
    splitNumber: 3,
    minInterval: 1
  },
  yAxisStyle2: {
    name: '(家)',
    nameTextStyle: {
      color: defaultColor,
      fontSize: defaultFontSize,
      align: 'right'
    },
    offset: -10,
    type: 'value',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: formatToMillion
    }
  },
  yAxisStyle3: {
    nameTextStyle: {
      color: defaultColor,
      fontSize: defaultFontSize,
      align: 'right'
    },
    offset: -10,
    type: 'value',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: formatToMillion
    }
  },
  yAxisStyle4: {
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(16)
    },
    splitNumber: 5,
    // interval: 7000,
    splitLine: false,
    // axisLine: false,
    axisTick: false,
    type: 'value'
  },
  yAxisStyle5: {
    type: 'value',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: formatToMillion
    }
  },
  yAxisStyle6: {
    type: 'value',
    show: false,
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: formatToMillion
    }
  },
  yAxisStyle7: {
    type: 'category',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: formatToMillion
    },
    data: []
  },
  yAxisStyle8: {
    type: 'value',
    axisLine: {
      show: false
    },
    axisTick: {
      show: false
    },
    axisLabel: {
      color: '#999'
    }
  },
  yAxisStyle9: {
    ...yAxisStyle
  },
  yAxisStyle10: {
    type: 'category',
    ...axisStyle,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: function (params, index) {
        let allIndex = 5
        let NO = `{a|NO.${allIndex - index}}`
        if (params.length > 6) {
          params = params.substring(0, 6) + '..'
        }
        let name = `{b|${params}}`
        let array = [
          NO + name
        ]
        let result = array
        return result
      },
      rich: {
        a: {
          align: 'left',
          // backgroundColor: {
          //   color: '#fff'
          // },
          width: 50,
          height: 20,
          color: 'rgba(0, 186, 188, 1)',
          lineHeight: 20
        },
        b: {
          align: 'left',
          color: '#FFFFFF',
          height: 40
        }
      },
      textStyle: {
        align: 'left', // 设置左对齐
        baseline: 'middle'
      },
      margin: 150
    },
    data: []
  },
  yAxisStyle11: {
    type: 'value',
    axisLine: {
      show: false
    },
    axisTick: {
      show: false,
      fontSize: fontSize(12)
    },
    splitLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, 0.15)'
      }
    },
    axisLabel: {
      ...fontStyle
    }
  },
  yAxisStyle12: {
    type: 'category',
    ...axisStyle,
    offset: -1000,
    axisLabel: {
      color: defaultColor,
      fontSize: defaultFontSize,
      formatter: function (params, index) {
        let allIndex = 5
        let NO = `{a|NO.${allIndex - index}}`
        if (params.length > 6) {
          params = params.substring(0, 6) + '..'
        }
        let name = `{b|${params}}`
        let array = [
          NO + name
        ]
        let result = array
        return result
      },
      rich: {
        a: {
          align: 'left',
          // backgroundColor: {
          //   color: '#fff'
          // },
          width: 50,
          height: 20,
          color: 'rgba(0, 186, 188, 1)',
          lineHeight: 20
        },
        b: {
          align: 'left',
          color: '#FFFFFF',
          height: 40
        }
      },
      textStyle: {
        align: 'left', // 设置左对齐
        baseline: 'middle'
      },
      margin: 150
    },
    data: []
  },
  yAxisStyle13: {
    name: '人数（万）',
    ...yAxisStyle,
    splitNumber: 2,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, .7)',
        width: 2
      }
    },
    splitLine: {
      show: false
    }
  },
  yAxisStyle31: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    splitNumber: 2,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false

  },
  yAxisStyle32: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    splitNumber: 2,
    axisLine: {
      show: true,
      lineStyle: {
        color: '#7c8397',
        width: 2
      }
    },
    axisTick: false,
    splitLine: {
      show: true,
      lineStyle: {
        type: 'dashed',
        color: 'rgba(58, 205, 255, .4)'
      }
    }

  },
  yAxisStyle33: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    type: 'category',
    zlevel: 9,
    name: '区县',
    nameTextStyle: {
      fontSize: fontSize(14),
      color: '#fff'
    },
    nameLocation: 'end',
    axisLine: {
      show: true,
      width: 1,
      lineStyle: {
        color: '#7c8397'
      }
    },
    axisTick: false,
    splitLine: false
  },
  yAxisStyle34: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    name: '(年)',
    nameTextStyle: {
      fontSize: fontSize(14),
      color: '#fff'
    },
    nameLocation: 'end',
    splitNumber: 5,
    axisLine: {
      show: true,
      lineStyle: {
        color: '#7c8397',
        width: 2
      }
    },
    axisTick: false,
    splitLine: {
      show: true,
      lineStyle: {
        type: 'dashed',
        color: 'rgba(58, 205, 255, .4)'
      }
    }

  },
  yAxisStyle35: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    name: '(个)',
    nameTextStyle: {
      fontSize: fontSize(12),
      color: '#fff'
    },
    nameLocation: 'end',
    splitNumber: 5,
    axisLine: {
      show: true,
      lineStyle: {
        color: '#7c8397',
        width: 2
      }
    },
    axisTick: false,
    splitLine: {
      show: true,
      lineStyle: {
        type: 'dashed',
        color: 'rgba(58, 205, 255, .4)'
      }
    }

  },
  yAxisStyle36: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(12),
      formatter: function (params) {
        if (params < 1000) {
          return params
        } else if (params < 10000) {
          params = params + ''
          let baselen = 3
          return params.substring(0, params.length - baselen) + ',' + params.substring(params.length - baselen)
        } else {
          return Math.round(params / 10000) + '万'
        }
      }
    },
    splitNumber: 4,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false

  },
  yAxisStyle37: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(12),
      formatter: function (params) {
        if (params < 1000) {
          return params + '人'
        } else if (params < 10000) {
          params = params + ''
          let baselen = 3
          return params.substring(0, params.length - baselen) + ',' + params.substring(params.length - baselen) + '人'
        } else {
          return params / 10000 + '万人'
        }
      }
    },

    splitNumber: 4,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)',
        width: 1
      }
    },
    axisTick: false,
    splitLine: false

  },
  yAxisStyle38: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(12),
      formatter: function (params) {
        params = params + ''
        let baselen = 3
        if (params.length > 3) {
          return params.substring(0, params.length - baselen) + ',' + params.substring(params.length - baselen)
        } else {
          return params
        }
      }
    },

    splitNumber: 4,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)',
        width: 1
      }
    },
    axisTick: false,
    splitLine: false

  },
  yAxisStyle39: {
    ...yAxisStyle,
    name: '(单位：人)',
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(12),
      formatter: function (params) {
        if (params < 1000) {
          return params
        } else if (params < 10000) {
          params = params + ''
          let baselen = 3
          return params.substring(0, params.length - baselen) + ',' + params.substring(params.length - baselen)
        } else {
          return Math.round(params / 10000) + '万'
        }
      }
    },
    splitNumber: 4,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false

  },
  yAxisStyle40: {
    ...yAxisStyle,
    name: '人数(万)',
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(12),
      formatter: function (params) {
        if (params < 1000) {
          return params
        } else if (params < 10000) {
          params = params + ''
          let baselen = 3
          return params.substring(0, params.length - baselen) + ',' + params.substring(params.length - baselen)
        } else {
          return Math.round(params / 10000) + '万'
        }
      }
    },
    splitNumber: 4,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, 1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false

  },

  yAxisStyle41: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false

  },
  yAxisStyle42: {
    ...yAxisStyle,
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    splitNumber: 2,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false
  },
  yAxisStyle43: {
    ...yAxisStyle,
    max: 200,
    min: 0,
    boundaryGap: [0.2, 0.2],
    axisLabel: {
      color: '#fff',
      fontSize: fontSize(14)
    },
    splitNumber: 2,
    axisLine: {
      show: true,
      lineStyle: {
        color: 'rgba(255, 255, 255, .1)',
        width: 2
      }
    },
    axisTick: false,
    splitLine: false
  }
}
export const lineYAxis = {
  ...commonYAxis
}
export const barYAxis = {
  ...commonYAxis
}
commonYAxis.lineYAxis = lineYAxis
commonYAxis.barYAxis = barYAxis
export const yAxis = {
  ...commonYAxis
}
export default yAxis
