Đây không phải là giải pháp lý tưởng, nhưng nếu bạn quan tâm bạn chỉ có thể đảo ngược giá trị năm theo cách thủ công trong biểu đồ nếu bạn sẵn sàng đảo ngược chúng trong dữ liệu. Cũng giống như vậy:
google.load("visualization", "1.1", {
packages: ["calendar"]
});
google.setOnLoadCallback(drawChart);
function drawChart() {
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({type: 'date'});
dataTable.addColumn({type: 'number'});
dataTable.addRows([
[new Date(2012, 1, 1), 1],
[new Date(2013, 1, 1), 2],
[new Date(2014, 1, 1), 3],
[new Date(2015, 1, 1), 4]
]);
var chart = new google.visualization.Calendar(document.getElementById('calendar_basic'));
var options = {};
google.visualization.events.addListener(chart, 'ready', swapYears);
chart.draw(dataTable, options);
}
// important code, this would be simpler w/ jQuery but here's pure JS
function swapYears() {
var yearTexts = document.querySelectorAll('[font-size="50"]');
var years = [];
yearTexts.forEach(function(text) {
years.push(text.innerHTML);
});
years.reverse();
for (var i = 0; i < yearTexts.length; i++) {
yearTexts[i].innerHTML = years[i];
}
}
JSFiddle
Output:
Nguồn
2016-07-27 01:37:26
lẽ bạn có thể rút ra ba bảng xếp hạng khác nhau với một DataView cho mỗi mà cô lập mỗi biểu đồ một năm, và sau đó bố trí 3 biểu đồ theo thứ tự ngược lại. – nbering
Tôi đang cố tránh điều đó. Tuy nhiên, cảm ơn bạn đã trả lời, – Khrys