Display stock quotes from Yahoo!: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
<jsxgraph width="700" height="400"> | <jsxgraph width="700" height="400"> | ||
var hi, lo, brd, periodical, | var hi, lo, brd, periodical, | ||
brd, g, | brd, g, txt, | ||
x = [], | x = [], | ||
y = []; | y = []; | ||
Line 25: | Line 25: | ||
x.push(x.length+1); | x.push(x.length+1); | ||
y.push(a[1]); | y.push(a[1]); | ||
if (!g) { | if (!g) { | ||
g = brd.createElement('curve', [x,y],{strokeWidth:3, strokeColor:'green'}); | g = brd.createElement('curve', [x,y],{strokeWidth:3, strokeColor:'green'}); | ||
txt = brd.createElement('curve', [20,(hi-lo)*0.5,a[1]],{fontSize:'14px'}); | |||
} else { | } else { | ||
g.dataX = x; | g.dataX = x; | ||
g.dataY = y; | g.dataY = y; | ||
txt.plaintextStr = a[1]; | |||
} | } | ||
brd.update(); | brd.update(); |
Revision as of 14:14, 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.