Dieses Script ermöglicht, ein Diagramm in das GUI einzubauen. Bis jetzt kann man 10 Balken erstellen. Ein weiteres updade des Sciptes wird mehr Balken ermöglichen. Was noch fehlt ist ein "GUICtrlSetDiagramm", also ein updade, mit dem man die Farbe und die % des Balkens verändern lässt.
Ich freue mich über brauchbare Kritik.
Spoiler anzeigen
GUICtrlCreateDiagramm (30, 30 , 300 , 200 ,-1,10,"",20,0xFF9933,30,0x33FF00,50,0x0066CC,20,0x00ff00,60,0x00ff00,70,0x00ff00,80,0x00ff00,"","","","")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]func GUICtrlCreateDiagramm ($left, $top , $width , $height , $color , $d1, $c1, $d2, $c2, $d3, $c3, $d4, $c4, $d5, $c5, $d6, $c6, $d7, $c7, $d8, $c8, $d9, $c9, $d10, $c10)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit];Diagramm-Fenster erstellen:
[/autoit] [autoit][/autoit] [autoit]GUICtrlCreateGraphic($left, $top, $width+50,$height)
[/autoit] [autoit][/autoit] [autoit]If not $color = "-1" then GUICtrlSetBkColor(-1, $color)
[/autoit] [autoit][/autoit] [autoit];Anzahl der Balken zählen:
Local $anzahl = 0
If not $d1 = "" then $anzahl = $anzahl + 1
If not $d2 = "" then $anzahl = $anzahl + 1
If not $d3 = "" then $anzahl = $anzahl + 1
If not $d4 = "" then $anzahl = $anzahl + 1
If not $d5 = "" then $anzahl = $anzahl + 1
If not $d6 = "" then $anzahl = $anzahl + 1
If not $d7 = "" then $anzahl = $anzahl + 1
If not $d8 = "" then $anzahl = $anzahl + 1
If not $d9 = "" then $anzahl = $anzahl + 1
If not $d10 = "" then $anzahl = $anzahl + 1
;Höhe der Balken berechnen:
Local $BalkenHoehe = (($height-20) / $anzahl)-3
;1 Prozent des Balken berechnen:
Local $Prozent = ($width-20) /100
;Erstellen der Balken:
If not $d1 = "" then
Local $balken1 = GUICtrlCreateGraphic($left+10, $top +10 +3, $Prozent*$d1 , $BalkenHoehe)
GUICtrlSetBkColor(-1, $c1)
$balken1 = GUICtrlCreateLabel ($d1 & "%", $width+50 ,$top +10 +4)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c1)
endif
If not $d2 = "" then
Local $balken2 = GUICtrlCreateGraphic($left+10, $top+ 10 + $BalkenHoehe +6, $Prozent*$d2, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c2)
$balken2 = GUICtrlCreateLabel ($d2 & "%", $width+50 ,$top +10 +7+ $BalkenHoehe)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c2)
endif
If not $d3 = "" then
Local $balken3 = GUICtrlCreateGraphic($left+10,$top+ 10 +9+ $BalkenHoehe*2 , $Prozent*$d3, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c3)
$balken3 = GUICtrlCreateLabel ($d3 & "%", $width+50 ,$top +10 +10+ $BalkenHoehe*2)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c3)
endif
If not $d4 = "" then
Local $balken4 = GUICtrlCreateGraphic($left+10, $top+ 10 + 12+$BalkenHoehe*3 , $Prozent*$d4, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c4)
$balken4 = GUICtrlCreateLabel ($d4 & "%", $width+50 ,$top +10 +13+ $BalkenHoehe*3)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c4)
endif
If not $d5 = "" then
Local $balken5 = GUICtrlCreateGraphic($left+10, $top+ 10 +15+ $BalkenHoehe*4, $Prozent*$d5, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c5)
$balken5 = GUICtrlCreateLabel ($d5 & "%", $width+50 ,$top +10 +16+ $BalkenHoehe*4)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c5)
endif
If not $d6 = "" then
Local $balken6 = GUICtrlCreateGraphic($left+10, $top+ 10 +18+ $BalkenHoehe*5, $Prozent*$d6, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c6)
$balken6 = GUICtrlCreateLabel ($d6 & "%", $width+50 ,$top +10 +19+ $BalkenHoehe*5)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c6)
endif
If not $d7 = "" then
Local $balken7 = GUICtrlCreateGraphic($left+10, $top+ 10 +21+ $BalkenHoehe*6, $Prozent*$d7, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c7)
$balken7 = GUICtrlCreateLabel ($d7 & "%", $width+50 ,$top +10 +22+ $BalkenHoehe*6)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c7)
endif
If not $d8 = "" then
Local $balken8 = GUICtrlCreateGraphic($left+10, $top+ 10 + 24+$BalkenHoehe*7, $Prozent*$d8, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c8)
$balken8 = GUICtrlCreateLabel ($d8 & "%", $width+50 ,$top +10 +25+ $BalkenHoehe*7)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c8)
endif
If not $d9 = "" then
Local $balken9 = GUICtrlCreateGraphic($left+10,$top+ 10 + 27+$BalkenHoehe*8, $Prozent*$d9, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c9)
$balken9 = GUICtrlCreateLabel ($d9 & "%", $width+50 ,$top +10 +28+ $BalkenHoehe*8)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c9)
endif
If not $d10 = "" then
Local $balken10 = GUICtrlCreateGraphic($left+10, $top+ 10 +30+ $BalkenHoehe*9, $Prozent*$d10, $BalkenHoehe)
GUICtrlSetBkColor(-1, $c10)
$balken10 = GUICtrlCreateLabel ($d10 & "%", $width+50 ,$top +10 +31+ $BalkenHoehe*9)
If not $color = "" then GUICtrlSetBkColor(-1, $color)
GUICtrlSetColor ( -1,$c10)
endif
endfunc
[/autoit] [autoit][/autoit] [autoit][/autoit]