我正在使用angular-flot绘制饼图。但我不能元素plotclick。我试过了:
element.bind("plotclick", function (event, pos, item) {
if(item){
alert("Clicked");
scope.$apply();
}
});
但它没有被触发。
这是我的控制器代码:
$scope.dataset = [
{ label: "IE", data: 19.5, color: "#4572A7"},
{ label: "Safari", data: 4.5, color: "#80699B"},
{ label: "Firefox", data: 36.6, color: "#AA4643"},
{ label: "Opera", data: 2.3, color: "#3D96AE"},
{ label: "Chrome", data: 36.3, color: "#89A54E"},
{ label: "Other", data: 0.8, color: "#3D96AE"}
];
$scope.options = {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 3/4,
formatter: labelFormatter,
background: {
opacity: 0.5,
color: '#000'
}
}
}
},
legend: {
show: false
},
grid: {
hoverable: true,
clickable: true
}
那么,我是否必须更改控制器代码或指令以实现点击事件。