Display coordinates of a point

340 views
Skip to first unread message

epm...@gmail.com

unread,
May 17, 2015, 1:40:10 PM5/17/15
to jsxg...@googlegroups.com
Hi All
How do I get to display the coordinates of a point on a graph?
Thanks

jea...@g.uky.edu

unread,
Jun 8, 2015, 10:39:58 PM6/8/15
to jsxg...@googlegroups.com, epm...@gmail.com
I would like to know this as well. The coordinates appear when the point is hovered over, but is there a way to turn them on at all times?

meeple142

unread,
Jun 10, 2015, 2:48:44 PM6/10/15
to jsxg...@googlegroups.com, epm...@gmail.com


I don't think that there is a way to just show it all the time with out making one yourself.
Two ways I could think to do it:
// Create a variable text at a variable position.
  var s = board.create('slider',[[0,4],[3,4],[-2,0,2]]);
  var graph = board.create('text',
                       [function(x){ return s.Value();}, 1,
                        function(){return "The value of s is"+s.Value().toFixed(2);}
                       ]
                    );

   But then make it dependent on the point not a slider. you don't even have to have the text follow the point if you don't want to
OR
set the name to a function and which will show up in the label - i think you can do that.

but either way if you have the text or label follow the point you might want to turn of off the other coordinates that pop up ( think you can do that with css - might be an easier/better way.)

Alfred Wassermann

unread,
Jun 17, 2015, 5:21:09 AM6/17/15
to jsxg...@googlegroups.com, jmckin...@gmail.com, epm...@gmail.com
If you do not need the name of the object you can do it like this:

A = board.create('point', [3, 1]);
A
.setAttribute({name: function() {
   
return '(' + A.X().toFixed(2) + ', ' + A.Y().toFixed(2) + ')';}
});



Best wishes,
Alfred

Reply all
Reply to author
Forward
0 new messages