RCHART for .NET, User Guide

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


Miscelaneous

 

Combined charts (Lines and bars)

You can easily combine lines and charts by creating 2 series, where one of the serie is a line serie and the other a bars serie:

Parameters
Description
Equivalent c# class/property

SERIE_1=Products
SERIE_2=Services
SERIE_TYPE_1=BAR
SERIE_TYPE_2=LINE
SERIE_DATA_1=30|30|34|23|40
SERIE_DATA_2=83|70|95|70|52
SERIE_DATAX_2=1|2|3|4|5|6|7

Definition of the scale

First serie, bars (in the background)
Second serie, line (in the foreground)
Bars values
Line values
Make the like start at tick 1 to that it is aligned with the bars

linePlotter=new LinePlotter();
barPlotter=new BarPlotter();



serie1=new BarDataSerie(values1,fillStyle);
serie2=new LineDataSerie(values2,lineStyle);

chart=new Chart(cTitle,barPlotter,cXAxis,cYAxis);
chart.addPlotter(linePlot);

 

Data population (ODBC)

You can use Rchart's odbc features in order to read data from a database. First of all you must specify how to connect to the database using the following parameters:

when RChart is connected to your database you can put a SQL Select command in any RChart parameter. SQL Queries must have the "ODBC:" prefix. For example:

SERIE_DATA_1=ODBC:Select soldQty from SalesMonth Order by salesMonth DESC

note that rchart will only read the first field in the select statement, for this reason it is useless to use more than 1 field in the query. If the query returns more than 1 record, rchart will return the values as a list separated by | , just like parameters are expected.

The SQL queries you define in RChart can also contain parameters. For example:

SERIE_DATA_1=ODBC:Select soldQty from SalesMonth where ProductId='[%product]' Order by salesMonth DESC

This query contains a parameter called "product". Before you try to create a chart containing this query you must provide a value for all parameters. This is done in the following java code:

chart.setSQLParameter("product","1");

where the first parameter of setSQLParameter is the parameter name and the second is the value.