Difference between revisions of "Plot data with slider"

From JSXGraph Wiki
Jump to navigationJump to search
Line 1: Line 1:
<jsxgraph width="600" height="300" box="box1">
+
<jsxgraph width="600" height="250" box="box1">
 
var plotData = [
 
var plotData = [
 
   [0, 1, 2, 3, 4, 5, 6, 7],
 
   [0, 1, 2, 3, 4, 5, 6, 7],
Line 5: Line 5:
 
  ];
 
  ];
  
var brd = JXG.JSXGraph.initBoard('box1', {boundingbox:[0,50,8,-50], axis:true, keepaspectratio:false});
+
var brd1 = JXG.JSXGraph.initBoard('box1', {boundingbox:[0,50,8,-50], axis:true, keepaspectratio:false});
  
var mu = brd.create('slider', [[2.5,30], [5,30], [0, 1, 1]], {name:'&mu;'});
+
var mu = brd1.create('slider', [[2.5,30], [5,30], [0, 1, 1]], {name:'&mu;'});
var plot = brd.create('curve', plotData, {type:'plot'});
+
var plot = brd1.create('curve', plotData, {type:'plot'});
  
 
plot.updateDataArray = function() {
 
plot.updateDataArray = function() {
Line 18: Line 18:
 
     }
 
     }
 
};
 
};
 +
</jsxgraph>
  
 +
<jsxgraph width="600" height="250" box="box2">
 +
var brd2 = JXG.JSXGraph.initBoard('box2', {boundingbox:[0,50,1,-1], axis:true,
 +
keepaspectratio:false});
 +
 +
var p = brd2.create('point', [ function() { return mu.Value();}, function() { return 1; }]);
 
</jsxgraph>
 
</jsxgraph>
  

Revision as of 09:45, 12 April 2014

The JavaScript code