Sunday, 15 May 2011

javascript - unique legend on multiple charts -



javascript - unique legend on multiple charts -

i'm using highcharts generate 8 #containers, or charts. want link 1 legend containers, sort of tricky.

plotoptions: { series: { events: { legenditemclick: function (event) { var xyz = $('#container2').highcharts(), series = xyz.get(this.options.id); //get corresponding series if (series) { if (this.visible) { series.hide(); } else { series.show(); } } } } } },

gives me link between 2 containers.

tried adding

for(var num=0; num<containernums; num++) { if(num != exclude) { var xyz = $('#container'+num).highcharts(),

to create go through possible containers (container#1-#8), no results.

any ideas on i'm doing wrong?

see related example: http://jsfiddle.net/u7fqs/15/ based on pie chart, mechanism similiar.

$(chart.series[0].data).each(function(i, e) { e.legenditem.on('click', function(event) { var legenditem=e.name; event.stoppropagation(); $(chart.series).each(function(j,f){ $(this.data).each(function(k,z){ if(z.name==legenditem) { if(z.visible) { z.setvisible(false); } else { z.setvisible(true); } } }); }); }); });

javascript highcharts

No comments:

Post a Comment