HighCharts设置不同的xAxis标签

HighCharts设置不同的xAxis标签,highcharts,Highcharts,我使用了2个数组和一些数字,并得到了百分比。我想做的是,如果两个数组索引都为0,我想将标签设置为“无数据” 我知道我需要获取当前列(点)索引或类似的内容,我已经尝试使用格式化程序来实现这一点 无论如何,我想象代码是这样的 xAxis: { categories: trebleNotes, labels: { rotation: -45, align: 'right', style: {

我使用了2个数组和一些数字,并得到了百分比。我想做的是,如果两个数组索引都为0,我想将标签设置为“无数据”

我知道我需要获取当前列(点)索引或类似的内容,我已经尝试使用格式化程序来实现这一点

无论如何,我想象代码是这样的

xAxis: {
   categories: trebleNotes,
       labels: {
               rotation: -45,
               align: 'right',
               style: {
                  fontSize: '13px',
                  fontFamily: 'Verdana, sans-serif'
               },
               formatter: function () {
                 if(array1[currentColumn] == 0 && array2[currentColumn] == 0){
                        return("NO DATA");
                      }else{
                         return(this.value);
                      }
               },
             }
       },

我不知道如何获取currentColumn索引并使用它进行格式化。我希望这是有意义的。

如果我理解正确,您不希望目录的索引位于
this.value

        labels: {
            formatter: function() {
                var currentColumn = -1;
                for (var idx = 0; idx < this.axis.categories.length; idx++){
                    if (this.axis.categories[idx] == this.value){
                        currentColumn = idx;
                        break;
                    }
                }
                console.log(currentColumn);
                return this.value;
            }
        }
标签:{
格式化程序:函数(){
var currentColumn=-1;
对于(var idx=0;idx
谢谢。这看起来几乎是可行的,它允许我获取列索引。。但是在很多实例中,类别是相同的(重复相同的值),所以我让“currentColumn”重复了好几次。你有图表的现场演示吗?