2016-03-15 65 views

回答

0

使用Google圖表的格式化程序。 這裏是例子

var formatter 
= new google.visualization.NumberFormat(
     {suffix: '%',pattern:'#,##'} 
); 
formatter.format(data, columnNo); 
// Apply formatter to any column you want 
+0

編輯的問題謝謝但我嘗試過的這個解決方案對我沒有幫助。 :-( –

0

沒有這樣做,使用谷歌圖表的一種簡單的方法。

Number formatter僅適用於數據表,並不影響圖表格式化的方式。

一種可能的解決方法是讓您設置選項{pieSliceText: 'label'},然後生成標籤爲'##,#%'。這當然需要您對這些值進行數學運算,然後將它們設置爲數據表中的標籤。

0

它看起來像你想本地化您的圖表? 如果是這樣,只需使用區域設置爲谷歌圖表:

// Load Google Charts for the German locale. 
google.charts.load('current', {'packages':['corechart'], 'language': 'de'}); 

或聚合物:

<google-chart lang="de" 
       type="{{chartType}}" 
       data="{{data}}" 
       options="{{options}}"></google-chart> 

https://developers.google.com/chart/interactive/docs/basic_load_libs#loadwithlocale