2014-01-21 50 views
1

我使用的是Highcharts的最新版本,它是Highcharts 3.0.9而且我需要做多個向下鑽取級別。所提供的示例僅顯示了1個深入級別。使用Highcharts向下鑽取多個子報表

示例代碼:jsfiddle

那麼怎麼辦鑽的多級使用新版本:

$('#container').highcharts({ 
    chart: { 
     type: 'column' 
    }, 
    title: { 
     text: 'Basic drilldown' 
    }, 
    xAxis: { 
     type: 'category' 
    }, 

    legend: { 
     enabled: false 
    }, 

    plotOptions: { 
     series: { 
      borderWidth: 0, 
      dataLabels: { 
       enabled: true, 
      } 
     } 
    }, 

    series: [{ 
     name: 'Things', 
     colorByPoint: true, 
     data: [{ 
      name: 'Animals', 
      y: 5, 
      drilldown: 'animals' 
     }, { 
      name: 'Fruits', 
      y: 2, 
      drilldown: 'fruits' 
     }, { 
      name: 'Cars', 
      y: 4, 
      drilldown: 'cars' 
     }] 
    }], 
    drilldown: { 
     series: [{ 
      id: 'animals', 
      data: [ 
       ['Cats', 4], 
       ['Dogs', 2], 
       ['Cows', 1], 
       ['Sheep', 2], 
       ['Pigs', 1] 
      ] 
     }, { 
      id: 'fruits', 
      data: [ 
       ['Apples', 4], 
       ['Oranges', 2] 
      ] 
     }, { 
      id: 'cars', 
      data: [ 
       ['Toyota', 4], 
       ['Opel', 2], 
       ['Volkswagen', 2] 
      ] 
     }] 
    } 
}) 

代碼的鏈接?

回答

1

你已經做得很好了Hayu Rahiza。

所有你需要做的就是重複你在串聯部的鑽取部分也做了同樣也

{ 
     name: 'Toyota', 
     y: 4, 
     drilldown: 'Toyota' 
    },{ 
     id: 'Toyota', 
     data: [ 
      ['Corolla', 4], 
      ['Fortuner', 2], 
      ['Etios', 2], 
      ['Liva', 10] 
     ] 
    } 

我在http://jsfiddle.net/dP35L/1/

更新您的提琴我希望這將有助於你

+0

耶..謝謝很多罷工者。 –