引入必要的包
import javax
import javax
import org
import org
import org
import org
import org
import org
//List的長度int[] Num = new int[n];
//存放人數String[] orgName = new String[n];
//存放機構名稱String title =
for (int i =
i < n; i++) {RepVteachStatic temp = new RepVteachStatic();
//臨時存放對象
//取得List中的對象int personNum = repVteachStaticService
//查詢出參加人數Num[i] = personNum;
orgName[i] = temp
}getOrgCoursePieChart(Num
//用三個參數調用圖表生成方法
圖表生成方法
public void getOrgCoursePieChart(int[] Num
DefaultPieDataset data = new DefaultPieDataset();
for (int i =
data
}
JFreeChart chart = ChartFactory
chart
ChartRenderingInfo info = new ChartRenderingInfo(
new StandardEntityCollection());
try {
HttpSession session = ActionContext
//取session對象
HttpServletRequest request = ActionContext
//取request對象
String filename = ServletUtilities
graphURL = request
+
}catch (Exception e) {}}
<img src=
From:http://tw.wingwit.com/Article/program/Java/ky/201311/11167.html