#!/boot/home/config/bin/yab

// Daten
dim alter(4)
alter(0)=90
alter(1)=120
alter(2)=45
alter(3)=105
//alter(4)=90

ueberschrift$="Statistik V0.1"

//**** Feststellen wie viele Einträge das Array hat und des höchsten Wertes im Array ****
for groesseArray=0 to arraysize(alter(), 1)-1
   if(alter(groesseArray)>maximum) maximum = alter(groesseArray)   
next groesseArray
//***************************************************************************************
//**** Werte für die Views ermitteln *****
BreiteView=800
unten=maximum+500
//**** Werte für die Views ermitteln *****
window open 100,100 to 800,500, "MainView", "Statistik"
view 0,0 to 685,385, "test1", "MainView"
SCROLLBAR "Diagramm", 3, "test1"
SCROLLBAR SET "Diagramm", "Vertical Range", 0, unten-370
SCROLLBAR SET "Diagramm", "Vertical Position",unten
SCROLLBAR SET "Diagramm", "Horizontal Range", 0, BreiteView+130-685
SCROLLBAR SET "Diagramm", "Horizontal Position", 0

view 0,0 to BreiteView+130,unten+15, "test", "test1"
draw set "bgcolor", 220,222,0, "test" 
draw set "Zurich,Bold,10", "test"

view 50,60 to BreiteView+90,unten, "DrawView", "test"
draw set "highcolor", 0,0,0, "DrawView"
draw set "bgcolor", 255,255,255, "DrawView"


//**************** Torte_berechnen *******************
draw set true, "HighSolidFill"
draw circle 150,150, 100, "DrawView"
	
 	for e=0 to 3	
 			
		 	winkel1=alter(e)+winkel1
		 	print winkel1		
			xwert=(cos(winkel1*pi/180)*100)*(-1)
			ywert=(sin(winkel1*pi/180)*100)*(-1)
			print "xwert:ywert"	
			print xwert:print ywert	
			draw line 150,150 to int(xwert)+150,int(ywert)+150, "DrawView" //		
	next e
	print 
//******************************************************




while(not instr(msg$,"NextButton"))
	msg$ = message$
	if(instr(msg$, "Quit")) then
		window close "test"
		end
	endif
	sleep 0.1
wend


window close "MainView"