You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Highmaps中移除图例名称?基于双击缩放示例场景

How to Remove Numeric Labels (1, 10, 100, 1k) from Highmaps Legend

Got it, let's fix this quickly! When building on that double-click zoom Highmaps demo and wanting to get rid of those numeric labels in the legend, the solution lies in customizing the legend's label formatter for the color axis.

Here's the straightforward approach:

  • Locate the colorAxis section in your Highmaps configuration (this is where the value scale legend is controlled).
  • Add or modify the legend property inside colorAxis, and override the labelFormatter function to return an empty string.

Here's the code snippet to implement this:

colorAxis: {
    min: 1,
    max: 1000,
    type: 'logarithmic',
    legend: {
        enabled: true,
        // This overrides default label text, returning nothing to hide the numeric labels
        labelFormatter: function() {
            return '';
        }
    }
}

Why this works:

The labelFormatter function dictates what text gets rendered next to each color segment in the legend. By returning an empty string, we suppress those numeric labels (1, 10, 100, 1k) entirely while keeping the color gradient bar intact. If you ever need to add custom text later, you can just adjust the return value in this function.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 08:54:05