It's not a mistake. The Google Visualization API has changed.
At http://code.google.com/apis/chart/interactive/docs/customizing_axes.html#Help they post some solutions to this problem. Using option:
strictFirstColumnType: false
can only be used as a temporary solution. Google says:
However, please note that this option is only available for a limited time and will be removed soon.
The recommended solution is that you change the Date fields along the x axis to String. I achieved this with formatting before adding the value to the DateTable.
var formatterMoney = new google.visualization.NumberFormat({suffix: ' zł', decimalSymbol: ',', groupingSymbol: ' '}); var formatterDate = new google.visualization.DateFormat({pattern: 'dd.MM.yyyy'}); var data = new google.visualization.DataTable(); data.addColumn('string', 'order date'); //used to be date field here data.addColumn('number', 'total amount'); data.addRow([formatterDate.formatValue(new Date('2011-12-20')),971793.93]); //used to be Date object, now is Date formated as String data.addRow([formatterDate.formatValue(new Date('2011-11-30')),1.0]); data.addRow([formatterDate.formatValue(new Date('2011-11-17')),1.0]); data.addRow([formatterDate.formatValue(new Date('2011-10-27')),1.72]); data.addRow([formatterDate.formatValue(new Date('2011-10-26')),10.27]); var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); formatterMoney.format(data, 1); chart.draw(data, {width: window.width, height: 400, hAxis: {direction: -1}});
Michał Maciej Gałuszka
source share