0

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)
        InitializeComponent()
        frames = no_frame
        time1 = time
    End Sub
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        CreateGraph(ZedGraphControl1)
        SetSize()
    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
        zgc.AxisChange()
    End Sub
    Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
        SetSize()
    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

Edited by dipankarnalui

Attachments Capture.JPG 89.54 KB 222.JPG 42.82 KB Capture.JPG 89.54 KB
2
Contributors
1
Reply
10
Views
1 Year
Discussion Span
Last Post by tinstaafl
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.