-1
I found this example on the line-chasrts website
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
But consider the case where the following occurs:
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2003', 870, ],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
Note that in the first line Expanses did not have any combo with the year 2003
This will generate an error.
How to do it in this case?
It wasn’t easier just to do
['Year', 'Sales', 'Expenses'],
 ['2003', 870, 0 ]
?– MarceloBoni