Changing X axis type from category to datetime on drilldown

Is it possible to change a graph's x axis type from category to datetime on drilldown? I have stacked column style graph where each column is a different category. When I click on one of the columns I want to drilldown to a dedicated column graph of that category with a datetime x axis.

I have been able to successfully drilldown to another category style graph, and set each category to a day in a daterange, but using the datetime format would be much better.

Here is the "onClick" code I am running to try to do this. Obviously the data is sample data just to keep things simple. Currently, this crashes Firefox with a memory limit.

Is it even possible to switch x axis type dynamically like this?

function setChart() {



    while(hChart.series.length > 0){
        hChart.series[0].remove();
    }


    hChart.xAxis[0].update({
        type: 'datetime'
    });

    console.log(hChart.xAxis[0]);


    data = [
            [Date.UTC(2010, 0, 1), 5],
            [Date.UTC(2010, 0, 2), 11],
            [Date.UTC(2010, 0, 3), 3],
            [Date.UTC(2010, 0, 6), 7],
            [Date.UTC(2010, 0, 7), 4],
            [Date.UTC(2010, 0, 8), 1]
    ];
    console.log(data);



    hChart.addSeries({
       type: 'column',
      data: data,
    }, false);

    hChart.redraw();
}

Answers:

Answer

Unforunately this option is not avaialble, you need to destroy and create new chart.

Answer

For someone still looking for answer. The solution is:

Define X-axis in an array:

xAxis: [{
          id: 0,
          type: 'category'
        }, {
          id: 1,
          type: 'datetime'
        }]

For each series in drilldown

drilldown: {
          series: [{
            name: "test",
            id: "test",
            xAxis: 1, // <--- your desired X axis ID
            data: [
              [your data]
            ]
          }]
        }

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.