BBjChart::writePNGToServer

Description

In BBj 7.0 and higher, this method creates a PNG image of the BBjChart and writes it to a file on the server.

Syntax

Return Value

Method

void

writePNGToServer(string filename)

void

writePNGToServer(string filename, boolean writeAlpha, int compression)

void

writePNGToServer(string filename, number width, number height, boolean writeAlpha, int compression)

Parameters

Variable

Description

compression

An indication of the desired compression level (0-9)

filename

The name of the file on the server to which the PNG image is to be written

height

The height in pixels of the desired PNG file

width

The width in pixels of the desired PNG file

writeAlpha

An indication of whether the PNG file should contain alpha information

Return Value

None.

Remarks

None.

Example

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

declare BBjBarChart barChart!
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 numCategories
declare BBjNumber series_ctr
declare BBjNumber categories_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
numCategories = 5
barChart! = win!.addBarChart(101,10,10,width-20,height-20,"X Axis","Y Axis",numSeries,numCategories,0,0,0)

barChart!.setTitle("Soapbox Derby")
barChart!.setXLabel("Race")
barChart!.setYLabel("Maximum Velocity")

for series_ctr = 0 to numSeries-1
    barchart!.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 numCategories-1
    barchart!.setCategoryName(categories_ctr,"Race #"+str(categories_ctr+1))
    for series_ctr = 0 to numSeries-1
        barchart!.setBarValue(series_ctr,categories_ctr,rnd(40))
    next series_ctr
next categories_ctr

barchart!.writePNGToServer("barchart.png")

process_events

end_demo:
release

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

ClientObject Tutorial

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.