Google Bar Chart Time Label Interval
- by Alex Angelini
Hi I am using Google Bar Chart through the visualization API on my site:
http://code.google.com/apis/visualization/documentation/gallery/imagebarchart.html
And my x-axis is time, and every time interval is a time of day in the format (HH:MM)
Here is my code for the graph:
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
%s
google.load("visualization", "1", {packages:["imagebarchart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Date');
data.addColumn('number', 'Amount');
data.addRows({{Rows}});
%s
var chart = new google.visualization.ImageBarChart(document.getElementById('chart_div'));
chart.draw(data, {width: 900, height: 340, min: 0, isVertical:true, legend:'none'});
}
</script>
The rows of data are added later using a templating engine, but that is the jist of my chart. Because I have added my time variable as 'string' I cannot use the valueLabelsInterval option to only show every 4 labels. Because I can't do that the labels overlap and look ugly. Is there any other way to only show every other time label or every 4th one, I read through the docs but could not see how to do it.
Any help would be greatly appreciated thanks