How to show a column with the value Zero in Column chart in Highcharts?
Asked Answered
O

4

11

Which I am passing to:

       series: [{
                        name: 'Fixed bugs',
                        data: fixed,
                        pointWidth: 40
                    }, {
                        name: 'Assigned Bugs',
                        data:assigned,
                        pointWidth: 40
                    }, {
                        name: 'Re-Opened Bugs',
                        data: Reopened,
                        pointWidth: 40
                    },
                    {
                        name: 'Closed Bugs',
                        data: closed,
                        pointWidth: 40
                    }]

to this chart and I have the data like this :

     data: fixed=[3,5,5,8]
    data:assigned=[0,1,0,0] 

and follows. Now I want to show the column with zero value to... For me its not showing the column value with zero.

Overuse answered 31/8, 2012 at 6:53 Comment(2)
If it is zero then there should be no height to the column. If the value is zero - do you just want to show that it is zero? Kind of confused as to what you want it to look like.Furuncle
@Furuncle yes i want to show that cloumn is zeroOveruse
F
0

Here is a way to do it - although I think just having the column be zero-valued and not visible is the best way.

Find a very very low number that none of your data points would ever have but still keep it >0. Let us say it is .005. When you bring in your data any value that is 0 assign it this .005 value. In your tooltip formatter do an IF on the value. If it is .005 then make it 0. This way you get to see the "zero" column but the tooltip displayed will be 0 as well. If you are doing any kind of calculation on the stacked columns then you need to account for this non-0 0 value in there as well.

Furuncle answered 4/9, 2012 at 12:44 Comment(2)
a nice explanation and a nice answer...i will try this tyOveruse
This should not be the accepted answer. It should be desired login's or Thilaga's answer. Please just use minPointLengthSwipe
R
43

minPointLength will work. Use this.

plotOptions: {
    column: {
    minPointLength: 3
    }
}
Rocket answered 11/12, 2013 at 11:32 Comment(0)
B
14

You can do this quite simply with the minPointLength option. It sets the minimum number of pixels per column, default is 0, so zero values don't show up. It's in the docs here.

Try this JSFiddle

Beecher answered 6/8, 2013 at 5:53 Comment(0)
L
0

Not sure what you are trying to display, but maybe you could try to show the datalabels like this:

plotOptions: {
    series: {
        dataLabels: {
            enabled: true,
            color: 'gray'
        }
    }
}

Attempt at demo

Levi answered 31/8, 2012 at 8:4 Comment(2)
@Qyvindk i want to display the zero column if the column has the value zeroOveruse
I'm no expert in graph theory, but wouldn't that imply that the column has a value greater or less than zero? Maybe you could draw a sketch showing how you want the chart to look?Levi
F
0

Here is a way to do it - although I think just having the column be zero-valued and not visible is the best way.

Find a very very low number that none of your data points would ever have but still keep it >0. Let us say it is .005. When you bring in your data any value that is 0 assign it this .005 value. In your tooltip formatter do an IF on the value. If it is .005 then make it 0. This way you get to see the "zero" column but the tooltip displayed will be 0 as well. If you are doing any kind of calculation on the stacked columns then you need to account for this non-0 0 value in there as well.

Furuncle answered 4/9, 2012 at 12:44 Comment(2)
a nice explanation and a nice answer...i will try this tyOveruse
This should not be the accepted answer. It should be desired login's or Thilaga's answer. Please just use minPointLengthSwipe

© 2022 - 2024 — McMap. All rights reserved.