2015-05-14 2 views

ответ

0

Bind legendItemClick Событие и там скрыты связанные фрагменты в круговой диаграмме. Демонстрация: 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); // get index of names 

        pie.points[index].setVisible(vis); //change visibility 
       } 
      } 
     } 
    }, 

И пример для вариантов пирогов:

{ 
     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 
     }] 
    } 
Смежные вопросы