Creating a circular profile with VB?

GFritz34
02-09-2005, 07:38 AM
I have tubing material which is circular (360) Every 4.5 (80 points) I get a reading of how thick the material is.


I want to create a circular diagram on my form to show all 80 points and their relative thickness to a setpoint thickness. So you would see a perfect circle representing the setpoint thickness, and around that circle you would see the 80 points showing the actual variance.

Where is the best place to start looking at how to piece this together?

**This is very similar to a Radar Chart in excel... however the radar chart is too limiting. I need to have the size of the chart relative to a setpoint value which is changing and allows for the setpoint circle of the chart to be a line always at 50% outward from the center of the circle, create the scale and have the circle always the same size.

ie: Setpoint thickness of 100microns. This creates a circle with a reference from 0-200 microns from the center to the outer edge. My 80 points of data are then placed around the setpoint line always in the same spot.

loquin
02-09-2005, 10:01 AM
Since this is such a specialized requirement, you're probably going to need to "roll you own" chart.

I would suggest that you take a look at BillSoo's excellent tutorial (http://www.xtremevbtalk.com/showthread.php?t=127331) on charting in the knowledge base. He discusses, and provides sample code to generate line charts using VB's native graphic line function. You would simply need to extend these methods to include VB's CIRCLE method, which is used to draw circles, elipses, or arcs on pictureboxes or forms.

Use his methods for setting the scale of the chart (methods to convert engineering units to graphic units of twips or pixels).

Also, remember that the CIRCLE method uses radians instead of degrees for it's angular measurements.

loquin
02-09-2005, 10:11 AM
As a follow-up.

Personally, it probably isn't a good (workable) solution to have 80 labels arranged around a circle to indicate the wall thickness. Instead, I would have the labels arranged tabularly, to one side, and build my circle with 80 separate arcs. In this way, I could set the arc line color to indicate if the reading was out-of-tolerance.

GFritz34
02-09-2005, 11:53 AM
As a follow-up.

Personally, it probably isn't a good (workable) solution to have 80 labels arranged around a circle to indicate the wall thickness. Instead, I would have the labels arranged tabularly, to one side, and build my circle with 80 separate arcs. In this way, I could set the arc line color to indicate if the reading was out-of-tolerance.

Thank you, I'm not going to need any labels at all. The points simply need to be graphed and displayed in real time in a circular chart fashion as the data is polled.

passel
02-09-2005, 09:00 PM
I couldn't quite follow all of your first post.
But perhaps this simple code will give you something to build on.


Const Deg2Rad = 3.1415926 / 180#

Private Sub Command1_Click()
Dim i As Single, variance As Single
Dim cx As Single, cy As Single
Dim Norm As Single

cx = 200
cy = 200
Norm = 100
ScaleMode = vbPixels
Circle (cx, cy), Norm '100 pixel radius circle as our reference
For i = 0 To 359 Step 4.5 '0 to 355.5 in 4.5 degree increments
variance = 4 - 8 * Rnd 'variance of +- 4 pixels
DrawWidth = 3 'make the points bigger so easier to see
PSet (cx + (Norm + variance) * Cos(i * Deg2Rad), cy + (Norm + variance) * Sin(i * Deg2Rad))
Next
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum