J4L RCHART, User Guide
Copyright 2012, J4L
Components (http://www.java4less.com)
Go bak to contents
RChart , first steps.
Installation
of the demo application
As a first step we recommend you to have a look
at the existing examples. The process for installing of the sample application
is:
- install the demo application in your Android emulator with "adb install
J4LChartDemos2.apk"
- Select the J4LCharts application and a list of charts will be
displayed.

when you create your own application you have to
include the library j4lchartlibrary.jar in your project.
Requirements
RChart will work with
Android 4.0 or later. We have a version for older Android version, contact us in
that case
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:
- either you create it
using the Java API, creating the RChart java objects and setting the
properties (see javadoc)
- 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
sampleproject/assets).
We recommend you to use the
second approach (using the ChartLoader) for the following reasons:
- You can create the parameters
for the ChartLoader using RChart Visual Builder.
- It is easier to learn.
- It is easier to develop
and debug.
- You can reuse the java
code since the same code can load different charts.
Nevertheless this guide
provides both the parameter names and the equivalent Java class and property.
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:
- Colors: predefined
values are:
RED
WHITE
GREEN
BLUE
YELLOW
GRAY
DARKGRAY
BLACK
LIME
OLIVE
MAROON
NAVY
PURPLE
TELA
FUCHSIA
AQUA
ALICEBLUE
ANTIQUEWHITE
AQUAMARINE
|
AZURE
BEIGE
BLUEVIOLET
BROWN
BORLYWOOD
CORAL
CYAN
DARKGOLDENROD
DARKGREEN
DARKOLIVEGREEN
DARKORANGE
DARKORCHID
DARKSALMON
DARKTURQUOISE
DARKVIOLET
DEEPPINK
DEEPSKYBLUE
FORESTGREEN
GOLD |
GOLDENROD
GREENYELLOW
HOTPINK
INDIANRED
IVORY
LAVENDER
LAWNGREEN
LIGHTBLUE
LIGHTCORAL
LIGHTCYAN
LIGHTGRAY
LIGHTPINK
LIGHTSALMON
LIGHTSKYBLUE
LIGHTYELLO
LIMEGREEN
MAGENTA
MEDIUMBLUE
MEDIUMPURPLE
|
MIDNIGHTBLUE
ORANGE
ORANGERED
ORCHID
PALEGREEN
PALETURQUOISE
PALEVIOLETRED
PINK
PLUM
PURPLE
SALMON
SEAGREEN
SIENNA
SKYBLUE
SPRINGGREEN
TURQUOISE
VIOLET
YELLOWGREEN |
You can also use
the RGB numeric value of a color as parameter. For example "0xFF0000"
is red (RGB format), "00x00FF00" is green and so on.
- List of values.
List of values a separated by "|", only certain parameters like
FiIll styles uses another separator.
- Fonts have the
format <font name>|<style>|<size>. Style can be PLAIN, ITALIC
or BOLD. Example: "Arial|BOLD|12"
- Line styles have
the format <width>|<color>|<style>. Style can be LINE, DASHED
or DOTS. Example: "1|RED|LINE".
You can define transparency in line styles using an additional parameter:
<width>|<color>|<style>|<transparency>. <transparency>
is a value between 0 (full transparent) and 1 (opaque). We recommend 0.5.
- Fill style: there
are several options:
- <color>: for
plain color filling.
- (Not
supported in Android yet) <color>|<transparentcy>:
for transparent color filling. <transparency> is a value between
0 (full transparent) and 1 (opaque). We recommend 0.5.
- (Not
supported in Android yet)<colorFrom>:<colorTo>:<orientation>:
for gadient filling. <orientation> can be VERTICAL or HORIZONTAL.
The fill style of following bar has been defined with "RED:ORANGE:HORIZONTAL".

as you can see the color changes from the <colorFrom> to the <colorTo>.
- (Not
supported in Android yet)<imageFile>.
For patten filling. The following area chart uses a pattern filling defined
as "pattern1.gif"
where the patter file "pattern1.gif"
is:
