LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graph Zoom Mouse Wheel

I'm developping a very lightweight world map on XY graph. The attached VIs are LV8.0.

 

It almost works but I dont understand why it's not stable as you can notice by running worldmap.vi with zoom.vi as subvi. Your mouse wheel should zoom in, zoom out the graph's limits... I dont understand why it doesnt change X and Y ranges simultaneously... And the position of the mouse should stay on the same position of the world map, after zooming.

 

I realize that my comment is not really clear, you can try it and suggest what I should change, I'm using LV8.6, you dont have to spend time to save for LV8.0

 

Post question I should reply quickly.

 

Regards,

Jimmy

0 Kudos
Message 1 of 7
(3,962 Views)

JICHFI wrote:

I'm developping a very lightweight world map on XY graph.


Well, I wouldn't call 70,000 points "lightweight". Smiley Wink

 

Have you considered using a picture indicator? It has a zoom capability built in.

0 Kudos
Message 2 of 7
(3,943 Views)

Thank you for your suggestion but do you think it would work better with 5 points?

 

I'm using XY Graph because I want to add more plots, with much less than 70 000 points :-), and I want to use a cursor also, to let user select points from the graph... Maybe its still possible with Picture indicator, I dont know much about that.

 

I will check it but for now I am concerned about my notifier structure, it seems to be something wrong because the graph doesnt look stable when I play with the wheel mouse, that would be a nice VI if it could work.

0 Kudos
Message 3 of 7
(3,920 Views)

The problem isn't with the notifier mechanism (although that code can be simplified). The problem is with the way you're calculating the new ranges and increments. When the calculations are done the proportions of the graph are not kept consistent, thereby causing a stretching of the "figure". Also, you are not putting a limit on the XScale.Increment and YScale.Increment such as when you hit the max/min scale ranges. This means that you can continue to "zoom out", with no chance in the scale, but the increment values keep increasing. This throws off the calculations when you try to "zoom back in".

 

My suggestion for using the picture indicator was not to try to draw 70,000 points. This would be way too slow. Rather, read in an image of the world to get drawn onto a picture indicator and then draw the axes over it. I don't know what your eventual goal is, so I don't know if this is a more suitable method. 

0 Kudos
Message 4 of 7
(3,912 Views)

You are right for the limits on Increments, I did not think about that... The main problem was caused by a typing error in the formula box, I put an "x" instead of a "y" somewhere. But it's still heavy with 70 000 points, I tried with an empty array and it's pretty faster.

 

My first idea was to apply a jpg background on the XY Graph, I have not found how it's possible. Even if there is a way to do something like that, I don't know if it would be easy to zoom it with the same factor as the graph...

 

I'm doing it for some GPS itinary display, I will merge the actual map with a more detailed one for my area. The world map is just to give a basic idea where we are on the world.

 

 

0 Kudos
Message 5 of 7
(3,888 Views)

You can draw an image onto a graph by using the Plot Images property. You can draw an image in the background, foreground, or middle.

 

If you were to use a picture indicator then you could use the Zoom Factor to zoom the picture and then you would just need to draw the cartesian axes. If you open the Example Finder and search for "picture" you will find several examples on drawing graphs using the picture control. These example have subVI to draw the axes and you can use them to draw your axes.

0 Kudos
Message 6 of 7
(3,868 Views)
Have a look at this thread http://forums.ni.com/ni/board/message?board.id=170&thread.id=376614&view=by_date_ascending&page=1 for some different ideas around using pictures and X/Y graphs, it worked very well for what I wanted to do, some of it might be of relevance - Mike
0 Kudos
Message 7 of 7
(3,834 Views)