I have a strange problem that I'm confused with, but I'm sure someone here will find out what I'm doing wrong. All my dates are displayed incorrectly (i.e. June shows July, July shows August)
My code is here:
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
var chartTable = new google.visualization.DataTable();
chartTable.addColumn('date', 'Date');
chartTable.addColumn('number', 'Sell');
chartTable.addColumn('number', 'GP');
chartTable.addRows(6);
chartTable.setValue(0, 0, new Date( 2011, 06, 22 ));
chartTable.setValue(0, 1, 1316.90);
chartTable.setValue(0, 2, 456.05);
chartTable.setValue(1, 0, new Date( 2011, 06, 21 ));
chartTable.setValue(1, 1, 1793.70);
chartTable.setValue(1, 2, 531.10);
chartTable.setValue(2, 0, new Date( 2011, 06, 20 ));
chartTable.setValue(2, 1, 13559.25);
chartTable.setValue(2, 2, 1337.75);
chartTable.setValue(3, 0, new Date( 2011, 06, 17 ));
chartTable.setValue(3, 1, 3034.15);
chartTable.setValue(3, 2, 892.30);
chartTable.setValue(4, 0, new Date( 2011, 06, 16 ));
chartTable.setValue(4, 1, 568.45);
chartTable.setValue(4, 2, 175.05);
chartTable.setValue(5, 0, new Date( 2011, 06, 15 ));
chartTable.setValue(5, 1, 7203.85);
chartTable.setValue(5, 2, 1343.45);
var date_formatter = new google.visualization.DateFormat({pattern: 'EEE, MMM-d'});
date_formatter.format(chartTable, 0);
var currency_formatter = new google.visualization.NumberFormat({prefix: '$'});
currency_formatter.format(chartTable, 1);
currency_formatter.format(chartTable, 2);
chart = new google.visualization.LineChart(document.getElementById('chart'));
chart.draw(chartTable, {width: 900, height: 400, title: 'Sales Summary',
vAxis: {maxValue: 20000, format: '$##,###', viewWindowMode: 'maximized'},
hAxis: {direction: -1}
});
Displays all data correctly. EXCLUDES a date — July is displayed instead of being displayed on a chart in June. On the same days of the month, but the month is wrong?