turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Adding Points to a graphbox

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Dec 21, 2011 10:37 AM
(3029 views)

Hi,

i created an interaktive graph. Now i need to add points (or more general: geometric shapes) to the graphbox.

This should be done on a mousklick using MouseTrap().

I thought of soemthing like that:

// Ad a marker to the graph at the position where the mouse was pressed

::click = function**({**x,y**}**,

::g << Marker**(**MarkerState**(****3****)**, x, y**)**;

::g << Circle**(**x, y, PixelRadius**(****10****));**

**)**;

::w = New Window**(**"Test",

// Some other components (Textboxes...)

::g = Graph Box**(**

FrameSize**(** **300**, **300** **)**,

Mousetrap**(** ::click**(** x, y **)**, **{}** **)**

**)**

**)**;

But sadly this does not work. Is there a way to do something like that?

Thanks for any hints!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

A couple of points:

- coordinates are typically expressed in a list or matrix format

- the graphical functions operate within a graphics script

The following should work:

::click = function({x,y},

pos = {};

InsertInto(pos,x);

InsertInto(pos,y);

::g[FrameBox(1)] << Add Graphics Script(

Marker(Marker State(3), pos) ;

Circle(pos, PixelRadius(10));

)

);

-Dave

-Dave

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

A couple of points:

- coordinates are typically expressed in a list or matrix format

- the graphical functions operate within a graphics script

The following should work:

::click = function({x,y},

pos = {};

InsertInto(pos,x);

InsertInto(pos,y);

::g[FrameBox(1)] << Add Graphics Script(

Marker(Marker State(3), pos) ;

Circle(pos, PixelRadius(10));

)

);

-Dave

-Dave

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Dec 22, 2011 7:03 AM
(2976 views)
| Posted in reply to message from David_Burnham 12/21/2011 05:21 PM

Thanks it works exactly as i need it!