2
我使用谷歌的時間線圖,將數據懸停後,它會顯示持續時間,開始日期和結束日期,但僅限於月和年。如果時間跨度像一個星期那樣短,它會顯示一天,但如果月份或年份只顯示月份和年份。如何在Google時間圖上始終顯示日期
我也想顯示一天,但我正在努力做到這一點,找不到任何指示。請參閱下面的js小提琴鏈接和代碼。
google.charts.load("current", {packages:["timeline"]});
google.charts.setOnLoadCallback(drawTimeline);
function drawTimeline() {
var container = document.getElementById('chart_div');
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Role' });
dataTable.addColumn({ type: 'string', id: 'Name' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
['RJR - Site Consumer Engagement Security (AKA on SOW Venue and Site Security for Vendors)','Target Date', new Date(2016, 10, 15), new Date(2017, 11, 18)],
['RJR - Site Consumer Engagement Security (AKA on SOW Venue and Site Security for Vendors)','Actual Date', new Date(2016, 11, 25), new Date(2017, 11, 30)]
]);
chart.draw(dataTable);
}
https://jsfiddle.net/mt15199/xsnru9oq/
希望這有助於... – WhiteHat
非常感謝你爲你的先生!祝你今天愉快! – MarlZ15199