Can I draw smooth x VS y curve in VB like smooth line curve in Pivot Chart in access? Or, can i use Pivot chart in VB?
Printable View
Can I draw smooth x VS y curve in VB like smooth line curve in Pivot Chart in access? Or, can i use Pivot chart in VB?
What about using the intrinsic 'Circle()' function ? (you can specify an arc length)
can I draw any curve (2d xy curve) using circle? I have two coulmn X and Y in my table which have random values. I want to draw a smooth X Versus Y line curve.
Ahh, ok ignore (both) those posts :)
How about PSet() ?
You could iterate the x and y values and place a pixel on the screen (or other container).
Thinking that tru, you may end up without lines between the points - probably unwanted.
These may help: http://vbforums.com/search.php?searchid=1442707
if you place the dots close enough together it is a line
here is an example that plots a spiral. originally it was just dots (50 points per circle), but i change it to 5000 and it is a solid line (as far as you and i can see)
vb Code:
Sub extrasub() Dim col() As Long, r1 As Double, r As Double, px As Double Dim py As Double, cnt As Long, spir As Long, spirw As Double Pic1.Cls px = Pic1.Width / 2 py = Pic1.Height / 2 r = 0 ' diameter of circle to sample 0 to start at center cnt = 5000 'no of point to sample in circle spir = 5 ' no of rings in spiral spirw = (py - r) / spir / cnt 'Text1(0).Move px, py ReDim col(cnt * spir) For i = 0 To cnt * spir - 1 r1 = 360 / cnt * (i) * radians '3.142 / 180 Pic1.PSet (px + r * Sin(r1), py - r * Cos(r1)), vbRed 'i used this to put a circle i could see for testing col(i) = Pic1.Point(px + r * Sin(r1), py - r * Cos(r1)) r = r + spirw '(py - 1000) / spir / cnt Next End Sub
so you just need to plot enough points on your curve,
or else join the dots together change the code like this
declare psx and psy both as doublevb Code:
If Not i = 0 Then Pic1.Line (psx, psy)-(px + r * Sin(r1), py - r * Cos(r1)), vbRed ' Pic1.PSet (px + r * Sin(r1), py - r * Cos(r1)), vbRed 'i used this to put a circle i could see for testing '**** psx = px + r * Sin(r1): psy = py - r * Cos(r1)
with 50 points on each circle