Datum und Urzeit mit zedgraph anzeigen?

  • VB.NET

Es gibt 3 Antworten in diesem Thema. Der letzte Beitrag () ist von Manu67100.

    Datum und Urzeit mit zedgraph anzeigen?

    Hallo,
    Also ich habe ein problem ( ;( ) :
    Ich habe eine textdatei in der pro zeile daten die ausgelesen werden geteilt werden in:
    [datum]
    [ Zeit ]
    [Antwort]

    Wie kann ich den neuen punkt angeben? (jahr, datum , Uhrzeit)
    -list.Add("22.11.2010 18:41:44", "52") Funktioniert nicht!
    Hier den aktuellen code:

    VB.NET-Quellcode

    1. Public Sub CreateChart(ByVal zgc As ZedGraphControl)
    2. Dim myPane As GraphPane = zgc.GraphPane
    3. ' Set the titles and axis labels
    4. myPane.Title.Text = "Anser Time of pings"
    5. myPane.XAxis.Title.Text = "Date"
    6. myPane.YAxis.Title.Text = "Ms"
    7. ' Make up some data points from the Sine function
    8. Dim list As New PointPairList()
    9. Dim list2 As New PointPairList()
    10. For i As Integer = 0 To 35
    11. Dim x As Double = New XDate(2010, i + 1, 1)
    12. Dim y As Double = Math.Sin(CDbl(i) * Math.PI / 15.0)
    13. Dim y2 As Double = 2 * y
    14. list.Add("22.11.2010 18:41:44", "52")
    15. 'list.Add(x, y)
    16. Next
    17. ' Generate a green curve , and "My Curve 2" in the legend
    18. Dim myCurve2 As LineItem = myPane.AddCurve("Usage", list, Color.Green, SymbolType.None)
    19. ' Fill the area under the curve with a white-red gradient at 45 degrees
    20. myCurve2.Line.Fill = New Fill(Color.White, Color.Red, 45.0F)
    21. ' Make the symbols opaque by filling them with white
    22. myCurve2.Symbol.Fill = New Fill(Color.White)
    23. ' Set the XAxis to date type
    24. myPane.XAxis.Type = AxisType.[Date]
    25. ' Fill the axis background with a color gradient
    26. myPane.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F)
    27. ' Calculate the Axis Scale Ranges
    28. zgc.AxisChange()
    29. End Sub



    Ich habe noch keine erfahrung mit zedgraph. 8|
    Ich freue mich auf Antworten
    Mfg manu :)

    Dieser Beitrag wurde bereits 9 mal editiert, zuletzt von „Manu67100“ ()

    Danke, aber leider bietet GDI nicht die Zeit funktion:

    VB.NET-Quellcode

    1. ' Set the XAxis to date type
    2. myPane.XAxis.Type = AxisType.[Date]

    Mfg Manu
    Habe Das Problem gelöst.

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Manu67100“ ()

    Zegraph zeichnet keine Kurve, Fehler im Code?

    Hallo,
    Ich versuche seit ein paar Tagen Verzeiweifelt nach einer lösung hier ist sie ... Doch er funktioniert nicht... ;(
    Ich benütze folgenden code doch zedgraph zeichnet keine kurve warum?

    VB.NET-Quellcode

    1. Dim pth As String = "C:\"
    2. Private Sub frmStats_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    3. CheckForIllegalCrossThreadCalls = False
    4. Readsplit(Charts, pth + result.log")
    5. End Sub
    6. Private Function Readsplit(ByVal zgc As ZedGraphControl, ByVal path As String)
    7. Dim list As New PointPairList()
    8. Dim myPane As GraphPane = zgc.GraphPane
    9. myPane.XAxis.Type = AxisType.[Date]
    10. ' Set the Titles
    11. myPane.Title.Text = "My Test Graph"
    12. myPane.XAxis.Title.Text = "Date"
    13. myPane.YAxis.Title.Text = "Results"
    14. Dim Oldstr As String
    15. Dim newStr As String
    16. Dim Text1 As IO.StreamReader
    17. Dim xp As String
    18. Dim yp As String
    19. Text1 = File.OpenText(path)
    20. While (Text1.Peek() > -1)
    21. Oldstr = Text1.ReadLine
    22. Dim text As String
    23. Dim result As String
    24. Dim strdate As String
    25. Dim astrArray As Object
    26. text = Oldstr
    27. astrArray = Split(text, ";")
    28. strdate = astrArray(0)
    29. result = Trim(astrArray(1))
    30. list.Add(ConvertDateToXdate(strdate), result)
    31. MsgBox(list)
    32. End While
    33. Text1.Close()
    34. ' Generate a green curve , and "My Curve 2" in the legend
    35. Dim myCurve2 As LineItem = myPane.AddCurve("Usage", list, Color.Green, SymbolType.Plus)
    36. ' Fill the area under the curve with a white-red gradient at 45 degrees
    37. myCurve2.Line.Fill = New Fill(Color.White, Color.Red, 45.0F)
    38. ' Make the symbols opaque by filling them with white
    39. myCurve2.Symbol.Fill = New Fill(Color.White)
    40. ' Fill the axis background with a color gradient
    41. myPane.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F)
    42. zgc.AxisChange()
    43. End Function
    44. Public Function ConvertDateToXdate(ByVal [date] As DateTime) As XDate
    45. Return New XDate([date].ToOADate)
    46. End Function


    Hier ist noch ein auszug von der textdatei:

    Quellcode

    1. 23.11.2010 19:14:25;94
    2. 23.11.2010 19:14:35;79
    3. 23.11.2010 19:14:45;96
    4. 23.11.2010 19:14:55;91



    Ich freue mich auf lösungen
    Mfg Manu

    *Topics zusammengeführt*

    Dieser Beitrag wurde bereits 6 mal editiert, zuletzt von „Marcus Gräfe“ ()