Question

I am trying to get my stacked column highchart display all stacks on drilldown . In my example below, when i click on a stack it only drills down to that stack level. I have tried this myself but i have been unable to get it to work. My expected output is that i click on a month and i see the stacked columns for each day

Any help would be grateful.

Was it helpful?

Solution

The problem is mainly in the way you organize your data. I have seen similar setups like this quite often and it's not a flexible way. So instead of:

data = [{
    y: 6863,
    color: colors[2],
    drilldown: {
        name: ['IPad Jan'],
        categories: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
        level: 1,
        data: [10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.06, 2.81, 10.85, 7.35, 33.07],
        color: colors[2]
    }}]

Do:

data = [{
    y: 6863,
    color: colors[2],
    drilldown: 'january'
]

Then you have an data structure like this on the side

var drilldownData = {
    'january': [/*data structured correctly for drilldown of january*/],
    'february': [...]
}

So in your "click" event you do: setChart(drilldown.name, drilldown.categories, [drilldownData[this.drilldown]], drilldown.color, drilldown.level, drilldown.type);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top