Plot data with slider: 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="300" box="box1"> | <jsxgraph width="600" height="300" box="box1"> | ||
var | var plotData = [ | ||
[0, 1, 2, 3, 4, 5, 6, 7], | [0, 1, 2, 3, 4, 5, 6, 7], | ||
[40, -1, 1, -40, -40, 1, 1, 40] | [40, -1, 1, -40, -40, 1, 1, 40] | ||
Line 8: | Line 8: | ||
var mu = brd.create('slider', [[2.5,30], [5,30], [0, 1, 1]], {name:'μ'}); | var mu = brd.create('slider', [[2.5,30], [5,30], [0, 1, 1]], {name:'μ'}); | ||
var plot = brd.create('curve', | var plot = brd.create('curve', plotData, {type:'plot'}); | ||
plot.updateDataArray = function() { | |||
var i, len = plotdata[0].length; | |||
for (i = 0; i < len; i++) { | |||
this.dataY[i] = plotData[1] * mu.Value(); | |||
} | |||
}; | |||
</jsxgraph> | </jsxgraph> | ||