日期:2014-05-16 浏览次数:20716 次
function showSplineCharts(url) { $.post(url, null, function(result) { var myChart = new FusionCharts(chartsPath, "myChartId", "900", "600", "0", "1" ); myChart.setDataXML(result); myChart.render("chartContainer"); }); }
import java.io.PrintWriter; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext; import org.apache.struts2.interceptor.validation.SkipValidation; import com.opensymphony.xwork2.ActionContext; public class SplineChartsAction extends BaseAction { private static final long serialVersionUID = -7084657534035687836L; public static final String NAMESPACE = "XXXX"; public static final String NAME = "spline-charts"; public static final String URL = NAMESPACE + "/" + NAME; @SkipValidation public void getXMLData() throws Exception { StringBuffer stringBuffer = new StringBuffer(); // XMLデータ stringBuffer.append("<chart caption=\"テスト\" xAxisName=\"月\" yAxisName=\"量\" showValues=\"0\" baseFontSize=\"11\" palette=\"1\" showFCMenuItem=\"1\" imageSave=\"1\">"); // X糸を設定する stringBuffer.append("<categories>"); stringBuffer.append("<category label=\"1\" />"); stringBuffer.append("<category label=\"2\" />"); stringBuffer.append("<category label=\"3\" />"); stringBuffer.append("<category label=\"4\" />"); stringBuffer.append("<category label=\"5\" />"); stringBuffer.append("<category label=\"6\" />"); stringBuffer.append("<category label=\"7\" />"); stringBuffer.append("<category label=\"8\" />"); stringBuffer.append("<category label=\"9\" />"); stringBuffer.append("<category label=\"10\" />"); stringBuffer.append("<category label=\"11\" />"); stringBuffer.append("<category label=\"12\" />"); stringBuffer.append("</categories>"); // DBデータを取得する stringBuffer.append("<dataset seriesName=\"2011年\">"); stringBuffer.append("<set value=\"25635\" />"); stringBuffer.append("<set value=\"12563\" />"); stringBuffer.append("<set value=\"15665\" />"); stringBuffer.append("<set value=\"15656\" />"); stringBuffer.append("<set value=\"16524\" />"); stringBuffer.append("<set value=\"12335\" />"); stringBuffer.append("<set value=\"56466\" />"); stringBuffer.append("<set value=\"22556\" />"); stringBuffer.append("<set value=\"44565\" />"); stringBuffer.append("<set value=\"22455\" />"); stringBuffer.append("<set value=\"41651\" />"); stringBuffer.append("<set value=\"14552\" />"); stringBuffer.append("</dataset>"); stringBuffer.append("<dataset seriesName=\"2012\">"); stringBuffer.append("<set value=\"45552\" />"); stringBuffer.append("<set value=\"14652\" />"); stringBuffer.append("<set value=\"12345\" />"); stringBuffer.append("<set value=\"14652\" />"); stringBuffer.append("<set value=\"43212\" />"); stringBuffer.append("<set value=\"52451\" />"); stringBuffer.append("<set value=\"12245\" />"); stringBuffer.append("<set value=\"12552\" />"); stringBuffer.append("<set value=\"11255\" />"); stringBuffer.append("<set value=\"11125\" />"); stringBuffer.append("<set value=\"11115\" />"); stringBuffer.append("<set value=\"23651\" />"); stringBuffer.append("</dataset>"); // 標準糸を設定する stringBuffer.append("<trendlines>"); stringBuffer.append("<line startValue=\"24000\" color=\"91C728\" displayValue=\"標準\" showOnTop=\"1\" />"); stringBuffer.append("</trendlines>"); stringBuffer.append("</chart>"); ActionContext ac = ActionContext.getContext(); HttpServletResponse response =