My favorites
|
Sign in
gwt-fusionchart
Set of tools for using FusionChart product inside GWT application
Project Home
Downloads
Issues
Source
Checkout
|
Browse
|
Changes
|
r190
Source path:
svn
/
trunk
/
fusionchart_server
/
src
/
com
/
raisepartner
/
chartfusion
/
web
/
server
/
toto
/
TotoXMLChartBuilderServlet.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* Copyright (c) 2008 Raise Partner
* 22, av. Doyen Louis Weil,
* 38000 Grenoble, France
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: sebastien@chassande.fr
*/
package com.raisepartner.chartfusion.web.server.toto;
import com.raisepartner.chartfusion.api.bar2d.Bar2D;
import com.raisepartner.chartfusion.api.bar2d.Set;
import com.raisepartner.chartfusion.web.client.servletapi.toto.TotoChartType;
import com.raisepartner.chartfusion.web.client.servletapi.xmlchart.ChartType;
import com.raisepartner.chartfusion.web.server.xmlchartbuilder.MapParameterProvider;
import com.raisepartner.chartfusion.web.server.xmlchartbuilder.ParameterProvider;
import com.raisepartner.chartfusion.web.server.xmlchartbuilder.XMLChartBuilder;
import com.raisepartner.chartfusion.web.server.xmlchartbuilder.XMLChartBuilderServlet;
/**
* This class is an example of Servlet providing XML data required for the
* chart building based on the FusionChart product.
* This examples contains an example of XMLChartBuilder.
*
* @author S.Chassande-Barrioz
*/
public class TotoXMLChartBuilderServlet extends XMLChartBuilderServlet {
private static final long serialVersionUID = 8847855115581995274L;
public XMLChartBuilder getXMLChartBuilder(int chartType) {
switch (chartType) {
case ChartType.CHART_DEFAULT:
case TotoChartType.MY_CHART_1:
default:
return new TotoChartXMLChartBuilder();
}
}
}
/**
*
* @author sebastien
*/
class TotoChartXMLChartBuilder extends XMLChartBuilder {
/**
* A main method to test xml produces by this XMlChart builder.
*/
public static void main(String[] args) {
//add parameter
ParameterProvider pp = new MapParameterProvider();
//pp.setParameter("", 12);
//...
System.out.println(new TotoChartXMLChartBuilder().getXMLData(pp, pp));
}
public int getChartType() { return 0; }
public String getRequestIdFromParameter(ParameterProvider pp) { return null;}
private Set setValue(Bar2D chart, String label, String value) {
Set s = chart.createSetNode();
s.setLabel(label);
s.setValue(value);
return s;
}
public String getXMLData(
ParameterProvider requestParameterProvider,
ParameterProvider sessionParamterProvider) {
//here you can use 'requestParameterProvider' to access to servlet parameters
//here you can use 'sessionParamterProvider' to access to session parameters
//Build the chart
Bar2D chart = new Bar2D();
chart.setCaption("Monthly Sales Summary");
chart.setSubCaption("For the year 2006");
chart.setXAxisName("Month");
chart.setYAxisName("Sales");
chart.setNumberPrefix("$");
setValue(chart, "Jan", "17400");
setValue(chart, "Feb", "19800");
setValue(chart, "Mar", "21800");
setValue(chart, "Apr", "23800");
setValue(chart, "May", "29600");
setValue(chart, "Jun", "27600");
setValue(chart, "Jul", "31800");
setValue(chart, "Aug", "39700");
setValue(chart, "Sep", "37800");
setValue(chart, "Oct", "21900");
setValue(chart, "Nov", "32900");
setValue(chart, "Dec", "39800");
//at the end, transform the Chart object into xml string
return chart.toString();
}
}
Show details
Hide details
Change log
r3
by chassande on Aug 31, 2008
Diff
[No log message]
Go to:
/trunk/fusionchart_server
...nk/fusionchart_server/.classpath
/trunk/fusionchart_server/.fbprefs
/trunk/fusionchart_server/.project
/trunk/fusionchart_server/build.xml
/trunk/fusionchart_server/etc
...usionchart_server/etc/Area2D.xls
...fusionchart_server/etc/Bar2D.xls
...usionchart_server/etc/Bubble.xls
...ionchart_server/etc/Column2D.xls
...ionchart_server/etc/Column3D.xls
...nchart_server/etc/Doughnut2D.xls
...nchart_server/etc/Doughnut3D.xls
.../fusionchart_server/etc/Line.xls
...usionchart_server/etc/MSArea.xls
...sionchart_server/etc/MSBar2D.xls
...sionchart_server/etc/MSBar3D.xls
...nchart_server/etc/MSColumn2D.xls
...nchart_server/etc/MSColumn3D.xls
..._server/etc/MSColumn3DLineDY.xls
...rt_server/etc/MSColumnLine3D.xls
...onchart_server/etc/MSCombi2D.xls
...hart_server/etc/MSCombiDY2D.html
...chart_server/etc/MSCombiDY2D.xls
...usionchart_server/etc/MSLine.xls
...etc/MSStackedColumn2DLineDY.html
.../etc/MSStackedColumn2DLineDY.xls
...fusionchart_server/etc/Pie2D.xls
...fusionchart_server/etc/Pie3D.xls
...sionchart_server/etc/Scatter.xls
...art_server/etc/ScrollArea2D.html
...hart_server/etc/ScrollArea2D.xls
...t_server/etc/ScrollColumn2D.html
...rt_server/etc/ScrollColumn2D.xls
/trunk/fusionchart_server/etc/todo
...t_server/etc/todo/ChartList.html
.../etc/todo/MSStackedColumn2D.html
...r/etc/todo/MSStackedColumn2D.xls
...rver/etc/todo/ScrollCombi2D.html
...erver/etc/todo/ScrollCombi2D.xls
...er/etc/todo/ScrollCombiDY2D.html
...ver/etc/todo/ScrollCombiDY2D.xls
...erver/etc/todo/ScrollLine2D.html
...server/etc/todo/ScrollLine2D.xls
.../todo/ScrollStackedColumn2D.html
...c/todo/ScrollStackedColumn2D.xls
...erver/etc/todo/StackedBar2D.html
...server/etc/todo/StackedBar2D.xls
...server/etc/todo/StackedBar3D.htm
...server/etc/todo/StackedBar3D.xls
Sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 3835 bytes, 113 lines
View raw file
Hosted by