Google style chart: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<jsxgraph width="600" height="400"> | <jsxgraph width="600" height="400"> | ||
var graph1; | var graph1; | ||
var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 20, originY: 300, axis: true, unitX: 28, unitY: 50}); | var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 20, originY: 300, axis: true, unitX: 28, unitY: 50}); | ||
function | function doIt() { | ||
var i; | |||
var t = ''; | var t = ''; | ||
for (var i=0;i<=20;i++) { | for (var i=0;i<=20;i++) { | ||
t += i+' '+brd.round(((Math.random()*4-2)+3),2)+'\n'; | t += i+' '+brd.round(((Math.random()*4-2)+3),2)+'\n'; | ||
} | } | ||
var a = t.split('\n'); | |||
var a = | |||
var x = [0]; | var x = [0]; | ||
var y = [0]; | var y = [0]; | ||
Line 34: | Line 22: | ||
brd.createElement('point', [b[0],b[1]], {strokeWidth:2, strokeColor:'#ffffff', | brd.createElement('point', [b[0],b[1]], {strokeWidth:2, strokeColor:'#ffffff', | ||
highlightStrokeColor:'#ffffff', fillColor:'white', | highlightStrokeColor:'#ffffff', fillColor:'white', | ||
highlightFillColor:'#0077cc', style:6}); | highlightFillColor:'#0077cc', style:6, name:''}); | ||
} | } | ||
x.push(x[i]); | x.push(x[i]); | ||
Line 40: | Line 28: | ||
brd.createElement('curve', [x,y], {strokeWidth:3, strokeColor:'#0077cc', highlightStrokeColor:'#0077cc',fillColor:'#e6f2fa'}); | brd.createElement('curve', [x,y], {strokeWidth:3, strokeColor:'#0077cc', highlightStrokeColor:'#0077cc',fillColor:'#e6f2fa'}); | ||
} | } | ||
brd.suspendUpdate(); | |||
doIt(); | |||
brd.unsuspendUpdate(); | |||
</jsxgraph> | </jsxgraph> | ||
[[Category:Examples]] | [[Category:Examples]] |