Line Chart Example
An example of a Google Line Chart.
HTML
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
JavaScript
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
[{
f: 'Date',
type: 'date'
}, {
f: 'Line',
type: 'number'
}], ]);
var options = {
title: 'Company Performance'
};
if (data.getNumberOfRows() == 0) {
data.addRow([new Date(), 0])
options.series = {
0: {
color: 'transparent'
}
}
}
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}