Is there a way to plot a chart with Google chart API so that the X-axis values are days in a month?
I have data points that are not provided with the same frequency. For
I had the same problem, found scatter plots on Google Charts, it does exactly what is necessary.
Here's the code I ended up with (took theirs as a starting point):
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'Quantity');
data.addRow([new Date(2011, 0, 1), 10])
data.addRow([new Date(2011, 1, 1), 15])
data.addRow([new Date(2011, 3, 1), 40])
data.addRow([new Date(2011, 6, 1), 50])
// Create and draw the visualization.
var chart = new google.visualization.ScatterChart(
document.getElementById('visualization'));
chart.draw(data, {title: 'Test',
width: 600, height: 400,
vAxis: {title: "cr", titleTextStyle: {color: "green"}},
hAxis: {title: "time", titleTextStyle: {color: "green"}},
lineWidth: 1}
);
}
Note that they seem to count months from 0, i.e. January is 0, February is 1, ..., December is 11.