The first step: the introduction of the Fusioncharts file, the version used is: Fusioncharts 3.2.1 (amount, share version, you understand, follow-up provide download link) support Genuine, official address: http://www.fusioncharts.com/
Step two: Introduce the Fcexporter.jar package (image export function library) and configure the following code in the Web. xml file
<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>
The third step: Add the test XML file, the actual development should use the dynamic URL pattern, otherwise the browser will have a cache
<chart basefont= ' Arial ' basefontsize= ' decimals= ' 0 ' exportenabled= ' 1 ' exportatclient= ' 0 ' exportaction= ' Download ' exportdialogmessage= ' is exporting, please wait ... ' exporthandler= ' fcexporter ' exportshowmenuitem= ' 1 ' exportformats= ' JPG= Export as JPG picture | png= export to PNG pictures | pdf= Export to PDF file ' formatnumberscale= ' 0 ' showvalues= ' 1 ' caption= ' total sales distribution for each heading year ' subcaption= ' 2014 ' exportfilename= ' 2014 Annual total sales distribution map ' palette= ' 4 ' numberprefix= ' ¥ ' ><categories><category label= ' "></category> <category label= ' ></category><category label= ' ></category><category label= ' 04 ' ></category><category label= ' ></category><category label= ' ></category> <category label= ' ></category><category label= ' ></category><category label= ' 09 ' ></category><category label= ' ></category><category label= ' one ' ></category> <category label= ' ></category></categories><set label= ' mobile hdd ' value= ' 3200000 ' ></set><set label= ' desktop computer ' value= ' 3200000 ' ></set><set label= ' multifunction machine ' value= ' 4600000 ' ></set></chart>
Fourth step: Writing a JSP file
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding=" UTF-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >Fifth step: Start the project and see the effect.
Complete Example: http://download.csdn.net/detail/for_china2012/8314697
Java Implementation Fusioncharts Chart export picture or PDF file function