Draw Polygon on chart and get coordinates question
May 20, 2019 1:02 PM(1449 views)
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?
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.