0
我正在使用Angular-nvd3來繪製餅圖。elementClick事件在角度-nvd3圖表中未觸發
HTML
<nvd3 options="options.chart.options" data="options.chart.data" api="options.chart.api" config="config" events="events"></nvd3>
的Javascript
$scope.options.chart = {
options: {
chart: {
type: 'pieChart',
height: 500,
margin: {
top: 0,
right: 40,
bottom: 80,
left: 40
},
x: function(d) {
return d.key;
},
y: function(d) {
return d.y;
},
showLabels: true,
duration: 1500,
labelThreshold: 0.01,
showLegend: true,
lines: {
dispatch: {
elementClick: function(e) {
console.log('click')
},
elementMouseover: function(e) {
console.log('mouseover')
},
elementMouseout: function(e) {
console.log('mouseout')
}
}
}
}
},
data: [{
key: "One",
y: 5
}, {
key: "Two",
y: 2
}, {
key: "Three",
y: 9
}, {
key: "Four",
y: 7
}, {
key: "Five",
y: 4
}, {
key: "Six",
y: 3
}, {
key: "Seven",
y: .5
}],
api: {}
};
我需要調用一個事件,當餡餅用戶點擊chart.But上面的代碼不行,請幫幫我?