FusionCharts free(跨平台跨浏览器的flash图形报表)
从http://www.infosoftglobal.com/站点下载免费版本到本地,解压到本地,取出 JSClass目录和Charts 目录下所有文件拷贝到你的网站chart目录下,即可开始FusionCharts的使用之旅。
一、开始一个简单的demo
1. 在你的网站根目录下新建 Data.xml文档,作为图表的数据源,内容如下:
<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showNames='1' decimalPrecision='0' formatNumberScale='0'><set name='Jan' value='462' color='AFD8F8' /><set name='Feb' value='857' color='F6BD0F' /><set name='Mar' value='671' color='8BBA00' /><set name='Apr' value='494' color='FF8E46' /><set name='May' value='761' color='008E8E' /><set name='Jun' value='960' color='D64646' /><set name='Jul' value='629' color='8E468E' /><set name='Aug' value='622' color='588526' /><set name='Sep' value='376' color='B3AA00' /><set name='Oct' value='494' color='008ED6' /><set name='Nov' value='761' color='9D080D' /><set name='Dec' value='960' color='A186BE' /></graph>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>第一个Flash图表页面</title><!-- 引入FusionCharts 需要的JS脚本文件 --><script language="JavaScript" src="chart/FusionCharts.js"></script></head><body><div id="chartDiv" align="center">First Chart Container Pie 3D</div><script type="text/javascript"> var myChart1 = new FusionCharts("chart/FCF_Column3D.swf", "myChartId", "600", "350"); myChart1.setDataURL("Data.xml"); myChart1.render("chartDiv");</script></body></html>
<%@ page language="java" contentType="text/xml; charset=UTF-8"%><% String xmlStr = "<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showNames='1' decimalPrecision='0' formatNumberScale='0'>" + "<set name='Jan' value='462' color='AFD8F8' />" + "<set name='Feb' value='857' color='F6BD0F' />" + "<set name='Mar' value='671' color='8BBA00' />" + "<set name='Apr' value='494' color='FF8E46' />" + "<set name='May' value='761' color='008E8E' />" + "<set name='Jun' value='960' color='D64646' />" + "<set name='Jul' value='629' color='8E468E' />" + "<set name='Aug' value='622' color='588526' />" + "<set name='Sep' value='376' color='B3AA00' />" + "<set name='Oct' value='494' color='008ED6' />" + "<set name='Nov' value='761' color='9D080D' />" + "<set name='Dec' value='960' color='A186BE' />" + "</graph>"; out.write(xmlStr);%>
<!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>使用字符串充当数据源</title><script language="JavaScript" src="chart/FusionCharts.js"></script></head><body><div id="chartDiv" align="center"> Chart Container Pie 3D</div> <script type="text/javascript"> //数据源 var xmlData = "<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showNames='1' decimalPrecision='0' formatNumberScale='0'>" + "<set name='Jan' value='462' color='AFD8F8' />" + "<set name='Feb' value='857' color='F6BD0F' />" + "<set name='Mar' value='671' color='8BBA00' />" + "<set name='Apr' value='494' color='FF8E46' />" + "<set name='May' value='761' color='008E8E' />" + "<set name='Jun' value='960' color='D64646' />" + "<set name='Jul' value='629' color='8E468E' />" + "<set name='Aug' value='622' color='588526' />" + "<set name='Sep' value='376' color='B3AA00' />" + "<set name='Oct' value='494' color='008ED6' />" + "<set name='Nov' value='761' color='9D080D' />" + "<set name='Dec' value='960' color='A186BE' />" + "</graph>"; var myChart1 = new FusionCharts("chart/FCF_Column3D.swf", "myChartId", "600", "350"); myChart1.setDataXML(xmlData); myChart1.render("chartDiv"); </script></body></html>