FusionCharts 实现统计图


 1 .将fusionChart.jar 解压后的文件放入项目中

FusionCharts 实现统计图

2.在jsp页面导入

<script src="<%=request.getContextPath()%>/FusionCharts/Charts/FusionCharts.js" type="text/javascript"></script>

 3.jsp页面

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
   <s:hidden id="xmldataString" name="xmldataString"/>
  	<%@ include file="template/resource.jsp" %>
    <div >
    	<div id="chartContainer" style="position:absolute; left :100px "> 柱状图测试 </div>
    	<script type="text/javascript" >
    	    var xmldataString=$("#xmldataString").val();
    	//    alert(xmldataString);
    	    var myChart = new FusionCharts( "FusionCharts/Charts/Column3D.swf","myChartId", "800", "350", "0", "1" );
   			//myChart.setXMLUrl("testxml.xml");
   			myChart.setDataXML(xmldataString);
  			myChart.render("chartContainer");
    	    //showCharts(xml);
    	</script>
    	
    	
    </div>
</body>
</html>

 4.提供数据

package com.gaeainfo.toponymbase.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import com.gaeainfo.toponymbase.pojo.ChangeStatisticsObject;
import com.gaeainfo.toponymbase.pojo.ConsultStatisticsObject;

/**
 *  
 * 
 * 统计图的xml数据
 */
public class GetXmlData {
//这里根据需要封装你需要的xml 返回给前台 

	}

 

 

 

你可能感兴趣的:(FusionCharts)