data.sort([{列:0, desc: True}]);
下面是示例代码:
google.charts.load("current", {packages: ["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Element", "a", "b", "c", "d"],
["x", 2, 3, 2, 5],
["y", 0, 0, 14, 5],
["z", 7, 3, 4, 10],
["w", 2, 3, 0, 10]]
);
var options = {
bar: {groupWidth: "95%"},
legend: {position: "top"},
chartArea: {
left: 100, top: 50, right: 0, bottom: 100, width: "100%", height: "100%"
},
isStacked: true,
hAxis: {
minValue: 1
}
}; …Run Code Online (Sandbox Code Playgroud)