FusionCharts控件导出为JPG或PDF文件的操作步骤
来源:互联网 发布:网络十大禁书小说下载 编辑:程序博客网 时间:2024/05/30 04:42
FusionCharts控件导出为JPG或PDF文件的操作步骤:
1:拷贝FusionCharts文件夹到网站根目录,其中里面含有必备的swf文件,比如常见的有:Column2D.swf,Column3D.swf,MSCombi2D.swf等
2:拷贝JS脚本文件,并在页面上添加对它的引用:
<script src="../FusionCharts/FusionCharts.js" type="text/javascript"></script>
3:构造XML文件或XML字符串,注意设置好以下属性:
exportEnabled='1' exportAction='Download' exportAtClient='0' exportHandler='../Export_Handler/FCExporter.aspx'
说明:
exportAction='Download' ,客户端可下载或直接打开
exportAction='Save' ,保存到服务器
代码示例:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test2.aspx.cs" Inherits="Test2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../FusionCharts/FusionCharts.js" type="text/javascript"></script>
<script type="text/javascript">
// this function exports chart from JavaScript
function exportChart(exportFormat) {
// checks if exportexportFormatChart function is present and call exportChart function
//注意调用的是productSales,而不是productSalesDiv
if (FusionCharts("productSales").exportChart)
FusionCharts("productSales").exportChart({ "exportFormat": exportFormat });
else
alert("Please wait till the chart completes rendering...");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="Flash">
<!-- START Script Block for Chart productSales -->
<div id="productSalesDiv" align="center" style="width: 755px; height: 160px;">
</div>
<script type="text/javascript">
var gPoints = "50;50;50;50;50;50;50;50;0";
var gPhsycalPoints = "<dataset seriesName='体质得分' color='108DD9' ><set value='50' /><set color='EB573D' value='50' /><set value='50' /><set value='50' /><set value='50' /><set value='50' /><set value='50' /><set value='50' /><set value='0' /></dataset>";
var arrPoint = new Array();
arrPoint = gPoints.split(";");
//MSCombi2D.swf
var chart_productSales = new FusionCharts("../FusionCharts/MSCombi2D_2010.swf", "productSales", "755", "160", "0", "0");
chart_productSales.setTransparent("false");
var strXML = "<chart exportEnabled='1' exportAction='Download' exportAtClient='0' exportHandler='../Export_Handler/FCExporter.aspx' baseFont='pmingliu' baseFontSize='11' showValues='0' showBorder='0' bgColor='FFFFFF' canvasBorderThickness='0' canvasBorderAlpha='50' plotGradientColor='' showPlotBorder='0' showAlternateHGridColor='0' divLineAlpha='0' chartTopMargin='0' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='0' showLegend='0' showYAxisValues='0' toolTipBorderColor='cccccc' toolTipBgColor='ffffff'>";
strXML += "<categories><category label='平和质' /><category label='气虚质' /><category label='阳虚质' /><category label='阴虚质' /><category label='痰湿质' /><category label='湿热质' /><category label='血瘀质' /><category label='气郁质' /><category label='特秉质' /></categories>";
strXML += gPhsycalPoints;
strXML += "<dataset seriesName='全国平均' renderAs='Line' color='A3E205' lineThickness='2'><set value='60' /><set value='39' /><set value='42' /><set value='36' /><set value='36' /><set value='41' /><set value='39' /><set value='41' /><set value='26' /></dataset>";
strXML += "<trendLines><line startValue='30' color='B8B8B8' displayvalue='倾向' dashed='1' valueOnRight='1'/> <line startValue='40' color='EB573D' displayvalue='判定' valueOnRight='1'/></trendLines></chart>";
chart_productSales.setDataXML(strXML);
//myChart.setDataURL("Data.xml"); //设置数据文件的地址 (如果XML字符过长)
chart_productSales.render("productSalesDiv");
</script>
<!-- END Script Block for Chart productSales -->
</div>
<input value="Export to JPG" type="button" onclick="JavaScript:exportChart('JPG')" />
<input value="Export to PNG" type="button" onclick="JavaScript:exportChart('PNG')" />
<input value="Export to PDF" type="button" onclick="JavaScript:exportChart('PDF')" />
</form>
</body>
</html>
- FusionCharts控件导出为JPG或PDF文件的操作步骤
- Java 实现 FusionCharts 图表导出图片或PDF文件功能
- FusionCharts保存为图片或PDF
- R语言中的导出为pdf文件或txt文件的注意事项
- FusionCharts fcexporter.jar图表导出图片或pdf功能
- 如何将FusionCharts图表导出为图像/PDF
- 用VBA导出Excel里的图表为JPG文件
- 用VBA导出Excel里的图表为JPG文件
- 拆分PDF文件的操作步骤
- flex 保存控件为jpg或png
- NSImage 存储为jpg或png文件的方法
- 将JPG图片直接转换成PDF软件操作步骤
- Repeater控件中的数据导出为Excel或Word文件
- apache poi导出Excel或Pdf文件
- pdf转换成txt文件的操作步骤解析
- 将多页PDF文件转换为多张JPG图片
- 把PDF文件多张转换为JPG单张
- 怎样可以快速将pdf文件转换为jpg图片
- C++异常处理体会,希望对大家学习有帮助
- MySQL Cluster 7.0.36 发布
- 清理webzip标记
- 只爱你能爱上的,才叫门当户对
- Java 根据url下载图片保存到本地
- FusionCharts控件导出为JPG或PDF文件的操作步骤
- [转]MySQL存储过程调试工具
- 自定义控件
- mysql获取插入ID
- 技术&坚持
- 连通图的割点、割边(桥)、块、缩点,有向图的强连通分量
- 你为什么会孤独?
- properties 资源文件解析工具
- VeryMule网上商城