BBjBarChart Example

rem ' BBjBarChart: Graph Maximum Velocities for the Soapbox Derby

declare BBjBarChart chart!
declare BBjWindow window!
declare BBjSysGui sysgui!
declare BBjSystemMetrics metrics!
declare java.awt.Dimension screen!

rem ' instantiate the window and chart to take up a quarter screen
sysgui = unt
open (sysgui) "X0"
sysgui! = bbjapi().getSysGui()
metrics! = sysgui!.getSystemMetrics()
screen! = metrics!.getScreenSize()
width = int(screen!.getWidth() / 2)
height = int(screen!.getHeight() / 2)
window! = sysgui!.addWindow(10,10,width,height,"BBjBarChart Sample")
window!.setCallback(window!.ON_CLOSE,"eoj")
series = 3
categories = 5
chart! = window!.addBarChart(101,10,10,width-20,height-20,"X Axis","Y Axis",series,categories,0,0,0)
chart!.setTitle("Soapbox Derby")
chart!.setXLabel("Race")
chart!.setYLabel("Maximum Velocity")
chart!.setSeriesCount(series)
chart!.setCategoryCount(categories)
for series_ctr=0 to series-1
    chart!.setSeriesName(series_ctr,"Soapbox #"+str(series_ctr+1))
next series_ctr

rem ' Populate the chart with data for each car and race.
for categories_ctr=0 to categories-1
    chart!.setCategoryName(categories_ctr,"Race #"+str(categories_ctr+1))
    for series_ctr=0 to series-1
        chart!.setBarValue(series_ctr,categories_ctr,rnd(40))
    next series_ctr
next categories_ctr
print "The chart's title is """,chart!.getTitle(),""""
print "The chart's X label is """,chart!.getXLabel(),""""
print "The chart's Y label is """,chart!.getYLabel(),""""
print "The chart has",chart!.getSeriesCount()," series."
print "The chart has",chart!.getCategoryCount()," categories."
if (chart!.is3D()) then
    print "The chart is 3D."
else
    print "The chart is not 3D."
endif
process_events

eoj:
release