Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27508

VS 2010 Making A 2D Line Graph From An Array - Brand New at this

$
0
0
Hi, I'm brand spanking-new to computers basically and have no idea what I'm doing.

I'm doing a math project where I ran a loop to count the prime numbers and then divide the number of primes by whatever number I'm at to get the current percentage of primes. I have the two values set to come out as Array1 and Array2 (p and j in my loop).

Now I want to create a graphical representation of this data set with a 2d line graph but the graph tool is really confusing.

I managed to do all of this:

Dim Array1() As Long
Dim Array2() As Decimal

For p = 1 To UpperBound

l = p / 2
IsPrime = True
For i = 1 To Math.Sqrt(l)
If p Mod 2 = 0 Or p = 1 Or p Mod ((2 * i) + 1) = 0 Then
IsPrime = False
Exit For
End If
Next

If IsPrime = True Or p = 2 Then
k += 1
Else
k = k
End If

If p = 1 Then
j = 0
Else
j = k / p
End If

ReDim Preserve Array1(p)
Array1(p) = p
ReDim Preserve Array2(p)
Array2(p) = j



I took out all the Dim parts for space, but I have no idea how to turn this into a graph. Any help would be massively appreciated, thanks.

Viewing all articles
Browse latest Browse all 27508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>