我对Amchart库相当新,并且遇到了图例的clickLabel事件的问题。
这是我尝试过的Javascript代码:
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"legend": {
"horizontalGap": 10,
"maxColumns": 1,
"position": "right",
"useGraphSettings": true,
"markerSize": 10,
"listeners": [{
"event": "clickMarker",
"method": function(e) {
document.getElementById('clicked').textContent =
e.dataItem.title + ' - marker status before toggle: ' + e.dataItem.hidden;
}
}]
},
chart.legend.addListener('clickLabel', function(event) {
document.getElementById('clicked').textContent =
e.dataItem.title + ' - marker status before toggle: ' + e.dataItem.hidden;
});
这里是Jsfiddle:http://jsfiddle.net/Shivin15/15k53omf/2/
感谢您的帮助!