Skip to content

php中让Google Chart API如何显示中文

Google Chart API是什么?Google Chart API是一想Google提供的在线服务,它能够根据你提供的数据实时的画出各种个样的图表。如果你在网页中调用一下图片网址:

http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

你就会看到下面这个图片出来:

Yellow pie chart

Google Chart API默认对英文支持的是非常好的,但是对其他语言支持的不够好。最近使用Google Chart API做了淘客精品榜,在使用中发现它对中文的支持不够友好。经过研究发现采用如下方式调用,可以完美的现实中文。这里要说明的一点是:如果想显示中文,首先必须要在x和y坐标中出现中文,然后在任何地方调用中文标签都可以完美显示,否则其他坐标的中文显示不出来。代码如下:

<a href="http://www.autobloglink.com/taoke/view/i/1" target="_blank" title="总销量趋势">
<img src="http://chart.apis.google.com/chart?
cht=lc
&chs=180x80
&chd=t:'.$xx.'
&chxt=x,y
&chls=1.0
&chxl=0:||'.urlencode("总销量趋势").'||1:|1||||99
&chxs=0,0000DD,13
&chds=1,99"/>
</a>

按照如上方法调用后显示的曲线图如下:

http://www.pkphp.com/(4)Google API php(3)google chart 中文(72)google chart 標籤中文(1)php version tree chart(1)google chart api(11)google chart api中文(9)google chart 支持中文(1)如可使google都显示中文(1)google chart(15)google chart中文(17)php google chart(4)php chart xhtml(1)chart api 中文(3)php chart(20)

Share in Google Reader Share in Google Reader 分享到 FriendFeed 分享到 FriendFeed 推荐到豆瓣 推荐到豆瓣 分享到 Twitter 分享到 Twitter

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

无觅相关文章插件,快速提升流量