How can I show zero on the Y axis?

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Raissam on 17th March 2014

I have a stacked bar graph and my data came from sql..

i format all data and complete with 0 when no have data from tables.. my string is like this..


but depends can be like that




its variable..

And i use this for show the values inside every bar:

.ondraw = function (obj)
                     for (var i=0; i<obj.coords.length; ++i) {
                         obj.context.fillStyle = 'white';
                         RGraph.Text(obj.context, 'Verdana', 10, obj.coords[i][0] + (obj.coords[i][2] / 2), obj.coords[i][1] + (obj.coords[i][3] / 2),obj.data_arr[i].toString(),'center', 'center', null,null,null,true);

Everithing shows right but my question is.

How i dont show the labels when the value is 0 on graph?

Posted by Enter your name... on 17th March 2014
Hi there,

Check the value in your original array. As you loop through the coords you can give you 'i' variable (the index) to this function:

var indices = RGraph.sequentialIndexToGrouped(index, data)

And that will give you back the correct indices to use with the data array.

Posted by Raissam on 18th March 2014
My original array is fine..

Have the same problem that another link

I dont want to show the label 0 on stacked bar..

My graph is like this..

If i remove the 0 from original string.. the mess all and don't show on the right order.

Any idea?
Posted by Enter your name... on 18th March 2014
Hi there,

This looks pretty similar to the question that I've just answered:



Add a reply

« Back to message list