Ben*_*Ben 7 google-visualization
https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Example
如何将单位添加到垂直轴,如"$"或"€"?在示例中,它应该是1.200 $,1.000 $,800 $,600 $和400 $.
只是像这样添加'$'不起作用:
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000 '$', 400],
['2005', 1170 '$', 460],
['2006', 660 '$', 1120],
['2007', 1030 '$', 540]
]);
Run Code Online (Sandbox Code Playgroud)
我知道,这是一个糟糕的例子,因为销售没有任何单位,但这只是一个例子.
小智 17
您需要在图表选项中添加格式标记,如下所示:
var options = {
vAxis: {format:'# $'}
};
Run Code Online (Sandbox Code Playgroud)
参考:https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Configuration_Options
| 归档时间: |
|
| 查看次数: |
6197 次 |
| 最近记录: |