how to use mschart in my program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepaangle
    New Member
    • Apr 2008
    • 1

    how to use mschart in my program

    hi can anyone help me, i'm having problem with mschart. i want to draw graph according to value in the Graph_Details table.i dont know where to start writing code and how. i have 0% knowledge on mschart and the coding. can someone help me.


    My code:
    [code=vb]
    Private Sub Timer2_Timer()
    Dim myvari As Integer
    Dim StartTime As Integer
    Dim StopTime As Integer
    Dim Store As Integer
    Dim timeGap As Integer
    Dim TimeEnd As String
    Dim avgSpeed As Long
    Dim NoOfCars As Integer

    Counter = Counter + 1
    If Counter = 300 Then
    Timer2.Enabled = False

    TimeEnd = Format(Now, "hh:mm:ss")

    strSql = "SELECT MAX(TimeGap) FROM Graph_Details"

    DataRs.Open strSql, DE.Conn, adOpenForwardOn ly, adLockReadOnly

    If DataRs.RecordCo unt > 0 Then
    If Not IsNull(DataRs(0 )) Then
    timeGap = DataRs(0) + 1
    Else
    timeGap = 1
    End If
    Else
    timeGap = 1
    End If

    DataRs.Close

    strSql = "SELECT TOP 150 TimeOut, Speed FROM Car_INFO ORDER BY ID DESC"

    'MsgBox strSql

    DataRs.Open strSql, DE.Conn, adOpenForwardOn ly, adLockReadOnly

    If DataRs.RecordCo unt > 0 Then

    NoOfCars = 0
    avgSpeed = 0

    For i = 0 To DataRs.RecordCo unt - 1
    If Not DataRs(0) = "" Then
    NoOfCars = NoOfCars + 1
    avgSpeed = avgSpeed + DataRs(1)
    End If
    DataRs.MoveNext

    Next i

    avgSpeed = avgSpeed / NoOfCars

    End If

    DataRs.Close

    strSql = "INSERT INTO Graph_Details (TimeStart, TimeEnd, AverageSpeed, NoOfCars, TimeGap) " & _
    " VALUES ('" & lblTimeStart.Ca ption & "','" & TimeEnd & "','" & avgSpeed & "'," & _
    " '" & NoOfCars & "'," & timeGap & ")"

    MsgBox strSql

    DE.Conn.Execute strSql
    Timer2.Enabled = True
    Counter = 0
    lblTimeStart.Ca ption = Format(Now, "hh:mm:ss")
    End If

    End Sub[/code]
    Last edited by debasisdas; May 6 '08, 01:27 PM. Reason: added code=vb tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    please find a related discussion here for reference.

    Comment

    Working...