You need to enable JavaScript to run this app. 如何在ApexChart polar area极区图中移除或设置数值的小数位数
优惠活动
大模型
产品
解决方案
定价
更多

如何在ApexChart polar area极区图中移除或设置数值的小数位数

极区图上显示的数值属于数据标签,通过修改配置项中的plotOptions字段即可实现你的两种需求:

方案1:直接移除所有显示的数值

在配置对象中新增plotOptions字段,关闭极区图的数据标签开关:

this.duChartOptions2 = {
  series:  [1,2,4],
  chart: {
    type: "polarArea"
  },
  // 新增配置段
  plotOptions: {
    polarArea: {
      dataLabels: {
        enabled: false // 关闭数据标签即可隐藏所有显示的数值
      }
    }
  },
  labels: ["a","b","c"],
  stroke: {
    colors: ["#fff"]
  },
  fill: {
    opacity: 0.8
  },
  responsive: [
    {
      breakpoint: 480,
      options: {
        chart: {
          width: 200
        },
        legend: {
          position: "bottom"
        }
      }
    }
  ]
};

方案2:数值保留2位小数

不关闭数据标签,添加formatter回调函数格式化输出的数值即可:

this.duChartOptions2 = {
  series:  [1,2,4],
  chart: {
    type: "polarArea"
  },
  // 新增配置段
  plotOptions: {
    polarArea: {
      dataLabels: {
        enabled: true,
        formatter: function(val) {
          return val.toFixed(2) // 格式化数值为保留2位小数
        }
      }
    }
  },
  labels: ["a","b","c"],
  stroke: {
    colors: ["#fff"]
  },
  fill: {
    opacity: 0.8
  },
  responsive: [
    {
      breakpoint: 480,
      options: {
        chart: {
          width: 200
        },
        legend: {
          position: "bottom"
        }
      }
    }
  ]
};

内容的提问来源于stack exchange,提问作者Rimuru

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.10 16:12:00