This JSFiddle demo shows an example of a Highcharts drilldown. When you click on one of the columns in the chart, the series is replaced with a drilldown series corresponding to the column that was clicked on
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]
]
}]
}
For example, if you click on the fruits column, this data will be displayed
data: [
['Apples', 4],
['Oranges', 2]
]
Notice that all the drilldown series have to be created up front. In this particular case, there are only 3 drilldown series, so this isn't a big issue. However, in my case, there are about 30 drilldown series and creating each one requires a few queries to be executed. Is there a way to have the drilldown series loaded lazily instead, i.e. the drilldown series data is only requested at the point when a user clicks on one of the columns?
Lazy drilldowns are supported by Highcharts, though it uses the term "async drilldown".
For that level of functionality, I'd just go ahead and create it yourself. Use the
point.events.click
callback to make the ajax call and replace the series:Where
swapSeries
is:Here's a working example.