I am trying to draw a baseline on a chart that uses date values to chart. Here is the code, and here is what the chart looks like:
function drawVisualization() { // Create and populate the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Assignment'); data.addColumn('date', 'Dummy'); data.addRows([ ['A', new Date(2011,1,1)], ['B', new Date(2012,1,1)], ['C', new Date(2013,1,1)], ]); // Create and draw the visualization. new google.visualization.BarChart(document.getElementById('visualization')). draw(data, { width:600, height:400, hAxis: {baseline: new Date(2012,6,1), baselineColor: 'red'} } ); }
This is not the expected behavior -- the baseline is set to be on July 1st, 2012, yet it is appearing all the way to the left (January 1st, 2011).
If you do this with a non-date Axis chart, the behavior is different:
function drawVisualization() { // Create and populate the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Assignment'); data.addColumn('number', 'Dummy'); data.addRows([ ['A', 1], ['B', 2], ['C', 3], ]); // Create and draw the visualization. new google.visualization.BarChart(document.getElementById('visualization')). draw(data, { width:600, height:400, hAxis: {baseline: 1.5, baselineColor: 'red'} } ); }
What the heck is going on here? Is it impossible to set the baseline of a date-axis chart?