i want to use y axes as datetime and x axes as interger. i used zedgraph control.

i used the following code

Imports ZedGraph
  Public Class Form6
    Dim frames As Integer
    Dim time1 As TimeSpan()
    Public Sub New(ByVal no_frame As Integer, ByVal time() As TimeSpan)
        frames = no_frame
        time1 = time
    End Sub
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
    Private Sub CreateGraph(ByVal zgc As ZedGraphControl)
        Dim myPane As GraphPane = zgc.GraphPane
        myPane.Title.Text = "Waste of Bandwidth in Stop and Wait Protocol"
        myPane.XAxis.Title.Text = "No of Frames"
        myPane.YAxis.Title.Text = "Time"
        myPane.YAxis.Type = AxisType.Date
        ' Make up some data points from the Sine function
        Dim list = New PointPairList()
        Dim x As Integer
        Dim y(100) As TimeSpan
        For x = 1 To frames
            y(x) = time1(x)
            list.Add(x, y(x))
        Next x
        ' Generate a blue curve with circle symbols, and "My Curve 2" in the legend
        Dim myCurve As LineItem = myPane.AddCurve("My Curve", list, Color.Blue, SymbolType.Circle)
        ' Fill the area under the curve with a white-red gradient at 45 degrees
        myCurve.Line.Fill = New Fill(Color.White, Color.Red, 45.0F)
        ' Make the symbols opaque by filling them with white
        myCurve.Symbol.Fill = New Fill(Color.White)
        ' Fill the axis background with a color gradient
        myPane.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F)
        ' Fill the pane background with a color gradient
        myPane.Fill = New Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0F)
        ' Calculate the Axis Scale Ranges
    End Sub
    Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    End Sub
    Private Sub SetSize()
        ZedGraphControl1.Location = New Point(10, 10)
        ' Leave a small margin around the outside of the control
        ZedGraphControl1.Size = New Size(ClientRectangle.Width - 20, ClientRectangle.Height - 20)
    End Sub
      End Class

error for the above code

Public Sub Add(x As Double(), y As Double())':

    Argument matching parameter 'x' cannot convert from 'Integer' to 'Double()'.

    Argument matching parameter 'y' cannot convert from 'TimeSpan' to 'Double()'.

'Public Overrides Sub Add(x As Double, y As Double)':

    Argument matching parameter 'y' cannot convert from 'TimeSpan' to 'Double'. 

what is the solution for this ?

i uploaded two images. from that table i want x axes = no of frames means integer and y axes = datetime

One option you have is to use the TotalDays, TotalHours, TotalMinutes, TotalSeconds, or TotalMilliseconds, depending on which scale you're mainly interested in. Each of these methods returns a Double. There are equivalent From methods that will convert back to a TimeSpan object.

Another option is to use the Ticks property which is a long and can easily be converted to a double.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.