score:1

Accepted answer

You would need to filter the data before initializing the chart like so:

var data = [{
    name: 'Year 1800',
    data: [0, 0, 0, 0, 0]
}, {
    name: 'Year 1900',
    data: [0, 156, 947, 408, 6]
}, {
    name: 'Year 2008',
    data: [0, 914, 4054, 732, 34]
}];

data = $.grep(data, function (category) {
    return $.grep(category.data, function (item) {
        return item > 0;
    }).length > 0;
});

http://jsfiddle.net/EJFsH/2/

score:1

The problem is that when you would like to dynamically remove categories (by setting them by setCategories function) you also should take care about elements in data series. In other words, when you would like to modify categories, you should also remove data points. Will be better to prepare data without zero, before you use data in highcharts.


Related Articles