Difference between revisions of "Highlight curve via slider"

From JSXGraph Wiki
Jump to: navigation, search
(New page: <jsxgraph height="500" width="600" board="board" box="jxgbox"> board = JXG.JSXGraph.initBoard('jxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25}); var a = board.createElement('s...)
 
Line 1: Line 1:
 
<jsxgraph height="500" width="600" board="board"  box="jxgbox">
 
<jsxgraph height="500" width="600" board="board"  box="jxgbox">
 
board = JXG.JSXGraph.initBoard('jxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
 
board = JXG.JSXGraph.initBoard('jxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
var a = board.createElement('slider', [[1,8],[5,8],[0,1,4]]);
+
var s = board.createElement('slider', [[1,8],[5,8],[0,0,1]]);
 
 
var g = board.createElement('functiongraph', [function(x){ return x*x;}]);
 
var f = board.createElement('functiongraph', [function(x){ return x+1;}]);
 
  
 +
var g = board.createElement('functiongraph', [function(x){ return x*x;}]
 +
                    {
 +
                        strokeColor:function(){ return (s.Value()<0.5)?'red':'blue';}
 +
                    });
 +
var f = board.createElement('functiongraph', [function(x){ return x+1;}]
 +
                    {
 +
                        strokeColor:function(){ return (s.Value()>=0.5)?'red':'blue';}
 +
                    });
 
</jsxgraph>
 
</jsxgraph>

Revision as of 14:12, 2 June 2009