rakeeee
rakeeee

Reputation: 1073

Highchart stacked column chart missing some items

I am using normal stacked column Highchart for displaying two items where sometimes any of the item value might become zero. In that case i am not getting next chart elements of that stack displayed instead only one of stack element is displayed. my sample code snippet mentioned below which might not straight forward to reproduce the issue but anyway

chartType : 'chart',
options : {
    chart : {
        animation : false,
        type : 'column',
        height : chart_height
    },
    credits : {
        enabled : false
    },
    legend : {
        enabled : true
    },
    title : {
        text : null
    },
    colors : ['#ED561B', '#50B432'],
    plotOptions : {
        series : {
            stacking : 'normal',
            minPointLength : 3
        }
    },
    tooltip : {
        useHTML : true
    },
    xAxis : {
        categories : categories,
    },
    yAxis : {
        title : {
            text : translations['chart.tooltip_packets'],
            useHTML : Language.isRtl() ? Highcharts.hasBidiBug : false
        },
        opposite : Language.isRtl()
    }
},
series : [{
        index : '0',
        name : 'SSS',
        data : [0, 15, 10, 20, 13, 14]
        tooltip : {
            style : {
                color : '#ED561B'
            },
            headerFormat : '',
            pointFormatter : function () {
                return '<strong>' + translations['chart.tooltip_packets'] + '</strong><br/>' + this.category + ': ' + this.y;
            }
        }
    }, {
        index : '1',
        name : 'DDD',
        data : [800, 0, 0, 0, 0, 0]
        tooltip : {
            style : {
                color : '#50B432'
            },
            headerFormat : '',
            pointFormatter : function () {
                return '<strong>' + translations['chart.tooltip_packets'] + '</strong><br/>' + this.category + ': ' + this.y;
            }
        }
    }
]

My chart looks like

enter image description here

In chart, i have zero value SSS in the first stack and rest of the DDD have zero values but had some value of SSS there which is missing on the chart.

I don't know what is the issue here. Can any one help me?

Upvotes: 0

Views: 632

Answers (1)

LPZadkiel
LPZadkiel

Reputation: 571

ok i find out the problem. turn out that you set a size for points that has value 0 with this line

minPointLength: 3

and the values with 10 15 20 are at yAxis starting at 0 but also the point with 0 value are starting at 0 and by you setting minPointLength the points with 0 value are bigger than the others and are on top of the others, so the stacked values are 0-15 and the 0 has extra size that is not stacked. did i explained myself correctly?

Upvotes: 1

Related Questions