Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
djhanson
Level V

Draw Polygon on chart and get coordinates question

I have a bivariate chart with x/y coordinates. 

I can draw a polygon (which I think is Add Polygon Annotation) and then script the chart to find out the polygon's coordinates.  Problem is: they are not the coordinates of the chart's x/y axis.  Rather they seem to be coordinates of its polygon coordinate system, maybe like pixels or something like this.

Question: is there anyway to draw/freehand a polygon over a chart and get the polygon's coordinates in terms of those of the chart's x/y coordinate system?

 

thanks, DJ

1 REPLY 1
Highlighted
gzmorgan0
Super User

Re: Draw Polygon on chart and get coordinates question

@djhanson,

The graphic created by Add Polygon Annotation seems to be added to the PictureBox object and the values in the save script are units of pixels. An approximation of the X and Y coordinates can possibly be made by:

  • getting the pixels of the polygon
  • getting the size of the PictureBox
  • getting the size of each AxisBox, and maybe the FrameBox
  • getting each axis's settings (Min, Max, Inc)
  • compute the relative values.

That said, once I calculated that, I would remove the Polygon Annotation and add a graphics script to the FrameBox that draws a polygon using the approximated coordinates. 

 

Other methods would be to add a button to the report that draws an editable polygon. This would require callback functions using a MouseBox or Handle or something like that. There are other call back methods that I can imagine.

 

I don't have time at the moment to take a stab at either method. But maybe another community member has a solution.

 

It would be useful to know how you intend to use these coodinates.

Article Labels

    There are no labels assigned to this post.