Zero Values

3,031 views
Skip to first unread message

Arush

unread,
Jan 3, 2013, 8:03:02 AM1/3/13
to google-visua...@googlegroups.com
Please tell how can I show zero values in column chart and Pie chart....Though logically since they are zero,they need not be shown but I feel I need to display it over there to show its existence else the graph looks incomplete....Thanks

asgallant

unread,
Jan 3, 2013, 9:59:52 AM1/3/13
to google-visua...@googlegroups.com
What do you want your zero-values to look like?  Drawing a column or a pie slice would imply that they are some value other than zero.

Arush Lamba

unread,
Jan 3, 2013, 10:10:44 AM1/3/13
to google-visua...@googlegroups.com
ya i understand that but i want to show zero value for them in some way so that if i am having 3 distinct options for the pie chart and its 100% one of the value...the pie chart will show 100% that colour...though its correct but i also need to somehow show that the other options could also be the possibilities but they are zero.....Thanx asgallant u have been very helpful always...please help me


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/7K3BW4dUX5MJ.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Arush Lamba

unread,
Jan 3, 2013, 10:25:26 AM1/3/13
to google-visualization-api
also 1 more thing...i want to display something when there is no data...in this case we get a white screen with only the axes...How can i display here that there is no data or something like that...?

asgallant

unread,
Jan 3, 2013, 11:47:43 AM1/3/13
to google-visua...@googlegroups.com
The PieCharts need an option to include zero values data points in the legend.  Until that gets added, you can cheat a bit by using a DataView to change zero's into very small values instead.  This will keep the data in the legend, but as long as the value is small enough, it won't change the way the pie is drawn.  Here's an example: http://jsfiddle.net/asgallant/qDScf/
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

asgallant

unread,
Jan 3, 2013, 11:48:56 AM1/3/13
to google-visua...@googlegroups.com
When you say no data, do you mean your DataTable has no rows of data, or do you mean that all of the data has a value of 0?
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

Arush Lamba

unread,
Jan 3, 2013, 12:21:45 PM1/3/13
to google-visualization-api
i mean all data has value of 0....in that case i get a blank white screen....Example...Suppose there is a website in which there had been no vists in the last week but there were 2 visits in the last month ...Now when i make graph for month using dates ...i get the 2 values...but in case of week since there is no data...in that case i get blank scree...instead i want to show that in the last week there were no visits



To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.

asgallant

unread,
Jan 3, 2013, 12:40:38 PM1/3/13
to google-visua...@googlegroups.com
You can iterate over the data table to see if all values are 0, and if they are, give some notice to the end user.  It would work something like this:

var allZeros true;
for (var 0data.getNumberOfRows()i++{
    // if the value in column 1 of row i is not zero, set allZeros to false and break the loop
    if (data.getValue(i1!= 0{
        allZeros false;
        break;
    }
}

if (allZeros{
    // do something to let users know that the values are all zero

}

On Thursday, January 3, 2013 12:21:45 PM UTC-5, Arush wrote:
i mean all data has value of 0....in that case i get a blank white screen....Example...Suppose there is a website in which there had been no vists in the last week but there were 2 visits in the last month ...Now when i make graph for month using dates ...i get the 2 values...but in case of week since there is no data...in that case i get blank scree...instead i want to show that in the last week there were no visits
On Thu, Jan 3, 2013 at 10:18 PM, asgallant <drew_g...@abtassoc.com> wrote:
When you say no data, do you mean your DataTable has no rows of data, or do you mean that all of the data has a value of 0?


On Thursday, January 3, 2013 10:25:26 AM UTC-5, Arush wrote:
also 1 more thing...i want to display something when there is no data...in this case we get a white screen with only the axes...How can i display here that there is no data or something like that...?
On Thu, Jan 3, 2013 at 8:40 PM, Arush Lamba <ar...@smukin.com> wrote:
ya i understand that but i want to show zero value for them in some way so that if i am having 3 distinct options for the pie chart and its 100% one of the value...the pie chart will show 100% that colour...though its correct but i also need to somehow show that the other options could also be the possibilities but they are zero.....Thanx asgallant u have been very helpful always...please help me
On Thu, Jan 3, 2013 at 8:29 PM, asgallant <drew_g...@abtassoc.com> wrote:
What do you want your zero-values to look like?  Drawing a column or a pie slice would imply that they are some value other than zero.


On Thursday, January 3, 2013 8:03:02 AM UTC-5, Arush wrote:
Please tell how can I show zero values in column chart and Pie chart....Though logically since they are zero,they need not be shown but I feel I need to display it over there to show its existence else the graph looks incomplete....Thanks

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/7K3BW4dUX5MJ.

To post to this group, send email to google-visua...@googlegroups.com.

To unsubscribe from this group, send email to google-visualization-api+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Arush Lamba

unread,
Jan 3, 2013, 1:40:24 PM1/3/13
to google-visualization-api
Thanx a lot asgallant...You are such a life saver :)...



To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages