最近的曲线需要用油画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 资源 破解版 出口能力的更多相关文章

  1. mac svn cornerstone 破解版资源以及使用方法(仅供学习,非商业使用)

    mac svn 可视化客户端,找了好久,不知道是我搜索的有问题还是怎么了,没有特别好用的. 后来发现了一个大神做的破解版的 cornerstone,具体大神的博客我给忘记了,后续找到会贴出地址,以供膜 ...

  2. PyCharm for Mac(Python 开发工具)破解版安装

    1.软件简介    PyCharm 是 macOS 系统上一款 Python 编辑利器,具有智能代码编辑器,能理解 Python 的特性并提供卓越的生产力推进工具:自动代码格式化.代码完成.重构.自动 ...

  3. CorelCAD for Mac(绘图设计软件)破解版安装

    1.软件简介    CorelCAD 是 macOS 系统上的 CAD 绘图工具,为我们提供了获取本地 DWG 格式的高性能 CAD 设计解决方案.打开.处理和保存 .DWG 文件,实现轻松协作.借助 ...

  4. Duplicate Manager Pro for Mac(重复文件查找工具)破解版安装

    1.软件简介    Duplicate Manager Pro 是 macOS 系统上一款重复文件查找工具,可以帮你在 Mac 电脑上查找出磁盘上面的重复文件,然后让你对这些重复文件进行判断并删除,使 ...

  5. Adobe Photoshop for Mac(图像处理软件)破解版安装

    1.软件简介    Adobe Photoshop(简称 "PS")是 macOS 系统上一款由 Adobe Systems 开发和发行的图像处理软件.Photoshop 主要处理 ...

  6. Visual Assist X 10.6.1837完美破解版(带VS2010破解)

    Visual Assist X 10.6.1837完美破解版(带VS2010破解) 实用软件, 资源分享Add comments 八102011 转载自:http://www.blog.namind. ...

  7. Axure RP 各个版本中文版 汉化包 破解版 下载地址及注册码

    导读:Axure RP Pro是一个产品经理必备的交互原型设计工具,能够高效率制作产品原型,快速绘制线框图.流程图.网站架构图.示意图.HTML模版等.Axure RP已被一些大公司采用.Axure ...

  8. InstallShield12豪华版破解版下载|InstallShield下载|软件打包工具

    InstallShield 12 豪华版+破解版 下载 下载速度:220kb/s InstallShield 12为软件发行方提供率先的安装程序解决方式,可以制作强大可靠的Windows Instal ...

  9. 完美:adobe premiere cs6破解版下载[序列号+汉化包+破解补丁+破解教程]

    原文地址:http://blog.sina.com.cn/s/blog_6306f2c60102f5ub.html 完美:adobe premiere cs6破解版下载,含序列号.汉化包.注册机.破解 ...

随机推荐

  1. C#执行sql文件

    C# 执行sql文件 2012-05-11 12:28:57|  分类: App Develop|举报|字号 订阅       /// <summary>         /// 执行sq ...

  2. 中英文对照 —— 标点符号(punctuation)

    有限的几个: What Are the Fourteen Punctuation Marks in English Grammar? period:句号:comma:逗号:冒号:colon:分号:se ...

  3. C语言深度解剖读书笔记

    开始本节学习笔记之前,先说几句题外话.其实对于C语言深度解剖这本书来说,看完了有一段时间了,一直没有时间来写这篇博客.正巧还刚刚看完了国嵌唐老师的C语言视频,觉得两者是异曲同工,所以就把两者一起记录下 ...

  4. 关于DOM的有关总结

    1.获取DOM元素 document.getElementById()  通过id获取DOM元素 document.getElementsByClassName() 通过类名获取DOM元素 docum ...

  5. Mysql从入门到精通整理

    目录 mysql基础 mysql进阶 mysql高级 mysql优化 正文 数据库是信息化产业的最基础的软件之一,各种管理系统,网站,在线游戏,背后基本都会有数据库的支持. 回到顶部 mysql基础 ...

  6. 搭建聊天机器人Bot Framework

    Bot Framework 搭建聊天机器人 这周我来跟大家分享的是在Microsoft Build 2016上发布的微软聊天机器人的框架. 现如今,各种人工智能充斥在我们的生活里.最典型的人工智能产品 ...

  7. 中间件、服务器和Web服务器三者的区别

    相信很多的Web安全初学者和我一样,对中间件和服务器的认识不够深刻,对两者的概念可能会有所混淆. 正好今天在学习的时候突然想到了这个问题,粗略百度了一下,似乎网上对这个问题的解释不多,那么就由我来为大 ...

  8. HDU 1287 破译密码 异或运算

    http://acm.hdu.edu.cn/showproblem.php?pid=1287 题目: 有个叫"猪头帮"的国家,采用一种简单的文法加密,他们所用的语言里面只有大写字母 ...

  9. occcont.cpp 925

    将InitInstance()中调用的 InitATL() 替换为 AfxOleInit()即可.

  10. spring mvc controller间跳转 重定向 传参(转)

    spring mvc controller间跳转 重定向 传参 url:http://zghbwjl.blog.163.com/blog/static/12033667220137795252845/ ...