0
votes

I am tiring to drill down twice and tiring to change the subtitle as I drill down.

plotOptions: {
         column: {
            cursor: 'pointer',
            point: {
               events: {
                  click: function(e) {

                     var drilldown = this.drilldown;
                     //var drilldownC = this.drilldown.categories;

                     if (drilldown) { // 1st drill down

                              this.series.chart.setTitle({
                              text: drilldown.name
                              });

                              chartC.setTitle(null, {
                              text: 'BBBBBBB'
                              });

                     } else { 

                        chartC.setTitle({
                             text: name
                         });
                        chartC.setTitle(null, {
                          text: 'AAAAAA'
                        });

                     }

                  }
               }
            },
            dataLabels: {
               enabled: true,
               formatter: function() {
                  return this.y;
               }
            }               
         }
      },

I am tiring to do this but it not working:

plotOptions: {
         column: {
            cursor: 'pointer',
            point: {
               events: {
                  click: function(e) {

                     var drilldown = this.drilldown;
                     //var drilldownC = this.drilldown.categories;

                     if (drilldown) { // 1st drill down

                              this.series.chart.setTitle({
                              text: drilldown.name
                              });

                              chartC.setTitle(null, {
                              text: 'BBBBBBB'
                              });


                            ----------

                              if (drilldown) {

                              this.series.chart.setTitle({
                              text: drilldown.name
                              });

                              chartC.setTitle(null, {
                              text: 'CCCCCCCC'
                              });

                              }   

                          ----------

                     } else { 

                        chartC.setTitle({
                             text: name
                         });
                        chartC.setTitle(null, {
                          text: 'AAAAAA'
                        });

                     }

                  }
               }
            },
            dataLabels: {
               enabled: true,
               formatter: function() {
                  return this.y;
               }
            }               
         }
      },

all I did is added:

                               ----------

                                  if (drilldown) {

                                  this.series.chart.setTitle({
                              text: drilldown.name
                              });

                              chartC.setTitle(null, {
                              text: 'BBBBBBB'
                              });

                                  }   

                              ----------

if any one has a solution please let me know. all I needd to do is chaeck if "drilldown" exist?

2

2 Answers

0
votes

Why using point.click event, not chart.drilldown and chart.drillip events? Like this: http://jsfiddle.net/eqrnj220/

Code:

    chart: {
        type: 'column',
        events: {
          drilldown: function (e) {
            this.setTitle({
                text: e.point.name
            });
          },
          drillup: function (e) {
            this.setTitle({
                text: "Animals" 
            });
          }
        }
    },
0
votes

I solved the problem by adding "Level" to Data series and kept a condition to check which level I am in and change the subtitle.

if(drilldown.level == 1)
{
     chartC.setTitle(null, {
           text: 'Bla Bla Bla Bla Bla Bla Bla'
     });
}