-->

showing line chart vertical axis in another number

2019-08-01 09:30发布

问题:

i am trying to make vertical axis labeled in indian ١،٢،٣ and plotted in Indian too , however it seems it has no meaning for computer , since there is no native encoding for arabic number , however in terms of english 0,1,2,3... you can do calculations no problem in that , the problem i must to show indian-arabic values

this line chart is done by google Visualization api , the last version 46.0 , and the lang is ar however the result is not as i aimed for , the vaxis should be in ١،٢،٣ and the plotted values

回答1:

(This is a slightly modified answer to the duplicate question posted at stackoverflow.com/questions/46423807. Martijn Pieters, if you are paying attention, please delete that question instead of this one.)

There is a solution, but you'll have to use an undocumented feature, which will be documented at some point. You'll need to make this call sometime before you draw your chart.

google.visualization.NumberFormat.useNativeCharactersIfAvailable(true);

This works with material charts prior to v46, and also in classic charts starting with v46. See this example: https://jsfiddle.net/dlaliberte/6k8vdgz7/

You may see some problems depending on what formatting options you also specify.