borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Accessing files on a Win Mobile Device)Next Topic (COMM PORT Problem) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Hi, good evening, wanna know to plot 3 curves in one graph using visual basic instead of one curve.
Poster Message
erickk
Level: Trainee

Registered: 11-08-2006
Posts: 2

icon Hi, good evening, wanna know to plot 3 curves in one graph using visual basic instead of one curve.

Hi gd evening everyone
  
  I wish to know how to modify the Visual Basic 2005 program in order to plot 3 curves in one graph for the Application instead of one?
  
Currently if i load the program, i can plot one curve in the application. When I click data IDs in the listboxes, it will show a temperature graph individually.
  
  Can anyone kindly post or send me the modified Visual Basic 2005 code that c
an plot 3 curves together in one graph in t
he application.
I really appreciate if anyone can help me and solve my problem as i have been trying very hard for the past few weeks.
  
  Thank you very much!
  
  Best warmest regards,
  Eric Koh, email: sunapple28@yahoo.com (can send me the code to this email, thank you!)
  
   Below, is the code for the Visual Basic Code to plot 1 curve only.

#Region "Plotting TemperatureRecord Graph"
    
Public Sub getLoggerTemperature(ByVal intDataLoggerID As Integer)
        Dim i As Integer

        Dim firstRow As Integer

        Dim dt, dtmax, tempdate As Date

        'set dtmax to last record of temperture in database
        dtmax=Me.HSMSDataSet.Tables("TemperatureRecord").Rows(Me.HSMSDataSet.Tables("TemperatureRecord").Rows.Count - 1)("dtDataLoggerDateTime")

        'convert dtmax datetime to date

        dtmax = CDate(dtmax.ToShortDateString)

        'loop through database 0 step -1
        For i = Me.HSMSDataSet.Tables("TemperatureRecord").Rows.Count - 1 To 0 Step -1

            'check for the particular logger

             If   Me.HSMSDataSet.Tables("TemperatureRecord").Rows(i)("intDataLoggerID") = intDataLoggerID Then

'get temperture of logger
                
dt =      Me.HSMSDataSet.Tables("TemperatureRecord").Rows(i)("dtDataLoggerDateTime")
                
'convert particular record of temperture from datatime to date

dt = CDate(dt.ToShortDateString)

                'check whether if current is smaller than dtmax

                If dt < dtmax Then

                    'set firstrow as current row index

                    firstRow = i - 1

                    Exit For

                End If

            End If

        Next

        'loop through database again

        For i = firstRow To
Me.HSMSDataSet.Tables("TemperatureRecord").Rows.Count - 1
            'check for particular logger

            If Me.HSMSDataSet.Tables("TemperatureRecord").Rows(i)("intDataLoggerID") = intDataLoggerID Then

                'get datetime of all reocords for the logger

                tempdate = Me.HSMSDataSet.Tables("TemperatureRecord").Rows(i)("dtDataLoggerDatetime")
                
'convert datetime to date

tempdate = CDate(tempdate.ToShortDateString)

'compare current date and lastest date(dtmax)
If tempdate = dtmax Then
'if current date = lastest date, add temperture to arraylist arryTemperaturePtGraph
                    arryTemperaturePtGraph.Add(Me.HSMSDataSet.Tables("TemperatureRecord").Rows(i)("realEarTemperature"))
                    'if current date = lastest date, add datetime to arraylist arryDateTimePtGraph
                    arryDateTimePtGraph.Add(Me.HSMSDataSet.Tables("TemperatureRecord").Rows(i)("dtDataLoggerDateTime"))
                End If
            End If
        Next
    End Sub
#End Region


'Plotting temperature graph
Dim arryTemperaturePtGraph As ArrayList = New ArrayList

Private Sub CreateGraph(ByVal zgc As ZedGraphControl)

        Dim myPane As GraphPane = zgc.GraphPane

        ' Set the title and axis labels
        myPane.Title = "Temperature Record"
        myPane.XAxis.Title = "No. Of Temperature Taken"
        myPane.YAxis.Title = "Temperature (oC)"
        'Label28.Text = "SelectedItem"

        ' Create points for three BarItems
        Dim list1 As New PointPairList()

        ' Use random data values
        Dim i As Integer, rand As New Random()
        Dim y As Double, x1 As Double
        For i = 1 To arryTemperaturePtGraph.Count
            y = i
            x1 = arryTemperaturePtGraph.Item(i - 1)
            'note: to rotate the curve's axis- use list1.Add(x1,y)
            list1.Add(y, x1)

        Next i

        
        Dim Curve As CurveItem = myPane.AddCurve("Temperature/Step", list1, Color.Blue, SymbolType.Diamond)

'Show the X and Y grids
        myPane.XAxis.IsShowGrid = True
        myPane.YAxis.IsShowGrid = True

        ' Set BarBase to the YAxis for horizontal bars
        myPane.BarBase = BarBase.Y
        ' Make the bars stack instead of cluster
        myPane.BarType = BarType.Stack

        ' Fill the axis background with a color gradient
        myPane.AxisFill = New Fill(Color.YellowGreen, _
              Color.FromArgb(255, 255, 166), 45.0F)


        zgc.AxisChange()

        'Create TextItem's to provide labels for each bar
        CreateBarLabels(myPane, True, "Yes")
    End Sub


[Edited by erickk on 12-08-2006 at 02:16 AM GMT]

[Edited by erickk on 12-08-2006 at 02:22 AM GMT]

____________________________
erickk...thanks for helpin me, I REALLY APPRECIATE IT!!
Thanks a million!!

11-08-2006 at 05:29 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Hi, good evening, wanna know to plot 3 curves in one graph using visual basic instead of one curve.
Previous Topic (Accessing files on a Win Mobile Device)Next Topic (COMM PORT Problem) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder