BBjWindow::addLineChart

Description

In BBj 7.00 and higher, this method adds a line chart control to the BBjWindow.

Syntax

Return Value

Method

BBjLineChart addLineChart(int ID, number x, number y, number w, number h, string xLabel, string yLabel, int numSeries, boolean showLegend)
BBjLineChart addLineChart(int ID, number x, number y, number w, number h, string xLabel, string yLabel, int numSeries, boolean showLegend, byte[] flags)
BBjLineChart addLineChart(int ID, string xLabel, string yLabel, int numSeries, boolean showLegend)
BBjLineChart addLineChart(int ID, string xLabel, string yLabel, int numSeries, boolean showLegend, byte[] flags)
BBjLineChart addLineChart(string xLabel, string yLabel, int numSeries, boolean showLegend)
BBjLineChart addLineChart(string xLabel, string yLabel, int numSeries, boolean showLegend, byte[] flags)

Parameters

Variable

Description

ID

Specifies the Control ID number. It must be an integer between 1 and 32767 and be unique within a given top level window.

x

Horizontal position of the upper-left corner of the control in current units.

y

Vertical position of the upper-left corner of the control in current units.

width

Width of the control in current units.

height

Height of the control in current units.

xLabel

The label that should appear on the x axis.

yLabel

The label that should appear on the y axis.

numSeries

The number of series that are to be displayed.

showLegend

An indication of whether a default legend should be displayed.
0 = Do not show legend
1 = Show legend

flags

Control flags, as follows:

Flag Description
$0001$ Sets the control to be initially disabled.
$0010$ Sets the control to be initially invisible.
$0800$ Draws a recessed client edge around the control.
$1000$ Draws a raised edge around the control.

Return Value

Returns the created BBjLineChart object.

Remarks

If the ID parameter is not specified, a control ID is assigned dynamically using getAvailableControlID().

If the x, y, width, and height parameters are not specified, they're all initialized to 0. This is typically for use with DWC windows that dynamically arrange their contents (window creation flag $00100000$).

Example

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

declare BBjLineChart lineChart!
declare BBjWindow win!
declare BBjSysGui sysgui!
declare BBjNumber sysgui
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
sysgui=unt
open (sysgui) "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,"BBjLineChart Sample",$00090083$)
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

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjLineChart

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