Tza*_*ach 15 javascript google-visualization
在Google Charts中,有没有办法更改工具提示值的日期格式,而不是将其作为HTML工具提示.例如,默认情况下我得到这个:

但我真正想要的是:

图表代码如下:
data_table = google.visualization.arrayToDataTable(graph_data_raw);
chart = new google.visualization.LineChart(document.getElementById('DivGraph'));
chart.draw(data_table, {
hAxis: {
ticks: x_ticks,
format: 'MMM d, y',
},
});
Run Code Online (Sandbox Code Playgroud)
Tza*_*ach 24
找到解决方案,使用DateFormat:
var date_formatter = new google.visualization.DateFormat({
pattern: "MMM dd, yyyy"
});
date_formatter.format(data_table, 0); // Where 0 is the index of the column
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6786 次 |
| 最近记录: |