I am trying to create a bar chart using google charts but I need to reverse the directions of the bars. I have achieved it by setting hAxis: { direction: -1,}
But the problem is only the direction of bars is reversed and the y axis labels are not placed accordingly as shown in the picture.
How can I change the placement of y-axis labels to come to the right of y -axis? My code:
function drawBasic() {
var data = google.visualization.arrayToDataTable([
['Locations', 'Product count',{role:'annotation'}],
['Bengaluru', 277, '277'],
['Hyderabad', 182, '182'],
['Chennai', 139, '139'],
['Kolkata', 136, '136'],
['Jaipur', 78 , '78 ']
]);
var options = {
legend: 'none',
chartArea: {width: '50%'},
colors: ['#3cb371'],
hAxis: {
direction: -1,
gridlines: { color: 'transparent' },
minValue: 0,
textPosition: 'none'
},
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}