KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > transactions > SalesChart


1 package transactions;
2
3 import dinamica.*;
4
5 /**
6  * Demo Charting Transaction
7  *
8  * <br>
9  * Creation date: 29/10/2003<br>
10  * Last Update: 29/10/2003<br>
11  * (c) 2003 Martin Cordova<br>
12  * This code is released under the LGPL license<br>
13  * @author Martin Cordova
14  * */

15 public class SalesChart extends GenericTransaction
16 {
17
18     /* (non-Javadoc)
19      * @see dinamica.GenericTransaction#service(dinamica.Recordset)
20      */

21     public int service(Recordset inputParams) throws Throwable JavaDoc
22     {
23         
24         int rc = super.service(inputParams);
25         
26         /* create a recordset with ChartInfo column structure */
27         Recordset rs = getChartInfoRecordset();
28
29         /* set chart configuration parameters */
30         rs.addNew();
31         rs.setValue("title", "Compras Anuales");
32         rs.setValue("title-x", "A�o"); //irrelevant for pie charts
33
rs.setValue("title-y", "Monto en US$"); //irrelevant for pie charts
34
rs.setValue("column-x", "the_year");
35         rs.setValue("column-y", "subtotal"); //if multiseries then type multiple column names separated by ";"
36
rs.setValue("title-series", null); //no series - otherwise set label names separated by ";"
37
rs.setValue("width", new Integer JavaDoc(300)); //in pixels
38
rs.setValue("height", new Integer JavaDoc(300)); //in pixels
39
rs.setValue("data", "total_per_year.sql"); //recordset that must be stored in session attribute
40

41         //added on april-6-2004 - persist image bytes in session attribute
42
//to be reused by PDF generators
43
//rs.setValue("session", "true");
44
//rs.setValue("image-id", "chart.demo");
45

46         /* select the type of chart you want to use */
47         rs.setValue("chart-plugin", "dinamica.charts.VerticalBarChart");
48         
49         /* publish recordset to be consumed by output module */
50         publish("chartinfo", rs);
51         
52         return rc;
53         
54     }
55
56 }
57
Free Books   Free Magazines  
Popular Tags