I have a line chart, along the lines of the below, and I want to be able to set which label is on top. (In the example, would want "dogs" to be on top.)
I realize I could do this manually -- just by switching the order of the columns -- but in practice I am dealing with large datasets and would much prefer to simply be able to specify the order in which the labels should appear on the axis without rearranging the columns themselves.
Is there any way to do that? I could not find it in the documentation.
Code example: https://www.w3schools.com/code/tryit.asp?filename=G2W868VK63KD
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable
([['X','dogs', 'cats'],
[0, 1, 9],
[1, 2, 7],
[2, 3, 6],
[3, 3, 9],
]);
var options = {
series: {
0: { color: '#e2431e' },
1: { color: '#e7711b' },
2: { color: '#f1ca3a' },
3: { color: '#6f9654' },
4: { color: '#1c91c0' },
5: { color: '#43459d' },
}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>