Display stock quotes from Yahoo!: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 19: Line 19:
     new Ajax.Request('/ajax/stockquotes.php', {
     new Ajax.Request('/ajax/stockquotes.php', {
         onComplete: function(transport) {
         onComplete: function(transport) {
            var t, a;
             if (200 == transport.status) {
             if (200 == transport.status) {
                 var t = transport.responseText;
                 t = transport.responseText;
                 var a = t.split(',');
                 a = t.split(',');
                 x.push(x.length+1);
                 x.push(x.length+1);
                 y.push(a[1]);
                 y.push(a[1]);
Line 37: Line 38:


// Fetch max and min of today.
// Fetch max and min of today.
new Ajax.Request('stockquotes.php', {
new Ajax.Request('/ajax/stockquotes.php', {
         onComplete: function(transport) {
         onComplete: function(transport) {
             var a, t;
             var a, t;
Line 45: Line 46:
                 hi = a[6]*1.001;
                 hi = a[6]*1.001;
                 lo = a[7]*0.999;
                 lo = a[7]*0.999;
                 brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[0,hi,200,lo], grid:true});
                 brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[0,hi,200,lo]});
                 brd.createElement('axis',[[0,lo],[1,lo]]);
                 brd.createElement('axis',[[0,lo],[1,lo]]);
                 Start();
                 Start();

Revision as of 14:10, 20 August 2009

This JSXGraph application fetches the live stock quotes of the German DAX Index (gdaxi) from Yahoo!. The curve is updated only once a second, so initially it needs a little patience until the curve is visible.