/* Function run the chart. Need global object `Chart`. */ function chart($period, $ticker) { if (typeof $period == "undefined" || $period == null) { $period = Chart.qty + Chart.period; } if (typeof $ticker == "undefined") { $ticker = Chart.ticker; } var qty = parseInt($period); var per = $period.replace(qty, ""); var url = per == "intra" || per == "week" ? Chart.URL_intra : Chart.URL_histo; var volume = per == "intra" || per == "week" ? "0" : "1"; // Update globals Chart.qty = qty; Chart.period = per; Chart.ticker = $ticker; var src_ = url; src_ += "?ticker=" + $ticker; src_ += "&period=" + per; src_ += "&qty=" + qty; src_ += "&vol=" + volume; src_ += "&width=" + Chart.width; src_ += "&height=" + Chart.height; src_ += "&" + Chart.colors; src_ += "&lang=" + Chart.lang; // Debug // alert(qty + "\n" + per + "\n" + url + "\n" + src_); $('#' + Chart.ID).css({'width': Chart.width, 'height': Chart.height}) $('#' + Chart.ID).attr('src', src_); }