Skip to content

Instantly share code, notes, and snippets.

@kulesa
Created October 26, 2010 10:38
Show Gist options
  • Save kulesa/646678 to your computer and use it in GitHub Desktop.
Save kulesa/646678 to your computer and use it in GitHub Desktop.
Problem with google linechart options
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html;charset=UTF-8' http-equiv='content-type' />
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages':['linechart']});
</script>
<title>AGGRHHHH</title>
</head>
<body onload='drawVisualization()'>
<script type='text/javascript'>
function drawVisualization() {
var substances = ["CO", "NO2", "NO"]
var dates = ["02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00"]
var values = [[0.07, 0.06, 0.06, 0.06, 0.1, 0.13, 0.17, 0.25], [0.01, 0.0, 0.0, 0.0, 0.01, 0.02, 0.03, 0.05], [0.01, 0.01, 0.01, 0.01, 0.02, 0.02, 0.04, 0.08]]
var data = new google.visualization.DataTable();
data.addColumn('string', 'Time');
for (var i = 0; i < substances.length; ++i) {
data.addColumn('number', substances[i]);
}
data.addRows(dates.length);
for (var i = 0; i < dates.length; ++i) {
data.setCell(i, 0, dates[i]);
}
for (var substance = 0; substance < substances.length; ++substance) {
for (var datum = 0; datum < dates.length; ++datum) {
data.setCell(datum, substance + 1, values[substance][datum]);
}
}
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {
curveType: "function",
width: 550, height: 220,
vAxis: { minValue: 0.0, maxValue: 2.0, title: "TITLE PLEASE"},
legend: "bottom",
title: "The Chart",
titleTextStyle: { color: "#B4B4B4", fontSize: 14 }
});
}
</script>
<div id='visualization'></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment