Two pies, one legend with unique items (merge legends)

前端 未结 1 1906
执笔经年
执笔经年 2021-01-14 03:10

Is it possible to do two pies in one graphic and merge legends?

I did this : http://jsfiddle.net/Adysone/YpfBs/

chart = new Highcharts.Chart({
    ch         


        
1条回答
  •  耶瑟儿~
    2021-01-14 04:10

    Please take look at example http://jsfiddle.net/u7FQS/15/ which used 3 pie charts and has common legend

    $(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);
                               }
                           }
                       });
                });
    
            });
        });
    

    0 讨论(0)
提交回复
热议问题