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

org.jfree.chart.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 java.lang.Object
use org.jfree.data.xy.XYDataset
use org.jfree.data.xy.XYSeries
use org.jfree.chart.axis.DateTickUnit
use org.jfree.chart.JFreeChart
use org.jfree.chart.ChartFactory
use org.jfree.chart.ChartPanel
use org.jfree.chart.plot.XYPlot
use org.jfree.data.xy.XYSeriesCollection
use org.jfree.data.time.TimeSeries
use org.jfree.data.time.TimeSeriesCollection
use org.jfree.data.time.Day
use org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
use org.jfree.chart.annotations.XYTextAnnotation
use org.jfree.chart.plot.XYPlot

open(unt)"X0"

declare BBjSysGui sg!
declare BBjWindow win!

sg! = BBjAPI().getSysGui()
win! = sg!.addWindow(50,50,600,350, "BBjCharts")
win!.setCallback(win!.ON_CLOSE,"closeApp")



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


declare BBjLineChart lineChart!
lineChart! = win!.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 = java.lang.Math.cos(x)
z = 2 * java.lang.Math.sin(x)

lineChart!.setXYValue(0,x,y)
lineChart!.setXYValue(1,x,z)

next count

declare Object@ obj!
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
obj! = lineChart!.getClientChart()
chart! = cast(JFreeChart@, obj!)

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.