home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / A_SINE256_2053303122007.psc / GraphMdl.bas < prev    next >
BASIC Source File  |  2007-03-12  |  2KB  |  43 lines

  1. Attribute VB_Name = "GaphIt"
  2. Option Explicit
  3. Public Declare Function GetTickCount Lib "kernel32" () As Long 'Just for stats
  4. Private Const PI As Double = 3.14159265
  5. Public Const BIGNUMBER_32 As Double = (2 ^ 32)
  6.  
  7. 'THERES NOTHING REALLY IMPORTANT HERE
  8. 'JUST TO VISUALISE THE ALGORITHM
  9. Public Function ChartIt(Chart As MSChart, ArrayX() As Byte)
  10.     Dim i As Long
  11.     Dim a As Long
  12.     a = UBound(ArrayX)
  13.     Dim k() As Long
  14.     ReDim k(0 To a)
  15.     For i = 0 To UBound(ArrayX)
  16.         k(i) = ArrayX(i) 'Convert bytes to long
  17.     Next
  18.     Chart.ChartData = k 'Draw datas
  19.     For i = 0 To UBound(ArrayX) 'Change graph color
  20.         Chart.Plot.SeriesCollection(i + 1).DataPoints(-1).Brush.FillColor.Red = 0
  21.         Chart.Plot.SeriesCollection(i + 1).DataPoints(-1).Brush.FillColor.Blue = 150
  22.         Chart.Plot.SeriesCollection(i + 1).DataPoints(-1).Brush.FillColor.Green = 70
  23.     Next
  24. End Function
  25.  
  26. Public Function ChartIt2(Chart As MSChart, y() As Double)
  27.     Dim k As Long
  28.     Dim R(1 To 5000) As Double
  29.     Dim Buff As Double
  30.     For k = 1 To 5000
  31.         Buff = Round(((UBound(y)) / 5000) * k)
  32.         If Buff = 0 Then Buff = 1
  33.         R(k) = y(Buff)
  34.     Next
  35.     Chart.ChartData = R()
  36.     For k = 1 To 5000
  37.         Chart.Plot.SeriesCollection(k).DataPoints(-1).Brush.FillColor.Red = 0
  38.         Chart.Plot.SeriesCollection(k).DataPoints(-1).Brush.FillColor.Blue = 150
  39.         Chart.Plot.SeriesCollection(k).DataPoints(-1).Brush.FillColor.Green = 70
  40.     Next
  41. End Function
  42.  
  43.