
Help with live wave updates

I'd like to create an interactive plot.
The plot would consist of two markers.
I want to be able to move one marker with my cursor, and depending on it's live x,y position in the plot have the the second marker move. The location of the second marker is a function of the x,y coordinates of the first marker.
I have only been able to do this iteratively: Each marker is the x-y plot of two, single row waves. I use the Edit Wave tool to move the first marker, then execute a function to update the location of the second function according to the new resting location of the first marker.
How can I make the location of the second marker update in real time as I move the first marker? Something that would continuously update
Thanks a bunch.
Hi,
This can be done but it is a little advanced in programming and requires the creation of a window hook. Here is a simple example where I assume you have two cursors on your graph specifically A and B and they are both on a trace called exampleTrace. The example here will place cursor B 20 points away from A. Things to note in the function is eventCode 7 specifically means that a cursor has moved. Also notice the hookresult being set to 1 which is required for it to actually work. Common error is to forget that.
But before you can use this the function needs to be attached to a specific window and in this case the window name is Demograph and recall that the window name is different than the title string.
SetWindow DemoGraph, hook(MyHook) = MyWindowHook // Install window hook
This is the general idea and you will need to tailor to your own specifics.
Andy
February 19, 2025 at 12:15 pm - Permalink
How familiar are you with programming using Hook functions? Look especially for help on programming with the Cursor moved hook. A hook function would allow you to automatically move the second cursor at the point in time just after the first one has been moved.
February 19, 2025 at 12:15 pm - Permalink
If you're using the Edit Wave tool, then you aren't talking about the graph cursors; you are actually moving the markers for a trace. I think the only way to do that is via a dependency formula (DisplayHelpTopic "Dependencies"). Here is an example:
That will make two waves, displayed in two graphs. The ":=" operator creates a dependency that makes `junk2` follow any changes to values in `junk`. Now go to the first graph, show the drawing tools and put the trace into Edit Wave mode. Move one of the data points on the trace; watch as the same thing happens to the trace in the other graph!
The dependency can call a function; that function can do just about anything you want.
<deep voice> With great power comes great responsibility.
February 19, 2025 at 04:35 pm - Permalink