Charts now formatting data type "number"?

34 views
Skip to first unread message

moresugarmore

unread,
May 17, 2016, 4:51:10 PM5/17/16
to Google Visualization API
Hi all,

I noticed that sometime recently my google charts have started automatically formatting the columns I've labeled as type = "number". 

Problem with this is I have columns that have numbers such as Year, or IDs. None of these should be given commas. But at the same time I went to keep them as numbers because that is what they are!

How can I override this automatic behavior? 

Thank you!
Ling

moresugarmore

unread,
May 18, 2016, 12:30:51 PM5/18/16
to Google Visualization API
Does anyone know how I can stop this default formatting? I have specific formats for when I DO want the tables to format numbers in a certain way, but it used to be that if I don't give it a formatter, it would just display the number without any kind of formatting. Can I get that behavior back?

Daniel LaLiberte

unread,
May 18, 2016, 1:16:13 PM5/18/16
to Google Visualization API
There was always some default formatter, which happened to be the default JS formatter. That was the bug we fixed.  We don't have an option to go back to the previous behavior.

You can include a formatted string value with each value.  Replace your value with { v: value, f: "formattedString" }. 
Running a formatter actually generates those formatted strings and adds them to the table.

Or, if you are not actually using a number as a number, then specify it as a string.  IDs are typically strings.  Years are numbers formatted differently just because they only go up to thousands, so far.  In another 8000 years, we'll probably want to rethink how we format years. :)


On Wed, May 18, 2016 at 12:30 PM, moresugarmore <moresu...@gmail.com> wrote:
Does anyone know how I can stop this default formatting? I have specific formats for when I DO want the tables to format numbers in a certain way, but it used to be that if I don't give it a formatter, it would just display the number without any kind of formatting. Can I get that behavior back?

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/271c5b20-1163-4949-82e9-421bcc8fd14d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

moresugarmore

unread,
May 18, 2016, 1:39:00 PM5/18/16
to Google Visualization API
Thank you for your reply! At least I know how this was a change and I just have to change my code to deal with that. We aren't manipulating the ID in any kind of mathematic way so you're right the best course is probably to turn it into strings. But for the years, its currently set as number so my years are coming out looking like "2,012" or "2,014". I suppose we could turn these into date types.

Thanks again!
Reply all
Reply to author
Forward
0 new messages