Skip to content

Instantly share code, notes, and snippets.

@drinks
Created September 28, 2012 02:56
Show Gist options
  • Save drinks/3797696 to your computer and use it in GitHub Desktop.
Save drinks/3797696 to your computer and use it in GitHub Desktop.
google charts with valid html
<div id="google_chart" style="width:100%;height:350px;"></div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
(function(){
var drawChart = function(){
var data = {"dataSourceUrl":"//docs.google.com/a/sunlightfoundation.com/spreadsheet/tq?key=0Av12a-o2y1_WdEdGNVl0ZTFOQklqR3NNYzRWSk9kcEE&transpose=0&headers=0&range=A1%3AB56&gid=0&pub=1","options":{"displayAnnotations":true,"vAxes":[{"useFormatFromData":true,"title":"Left vertical axis title","minValue":null,"viewWindowMode":"pretty","viewWindow":{"min":null,"max":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"viewWindowMode":"pretty","viewWindow":{"min":null,"max":null},"maxValue":null}],"titleTextStyle":{"fontSize":16},"booleanRole":"certainty","title":"Chart title","wmode":"opaque","hAxis":{"useFormatFromData":true,"title":"Horizontal axis title","minValue":null,"viewWindowMode":"pretty","viewWindow":{"min":null,"max":null},"maxValue":null},"width":600,"height":371},"state":{},"view":{},"chartType":"AnnotatedTimeLine","chartName":"Chart 1"}
data.containerId = 'google_chart';
google.visualization.drawChart(data);
};
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment