GUI: locating mouse on graph indicator

I’m working on another non-FRC project. The idea is that you can draw a waveform on a graph, and hear it played. However, instead of drawing a continuous curve, I figured it’d be easier to just select some points, and spline fit between them.
So, part of that involves converting the location of the mouse into the point on the graph, and that’s where I’m having some trouble. It mostly works, but there’s some scaling and offset issues.
I’ve attached the subVI and the testing VI.

NOTE:
If you do not understand control references, event structures, and property nodes, the code may be quite confusing.

EDIT: I forgot the attachement. Thanks Tanner.

TESTER (point clicked on graph).zip (26 KB)


TESTER (point clicked on graph).zip (26 KB)

No attachment is present.

-Tanner

Looks like a) the coordinates for Plot Bounds are Panel-relative, rather than control-relative, so you’re accounting for the control offset twice and b) since the mouse coordinate origin is at the top-left, the offset/scaling for the y-axis is reversed. The version I’ve attached seems to work.

–Ryan

point clicked on graph.vi (17.1 KB)


point clicked on graph.vi (17.1 KB)

Thank you.