Hallo,
ich hoffe ich werde nicht gelüncht, aber ich habe leider keine passendere Überschrift gefunden ![]()
in einem Programm benutze ich den angehängten Quellcode um einen Graphen zu zeichnen.
Das angegebene Array($array_neu[0]) beinhaltet die y-Werte des Graphen.
Soweit so gut, der Graph wird mir gezeichnet und das passt auch einigermaßen so.
Nun hab ich aber das Problem, dass die y-Werte variabel sind und auch größer als das Grafik ctrl sein können.
Daher müssten die y-Werte so angepasst werden, das ymax = 250px (60) und ymin=0px (10) entspricht,
hoffe das war einigermaßen verständlich, weil ich auch nicht so wirklich weiß wie ich das beschreiben soll...
Der Graph soll quasi die ganze Höhe des Ctrls ausreizen. also mein ymax = ctrlhöhe.
Kann mir da mal bitte jemand einen tip geben?
sollten noch Fragen offen sein, und das werden einige sein, einfach melden ![]()
Vielen Dank im Voraus
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <array.au3>
CreateChild()
Func CreateChild()
dim $array_neu[20]
$array_neu[0] = "20"
$array_neu[1] = "40"
$array_neu[2] = "40"
$array_neu[3] = "55"
$array_neu[4] = "10"
$array_neu[5] = "33"
$array_neu[6] = "22"
$array_neu[7] = "44"
$array_neu[8] = "50"
$array_neu[9] = "60"
$array_neu[10] = "40"
$array_neu[11] = "55"
$array_neu[12] = "20"
$array_neu[13] = "40"
$array_neu[14] = "10"
$array_neu[15] = "33"
$array_neu[16] = "22"
$array_neu[17] = "44"
$array_neu[18] = "50"
$array_neu[19] = "60"
dim $tab2_array_graph_daten[UBound($array_neu)/2][2]
$Pixel = 250
$array_max = _ArrayMax($array_neu) ;60
$zoom = $array_max/$Pixel
For $lv = 0 to ubound($array_neu)/2-1
if $array_neu[$lv*2] > $array_neu[$lv*2+1] then
$tab2_array_graph_daten[$lv][0] = $array_neu[$lv*2]/$zoom
$tab2_array_graph_daten[$lv][1] = $array_neu[$lv*2+1]/$zoom
Else
$tab2_array_graph_daten[$lv][0] = $array_neu[$lv*2+1]/$zoom
$tab2_array_graph_daten[$lv][1] = $array_neu[$lv*2]/$zoom
EndIf
Next
$child = GUICreate("My Draw",$Pixel*2 ,$Pixel)
$tab2_graph = GUICtrlCreateGraphic(20,45,2*$Pixel,$Pixel)
$spalte = 10
For $a = 0 to ubound($tab2_array_graph_daten)-1
GUICtrlSetGraphic($tab2_graph, $GUI_GR_MOVE, $spalte, $tab2_array_graph_daten[$a][1])
GUICtrlSetGraphic($tab2_graph, $GUI_GR_LINE, $spalte, $tab2_array_graph_daten[$a][0])
$spalte +=10
Next
GUISetState()
EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd