rss
twitter

Wednesday, January 04, 2017

Set percentage sign in Vertical axis of in Google Visualization Chart API charts

Using the below line set the vertical axis to display percent but with that it also multiply the original data value by 100. i.e if your current vertical axis for your data value is 10,20,30.
 applying the below option will make that as 1000%, 2000%, 3000%.

To overcome this you need to divide each data value for the vertical axis by 100.


chart.draw(data, {vAxis: {format:'#%'} } );


To fix this i tried the following, i have escaped the % by quotes in options, this works
chart.draw(data, {vAxis: {format: '#\'%\''} } );


Escaping the percentage sign in format works for me.

chart.draw(data, {vAxis: {format: '#\'%\''} } );

This shows Y axis labels with percentage sign without any data update as i expected.

Bookmark and Share

1 comments:

mrkdvsn February 11, 2020 at 12:08 AM  
This comment has been removed by a blog administrator.

Post a Comment

Tech World

Label Cloud

Must Buy

  © Blogger templates by Ourblogtemplates.com updated with zenplate.com tips

Back to TOP