MBS REALbasic Plugin Tutorial Videos
ChartDirectorBar Source
Note: The function DesktopFolder is deprecated in REALbasic. You can replace it with SpecialFolder.desktop.
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class
Class Window1
Inherits Window
// Event implementations
Sub Open()
dim t as TextInputStream
dim f as FolderItem
dim hits(23) as double
f=DesktopFolder.Child("testdata.txt")
t=f.OpenAsTextFile
while not t.eof
dim line as string
line=t.ReadLine(encodings.ASCII)
// format of line for apache webserver:
// 1.2.3.4 - - [07/Apr/2008:01:02:03 +0200] "GET /folder/file.html HTTP/1.1" 200 1234 "-" "Mozilla"
dim p as integer
p=instr(line,"[")
if p>0 then
p=instr(p,line,":")
dim hour as integer
hour=val(mid(line,p+1,2))
hits(hour)=hits(hour)+1
end if
wend
dim c as new CDXYChartMBS(Width,Height)
dim labels(-1) as string
dim colors(-1) as integer
dim i as integer
for i=0 to 23
labels.Append str(i)
colors.Append CDXYChartMBS.RGB(rnd*127+127,rnd*127+127,rnd*127+127)
next
call c.setPlotArea 40, 20, Width-50, Height-50
dim b as CDBarLayerMBS
b= c.addBarLayer(hits, colors)
b.set3D 3
call c.xAxis.setLabels labels
Backdrop=c.makeChartPicture
End Sub
End Class
Links
MBS Realbasic Plugins - Nachhilfe in Wassenach