简体   繁体   English

具有“ pullOutOnlyOne”属性的两个或更多饼图如何相互配合使用?

[英]How can 2 or more pie-charts with the property of “pullOutOnlyOne” work with one another- Amcharts

There are two pie-charts. 有两个饼图。 I want the functionality so that only one slice of the pie-charts pulls out whichever last clicked. 我想要此功能,以便仅从最后单击的那一块饼图中抽出。 "pullOutOnlyOne" is working only for single pie-chart. “ pullOutOnlyOne”仅适用于单个饼图。 I need it to be worked like this, If i click on a slice of One pie-chart then second one, then slice of first pie-chart should pulled in. 我需要像这样工作,如果我单击一个饼图的切片,然后单击第二个饼图,则应插入第一个饼图的切片。

JSFIDDLE JSFIDDLE

I tried this one but unable to capture which pie-chart and which slice...:( var lastClickedSlice; ... ... { "event": "clickSlice", "method": function (e) { if (lastClickedSlice === "") { lastClickedSlice = e.dataItem.dataContext; } else { console.log(JSON.stringify(lastClickedSlice)); lastClickedSlice.clickSlice(lastClickedSlice.index); lastClickedSlice = e.dataItem.dataContext; } } } How to implement this thing with 2 or more than 2 pie-charts? 我尝试了此操作,但无法捕获哪个饼图和哪个切片... :( var lastClickedSlice; ... ... { "event": "clickSlice", "method": function (e) { if (lastClickedSlice === "") { lastClickedSlice = e.dataItem.dataContext; } else { console.log(JSON.stringify(lastClickedSlice)); lastClickedSlice.clickSlice(lastClickedSlice.index); lastClickedSlice = e.dataItem.dataContext; } } }如何用2个或2个以上的饼图实现此功能?

Add click listners on each slice of the chart, for example on chart-1 slice click event below : 在图表的每个切片上添加点击列表查看器,例如,在下面的chart-1切片单击事件上:

"listeners": [{ "event": "clickSlice", "method": function(e) {
chart2.pullOutRadius = "0%"; chart2.validateData(); chart2.pullOutRadius = "20%"; chart2.validateData(); } }]

Working Demo here : https://jsfiddle.net/6oo9jvLj/5/ 此处的工作演示: https : //jsfiddle.net/6oo9jvLj/5/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM