BBjChart::getClientChart

Description

In BBj 7.0 and higher, this method returns a client object that represents the client-side bar chart.

Syntax

Return Value

Method

JFreeChart@

getClientChart()

Parameters

None.

Return Value

Returns a client object that represents the client-side bar chart.

Remarks

The ClientObject can be used as an RMI handle to invoke methods on the client-side chart.

Example

use org.jfree.chart.JFreeChart
use org.jfree.chart.plot.XYPlot
use org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
use org.jfree.chart.annotations.XYTextAnnotation

open(unt)"X0"

declare BBjSysGui sysgui!
declare BBjWindow window!

sysgui! = BBjAPI().getSysGui()
window! = sysgui!.addWindow(50,50,600,350, "BBjChart::getClientChart")
window!.setCallback(window!.ON_CLOSE,"closeApp")

rem '===========================================================
rem 'make a line chart using BBjWindow.addLineChart
rem '===========================================================

declare BBjLineChart lineChart!
lineChart! = window!.addLineChart(203, 10, 10, 500, 270, "x", "y", 2, 1)
lineChart!.setTitle("Noise levels")
lineChart!.setSeriesName(0, "high frequency")
lineChart!.setSeriesName(1, "low frequency")

for count = 1 to 200
    x = - 10.0 + count/10.0
    y = Math.cos(x)
    z = 2 * Math.sin(x)
    lineChart!.setXYValue(0,x,y)
    lineChart!.setXYValue(1,x,z)
next count

declare JFreeChart@ chart!
declare XYPlot@ xyPlot!
declare XYLineAndShapeRenderer@ xyRenderer!

rem 'write some random text at a point on the chart
rem 'first retrieve the chart
chart! = lineChart!.getClientChart()

rem 'retrieve the plot from the chart
rem 'and retrieve the renderer from the plot
xyPlot! = cast(XYPlot@, chart!.getPlot())
obj! = xyPlot!.getRenderer()
xyRenderer! = cast(XYLineAndShapeRenderer@, xyPlot!.getRenderer())

rem 'create an annotation and add it to the renderer
annotation! = new XYTextAnnotation@("Free form text centered at (-2.5, 1.5)", -2.5, 1.5)
xyRenderer!.addAnnotation(annotation!)

process_events

closeApp:
release

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

ClientObject Tutorial

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