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 i = 0; i < data.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(i, 1) != 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
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...?
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
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.