Javascript 当悬停国家/地区没有可用数据时,Highmaps中的自定义光标
我使用Highcharts和Highmaps来显示国家信息。我的世界地图初始化如下:Javascript 当悬停国家/地区没有可用数据时,Highmaps中的自定义光标,javascript,css,highcharts,highmaps,Javascript,Css,Highcharts,Highmaps,我使用Highcharts和Highmaps来显示国家信息。我的世界地图初始化如下: data.series[0].data = {...}; // array with 135 entries data.series[0].mapData = Highcharts.maps['custom/world']; // world map with 213 countries data.series[0].point.events.click = function(){ //do some
data.series[0].data = {...}; // array with 135 entries
data.series[0].mapData = Highcharts.maps['custom/world']; // world map with 213 countries
data.series[0].point.events.click = function(){ //do something };
一切正常,数据显示,onClick处理程序也正常工作。为了向用户显示可以单击的国家,我将光标设置为手形图标:
data.plotOptions.series.cursor = "pointer";
现在问题来了。有时我没有所有国家的数据,所以不能点击“空”国家。Highmaps在单击国家/地区时不会触发事件,但我还希望覆盖这些国家/地区的光标
如果给定点不存在值,如何设置自定义光标
Highcharts v4.2.5您可以使用
plotOptions.series.point.events.mouseOver
event
及
plotOptions.series.point.events.mouseOut
event
plotOptions: {
series: {
point: {
events: {
mouseOver: function () {
$("#container").addClass("cursor");
},
mouseOut: function () {
$("#container").removeClass("cursor");
}
}
},
}
}
通过这样做,在没有价值的区域上不会触发任何事件。
还应删除plotOptions.series.cursor=“pointer”代码>