anychart.onDocumentReady(function() {
var chart = anychart.pie([
{name: "John", value: 10000},
{name: "Jake", value: 12000},
{name: "Peter", value: 16000},
{name: "Alex", value: 11000},
{name: "Tom", value: 13000},
{name: "Julia", value: 18000}
var menu = chart.contextMenu();
menu.itemsProvider(function(){
for (var i=0;i<data.getRowsCount();i++)
slices.push({text: data.get(i, "name"), action: function(){
var slice = data.find("name", this.item.text);
chart.explodeSlice(slice, !chart.getPoint(slice).selected());
chart.explodeSlices(true)
enabled: allState(false),
chart.explodeSlices(false);
function allState (state){
for (var i=0;i<chart.data().getRowsCount();i++)
if (state != chart.getPoint(i).selected()) return true;
chart.title("Custom Context Menu");
chart.container("container");