GordanWebb
GordanWebb

Reputation: 93

Highcharts Column Series Point Object Click Function

Recently I posted a question on Highcharts column charts drilldown. I have found that in click event of point object you can find out which column was clicked. I have implemented the same in my code but I am not getting alert in my code. Please find below my code. First is my chart options variable -

var columnoptions = {
                chart: {
                    renderTo: 'container',
                    type: 'column'
                },
                title: {
                    text: 'Column Chart'
                },
                xAxis: {
                    categories: []
                },
                yAxis: {
                    title: {
                        text: 'Exposure'
                    }
                },              
                plotOptions: {
            series: {
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            alert ('here');
                        }
                    }
                }
            }
        },
                series: []
            };

I am filling the series dynamically with below statements in a loop -

columnoptions.xAxis.categories.push(categoryArray[index]);

             seriesOptions.data.push(valueArray[index]);    

Finally I display my chart like this -

         chart = new Highcharts.Chart(columnoptions);

But I am not getting any alert on column click. I get error javascript error messages in IE. I am using IE8. Kindly help me with this. Highcharts official example with static data works fine and I have seen that. My chart displays correctly without any issues. But I need to know which column was clicked to implement drilldown functionality. Please help.

---Edit Here is the full function I am using to draw the charts-

function displayColumnChart(){

         columnoptions.series = [];
         columnoptions.xAxis.categories = [];          



         var seriesOptions = {
                        name: 'Column Chart',
                        data: [],                       

                    };  

         /* category array contains x axis category values
            value array contains y axis numeric values */

         for(index = 0; index < categoryArray.length; index++){

             columnoptions.xAxis.categories.push(categoryArray[index]);

             seriesOptions.data.push(valueArray[index]);        

         }      

         columnoptions.series.push(seriesOptions);     

         chart = new Highcharts.Chart(columnoptions);
       }  

I am reading my data from an XML doc and then creating value and category array. Chart comes fine but not getting alert on point click. Please help. Thanks. :) Sorry for delay in posting the code.

Upvotes: 1

Views: 2949

Answers (1)

GordanWebb
GordanWebb

Reputation: 93

I only added the latest version of the highcharts and point click is working for me. Thanks.

Upvotes: 0

Related Questions