LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Polar plot in LabWindows

Please, is there any possibility how to draw a polar plot by means of LabWindows/CVI?
Thank you!
0 Kudos
Message 1 of 5
(4,940 Views)
There is no native polar chart type in CVI that I am aware of but it should not be very hard to do such a thing on a canvas.

Converting from polar coordinates to cartesian is not difficult:

X= R*cos(Theta)
Y= R*sin(Theta)

Or going the other way:

R=Sqrt(x2+y2)
Theta=ArcTan(Y/X)

You will probably have to scale the values by some factor and apply an offset to get the coordinates for drawing on the canvas.

You can use the CanvasDrawLine() and CanvasDrawOval() functions to create axes for the polar graph. You would then use CanvasDrawPoint() to plot your points on the graph.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 5
(4,926 Views)
There are also ToRect() and ToRect1D() functions available in CVI to do this conversion. The attached example program demonstrates how to convert from polar coordinates to rectangular, and also from rectangular to polar coordinates.

Scott Y
NI
0 Kudos
Message 3 of 5
(4,912 Views)

You can build a radar-looking polar plot using an X/Y graph and a picture control.  Create a square bitmap of a circular radar display (with range circles and such) using the Windows Paint program.  Then place a Picture control (with no border) on your panel and copy the bitmap you created into it.  Have Labwindows size the control to the image so you know your image isn't being scaled.  Last, size an X/Y graph to exactly the same pixel size as your picture control, place it over the picture, and set the background color of the X/Y graph to transparent so your picture shows through from underneath.  You can even use the 'Round Frame' Decoration off the 'Classic-Style Controls' to put a nice border around your radar display.

 

Mathematically you can calculate your X and Y points from your polar data to use all the standard graph functions.  You can also programmatically mask off the corner areas of your graph by only plotting the data if the magnitude is less than the maximum magnitude of the graph.  You just have to come up with a scale factor from pixels of picture size to X/Y axis range.

 

On a canvas control the 0/0 point is the upper left corner.  To graph points, you have to calculate offsets to move this to the center of the canvas.  Using the graph control makes this simpler.

 

Is it possible to create a custom control so I could reuse this easily in other applications?

0 Kudos
Message 4 of 5
(4,505 Views)

Hi Brain chase

 

Are you succeeded in plotting a polar graph on Labwindows using canvas control? If yes please send.

0 Kudos
Message 5 of 5
(4,114 Views)