javascript - How linked/shared legend with pie and column? -


if take exemple : http://www.highcharts.com/demo/combo

how can shared legend between pie , column? want aviable/disable 1 serie when click on legend column , pie in same time !

bind legenditemclick event , there hide connected slices in pie chart. demo: http://jsfiddle.net/x8ygvwbx/1/

    plotoptions: {         series: {             events: {                 legenditemclick: function(e) {                     var vis = this.visibility,                         name = this.name,                         pie = this.chart.get("my-pie"), // set pie's id                         index = pie.options.legendnames.indexof(name); // index of names                      pie.points[index].setvisible(vis); //change visibility                 }             }         }     }, 

and example pie options:

    {         id: "my-pie",  // id         type: 'pie',         name: 'total consumption',         legendnames: ["jane", "john", "joe"], //names         data: [{             name: 'jane',             y: 13,             color: highcharts.getoptions().colors[0] // jane's color         }, {             name: 'john',             y: 23,             color: highcharts.getoptions().colors[1] // john's color         }, {             name: 'joe',             y: 19,             color: highcharts.getoptions().colors[2] // joe's color         }]     } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -