pieChart - if value 0, chart displays wrong value

890 views
Skip to first unread message

peted

unread,
Nov 23, 2009, 7:33:51 PM11/23/09
to Google Visualization API
Hello,
I am having an issue with the pieChart visualization.

Basically, I am using the chart to display four types of emotion, 1)
positive, 2) negative, 3) neutral, and 4)mixed -- always in that
order.
Sometimes there are 0 values for a particular sentiment. i.e. there
are 10 for positive, 0 negative, 3 for neutral and 2 for mixed.

My issue is:that the pieChart will not correctly skip values with 0's.
Rather, it will get the next value and display the that value for the
wrong color.

So in regards to the example:
there are 10 for positive, 0 negative, 3 for neutral and 2 for mixed.

The pie chart will display 10 for positive, 3 for negative, 2 for
neutral and 0 for mixed.

Has anyone had any experience with this?

Thanks in advance!

Viz Kid

unread,
Nov 25, 2009, 2:25:40 AM11/25/09
to google-visua...@googlegroups.com

Hi.

Currently there is no way to make a 0 valued slice to have a legend entry. However, any small value which is strictly bigger than 0 would work for you. As a workaround, you can replace zeroes with 0.0001 (and you can set its formatted value to '0' if this is a concern) and the chart would look as you would want it to, meaning the 0 slice would have a legend entry but will not be drawn.

Best,
  Viz Kid


--

You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
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=.



NextWave

unread,
Nov 25, 2009, 12:33:01 PM11/25/09
to Google Visualization API
I had the same issue. I ended up adding a tiny value (like .00005) to
all zero values. Since the Pie Chart rounds the values, they show as
zero. It's a weird workaround, but it solved my issue.
Reply all
Reply to author
Forward
0 new messages