Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,
I have created a simple page that shows a line chart using google api. The problem is, sometimes it showing on the browser, sometimes it doesn't. Can you help me figure out is there something wrong with my code.

<br />
<html><br />
<head><br />
 <script type='text/javascript' src='https://www.google.com/jsapi'></script><br />
<script type='text/javascript'><br />
google.load('visualization','1',{packages:['corechart']});<br />
google.setOnLoadCallback(drawVisualization);<br />
function drawVisualization(){<br />
var data = new google.visualization.DataTable();<br />
data.addColumn('string','DateTime');<br />
data.addColumn('number','GBPUSD');<br />
data.addColumn('number','EURUSD');<br />
data.addRows(10);<br />
data.setValue(0,0,'22 Dec 07:00');<br />
data.setValue(0,1,'0.00000');<br />
data.setValue(0,2,'0.00000');<br />
data.setValue(1,0,'22 Dec 07:30');<br />
data.setValue(1,1,'-107.0');<br />
data.setValue(1,2,'-72.0');<br />
data.setValue(2,0,'22 Dec 08:00');<br />
data.setValue(2,1,'78.0');<br />
data.setValue(2,2,'71.0');<br />
data.setValue(3,0,'22 Dec 08:30');<br />
data.setValue(3,1,'126.0');<br />
data.setValue(3,2,'-77.0');<br />
data.setValue(4,0,'22 Dec 09:00');<br />
data.setValue(4,1,'197.0');<br />
data.setValue(4,2,'-42.0');<br />
data.setValue(5,0,'22 Dec 09:30');<br />
data.setValue(5,1,'288.0');<br />
data.setValue(5,2,'-29.0');<br />
data.setValue(6,0,'22 Dec 10:00');<br />
data.setValue(6,1,'256.0');<br />
data.setValue(6,2,'22.0');<br />
data.setValue(7,0,'22 Dec 10:30');<br />
data.setValue(7,1,'264.0');<br />
data.setValue(7,2,'-1.0');<br />
data.setValue(8,0,'22 Dec 11:00');<br />
data.setValue(8,1,'387.0');<br />
data.setValue(8,2,'8.0');<br />
data.setValue(9,0,'22 Dec 11:30');<br />
data.setValue(9,1,'362.0');<br />
data.setValue(9,2,'11.0');<br />
var options={<br />
width:800,<br />
height:600,<br />
interpolateNulls:true,<br />
hAxis:{<br />
textStyle:{<br />
fontSize:10,<br />
},<br />
},<br />
vAxis:{<br />
textStyle:{<br />
fontSize:10,<br />
},<br />
}<br />
}<br />
var chart =  new google.visualization.LineChart(document.getElementById('visualization'));<br />
chart.draw(data,options);<br />
}<br />
</script><br />
</head><br />
<body><br />
<div id='visualization' style='width: 800px; height: 600px;'></div><br />
</body><br />
</html><br />
<br />
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900