FusionCharts的使用總結(java)

因爲系統原先使用的就fusioncharts,最近老闆要求升級,並提供下載功能。 javascript

  1. 去網上下載了最新版的FusionCharts: http://www.fusioncharts.com/。下載完成後名爲:fusioncharts-suite-xt.zip
  2. 能夠先參考下官方入門文檔,寫的很詳細並且有例子。各類圖表都有(固然我不須要太複雜的),還要地圖圖表很強大(但貌似中國地圖有三種,還要沒

    臺灣的…) html

  3. 具體記錄如下兩個重點:
    1. 下載:有兩種下載方式:client and private server

      Client:下載官方文檔說支持firefox和chrome可是個人chrome不行(肯定chrome是最新版),可是firefox可行 html5

          exportEnable:"1" //在chart熟悉中加上這句圖標右上方出現下載圖標 雖然實現簡單(調用html5的api),可是不少瀏覽器不支持 java

      Server:     個人是linux服務器(windows有必定的差別)須要Inkscape ImageMagick 的支持,具體不一樣系統安裝方式不一樣。安裝成功後配置web.xml linux

<servlet> 

<display-name>FCExporter</display-name> web

<servlet-name>FCExporter</servlet-name> chrome

<servlet-class>com.fusioncharts.exporter.servlet.FCExporter</servlet-class> windows

<load-on-startup>1</load-on-startup> api

</servlet> 瀏覽器

<servlet-mapping>

<servlet-name>FCExporter</servlet-name>

<url-pattern>/JSP/ExportExample/FCExporter</url-pattern>

</servlet-mapping>

FusionCharts中有一個java-export的文件夾裏面有jar文件,導入到lib中

增長fusioncharts_export.properties:

# Please specify the path to a folder with write permissions

# The exported image/PDF files would be saved here (for Linux based server SAVEPATH should be changed to relative or absolute path accordingly)

SAVEPATH = /JSP/ExportExample/ExportedImages/

 

# This constant HTTP_URI stores the HTTP reference to

# the folder where exported charts will be saved.

# Please enter the HTTP representation of that folder

# in this constant e.g., http://www.yourdomain.com/images/

HTTP_URI = http://localhost:8081/ExportHandler/JSP/ExportExample/ExportedImages/

 

# OVERWRITEFILE sets whether the export handler would overwrite an existing file

# the newly created exported file. If it is set to false the export handler would

# not overwrite. In this case if INTELLIGENTFILENAMING is set to true the handler

# would add a suffix to the new file name. The suffix is a randomly generated UUID.

# Additionally, you can add a timestamp or random number as additional prefix.

FILESUFFIXFORMAT = TIMESTAMP

OVERWRITEFILE = false

INTELLIGENTFILENAMING = true

 

# Set the path of Inkscape here(Only for Windows)

INKSCAPE_PATH = C:\\Program Files (x86)\\Inkscape

 

# Set the path of ImageMagick here(Only for Windows)

IMAGEMAGICK_PATH = C:\\Program Files\\ImageMagick-6.9.0-Q16

在chart中:

注意exportHandler要配置到web.xml中配置的servlet url-pattern exportAction:"download"下載到client

  1. 去掉fusionchart xt trial的水印logo:用js操做svg

    給body增長onload事件 onload="complete();"

    <script type="text/javascript">

    function changeTspan(){

        var tspans = document.getElementsByTagName('tspan');

        var len = tspans.length;

        var tp = tspans[len-1];

        //alert(tp.innerHTML);

        tp.innerHTML = '1';

    }

    function complete(){

        setTimeout(

            "changeTspan()",    

            500

        );

    }

    若是當前頁面有多個圖這個方法要修改,可是方法同樣

    具體不是很瞭解fusionchartrender()方法,原先是直接在render方法後執行的,但沒有效果

相關文章
相關標籤/搜索