FusionChartsHTMLRenderer.jsp
4.1 KB
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
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
/*
* Works with all jdk versions >=1.4.
* Creates the object tag required to embed a chart.
* Generates the object tag to embed the swf directly into the html page.<br>
* Note: Only one of the parameters strURL or strXML has to be not null for this<br>
* method to work. If both the parameters are provided then strURL is used for further processing.<br>
*
* @param chartSWF -
* SWF File Name (and Path) of the chart which you intend
* to plot
* @param strURL -
* If you intend to use dataURL method for this chart,
* pass the URL as this parameter. Else, set it to "" (in
* case of dataXML method)
* @param strXML -
* If you intend to use dataXML method for this chart,
* pass the XML data as this parameter. Else, set it to ""
* (in case of dataURL method)
* @param chartId -
* Id for the chart, using which it will be recognized in
* the HTML page. Each chart on the page needs to have a
* unique Id.
* @param chartWidth -
* Intended width for the chart (in pixels)
* @param chartHeight -
* Intended height for the chart (in pixels)
* @param debugMode -
* Whether to start the chart in debug mode (Nt used in Free version)
*/
%>
<%
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
String chartSWF= request.getParameter("chartSWF");
String strURL= request.getParameter("strURL");
//String strXML= request.getParameter("strXML");
String chartId= request.getParameter("chartId");
String chartWidthStr= request.getParameter("chartWidth");
String chartHeightStr= request.getParameter("chartHeight");
String debugModeStr= request.getParameter("debugMode"); // not used in Free version
String strXML = (String)session.getAttribute(chartId);
session.removeAttribute(chartId);
int chartWidth= 0;
int chartHeight=0;
Boolean debugMode= new Boolean(false);
Boolean registerWithJS=new Boolean(false);
int debugModeInt =0;
if(null!=chartWidthStr && !chartWidthStr.equals("")){
chartWidth = Integer.parseInt(chartWidthStr);
}
if(null!=chartHeightStr && !chartHeightStr.equals("")){
chartHeight = Integer.parseInt(chartHeightStr);
}
if(null!=debugModeStr && !debugModeStr.equals("")){
debugMode = new Boolean(debugModeStr);
debugModeInt= boolToNum(debugMode);
}
String strFlashVars="";
if (strXML.equals("")) {
// DataURL Mode
strFlashVars = "chartWidth=" + chartWidth + "&chartHeight="
+ chartHeight + "&debugMode=" + debugModeInt
+ "&dataURL=" + strURL + "";
} else {
// DataXML Mode
strFlashVars = "chartWidth=" + chartWidth + "&chartHeight="
+ chartHeight + "&debugMode=" + debugModeInt
+ "&dataXML=" + strXML + "";
}
%>
<!--START Code Block for Chart <%=chartId%> -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="<%= chartWidth%>" height="<%= chartHeight%>" id="<%= chartId%>">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="<%=chartSWF%>"/>
<param name="FlashVars" value="<%=strFlashVars%>" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="<%=chartSWF%>" FlashVars="<%=strFlashVars%>" wmode="transparent"
quality="high" width="<%=chartWidth%>"
height="<%=chartHeight%>" name="<%=chartId%>"
allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!--END Code Block for Chart <%=chartId%> -->
<%!
/**
* Converts a Boolean value to int value<br>
*
* @param bool Boolean value which needs to be converted to int value
* @return int value correspoding to the boolean : 1 for true and 0 for false
*/
public int boolToNum(Boolean bool) {
int num = 0;
if (bool.booleanValue()) {
num = 1;
}
return num;
}
%>