The formatter doesn't return a DataTable, it modifies an existing DataTable. You would use it like this: http://jsfiddle.net/asgallant/zwPuU/1/
Incidentally, you have to make an adjustment to the view used by the chart, too, to pass the formatted value of the data along with the raw value of the data. On Monday, October 15, 2012 6:25:03 PM UTC-4, Raji wrote: > > Thanks, should this have worked from your code > http://jsfiddle.net/asgallant/zwPuU/ ? > > function drawChart() { > var formatter = new google.visualization.NumberFormat({suffix: '%'}); > > var data = new google.visualization.DataTable(); > data.addColumn('string', 'Name'); > data.addColumn('number', 'Value'); > data.addRows([ > ['Germany', 700], > ['USA', 300], > ['Brazil', 400], > ['Canada', 500], > ['France', 600], > ['Russia', 800] > ]); > > var chart = new google.visualization.ChartWrapper({ > chartType: 'ColumnChart', > containerId: 'chart_div', > dataTable: formatter.format(data, 1), > options: { > // setting the "isStacked" option to true fixes the spacing > problem > isStacked: true, > height: 300, > width: 600 > } > > > On Monday, October 15, 2012 2:34:03 PM UTC-7, asgallant wrote: >> >> Use a >> NumberFormatter<https://developers.google.com/chart/interactive/docs/reference#numberformatter>on >> the DataTable column. >> >> On Monday, October 15, 2012 5:23:01 PM UTC-4, Raji wrote: >>> >>> One more question- >>> Is it possible to add '%' symbol to each column mouse over value? Eg. on >>> mouseover the chart, it should read 90% instead of 90. Can this be done? >>> >>> Thanks! >>> >>> On Friday, October 12, 2012 11:40:22 AM UTC-7, Raji wrote: >>>> >>>> Thank you! >>>> >>>> On Friday, October 12, 2012 11:06:01 AM UTC-7, asgallant wrote: >>>>> >>>>> You can get rid of the legend by setting the legend.position option to >>>>> "none". There is no way to add value labels (percentage or otherwise) to >>>>> the columns, though. There is a feature request for this >>>>> here<http://code.google.com/p/google-visualization-api-issues/issues/detail?id=963>, >>>>> >>>>> you can help bump up it's priority by voting for it (click the star in >>>>> the >>>>> upper left). >>>>> >>>>> On Friday, October 12, 2012 1:27:23 PM UTC-4, Raji wrote: >>>>>> >>>>>> I have 2 more questions - not sure if I should start new thread or >>>>>> continue here since its custom code: >>>>>> >>>>>> 1. Can I get rid of the legend on the right side since the x axis >>>>>> labels are in place? >>>>>> 2. Is it possible to include the percentage at the top of each column? >>>>>> >>>>>> Thanks in advance, >>>>>> Raji >>>>>> >>>>>> >>>>>> On Thursday, October 11, 2012 2:42:13 PM UTC-7, asgallant wrote: >>>>>>> >>>>>>> You're welcome. >>>>>>> >>>>>>> On Thursday, October 11, 2012 5:15:29 PM UTC-4, Raji wrote: >>>>>>>> >>>>>>>> Thank you, it has helped me! >>>>>>>> >>>>>>>> On Wednesday, October 10, 2012 9:36:20 PM UTC-7, asgallant wrote: >>>>>>>>> >>>>>>>>> The API wasn't designed to make bars of a single series different >>>>>>>>> colors. This is just a hack that I wrote to get around the problem. >>>>>>>>> >>>>>>>>> On Wednesday, October 10, 2012 7:59:07 PM UTC-4, Raji wrote: >>>>>>>>>> >>>>>>>>>> I don't know why it does it have to be so many steps though.. >>>>>>>>>> seems like a straight forward requirement.. :) >>>>>>>>>> >>>>>>>>>> On Wednesday, October 10, 2012 4:45:42 PM UTC-7, Raji wrote: >>>>>>>>>>> >>>>>>>>>>> Yes, this is exactly what I am looking for, thank you!! >>>>>>>>>>> >>>>>>>>>>> On Wednesday, October 10, 2012 2:52:28 PM UTC-7, asgallant wrote: >>>>>>>>>>>> >>>>>>>>>>>> There are two things in play here: >>>>>>>>>>>> >>>>>>>>>>>> 1) bars are colored by data series, so every color needs its >>>>>>>>>>>> own column in the DataTable >>>>>>>>>>>> 2) labels are generated for each row in the DataTable >>>>>>>>>>>> >>>>>>>>>>>> Here's an example that takes a DataTable with country name and >>>>>>>>>>>> value columns and turns it into the chart you are looking for: >>>>>>>>>>>> http://jsfiddle.net/asgallant/zwPuU/ >>>>>>>>>>>> >>>>>>>>>>>> On Wednesday, October 10, 2012 5:02:38 PM UTC-4, Raji wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> The chart wrapper meets my needs of having multi colored >>>>>>>>>>>>> single column charts. >>>>>>>>>>>>> >>>>>>>>>>>>> https://code.google.com/apis/ajax/playground/?type=visualization#chart_wrapper >>>>>>>>>>>>> >>>>>>>>>>>>> 2 questions: >>>>>>>>>>>>> >>>>>>>>>>>>> 1. How can I label the x axis to show "Germany", "USA", >>>>>>>>>>>>> "Brazil" etc >>>>>>>>>>>>> 2. How can I increase the space between the charts >>>>>>>>>>>>> >>>>>>>>>>>>> Thanks, >>>>>>>>>>>>> Raji >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> -- 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/-/U7fETS2pvZQJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
