shawnnyglum
shawnnyglum

Reputation: 221

Enable Drilldown in highchart without modifying the series

I want to enable drilldown in highcharts, but my constraint is that I can't modify the data in the "series" property of chart. Hence I can't have the "drilldown" property set to true/any value for any item in the series.

I have tried defining "events" property in the "chart" Object. But that doesn't seem to work until and I unless I specify "drilldown" property to true for the items in the series options.

So is there a way to enable/set drilldown property to true for the chart without modifying my series? My series would just have the array of name/value pair and NO other properties.

Upvotes: 1

Views: 1135

Answers (2)

Halvor Holsten Strand
Halvor Holsten Strand

Reputation: 20536

You could utilize the Chart.addSeriesAsDrilldown (API) method to achieve something like this.

For example, your click listener could be:

plotOptions: {
    series: {
        point: {
            events: {
                click: function(e) {
                    $('#container').highcharts()
                            .addSeriesAsDrilldown(this, { data: [1,2,3] });
                }
            }
        }
    }
}

See this JSFiddle for a demonstration.

Upvotes: 3

ODaniel
ODaniel

Reputation: 595

According to the Highcharts API there isn't, and even if there was, it's not intended to be used that way. How constrained are you in modifying the series? Can't you just loop the series in javascript and add the drilldown property dynamically before you initialize the chart?

Upvotes: 1

Related Questions