1、XML提供数据源

Pyramid.xml:

<?xml version="1.0" encoding="UTF-8"?>
<chart manageresize="1" animation="0" decimals="0" caption="一周分布人数" baseFontSize="18"
showpercentvalues="1" smartlinecolor="333333" showborder="0" showtooltipshadow="1" >
<set value="48940" label="星期一" />
<set value="67845" label="星期二" />
<set value="50421" label="星期三" />
<set value="27850" label="星期四" />
<set value="40121" label="星期五" />
<set value="78455" label="星期六" />
<set value="56454" label="星期日" />
</chart>

2、页面源码

Pyramid.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>FusionChart金字塔图</title>
<script type="text/javascript" src="../Scripts/JS/jquery-1.10.2.js"></script>
<script type="text/javascript" src="../Chart/JS/FusionCharts.js"></script>
<script type="text/javascript">
$(function(){
var pyramid = new FusionCharts( "../Chart/SWF/Pyramid.swf", "pyramidId", "1280", "550", "0" );
pyramid.setXMLUrl("xml/Pyramid.xml");
pyramid.render("Pyramid");
});
</script>
</head>
<body>
<div id="Pyramid"></div>
</body>
</html>

3、运行结果如下:

FusionChart实现金字塔分布图-LMLPHP

04-14 02:43