Grafische Auswertung in Autoit

  • Hallo,
    ich habe vor eine grafische Auswertung von z.B. Pingzeiten (ms) zu realisieren.
    Aber eigentlich ist es egal was ausgewertet werden soll, da es mir ums Prinzip geht.

    Als Beispielwerte geb ich mal was an:
    X1=1
    X2=30
    X3=70
    X4=50
    X5=150
    X6=90
    X7=60
    X8=1
    X9=20
    X10=10

    Jetzt möchte ich einfach in einer GUI diese 10 Werte als Zickzack Kurve darstellen.
    Kann mir jemand eine Tip geben wie ich das realisieren kann ?

    Das ergebnis sollte dann so ähnlich aussehen:
    [Blockierte Grafik: https://lh6.googleusercontent.com/_H8FRvgX70e4/TcziqyYOcDI/AAAAAAAAE0A/nR8mm1gLwVk/graph.jpg]

    Gruß
    Wolke

  • Vll hilft dir meine UDF weiter. ;)
    OOPGDIP.au3

    MfG,
    Nestos.

    Zitat

    [Heute, 11:39] Raupi: Soll ich es dir machen?
    [Heute, 11:47] BugFix: "Soll ich es dir machen? " - also Raupi !! bitte nicht so öffentlich :rofl:

    Zitat

    [Heute, 11:51] BugFix: und ich werde es mir jetzt machen - das Mittagessen :P

    AMsg UDF v1.00.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%
    OwnStyle UDF Version 1.10.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%

  • Ein einfacher Graph lässt sich auch mit GUICtrlCreateGraphic erstellen ;)

    PS: RMChart ist eine DLL, die auf GDI+ basiert, aber alles wichtige selbst erleditgt. Du musst nur die Daten und den Diagrammtyp definieren.

  • Hie mal ein ganz einfaches Bsp.

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate ("Bsp.", 500, 400)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aTest[10][2] = [[10,5],[12,20],[14,2],[20,3],[24,33],[30,1],[33,4],[40,15],[45,40],[60,1]]

    [/autoit] [autoit][/autoit] [autoit]

    ;Dim $aTest[3][2] = [[0, 0],[10, 10],[20, 0]]

    [/autoit] [autoit][/autoit] [autoit]

    _GraphDraw ($hGraphic, $aTest, 5)

    [/autoit] [autoit][/autoit] [autoit]

    While (GUIGetMsg() <> -3)

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    Func _GraphDraw ($hGraphics, ByRef $aArray, $iScall)
    If UBound($aArray,0) < 2 Then Return SetError(1,"",-1)
    Local $aMax = _GetMax($aArray)
    ConsoleWrite ("!> DEBUG xMax = " & $aMax[0] & ' yMax = ' & $aMax[1] & @CRLF)
    _GDIPlus_GraphicsDrawLine ($hGraphics, 50, ($aMax[1] * $iScall) + 50, ($aMax[0] * $iScall) + 50, ($aMax[1] * $iScall) + 50) ;;=> X
    _GDIPlus_GraphicsDrawLine ($hGraphics, 50, 50, 50, ($aMax[1] * $iScall) + 50) ;;=> Y

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To UBound ($aArray)-1
    _GDIPlus_GraphicsDrawLine ($hGraphics, ($aArray[$i - 1][0] * $iScall) + 50, _
    (($aMax[1] * $iScall) + 50) - $aArray[$i -1][1] * $iScall, _
    ($aArray[$i][0] * $iScall) + 50, _
    (($aMax[1] * $iScall) + 50) - $aArray[$i][1] * $iScall)
    Next
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetMax(ByRef $aArray)
    Local $iMaxX, $iMaxY
    For $i = 0 To UBound($aArray,1)-1
    If $iMaxX < $aArray[$i][0] Then $iMaxX = $aArray[$i][0]
    If $iMaxY < $aArray[$i][1] Then $iMaxY = $aArray[$i][1]
    Next
    Local $aRet[2] = [$iMaxX, $iMaxY]
    Return $aRet
    EndFunc

    [/autoit]

    Das finden von Rechtschreibfehlern muss sofort und unverzüglich dem Autor gemeldet werden. Das eigennützige Verwenden dieser Rechtschreibfehler ist strengstens untersagt und kann mit Freiheitsenzug bestraft werden.

  • Und das gleiche Beispiel mal mit GUICtrlCreateGraphic:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate ("Bsp.", 500, 400)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $iGraphic = GUICtrlCreateGraphic(10, 10, 400, 300)
    GUICtrlSetBkColor(-1, 0xE4E4FF)

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aTest[10][2] = [[10,5],[12,20],[14,2],[20,3],[24,33],[30,1],[33,4],[40,15],[45,40],[60,1]]

    [/autoit] [autoit][/autoit] [autoit]

    _GraphDraw ($iGraphic, $aTest, 5)

    [/autoit] [autoit][/autoit] [autoit]

    While (GUIGetMsg() <> -3)

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GraphDraw ($hGraphics, ByRef $aArray, $iScall)
    If UBound($aArray,0) < 2 Then Return SetError(1,"",-1)
    Local $aMax = _GetMax($aArray)
    ConsoleWrite ("!> DEBUG xMax = " & $aMax[0] & ' yMax = ' & $aMax[1] & @CRLF)
    GUICtrlSetGraphic($hGraphics, $GUI_GR_COLOR, 0)
    GUICtrlSetGraphic($hGraphics, $GUI_GR_MOVE, 20, 10)
    GUICtrlSetGraphic($hGraphics, $GUI_GR_LINE, 20, 20 + $aMax[1] * $iScall)
    GUICtrlSetGraphic($hGraphics, $GUI_GR_LINE, 30 + $aMax[0] * $iScall, 20 + $aMax[1] * $iScall)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iX0 = 20, $iY0 = 20 + $aMax[1] * $iScall

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetGraphic($hGraphics, $GUI_GR_COLOR, 0xFF0000)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetGraphic($hGraphics, $GUI_GR_MOVE, $iX0+$aArray[0][0]*$iScall, $iY0-$aArray[0][1]*$iScall)
    For $i = 1 To UBound ($aArray)-1
    GUICtrlSetGraphic($hGraphics, $GUI_GR_LINE, $iX0+$aArray[$i][0]*$iScall, $iY0-$aArray[$i][1]*$iScall)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetGraphic($hGraphics, $GUI_GR_REFRESH)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetMax(ByRef $aArray)
    Local $iMaxX, $iMaxY
    For $i = 0 To UBound($aArray,1)-1
    If $iMaxX < $aArray[$i][0] Then $iMaxX = $aArray[$i][0]
    If $iMaxY < $aArray[$i][1] Then $iMaxY = $aArray[$i][1]
    Next
    Local $aRet[2] = [$iMaxX, $iMaxY]
    Return $aRet
    EndFunc

    [/autoit]