Hi all,
I want to show 2 line charts on the same page. However, only one is shwon.
Can anyone have a look what I did wrong (must be some stupid typo..)?
If I remove either on of the lines chart24.draw or chart15.draw, the
remaining charts is shown. When both should be shown, only the last one is
appearing.
It is even so, that reloading tha page will show the second chart only...
My code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<link rel="shortcut icon" href="./favicon.ico">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script
src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':['line']});
google.setOnLoadCallback(drawCharts);
function drawCharts() {
var data15 = google.visualization.arrayToDataTable([
['Minutes', 'Temperature', 'Wind','Rain'],
[1,18,0,0],
[2,18,2.5,1],
[3,18,0,2],
[4,18,0,0],
[5,18,0,2],
[6,18,0,2],
[7,18,0,2],
[8,18,0,5],
[9,18,0,0],
[10,18,0,5],
[11,18,0,1],
[12,18,0,1],
[13,18,0,4],
[14,18,0,0],
[15,18,5,5]
]);
var options15 = {
'title:' 'Data of the last 15 minutes',
'backgroundColor': '#000000',
'width': '800',
'height': '300'
};
var data24 = google.visualization.arrayToDataTable([
['Hours', 'Temperature', 'Wind','Rain'],
[1,17,6,116],
[2,17,4,156],
[3,17,0,155],
[4,17,0,108],
[5,17,0,126],
[6,17,53,113],
[7,17,0,92],
[8,17,2,99],
[9,17,2,117],
[10,17,5,115],
[11,17,22,115],
[12,18,2,115],
[13,18,4,127],
[14,18,8,104],
[15,18,74,101],
[16,19,107,79],
[17,20,0,141],
[18,21,27,157],
[19,21,0,153],
[20,21,3,110],
[21,21,5,113],
[22,21,10,155],
[23,21,16,152],
[24,20,9,109]
]);
var options24 = {
'title': 'Data of the last 24 Hours',
'backgroundColor': '#000000',
'width': '800',
'height': '300'
};
var chart24 = new google.charts.Line(document.getElementById('linechart24'));
var chart15 = new google.charts.Line(document.getElementById('linechart15'));
chart24.draw(data24, google.charts.Line.convertOptions(options24));
chart15.draw(data15, google.charts.Line.convertOptions(options15)); }
</script></head><body><center><div id="linechart15">15</div><div
id="linechart24">24</div></center></body></html>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/f9bd96e3-3114-49c0-a0ae-efc2a523bc5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.