Javascript 在hightcharts js中禁用事件
我需要禁用高图表堆叠区域图表中图例上的事件。这是我的密码:Javascript 在hightcharts js中禁用事件,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我需要禁用高图表堆叠区域图表中图例上的事件。这是我的密码: chart: { type: 'area', }, point: { events: { legendItemClick: function () { return false; // <== returning false will cancel the default action }, }, }, titl
chart: {
type: 'area',
},
point: {
events: {
legendItemClick: function () {
return false; // <== returning false will cancel the default action
},
},
},
title: {
text: title,
},
xAxis: {
type: 'datetime',
min: startDateInMS,
max: endDateInMS,
},
yAxis: {
title: {
text: yLabel,
},
},
series: data,
plotOptions: {
series: {
stacking: 'normal',
},
},
credits: {
enabled: false,
},
};
图表:{
类型:'区域',
},
要点:{
活动:{
legendItemClick:函数(){
return false;//您的问题源于您将单击事件指定给点,但从外观上看,您的图表是一个区域
,并且您将单击事件应用到了错误的属性
你把它放在行下
同时,它需要像-plotOptions->area->events->legendItemClick那样嵌套
相反,请确保事件嵌套如下:
chart: {
type: 'area',
},
plotOptions: {
area: {
events: {
legendItemClick: function () {
return false; // <== returning false will cancel the default action
}
}
}
},
title: {
text: title,
},
xAxis: {
type: 'datetime',
min: startDateInMS,
max: endDateInMS,
},
yAxis: {
title: {
text: yLabel,
},
},
series: data,
plotOptions: {
series: {
stacking: 'normal',
},
},
credits: {
enabled: false,
},
};
图表:{
类型:'区域',
},
打印选项:{
面积:{
活动:{
legendItemClick:函数(){
return false;//明白了…我有另一个绘图选项,进一步的停机代码是过度编写此代码的:
chart: {
type: 'area',
},
plotOptions: {
series: {
stacking: 'normal',
},
area: {
events: {
legendItemClick: function () {
return false; // <== returning false will cancel the default action
},
},
},
},
title: {
text: title,
},
xAxis: {
type: 'datetime',
min: startDateInMS,
max: endDateInMS,
},
yAxis: {
title: {
text: yLabel,
},
},
series: data,
credits: {
enabled: false,
},
};
图表:{
类型:'区域',
},
打印选项:{
系列:{
堆叠:“正常”,
},
面积:{
活动:{
legendItemClick:函数(){
return false;//发现问题出在如何嵌套事件上我只是尝试了你提供的代码,但仍然一无所获……arghhh!!即使我尝试并在控制台上注销正在发生的事情,该函数也永远不会fires@Jorge你能发布你的完整代码/创建一个JSFIDLE来复制这个问题吗?