- 浏览: 170842 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
917380319:
找了N多个,就你的能在安卓远程调用,谢谢了
Web Service修炼之二Xfire+Spring -
alpenliebe:
马克一下,日后学习
知识收集9【原创】 -
leo_lnx:
very good,顶大兵!
知识收集3【原创】 -
fengyuan_2012:
不错...
SSH搭建的框架,提供源码 -
影非弦:
没有效果图看啊
FusionChart实现的动态统计图
FusionCharts.jsp
<%!//Page: FusionCharts.jsp
//Author: InfoSoft Global (P) Ltd.
//This page contains functions that can be used to create FusionCharts.
/**
* Encodes the dataURL before it's served to FusionCharts.
* If you have parameters in your dataURL, you necessarily need to encode it.
* @param strDataURL - dataURL to be fed to chart
* @param addNoCacheStr - Whether to add aditional string to URL to disable caching of data
* @return
*/
public String encodeDataURL(String strDataURL, String addNoCacheStr,
HttpServletResponse response) {
String encodedURL = strDataURL;
//Add the no-cache string if required
if (addNoCacheStr.equals("true")) {
/*We add ?FCCurrTime=xxyyzz
If the dataURL already contains a ?, we add &FCCurrTime=xxyyzz
We send the date separated with '_', instead of the usual ':' as FusionCharts cannot handle : in URLs
*/
java.util.Calendar nowCal = java.util.Calendar.getInstance();
java.util.Date now = nowCal.getTime();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
"MM/dd/yyyy HH_mm_ss a");
String strNow = sdf.format(now);
if (strDataURL.indexOf("?") > 0) {
encodedURL = strDataURL + "&FCCurrTime=" + strNow;
} else {
strDataURL = strDataURL + "?FCCurrTime=" + strNow;
}
encodedURL = response.encodeURL(strDataURL);
}
return encodedURL;
}
/**
* Creates the Chart HTML+Javascript to create the FusionCharts object with the given parameters.
* This method uses JavaScript to overcome the IE browser problem with SWF wherein you have to 'Click to activate' the control
* @param chartSWF - SWF File Name (and Path) of the chart which you intend to plot
* @param strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
* @param strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
* @param chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
* @param chartWidth - Intended width for the chart (in pixels)
* @param chartHeight - Intended height for the chart (in pixels)
* @param debugMode - Whether to start the chart in debug mode
* @param registerWithJS - Whether to ask chart to register itself with JavaScript
*/
public String createChart(String chartSWF, String strURL, String strXML,
String chartId, int chartWidth, int chartHeight, boolean debugMode,
boolean registerWithJS) {
StringBuffer strBuf = new StringBuffer();
/*
First we create a new DIV for each chart. We specify the name of DIV as "chartId"Div.
DIV names are case-sensitive.
*/
strBuf.append("<!--START Script Block for Chart -->\n");
strBuf.append("\t\t<div id='" + chartId + "Div' align='center'>\n");
strBuf.append("\t\t\t\tChart.\n");
/*The above text "Chart" is shown to users before the chart has started loading
(if there is a lag in relaying SWF from server). This text is also shown to users
who do not have Flash Player installed. You can configure it as per your needs.*/
strBuf.append("\t\t</div>\n");
/*Now, we render the chart using FusionCharts Class. Each chart's instance (JavaScript) Id
is named as chart_"chartId".*/
strBuf.append("\t\t<script type='text/javascript'>\n");
//Instantiate the Chart
Boolean registerWithJSBool = new Boolean(registerWithJS);
Boolean debugModeBool = new Boolean(debugMode);
int regWithJSInt = boolToNum(registerWithJSBool);
int debugModeInt = boolToNum(debugModeBool);
strBuf.append("\t\t\t\tvar chart_" + chartId + " = new FusionCharts('"
+ chartSWF + "', '" + chartId + "', '" + chartWidth + "', '"
+ chartHeight + "', '" + debugModeInt + "', '" + regWithJSInt
+ "');\n");
//Check whether we've to provide data using dataXML method or dataURL method
if (strXML.equals("")) {
strBuf.append("\t\t\t\t//Set the dataURL of the chart\n");
strBuf.append("\t\t\t\tchart_" + chartId + ".setDataURL(\"" + strURL
+ "\");\n");
} else {
strBuf.append("\t\t\t\t//Provide entire XML data using dataXML method\n");
strBuf.append("\t\t\t\tchart_" + chartId + ".setDataXML(\"" + strXML
+ "\");\n");
}
strBuf.append("\t\t\t\t//Finally, render the chart.\n");
strBuf.append("\t\t\t\tchart_" + chartId + ".render(\"" + chartId + "Div\");\n");
strBuf.append("\t\t</script>\n");
strBuf.append("\t\t<!--END Script Block for Chart-->\n");
return strBuf.substring(0);
}
/**
* Creates the Chart HTML to embed the swf object with the given parameters
* @param chartSWF - SWF File Name (and Path) of the chart which you intend to plot
* @param strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
* @param strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
* @param chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
* @param chartWidth - Intended width for the chart (in pixels)
* @param chartHeight - Intended height for the chart (in pixels)
* @param debugMode - Whether to start the chart in debug mode
*/
public String createChartHTML(String chartSWF, String strURL,
String strXML, String chartId, int chartWidth, int chartHeight,
boolean debugMode) {
/*Generate the FlashVars string based on whether dataURL has been provided
or dataXML.*/
String strFlashVars = "";
Boolean debugModeBool = new Boolean(debugMode);
if (strXML.equals("")) {
//DataURL Mode
strFlashVars = "chartWidth=" + chartWidth + "&chartHeight="
+ chartHeight + "&debugMode=" + boolToNum(debugModeBool)
+ "&dataURL=" + strURL + "";
} else {
//DataXML Mode
strFlashVars = "chartWidth=" + chartWidth + "&chartHeight="
+ chartHeight + "&debugMode=" + boolToNum(debugModeBool)
+ "&dataXML=" + strXML + "";
}
StringBuffer strBuf = new StringBuffer();
// START Code Block for Chart
strBuf.append("\t\t<!--START Code Block for Chart-->\n");
strBuf
.append("\t\t\t\t<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"
+ chartWidth
+ "' height='"
+ chartHeight
+ "' id='"
+ chartId + "'>\n");
strBuf.append("\t\t\t\t <param name='allowScriptAccess' value='always' />\n");
strBuf.append("\t\t\t\t <param name='movie' value='" + chartSWF + "'/>\n");
strBuf.append("\t\t\t\t<param name='FlashVars' value=\"" + strFlashVars
+ "\" />\n");
strBuf.append("\t\t\t\t <param name='quality' value='high' />\n");
strBuf
.append("\t\t\t\t<embed src='"
+ chartSWF
+ "' FlashVars=\""
+ strFlashVars
+ "\" quality='high' width='"
+ chartWidth
+ "' height='"
+ chartHeight
+ "' name='"
+ chartId
+ "' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\n");
strBuf.append("\t\t</object>\n");
// END Code Block for Chart
strBuf.append("\t\t<!--END Code Block for Chart-->\n");
return strBuf.substring(0);
}
/**
* Converts boolean to corresponding integer
* @param bool - The boolean that is to be converted to number
* @return int - 0 or 1 representing the given boolean value
*/
public int boolToNum(Boolean bool) {
int num = 0;
if (bool.booleanValue()) {
num = 1;
}
return num;
}
%>
basicchart.jsp:
<%
/*
We've included ../Includes/FusionCharts.jsp, which contains functions
to help us easily create the charts that can be embedded.
*/
%>
<%@ include file="../fusionchart/FusionCharts.jsp"%>
<HTML>
<HEAD>
<TITLE>FusionCharts - Simple Column 3D Chart</TITLE>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</HEAD>
<BODY>
<CENTER>
<h2>FusionCharts Examples</h2>
<h4>Basic example using pre-built Data.xml</h4>
<%
/*
This page demonstrates the ease of generating charts using FusionCharts.
For this chart, we've used a pre-defined Data.xml (contained in /Data/ folder)
Ideally, you would NOT use a physical data file. Instead you'll have
your own JSP to create the XML data document. Such examples are also present.
For a head-start, we've kept this example very simple.
*/
//Create the chart - Column 3D Chart with data from Data/Data.xml
String chartHTMLCode=createChartHTML("../share/flash/charts/Column3D.swf", "../share/xml/charts/Data.xml", "", "myFirst", 600, 300, false);
%> <%=chartHTMLCode%> <BR>
<BR>
</CENTER>
</BODY>
</HTML>
- Column3D.rar (54.8 KB)
- 下载次数: 1241
- Data.rar (306 Bytes)
- 下载次数: 211
发表评论
-
jCharts用户指南翻译第六章 轴图表
2009-02-21 14:41 12606.轴图表 这是轴图表部分 6.1 -
jCharts用户指南翻译第五章 饼图图表
2009-02-18 08:49 19025.饼图图表 引言 这部分覆盖了jCharts饼图 ... -
jCharts用户指南翻译第四章 图例
2009-02-17 08:36 10384.图例 4.1默认行为默认下,图例会放到绘制区域下,所有的 ... -
jCharts用户指南翻译第三章 全部图表
2009-02-16 08:24 16563.全部图表 3.1输出图片 编码 经过 ... -
jCharts用户指南翻译第二章 安装
2009-02-13 19:17 12902.安装 2.1下载 最新的发布 去获取jcharts最 ... -
jCharts用户指南翻译第一章 前言
2009-02-13 19:11 1227由于用户指南都是英文的,本人只好为了以后别人方便阅读,特此翻译 ... -
jcharts开发
2009-02-10 17:36 1564java源代码: public class BarChart ... -
FusionChart中Using dataXML method in direct HTML
2009-02-03 13:39 1061Using dataXML method in dire ... -
<OBJECT> 和<EMBED>标签的区别
2009-02-03 11:54 4283<html> <head> ... -
最新版本的jfreechart-1.0.12解决中文支持问题
2009-01-21 20:01 2250最新版本的jfreechart-1.0. ...
相关推荐
最近做的项目中需要用饼状图显示——'问卷调查'的统计结果(之前用过FusionChart做过柱状图的数据展示,那还是两年前的事了),在网上查了下FusionChart实现饼状图显示方面的资料,却发现资料都比较零散、不完整,或者...
FusionCharts是一个基于Web的图表组件,支持多种浏览器和平台,它通过接收数据源并将其转化为动态、美观的图表来展示数据。其优点在于丰富的图表类型选择,如柱状图、饼图、线图、地图等,并且提供了良好的用户交互...
1. **图表类型**:FusionCharts提供了超过90种图表类型,涵盖了各种常见的统计图表,如条形图、线图、饼图等,同时支持自定义样式和颜色。 2. **交互性**:用户可以通过鼠标悬停、点击图表元素获取详细信息,支持...
FusionCharts支持多种图表类型,如柱状图、饼图、线图、面积图、散点图、组合图等,适用于各种业务场景,例如销售报告、数据分析、项目管理等。通过使用FusionCharts,开发者可以轻松地将JSON或XML格式的数据转化为...
本主题将深入探讨如何在C#应用中集成SWF(ShockWave Flash)文件播放以及如何利用FusionCharts库生成动态、交互式的统计图表。这在C/S(客户端/服务器)架构的应用程序中尤其有用,可以增强用户界面的吸引力和功能性...
这款工具特别适合IT专业人士、数据分析师以及网页开发者,用于在网站或应用程序中展示统计信息和数据报告。中文文档对于中国用户来说尤其方便,能够帮助他们更好地理解和应用FusionCharts。 在"fusionChart中文文档...
它支持多种图表类型,包括柱状图、饼形图、线形图、散点图等,适用于数据分析、业务报告、网站统计等多个领域。FusionCharts不仅提供了美观的外观,还强调用户体验,让用户能够轻松地理解并探索数据。 **二、报表...
在这个"fusionchart 小例子 Java+Servlet"项目中,我们将探讨如何结合Java后端技术和Servlet来实现FusionCharts的功能。 首先,`Java`是一种广泛使用的后端编程语言,它提供了强大的功能来处理数据和业务逻辑。在这...
本实例结合ASP.NET与SQLServer,旨在展示如何通过一条SQL语句快速构建动态统计图,为用户提供丰富的数据分析体验。 首先,我们来看ASP.NET框架。ASP.NET是由微软开发的一种服务器端编程模型,用于构建动态Web应用...
它支持多种图表类型,如折线图、柱状图、饼图等,这些图表都可以通过JavaScript进行便捷的调用和交互,使得在网页中实现动态、美观的数据展示变得简单易行。 在JavaScript库的支持下,FusionCharts提供了丰富的API...
**FusionCharts 全面解析:打造视觉盛宴的报表统计图** FusionCharts 是一款功能强大的图表库,专为创建互动式、美观的报表和统计图而设计。它以其丰富的图表类型、高度自定义和易用性,在IT行业内赢得了广泛的赞誉...
综上所述,FusionCharts的SWF文件是实现强大数据可视化的关键,它们结合JavaScript和服务器端技术,为用户提供了一种直观、互动的方式来展示和理解数据。通过学习和利用这些SWF文件,开发者和数据分析师可以更好地...
例如,`updateData`方法可用于动态更新图表数据: ```javascript chart.updateData('新数据源'); ``` 总结,FusionCharts是一个强大的JavaScript图表库,适合在网页应用中构建高质量的数据可视化。通过理解其安装...
在实训中,学生需要学习如何将图书销售或借阅统计数据转化为直观的图表,例如条形图、饼图等。 5. **数据导出至Excel**:系统还涵盖了将数据库中的数据导出到Excel的功能,这对于数据分析和报表生成非常实用。这...
2. **丰富的图表类型**:FusionCharts提供了大量不同类型的图表,如线图、柱状图、饼图、雷达图、热力图等,满足了用户在数据分析和展示时的多样化需求。 3. **交互性**:这些图表不仅外观精美,还具有高度的交互性...
1. **丰富的图表类型**:FusionCharts 支持超过 90 种不同类型的图表,涵盖了统计分析、时间序列、地理分布等多个领域。 2. **跨平台与跨浏览器**:由于基于 JavaScript 和 HTML5,FusionCharts 可在所有主流浏览器...