0
我有一個非常基本的JSP代碼。它返回從Oracle數據庫如何獲得甲骨文變量納入Amchart在JSP
String program_name = "";
Integer projects = 0;
Integer operations = 0;
statement = connection.createStatement();
if(deger.equals("All Priorities"))
{
rs = statement.executeQuery("SELECT PROGRAM_NAME prog_name, (SELECT COUNT(PRJ_TYPE) FROM EAD_PRJ_CURR_LIST LST WHERE LST.PROGRAM_ID= PG.PGM_PROGRAM_ID AND LST.PRJ_TYPE = 'Project') Project,(SELECT COUNT(PRJ_TYPE) FROM EAD_PRJ_CURR_LIST LST WHERE LST.PROGRAM_ID= PG.PGM_PROGRAM_ID AND LST.PRJ_TYPE = 'Operation') Operation FROM KCRT_FG_PFM_PROGRAM PG");
}
else
{
rs = statement.executeQuery("SELECT PROGRAM_NAME prog_name, (SELECT COUNT(PRJ_TYPE) FROM EAD_PRJ_CURR_LIST LST WHERE LST.PROGRAM_ID= PG.PGM_PROGRAM_ID AND LST.PRJ_TYPE = 'Project') AS Project,(SELECT COUNT(PRJ_TYPE) FROM EAD_PRJ_CURR_LIST LST WHERE LST.PROGRAM_ID= PG.PGM_PROGRAM_ID AND LST.PRJ_TYPE = 'Operation') as Operation FROM KCRT_FG_PFM_PROGRAM PG");
}
while(rs.next())
program_name = rs.getString("prog_name");
projects = rs.getInt("Project");
operations = rs.getInt("Operation");
3個變量這是圖表的代碼,它是一個柱狀圖 -
<!-- Chart code -->
<script>
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"categoryField": "List_Of_Programs",
"rotate": true,
"startDuration": 1,
"categoryAxis": {
"gridPosition": "start",
"position": "left"
},
"trendLines": [],
"graphs": [
{
"balloonText": "Projects:[[value]]",
"fillAlphas": 0.8,
"id": "AmGraph-1",
"lineAlpha": 0.2,
"title": "Projects",
"type": "column",
"valueField": "Projects"
},
{
"balloonText": "Operations:[[value]]",
"fillAlphas": 0.8,
"id": "AmGraph-2",
"lineAlpha": 0.2,
"title": "Operations",
"type": "column",
"valueField": "Operations"
}
],
"guides": [],
"valueAxes": [
{
"id": "ValueAxis-1",
"position": "top",
"axisAlpha": 0
}
],
"allLabels": [],
"balloon": {},
"titles": [],
"dataProvider": [
{
"List_Of_Programs": <%=projects%>,
"Projects": <%=projects%>,
"Operations": <%=operations%>
}],
"export": {
"enabled": true
}
});
</script>
<div id="chartdiv"></div>
都在我這個封裝在一個JSP文件。代碼編譯良好,沒有任何問題。然而,我需要與打印從較早查詢的數據(其具有大約20行)到圖表的邏輯幫助。
請協助。