11-29-2012 09:23 AM
Hi, i am new to measurement studio and have a problem where i could need help.
I have an application which loads signals from some files and plots them in waveformgraphs.
Now i want to build a cut functionallity. So with clicking left and right mouse button you mark a field, and can cut this out. I think i know how to build this, but when clicking mouse i want to draw a vertical line where the user clicked so that he can check his selection. I dried to draw this with the Graphics.DrawLine, but its drawn below the graph. When using the waveformgraph.draw nothing happens. Can somebody link me an example how to do this? I could not find an example on my own for this. Or is there a tutorial how you can draw inside a waveformgraph, above to the plotted graph.
Ty and best regards.
12-18-2012 03:38 AM
Hi Treckl,
sorry for the long waiting time.
I haven't found an example yet but I think I know what you mean.
Could you post your code which you tried it? Then I can see what you exactly wanna do.
Best regards,
Stefan
12-24-2012 04:29 AM
Hi, Treckl
If I understood you correctly, then all you need to do is the following two things:
1) Configure your graph to support zoom to selected area (it does support it by default, just try to press Shift and select some area by mouse as you do in many RTS games 🙂 )
2) When you need to "cut" your data just got to the plot you need and call its ClipDataPoints() function.
I hope this is what you wanted to do....
12-24-2012 05:58 AM
Another idea that came to my mind later is to use two vertical XYCursor-s.
Let your user just drag those two cursors and on some shortcut or button just cut your data. At any time you can get the point on any plot that is on the cursor's position.
And by the way. I draw a few thing on the graph too, and it is fine, displayed above it. I think that you are doing it in the mouse event of the control that has a graph as it's member, and you have to do it in mouse event handler of the graph in order to draw above the graph.