HttpServletResponse response, SQLParser Parser) throws Exception
{
// 绘制字符串
if (getParameter(request, "Action").equalsIgnoreCase("String")) {
Chart chart = new Chart(response, 200, Color.BLUE, Color.yellow, 3);
chart.setStr(getParameter(request, "str"));
return chart.drawChart();
}
// 绘制校验码
else if (getParameter(request, "Action").equalsIgnoreCase("randimg")) {
Chart chart = new Chart(response, 50, null, null, 3);
chart.setStrfont(new Font("Times New Roman", 0, 18));
chart.setStr(StringUtils.randomNumber(4));
return chart.drawChart();
} else { // 绘制饼图
Chart chart = new Chart(response, 400, Color.white, Color.black, 0);
DBResult Result = Parser
.QueryExecute("select label,value from piechart order by id desc");
chart.setResult(Result);
chart.setBKColor(Color.white);
chart.setLabelValue("label");
chart.setValueName("value");
chart.setFill(Color.red);
return chart.drawChart();
}
}