fusionchart实现ZoomLine 资源 破解版 出口能力
最近的曲线需要用油画ZoomLine官方网站看了好几天,今天整理出来供大家参考使用
zoomline.html资源
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FusionCharts Free Documentation</title>
<!-- 脚本区域 start -->
<script type="text/javascript" src="js/FusionCharts.js"></script>
<script type="text/javascript" src="js/FusionChartsExportComponent.js"></script>
<!-- 脚本区域 end -->
<script type="text/javascript">
//导出图片调用的方法
function startExport(){
var chart = getChartFromId("myFusionExport"); //生成的FusionCharts图表本身的标识
if (chart.hasRendered()){
chart.exportChart();
}else{
alert("Please wait for the chart to finish rendering, before you can invoke exporting");
}
}
</script>
</head>
<table width="98%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td valign="top" class="text" align="center">
<div id="myFusion" align="center">
FusionCharts.
</div>
<script type="text/javascript">
var chart = new FusionCharts("charts/ZoomLine.swf", "myFusionExport", "790", "450");
chart.setDataURL("data/zoomLine.xml");
chart.render("myFusion");
</script>
</td>
</tr>
<input type='button' value='导出FusionCharts图片' onClick="startExport();" />
</table>
</html>
zoomLine.xml源码
<chart
palette="1"
showLabels="0"
showBorder="1"
chartLeftMargin="10"
chartRightMargin="5"
chartTopMargin="15"
chartBottomMargin="15"
exportEnabled="1"
exportAtClient="0"
exportHandler="FCExporter"
showExportDialog="1"
animation="0"
exportFileName="fusioncharts"
exportDialogMessage="正在导出,请稍候..."
rotateLabels="0"
DIVLINES="Blur"
DATATOOLTIP="0x004E98"
showValues="0"
allowPinMode="1"
showVDivLines="1"
drawToolbarButtons="1"
lineThickness="1"
oolBarBtnHPadding="0"
mouseCursorColor="#FF0000"
toolTipBarColor="FF0000"
pinPaneBgColor="#FFFFFF"
lineColor="#0000FF"
divLineColor="#FF0000"
background="#0000FF"
bgColor="#FFFFFF"
scrollColor="#FFFFFF"
canvasBorderColor="#FF0000"
toolbarButtonColor="FFFFFF"
btnZoomOutTitle=" "
zoomOutMenuItemLabel=" "
btnResetChartTitle="缩小"
btnSwitchtoZoomModeTitle="切换Pin模式"
btnSwitchToPinModeTitle="切换Zoom模式"
showToolBarButtonTooltext="0"
toolbarButtonFontColor="000000"
>
<categories>
<category name="02-03 07:00:05" />
<category name="02-03 06:59:35" />
<category name="02-03 06:59:05" />
<category name="02-03 06:58:35" />
<category name="02-03 06:58:04" />
<category name="02-03 06:57:34" />
<category name="02-03 06:57:04" />
<category name="02-03 06:56:34" />
<category name="02-03 06:56:04" />
<category name="02-03 06:55:33" />
</categories>
<dataset>
<set value="300" />
<set value="349" />
<set value="627" />
<set value="445" />
<set value="623" />
<set value="575" />
<set value="567" />
<set value="576" />
<set value="745" />
<set value="409" />
</dataset>
</chart>
以上基本实现了图表的显示工作。假设须要导出还须要下面代码
FCExporterFormat.java源码
package com.fusioncharts.exporter.resources;
import javax.servlet.http.HttpServletResponse;
import com.fusioncharts.exporter.beans.ExportBean; public abstract class FCExporterFormat { abstract public Object exportProcessor(ExportBean exportBean); abstract public String exportOutput(Object exportObj,
HttpServletResponse response);
}
FCExporterIMG.java源码
package com.fusioncharts.exporter.resources; import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;
import com.fusioncharts.exporter.ErrorHandler;
import com.fusioncharts.exporter.FusionChartsExportHelper;
import com.fusioncharts.exporter.beans.ChartMetadata;
import com.fusioncharts.exporter.beans.ExportBean;
import com.fusioncharts.exporter.encoders.BasicEncoder;
import com.fusioncharts.exporter.encoders.JPEGEncoder;
import com.fusioncharts.exporter.generators.ImageGenerator; public class FCExporterIMG extends FCExporterFormat { private ExportBean exportBean = null; public String exportOutput(Object exportObj, HttpServletResponse response) {
String action = (String)exportBean.getExportParameterValue("exportaction");
String exportFormat = (String)exportBean.getExportParameterValue("exportformat");
String exportTargetWindow = (String)exportBean.getExportParameterValue("exporttargetwindow"); String fileNameWithoutExt = (String)exportBean.getExportParameterValue("exportfilename");
String extension = FusionChartsExportHelper.getExtensionFor(exportFormat.toLowerCase());;
String fileName = fileNameWithoutExt+"."+ extension; StringBuffer err_warn_Codes = new StringBuffer(); BufferedImage chartImage = (BufferedImage)exportObj;
boolean isHTML = false;
if(action.equals("download"))
isHTML=true; String noticeMessage = "";
String meta_values= exportBean.getMetadataAsQueryString(null,false,isHTML); if(action.equals("download")){
try {
response.setContentType(FusionChartsExportHelper.getMimeTypeFor(exportFormat.toLowerCase())); OutputStream os = response.getOutputStream(); if(exportTargetWindow.equalsIgnoreCase("_self")){
response.addHeader("Content-Disposition", "attachment; filename=\""+fileName+"\"");
//response.addHeader("Content-length",""+ios.length());
} else {
response.addHeader("Content-Disposition", "inline; filename=\""+fileName+"\"");
}
if( exportFormat.toLowerCase().equalsIgnoreCase("jpg") || exportFormat.toLowerCase().equalsIgnoreCase("jpeg")){
JPEGEncoder jpegEncoder = new JPEGEncoder();
try {
jpegEncoder.encode(chartImage,os);
os.flush();
}catch(Throwable e){
//Unable to encode the buffered image
System.out.println("Unable to (JPEG) encode the buffered image");
err_warn_Codes.append("E516,");
//os.flush();
// Note forward will not work in this case, as the output stream has already been opened
// Hence we have to output the error directly.
meta_values =exportBean.getMetadataAsQueryString(null,true,isHTML);
// Reset the response to set new content type and use out instead of outputstream
response.reset();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print(meta_values+noticeMessage+ErrorHandler.buildResponse(err_warn_Codes.toString(),isHTML));
return null;
}
chartImage=null;
} else { BasicEncoder basicEncoder = new BasicEncoder();
try {
basicEncoder.encode(chartImage,os,1F,exportFormat.toLowerCase());
os.flush();
}catch(Throwable e){
System.out.println("Unable to encode the buffered image");
err_warn_Codes.append("E516,");
//os.flush();
// Note forward will not work in this case, as the output stream has already been opened
// Hence we have to output the error directly.
meta_values =exportBean.getMetadataAsQueryString(null,true,isHTML);
// Reset the response to set new content type and use out instead of outputstream
response.reset();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print(meta_values+noticeMessage+ErrorHandler.buildResponse(err_warn_Codes.toString(),isHTML));
return null;
}
chartImage=null;
} } catch (IOException e) {
e.printStackTrace();
}
} if(err_warn_Codes.indexOf("E") != -1) {
meta_values =exportBean.getMetadataAsQueryString(null,true,isHTML);
PrintWriter out;
try {
out = response.getWriter();
out.print(meta_values+noticeMessage+"&statusCode=1&statusMessage=successful");
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
} public Object exportProcessor(ExportBean pExportBean) {
exportBean = pExportBean;
String stream = (String)exportBean.getStream();
ChartMetadata metadata= exportBean.getMetadata();
BufferedImage chartImage = ImageGenerator.getChartImage(stream,metadata); return chartImage;
} }
FCExporter.java源码
package com.fusioncharts.exporter.servlet; import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fusioncharts.exporter.ErrorHandler;
import com.fusioncharts.exporter.FusionChartsExportHelper;
import com.fusioncharts.exporter.beans.ExportBean;
import com.fusioncharts.exporter.resources.FCExporterFormat; public class FCExporter extends HttpServlet { public FCExporter() {
super();
} public void init(ServletConfig config) throws ServletException {
super.init(config);
} public void destroy() {
super.destroy();
} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
} protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext sc = getServletContext();
String WEB_ROOT_PATH = sc.getRealPath("/");
ExportBean localExportBean = FusionChartsExportHelper.parseExportRequestStream(request); String exportFormat = (String)localExportBean.getExportParameterValue("exportformat");
String exportTargetWindow = (String)localExportBean.getExportParameterValue("exporttargetwindow");
StringBuffer err_warn_Codes = new StringBuffer();
if (localExportBean.getMetadata().getWidth() == -1 ||
localExportBean.getMetadata().getHeight() == -1 ||
localExportBean.getMetadata().getWidth() == 0 ||
localExportBean.getMetadata().getHeight() == 0 ) { //If Width/Height parameter is not sent, the ChartMetadata will have width/height as -1
//Raise Error E101 - Width/Height not found
err_warn_Codes.append("E101,");
} if (localExportBean.getMetadata().getBgColor() == null) {
//Background color not available
err_warn_Codes.append("W513,");
} if (localExportBean.getStream() == null ) { //If image data not available
//Raise Error E100
err_warn_Codes.append("E100,");
}
String exportAction = (String)localExportBean.getExportParameterValue("exportaction");
boolean isHTML = false;
if(exportAction.equals("download"))
isHTML=true; if(!exportAction.equals("download")) {
String fileNameWithoutExt = (String)localExportBean.getExportParameterValue("exportfilename");
String extension = FusionChartsExportHelper.getExtensionFor(exportFormat.toLowerCase());;
String fileName = fileNameWithoutExt+"."+ extension;
err_warn_Codes.append(ErrorHandler.checkServerSaveStatus(WEB_ROOT_PATH,fileName));
}
String pathToWebAppRoot = getServletContext().getRealPath("/");
localExportBean.addExportParameter("webapproot", pathToWebAppRoot);
String meta_values= localExportBean.getMetadataAsQueryString(null,true,isHTML);
if(err_warn_Codes.indexOf("E") != -1) {
// There are errors - forward to error page
writeError(response,""+isHTML,err_warn_Codes.toString(),meta_values,exportTargetWindow); } else {
// get the exporter for this format
//String path = FusionChartsExportHelper.getExporterFilePath(exportFormat).replace(" ","");
// gives with .jsp extension, let us remove the extension - this is a work-around until next release, where Servlets will also be supported
//int indexOfDot = path.lastIndexOf(".");
//String exporterClassName = path.substring(0, indexOfDot);
try {
//Class exporterClass = Class.forName(exporterClassName);
Class exporterClass = Class.forName("com.fusioncharts.exporter.resources.FCExporterIMG");
FCExporterFormat fcExporter = (FCExporterFormat)exporterClass.newInstance();
Object exportObject = fcExporter.exportProcessor(localExportBean);
String status= fcExporter.exportOutput(exportObject, response);
} catch (ClassNotFoundException e) {
err_warn_Codes.append("E404");
writeError(response,""+isHTML,err_warn_Codes.toString(),meta_values,exportTargetWindow);
} catch (InstantiationException e) {
err_warn_Codes.append("E404");
writeError(response,""+isHTML,err_warn_Codes.toString(),meta_values,exportTargetWindow);
} catch (IllegalAccessException e) {
err_warn_Codes.append("E404");
writeError(response,""+isHTML,err_warn_Codes.toString(),meta_values,exportTargetWindow);
}
}
}
private void writeError(HttpServletResponse response, String isHTML, String errorCodes, String otherMessages, String exportTargetWindow) {
if(isHTML==null){
isHTML = "true";
}
if(otherMessages==null){
otherMessages="";
}
if(errorCodes==null){
errorCodes="";
}
response.setContentType("text/html");
if(exportTargetWindow.equalsIgnoreCase("_self")){
response.addHeader("Content-Disposition", "attachment;");
} else {
response.addHeader("Content-Disposition", "inline;");
}
PrintWriter out;
try {
out = response.getWriter();
out.print(ErrorHandler.buildResponse(errorCodes,new Boolean(isHTML).booleanValue())) ; out.print(otherMessages);
} catch (IOException e) { }
}
}
web.xml配置
<? xml version="1.0" encoding="UTF-8"? >
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet>
<display-name>FCExporter</display-name>
<servlet-name>FCExporter</servlet-name>
<servlet-class>com.fusioncharts.exporter.servlet.FCExporter</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FCExporter</servlet-name>
<url-pattern>/FCExporter</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>zoomline.html</welcome-file>
</welcome-file-list>
</web-app>
fusionchart实现ZoomLine 资源 破解版 出口能力的更多相关文章
- mac svn cornerstone 破解版资源以及使用方法(仅供学习,非商业使用)
mac svn 可视化客户端,找了好久,不知道是我搜索的有问题还是怎么了,没有特别好用的. 后来发现了一个大神做的破解版的 cornerstone,具体大神的博客我给忘记了,后续找到会贴出地址,以供膜 ...
- PyCharm for Mac(Python 开发工具)破解版安装
1.软件简介 PyCharm 是 macOS 系统上一款 Python 编辑利器,具有智能代码编辑器,能理解 Python 的特性并提供卓越的生产力推进工具:自动代码格式化.代码完成.重构.自动 ...
- CorelCAD for Mac(绘图设计软件)破解版安装
1.软件简介 CorelCAD 是 macOS 系统上的 CAD 绘图工具,为我们提供了获取本地 DWG 格式的高性能 CAD 设计解决方案.打开.处理和保存 .DWG 文件,实现轻松协作.借助 ...
- Duplicate Manager Pro for Mac(重复文件查找工具)破解版安装
1.软件简介 Duplicate Manager Pro 是 macOS 系统上一款重复文件查找工具,可以帮你在 Mac 电脑上查找出磁盘上面的重复文件,然后让你对这些重复文件进行判断并删除,使 ...
- Adobe Photoshop for Mac(图像处理软件)破解版安装
1.软件简介 Adobe Photoshop(简称 "PS")是 macOS 系统上一款由 Adobe Systems 开发和发行的图像处理软件.Photoshop 主要处理 ...
- Visual Assist X 10.6.1837完美破解版(带VS2010破解)
Visual Assist X 10.6.1837完美破解版(带VS2010破解) 实用软件, 资源分享Add comments 八102011 转载自:http://www.blog.namind. ...
- Axure RP 各个版本中文版 汉化包 破解版 下载地址及注册码
导读:Axure RP Pro是一个产品经理必备的交互原型设计工具,能够高效率制作产品原型,快速绘制线框图.流程图.网站架构图.示意图.HTML模版等.Axure RP已被一些大公司采用.Axure ...
- InstallShield12豪华版破解版下载|InstallShield下载|软件打包工具
InstallShield 12 豪华版+破解版 下载 下载速度:220kb/s InstallShield 12为软件发行方提供率先的安装程序解决方式,可以制作强大可靠的Windows Instal ...
- 完美:adobe premiere cs6破解版下载[序列号+汉化包+破解补丁+破解教程]
原文地址:http://blog.sina.com.cn/s/blog_6306f2c60102f5ub.html 完美:adobe premiere cs6破解版下载,含序列号.汉化包.注册机.破解 ...
随机推荐
- 【 2017 Multi-University Training Contest - Team 9 && hdu 6162】Ch’s gift
[链接]h在这里写链接 [题意] 给你一棵树,每个节点上都有一个权值. 然后给你m个询问,每个询问(x,y,a,b); 表示询问x->y这条路径上权值在[a,b]范围内的节点的权值和. [题解] ...
- [求助]linux同一目录可否挂载多个数据盘?
https://bbs.aliyun.com/read/281222.html?pos=20
- Oracle分页查询的一个存储过程:
create or replace procedure AspNetOraclePager( tableName in varchar2, --表名 fields in var ...
- 代码适配Masonry使用的详细介绍
Masonry简介 Masonry是一个轻量级的布局框架,它拥有自己的描述语法(采用更优雅的链式语法封装)来自动布局,具有很好可读性且同时支持iOS和Max OS X等.总之,对于侧重写代码的code ...
- 自己定义Dialog的具体步骤(实现自己定义样式一般原理)
转载请标注转载http://blog.csdn.net/oqihaogongyuan/article/details/50958659 自己定义Dialog的具体步骤(实现自己定义样式一般原理) ...
- [Nuxt] Add CSS Libraries to Nuxt
You can easily add CSS libraries to Nuxt using yarn or npm to install them, then simply adding them ...
- mysql快速入门 分类: B6_MYSQL 2015-04-28 14:31 284人阅读 评论(0) 收藏
debian方式: apt-get install mysql-server-5.5 mysql -u root -p redhat安装方式 一.下载并解压 $ wget http://cdn ...
- php spl标准库简介(SPL是Standard PHP Library(PHP标准库)(直接看代码实例,特别方便)
php spl标准库简介(SPL是Standard PHP Library(PHP标准库)(直接看代码实例,特别方便) 一.总结 直接看代码实例,特别方便易懂 thinkphp控制器利眠宁不支持(说明 ...
- Java 开发规约插件
阿里巴巴 Java 开发规约插件初体验 阿里巴巴 Java 开发手册 又一次来谈<阿里巴巴 Java 开发手册>,经过这大半年的版本迭代,这本阿里工程师们总结出来避免写出那么多 Bug 的 ...
- 一个例子讲解wav头文件 stm32声音程序 录音和播放 wav
下面我们一wav头文件来分析一下: 下面是双声道的,16位,48000采样录的wav文件: 打开属性,能看到的有用信息只有比特率了: 上图的比特率就是 wav头文件里的bitrate: 1536kbp ...