Skip to content

Instantly share code, notes, and snippets.

@jgonera
Created June 8, 2012 20:02
Show Gist options
  • Save jgonera/2897851 to your computer and use it in GitHub Desktop.
Save jgonera/2897851 to your computer and use it in GitHub Desktop.
Google Chart interpolateNulls
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Google Charts</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
function drawVisualization() {
// Some raw data (not necessarily accurate)
var data = google.visualization.arrayToDataTable([
['X', 'Raw', 'Base'],
[0, 0, 0],
[75, 1, null],
[100, null, 0.5],
[150, 2, null],
[200, null, 0.7],
[225, 4, null],
[300, 8, 0.9]
]);
var options = {
title: 'Test',
seriesType: "line",
interpolateNulls: true, // this must be true to be able to set some values to null
series: {
0: { pointSize: 5, lineWidth: 0}
}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<div id="chart_div" style="width: 1000px; height: 800px;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment