Line Chart: Missing commas when hover over points Options

379 views
Skip to first unread message

Brandon Tran

unread,
Oct 7, 2011, 7:44:43 PM10/7/11
to google-visua...@googlegroups.com
When you hover over a point on a line chart, the number doesn't have a 
comma formatting. It isn't a huge deal if you have smaller numbers, 
but when you are in the 200 million range it is tough to read. Here is 
a screen shot. 

https://skitch.com/brandontran/f6exs/photoshop 

I tried adding commas to the numbers and this causes an error because 
it's not a real number: 
data.setValue(i, 1, '100,100,123'); 

It has to be set as: 
data.setValue(i, 1, '100100123'); 

The y axis does format the numbers, it's just the hover that doesn't 
format the numbers. 

Is this an option that I am missing or is this a bug? 


Jinji

unread,
Oct 9, 2011, 9:38:00 AM10/9/11
to google-visua...@googlegroups.com
You need to set the formatted value of each cell to whatever you want (in your case, a string with comma formatting). See http://code.google.com/apis/chart/interactive/docs/reference.html#DataTable and search for "formatted value".

You can also use the number formatter as a convenience method to set the formatted values of an entire data table.

--
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/-/3pUz5DrWXuQJ.
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.

Brandon Tran

unread,
Nov 2, 2011, 7:58:02 PM11/2/11
to google-visua...@googlegroups.com
Yuval thank you for your reply. Can the table chart format be applied to the line visualization? http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html

The data set looks completely different.

asgallant

unread,
Nov 3, 2011, 10:44:19 AM11/3/11
to google-visua...@googlegroups.com
You can set the formatted value of data points independent of chart type.  Most charts (if not all?) allow the use of NumberFormatter as well: http://code.google.com/apis/chart/interactive/docs/reference.html#numberformatter

Brandon Tran

unread,
Nov 3, 2011, 9:27:45 PM11/3/11
to google-visua...@googlegroups.com
Hi asgallant. It does work actually.

Here is what I added:

var formatter = new google.visualization.NumberFormat({
  fractionDigits: '0'
});
formatter.format(data, 1); // Apply formatter to second column

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