RCHART, User Guide

Copyright 2005, J4L Components (http://www.java4less.com)
Go bak to contents


RChart , first steps.

Installation

The installation of RChart is very simple:
  1. Either you download the evaluation version from http://www.java4less.com or you have received the registered product per email.
  2. Unzip the file you have downloaded in an empty directory. Make sure you unzip also the subdirectories.
You can now open the following files:

Requirements

RChart will work with:

Where to start

As starting point we recommend you not to create a chart from scratch but to take one of the examples we provide and start working by modifying it.

But first of all you must be aware that there are 2 ways to create a chart:

  1. either you create it using the Java API, creating the RChart java objects and setting the properties (see File bin/ChartExamples.java)
  2. or you create the chart by means of the ChartLoader. In this case you do not have to worry about the Java API. You just have to create a list of parameters and use the ChartLoader class to create the chart (see examples in directory data/examples).
We recommend you to use the second approach (using the ChartLoader) for the following reasons:

Nevertheless this guide provides both the parameter names and the equivalent Java class and property.

If you want to use the RChart in a:

Format of the parameters

If you are going to create you chart by mean of the chart loader (instead of using the Java API), there are some parameters that have a special format:

 

RChart Graphic Context Provider

As you know rchart can work in AWT/Swing mode or in SWT mode. For this reason, all graphic functions which are specific to SWT or AWT are implemented in a package (com.java4less.rchart.gc) which is an abstract layer above the specific graphic implementation (see diagram).

 

The default implemementation is AWT, however you can switch to SWT by means of the following code:

GraphicsProvider.setMode(GraphicsProvider.MODE_SWT);

There is a third implementation called AWT1 which is compatible with JDK1.1. If you select AWT and your current Java version is 1.1, RChart will automatically select AWT1. In other other, RChart will work with JDK 1.1 or later.

If you set the SWT mode you must also provide a Display object which RChart will use for creating colors and fonts:

SwtGraphicsProvider.setDefaultDisplay(display);

If you do not set the display, RChart will create a new display. Since an application can only have 1 display this might trigger an error.

This design also means you should not use AWT or SWT font and color objects but RChart's abstract object instead. There are 3 type of graphic object you are interested in if you are going to create the chart using the Java API: