Skip to content

Instantly share code, notes, and snippets.

@nikitae
Created February 15, 2013 12:48
Show Gist options
  • Save nikitae/4960200 to your computer and use it in GitHub Desktop.
Save nikitae/4960200 to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
<html>
<head>
<title> Example Chart </title>
<script language="javascript" src="http://www.google.com/jsapi"></script>
</head>
<body>
<div id="chart"></div>
<script type="text/javascript">
var queryString = '';
var dataUrl = '';
function onLoadCallback() {
if (dataUrl.length > 0) {
var query = new google.visualization.Query(dataUrl);
query.setQuery(queryString);
query.send(handleQueryResponse);
} else {
var dataTable = new google.visualization.DataTable();
dataTable.addRows(8);
dataTable.addColumn('number');
dataTable.setValue(0, 0, 51.32109372643754);
dataTable.setValue(1, 0, 67.26610037585488);
dataTable.setValue(2, 0, 68.75417943883804);
dataTable.setValue(3, 0, 47.420417485409416);
dataTable.setValue(4, 0, 68.67634647569503);
dataTable.setValue(5, 0, 66.72551440569805);
dataTable.setValue(6, 0, 74.80659828070202);
dataTable.setValue(7, 0, 64.66771566774696);
draw(dataTable);
}
}
function draw(dataTable) {
var vis = new google.visualization.ImageChart(document.getElementById('chart'));
var options = {
chf: 'bg,s,00000000',
chxl: '',
chxp: '',
chxr: '0,46,1|1,0,25',
chxs: '0,000000,9.5,0,lt,000000|1,000000,9.5,0,lt,000000',
chxtc: '',
chxt: 'y,x',
chs: '700x250',
cht: 'lc',
chco: '150A01',
chd: 's:fpqdqpun',
chdl: '',
chg: '6,-1,1,1',
chls: '2,9,0',
chm: 'B,F38630,0,0,0'
};
vis.draw(dataTable, options);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
draw(response.getDataTable());
}
google.load("visualization", "1", {packages:["imagechart"]});
google.setOnLoadCallback(onLoadCallback);
</script>
</body>
</html>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment