non-english chars in google charts label?

。_饼干妹妹 提交于 2019-12-25 02:46:23

问题


Does non-english characters work in google charts labels/legends ?

This works, the legends shows up fine:

var chart_url = 'http://chart.apis.google.com/chart?' + 'cht=bvs' + ...some other stuff... + '&chdl=Lowest price|Average price';

This doesn't work, the legends don't show at all:

var chart_url = 'http://chart.apis.google.com/chart?' + 'cht=bvs' + ...some other stuff... + '&chdl=L' + unescape("%E4") + 'gsta pris|Genomsnittligt pris';

Any ideas? Thanks in advance!

/toby

-----------edit-----------

Neither of these works:

'&chdl=Lägsta pris|Genomsnittligt pris'

'&chdl=L& auml;gsta pris|Genomsnittligt pris' (without the space after &)

'&chdl=L%E4gsta pris|Genomsnittligt pris'

%E4 == ä urlencoded.


回答1:


My guess is that most letters will work, but you have to do the equivalent of urlencoding them (see urlencode()).




回答2:


Struggled with the same problem and it turned out that google charts want the texts urlencoded in UTF-8 (of course...)

So "Lägsta pris" should be == L%C3%A4gsta+pris



来源:https://stackoverflow.com/questions/1227837/non-english-chars-in-google-charts-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!