BBjLineChart Example

rem 'Barchart demo: Graph Maximum Velocities for the Soapbox Derby

declare BBjLineChart lineChart!
declare BBjWindow win!
declare BBjSysGui sysgui!
declare BBjNumber sysguiChan
declare BBjSystemMetrics sysMetrics!
declare java.awt.Dimension screenDimension!
declare BBjNumber height
declare BBjNumber width
declare BBjNumber numSeries
declare BBjNumber numXPoints
declare BBjNumber series_ctr
declare BBjNumber xPoints_ctr

rem 'instantiate the window and chart to take up a quarter screen
sysguiChan=unt
open (sysguiChan) "X0"
sysgui!=BBjAPI().getSysGui()
sysMetrics!=sysgui!.getSystemMetrics()
screenDimension!=sysMetrics!.getScreenSize()
width=int(screenDimension!.getWidth()/2)
height=int(screenDimension!.getHeight()/2)
win!=sysgui!.addWindow(10,10,width,height,"BBjBarChart Sample")
win!.setCallback(win!.ON_CLOSE,"end_demo")
numSeries=3
numXPoints=20
lineChart!=win!.addLineChart(101,10,10,width-20,height-20,"X Axis","Y Axis",numSeries,0)
lineChart!.setTitle("Soapbox Derby")
lineChart!.setXLabel("Time")
lineChart!.setYLabel("Velocity")

rem 'Populate the chart with data for each car and race.
for xPoints_ctr=0 to numXPoints-1
    for series_ctr=0 to numSeries-1
        lineChart!.setSeriesName(series_ctr,"Soapbox #"+str(series_ctr+1))
        lineChart!.setXYValue(series_ctr,XPoints_ctr,rnd(40))
    next series_ctr
next xPoints_ctr
print "The Chart's title is ",$22$,lineChart!.getTitle(),$22$
print "The Chart's X Label is ",$22$,lineChart!.getXLabel(),$22$
print "The Chart's Y Label is ",$22$,lineChart!.getYLabel(),$22$
process_events

end_demo:
release