Keep in mind that many web platforms already use the window.onload method, and owing to the fact that window.onload can be called only once, you could have a script collision. You might consider using a different method for loading your script that builds the window.onload or waits for the page load to complete.
An example without using a JavaScript framework like JQuery would look like:
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
}
else {
window.onload = function() {
oldonload();
var x = new Array(0,2,3,4,5,6,7,8);
var y = new Array(20,10,40,30,60,50,70,10);
drawGraph(y,x);
}
}
}
An example using JQuery would look like:
$(document).ready(function() {
var x = new Array(0,2,3,4,5,6,7,8);
var y = new Array(20,10,40,30,60,50,70,10);
drawGraph(y,x);
})