我想使用$作为我的vAxis的前缀,但是使用短格式化程序,但我没有成功,是否可以在不实现自己的格式的情况下完成? ,我的图表代码是:
options = {
title: arr[0][0],
titleTextStyle: { fontSize: '12', color: '#666' },
colors: ['#50c0ed'],
backgroundColor: { fill: 'transparent' },
height: 220,
width: '100%',
is3D: true,
fontSize: '11',
pointSize: '20',
seriesType: 'bars',
hAxis: { format: '$###,###,###.00' },
vAxis: { format: 'short' },
vAxes: {
0: {
viewWindowMode: 'explicit',
gridlines: { color: 'transparent' },
},
1: {
gridlines: { color: 'transparent' },
format: '###,### Sales'
},
},
series: {
0: { targetAxisIndex: 0 },
1: { targetAxisIndex: 1, type: 'line', color: '#f3a600' },
},
chartArea: { width: '100%', height: '60%', top: '40', left: '65', right: '10' },
tooltip: { textStyle: { color: '#333', fontSize: '11' } }
};
formatter = new google.visualization.NumberFormat({ pattern: '$###,###,###,###.##' });
formatter.format(data, 1);
chart = new google.visualization.ComboChart(container[0]);
var view = new google.visualization.DataView(data);
view.setColumns([0, 1, 2,
{
calc: "stringify",
sourceColumn: 2,
type: "string",
role: "annotation"
}]);
所以我希望vAxes将$作为前缀,如$ 1.5B。