我正在使用有四个孩子的森伯斯特图,并希望在某些情况下防止onclick事件
我尝试了d3.event.prevenDefault和d3.event.stopPropogation函数,但没有成功。
森伯斯特图表数据
var data = [
{
"name": "Root",
"color": statusColor,
"children": [
{
"name": "analysis",
"chartID": indexchart
},
{
"name": "Closure",
"chartID": indexchart,
"children": []
},
{
"name": "Quality",
"chartID": indexchart,
"children": []
},
{
"name": "Performance",
"chartID": indexchart,
"children": []
}]
}
选项:
$scope.Options = {
chart: {
type: 'sunburstChart',
height: 450,
mode: "size",
duration: 250,
showLabels: true,
labelThreshold: 0.2,
labelFormat: function (d, t) {
return d.name;
}
sunburst: {
dispatch: {
elementClick: function (t, u) {
if(t.data.value === 0){
d3.event.preventDefault();
d3.event.stopPropogation();
}
}
}
我希望找到在某些情况下可以防止onclick事件的解决方案。