Php 在highcharts上有一些条不是url链接

Php 在highcharts上有一些条不是url链接,php,javascript,highcharts,Php,Javascript,Highcharts,我有一张这样的海图: 它是用PHP在服务器上用数据生成的,但如果数据的计数为零,我不希望它有URL(因为没有什么可看的) 我如何告诉图表仅禁用这些条形图上的链接 if($value['category'] > 0){ $chartActive .= $comma."{y:".$value['category'].", url: '/section/of/site/index.php'}"; }else{ $chartActive .= $comma.

我有一张这样的海图: 它是用PHP在服务器上用数据生成的,但如果数据的计数为零,我不希望它有URL(因为没有什么可看的)

我如何告诉图表仅禁用这些条形图上的链接

if($value['category'] > 0){
        $chartActive .= $comma."{y:".$value['category'].", url: '/section/of/site/index.php'}";
    }else{
        $chartActive .= $comma."{y:0, url: javascript:void(0)}";
    }
然后将其添加到图表中,如下所示:

plotOptions: {
            column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || '#333'
                }
            },
            series: {
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            location.href = this.options.url;
                        }
                    }
                }
            }
        },
        series: [{
            name: 'Active',
            data: [<?php echo $chartActive; ?>]
        },
plotOptions:{
专栏:{
堆叠:“正常”,
数据标签:{
启用:对,
颜色:(Highcharts.theme&&Highcharts.theme.dataLabelsColor)| |'#333'
}
},
系列:{
光标:“指针”,
要点:{
活动:{
单击:函数(){
location.href=this.options.url;
}
}
}
}
},
系列:[{
名称:'活动',
数据:[]
},
正如您所看到的,url是在plotOptions的系列部分中定义的,因此它始终存在,如果我现在按照我的方式进行,则链接可以工作,但会转到mysite.com/undefined

如有任何建议,将不胜感激


标记

在设置url之前,您可以在单击事件中测试该点是否有值。但是,任何空点仍将有指针光标,我还没有找到绕过它的方法


series: {
    cursor: 'pointer',
    point: {
        events: {
            click: function() {
// if you've more than one series then you'll have to sum up the value for the stack
                if (this.y != 0) {  
                    location.href = this.options.url;
                }
            }
        }
    }
}

系列:{
光标:“指针”,
要点:{
活动:{
单击:函数(){
//如果有多个系列,则必须对堆栈的值求和
如果(this.y!=0){
location.href=this.options.url;
}
}
}
}
}

谢谢,我做了类似的操作,如果我不想使用每个URL,我会将其设置为false,然后执行if!=false测试。否则,我会返回false,这样图表就不会将用户发送到“未定义”