Search code examples
jsxgraph

How to write circle depend val a (jsxgraph)


I write function in jsxgraph. Why it can't show?

var graph = board.create('circle', [
function(x) {
    var val = [[0,3/(4*a.Value())],0,2/(4*a.Value())];
    return val;
}], {strokeColor: 'green',strokeWidth:3})

Code show bellow link:

http://jsfiddle.net/quantv/6cmydpxv/13/


Solution

  • A circle defined by two points needs two separate functions, each returning a point coordinate:

    var graph = board.create('circle', [
        function(x) {
            return [0, 3/(4*a.Value())];
        },
        function() {
            return [0, 2/(4*a.Value())];
        }
      ], {strokeColor: 'green',strokeWidth:3})
    

    See it at http://jsfiddle.net/L7jdzf3o/