LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize X scrolling (scrollbars)

Ok, here is a tough one. One smiley face for anyone who can figure this one out.

I have several charts displaying different data channels. Some channels have different sampling rate than others. Some are regular charts, some are intensity charts. I am working on loading info from file to populate these charts and have enough chart history length to store the whole session. BUT I need to view all charts properly alligned so when I scroll with the chart's X scrollbar I need the other charts to scroll the same amount as well (all charts show the same time window length).

Ideas anyone? Thanks.
0 Kudos
Message 1 of 4
(2,634 Views)
Salutations,

I've written a little vi that should do something along the lines you are talking about. If this VI doesn't help you, then please tell me what's wrong with it, and I'll try again.


It's an event structure that gets information when you hit "okay" and will stop the vi when you hit "stop". However, everytime the mouse button goes down, it updates the range for each of the graphs. Now, this will work when you hit the scrollbar, but also if you hit something else, it should update. This might not be the most efficient way of doing things, but this is how I've done it in the past.

If you have any questions, don't hesitate to ask. I didn't take the time to write it all out, I hope it makes sense. I've also turned off auto-scaling in the graphs. I've only done the updating for the x-axis as well, I'm sure you can apply it to the Y if necessary.

Sincerely,
ElSmitho
0 Kudos
Message 2 of 4
(2,623 Views)
This is pretty good! Not quite there but gives me an excelent starting point. It doesn't work perfect since if you leave the mouse pressed to scroll more the event doesn't trigger again. You'd have to release and click again to update correctly. Also triggering on any part of the control isn't the best thing. I'd also have to add all events for each chart all over the place to all be in sync. Perhaps I'll use a separate slider control to set scale's Min and another control to set the window length (Max = Min + slider2). Then it'll also be easier to handle the single event and doesn't have the problem of triggering in any part of the chart control.
Thanks a lot for the help. You rock!
0 Kudos
Message 3 of 4
(2,618 Views)
Another way might be only running the code if the click was on the scrollbar by using the coords output and a case structure (you would have to know the exact position and size of the scrollbar). Then you can set a flag and run the code when a mouse move happens. When a mouse up or mouse leave happens, cancel the flag. Note that you probably wouldn't want to do this for all mouse move events, because this will overload the CPU.

___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(2,615 Views)