Google charts should draw vertical lines for each data point - it works good for continuous dates like days, months, but when I provide dates with gaps - as sundays only - it stops to draw vertical lines after some count, even if I specify parameter hAxis.gridlines.count:
Note, that major lines for start of month only! This occurs when number of points above ~20. hAxis config:
Looks like google charts has own logic for some cases or have a bug?
google.charts.load('current', {packages: ['corechart', 'line']});
google.charts.setOnLoadCallback(drawBackgroundColor);
function drawBackgroundColor() {
var data = new google.visualization.DataTable();
data.addColumn('date', 'X');
data.addColumn('number', 'Dogs');
data.addRows([
[new Date(2023,04,23), 0], [new Date(2023,04,30), 10],
[new Date(2023,05,7), 12], [new Date(2023,05,14), 1],[new Date(2023,05,21), 12],
[new Date(2023,05,28), 1], [new Date(2023,06,4), 1], [new Date(2023,06,11), 12],
[new Date(2023,06,18), 5], [new Date(2023,06,25), 6], [new Date(2023,07,2), 5],
[new Date(2023,07,9), 5], [new Date(2023,7,16), 3], [new Date(2023,07,23), 15],
]);
var options = {
hAxis: {
title: 'Time',
gridlines: { count: 14 }
},
vAxis: {
title: 'Popularity'
},
backgroundColor: '#f1f8e9'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}