ZingChart: How do I deal with small pie slices?
If a pie slice is too thin to click on, you can instead register a click somewhere else and that will detach the pie slice. I would suggest using the valueBox
associated to the slice to click on. You can start out by putting the valueBox
outside of the pie chart.
plot:{
valueBox:{
placement:'out'...
Now that we have placed our text outside of the pie chart we want to make it clickable. As all text are considered flat static labels in our library for performance purposes we'd need to indicate this text as clickable by setting the flat
attribute to false.
plot:{
valueBox:{
flat:false...
Last, we want to grab the click event and manually click on the pie slice to detach it from the graph.
zingchart.label_click = function(e) {
zingchart.exec('myChart', 'clicknode', {
plotindex:e.plotindex,
nodeindex:e.nodeindex
});
}
The demo here shows an example pie chart with some very small slices where this idea works well. You should also use of the decimals
property so smaller slices are given values that provide some value.