BBjPieChart Example

rem 'Barchart demo: Graph time spent in the lead for the Soapbox Derby

declare BBjPieChart pieChart!
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 numSlices
declare BBjNumber slices_ctr
declare BBjNumber value
declare BBjNumber total

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,"BBjPieChart Sample")
win!.setCallback(win!.ON_CLOSE,"end_demo")
numSlices=3
pieChart!=win!.addPieChart(101,10,10,width-20,height-20,1,1)
pieChart!.setTitle("Soapbox Derby: Time spent in the lead")

rem 'Populate the chart with data for each car
total=0
for slices_ctr=1 to numSlices-1
    value=(1-total)*rnd(0)
    total=total+value
    pieChart!.setSliceValue("Soapbox #"+str(slices_ctr),value)
next slices_ctr
pieChart!.setSliceValue("Soapbox #"+str(slices_ctr),1-total)
print "The Chart's title is ",$22$,pieChart!.getTitle(),$22$
if (piechart!.is3D()) then
    print "The Chart is 3D."
else
    print "The Chart is not 3D."
endif
process_events

end_demo:
release