在仪表高图轴标签上显示一些特定数字

时间:2014-01-13 13:54:32

标签: highcharts

我想在仪表数据标签上显示一些数字,如下所示:
gauge with user select number

我尝试在 category 中使用formatteryAxis选项,但这样会发生错误!

categories: ['0','3','7','14'],  

labels: {
    formatter: function() {
        if(this.value == '0' ||this.value == '3' ||this.value == '7' ||this.value == '14') 
            return this.value;
    }
},

这种方法有什么问题?任何其他解决方案将不胜感激 这是fiddle我将继续工作。

1 个答案:

答案 0 :(得分:5)

最后我解决了这个问题。这是我添加到yAxis的内容:

  rotation:'auto',      
  labels: {
      distance: 20,
      formatter: function() {
          if(this.value == '0' ||this.value == '3' ||this.value == '7' ||this.value == '14') 
              return this.value;
      }
  },
  tickInterval: 1,
  minorTickLength:0,

以下是Fiddle

相关问题