index.config.ts 1.06 KB
export const getDefaultOption = (unit: string = '℃') => {
  return {
    series: [{
      type: 'gauge',
      min: 0,
      max: 100,
      startAngle: 200, // 仪表盘起始角度
      endAngle: -20, // 仪表盘结束角度
      radius: '85%',
      progress: {
        show: true,
        width: 15,
      },
      axisLine: {
        lineStyle: {
          width: 15,
        },
      },
      axisTick: { // 是否显示刻度
        show: true,
        distance: 2,
      },
      splitLine: { // 分割线
        length: 8,
        show: true,
        distance: 2,
        lineStyle: {
          width: 2,
        },
      },
      pointer: { // 指针
        show: false,
      },
      axisLabel: {
        distance: 18,
        color: '#999',
        fontSize: 14,
      },
      title: {
        show: false,
      },
      detail: {
        valueAnimation: true,
        fontSize: 17,
        offsetCenter: [0, 0],
        formatter: `{value} ${unit}`,
        color: 'inherit',
      },
      data: [
        {
          value: 70,
        },
      ],
    }],
  }
}