Google图表veritcal轴与百分比符号 [英] Google Chart veritcal axis with percentage sign

查看:571
本文介绍了Google图表veritcal轴与百分比符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用google chart api在我的应用程序中显示折线图,在该图表现在我想显示具有百分比符号的垂直轴值。为我尝试了以下选项

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

中提及的



如何在Google可视化图表API中设置百分比?



使用此方法时,「 值乘以100.即,而不是'12%' - 在vaxis中获得1200%!



我已签入https://developers.google.com 文档,我找不到任何方法来做到这一点。



解决方案

转义格式中的百分比符号对我有用。

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

这显示了Y轴标签百分号,没有任何数据更新。 b $ b

Im using google chart api to show line chart in my application, in that chart now i want to show the vertical axis values with percentage sign. for that i tried the following option

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

as mentioned in

How do you set percentage in Google Visualization Chart API?

by 'B Seven'

when using this method, the vertical axis values got multiplied by 100. i.e instead of '12%' - im getting 1200% in vaxis!!!!

i have checked in https://developers.google.com documents also, i cant find any approach to do this.

Is there any alternate to show percentage sign in vaxis.

解决方案

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.

这篇关于Google图表veritcal轴与百分比符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆