Rick Suggs
Rick Suggs

Reputation: 1622

Highcharts - null values are plotted on stacked area chart, in latest version

I am upgrading from Highcharts 2.2.4 to 3.0.4. I am dealing with a time series with stacked area chart. As a real-time updating chart, I wanted it to show the stacked area up to the latest hour. With the upgrade to highcharts 3.0.4, now it looks as if the data is falling to 0 -value on the next interval. I would rather see the sharp cutoff on the end, when the rest of the series is filled with nulls.

This is related to a issue on the Github repo for Highcharts, the issue has been closed, but there is still a lot of discussion around it. https://github.com/highslide-software/highcharts.com/issues/1836

Is there a known workaround to get the 2.2.4 effect in the 3.0.4 version?

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'area'
        },
        plotOptions: {
            area: {
                stacking: 'normal'
            }
        },
        series: [{
            data: [635, 635, 809, 947, 1402, 3634, null,null,null,null]
        }, {
            data: [107, 107, 111, 133, 221, 767, null,null,null,null]
        }, {
            data: [203, 203, 276, 408, 547, 729, null,null,null,null]
        }, {
            data: [31, 31, 54, 156, 339, 818, null,null,null,null]
        }, {
            data: [2, 2, 2, 6, 13, 30, null,null,null,null]
        }]
    });
});

Here is a jsfiddle with Highcharts 2.2.4 : http://jsfiddle.net/ricksuggs/gzcaL/6/

Here is what it looks like after upgrading: http://jsfiddle.net/ricksuggs/6vCHe/

Upvotes: 3

Views: 2613

Answers (1)

Joulss
Joulss

Reputation: 11

A patch has been applied, but a problem is still there in the 3.0.10 release. I had the problem and some other users too, only a few days ago (see https://github.com/highslide-software/highcharts.com/issues/2734 or https://github.com/highslide-software/highcharts.com/issues/2069)

When you set connectNulls to true, it doesn't connects, and when you set it to false it connects : http://jsfiddle.net/SEU5v/

The fix :

if (!connectNulls && (!pointMap[x] || pointMap[x].y === null)) { // #1836

instead of

if (connectNulls && (!pointMap[x] || pointMap[x].y === null)) { // #1836

in http://code.highcharts.com/highcharts.src.js (line 14868)

The problem is not resolved ! Why this edit is being rejected ??

Upvotes: 1

Related Questions