See below example.
Top chart: should draw a single datapoint ('date', 'number')
Bottom chart: draws two datapoints ('data', 'number')
The top one does not display the datapoints in the chart. Further, the option "explorer: { ... }" causes the "a is null" in the top chart.
Any clues on why this is? Why is the single data point not drawn?
What's up with the "a is null" when "explorer" is used??
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
</head>
<body>
<div id="chart1" class="chart"></div>
<div id="chart2" class="chart"></div>
<script type="text/javascript">
var chartData = {};
var datapoint = [new Date("2018-07-01T23:26:34.000Z"), 4321];
var datapoint2 = [new Date("2018-07-01T22:26:34.000Z"), 1234];
google.charts.load('current', {
packages: ['line', 'corechart'],
mapsApiKey: "AIzaSyAJmRgAldd-U2y2-8EDlppO4Y5tZnK3D3g"
});
var options = {
// Explorer causes "a is null" in chart1
explorer: { axis: 'horizontal', keepInBounds: true },
pointSize: 2,
lineWidth: 1
}
google.charts.setOnLoadCallback(function() {
var table1 = new google.visualization.DataTable();
table1.addColumn('date');
table1.addColumn('number');
// This datapoint will not be visible in the chart! Why?
table1.addRows([datapoint]);
var chart1 = new google.visualization.LineChart(document.getElementById('chart1'));
chart1.draw(table1, options);
var table2 = new google.visualization.DataTable();
table2.addColumn('date');
table2.addColumn('number');
table2.addRows([datapoint, datapoint2]);
var chart2 = new google.visualization.LineChart(document.getElementById('chart2'));
chart2.draw(table2, options);
});
</script>
</body>
</html>