JSX Graph Example
Reference: http://jsxgraph.uni-bayreuth.de/wp/
by migerh
HTML
<link rel="stylesheet" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css">
<script src="http://jsxgraph.uni-bayreuth.de/~michael/jsxgraph-nightly/jsxgraphcore.js"></script>
<script type="jessiecode">
$board.setView([-7,4,7,-4],keepaspectratio=true);
O=point(0,0)<<name:'0',fixed:true>>;
U=point(1,0)<<name:'1',fixed:true>>;
I=point(0,1)<<name:'i',fixed:true>>;
x=line(O,U)<<withLabel:true,name:'x',lastArrow:true>>;
y=line(O,I)<<withLabel:true,name:'y',lastArrow:true>>;
r = 3;
c=circle(O,r);
p=point(1,1)<<color:'lime'>>;
g=<<x:1,y:1>>;
p.on('drag',function(){
if(sqrt(p.X()^2+p.Y()^2)>r) {
p.moveTo([g.x,g.y]);
};
g.x=p.X();
g.y=p.Y();
});
</script>