Visifire statistical charts have been introduced in previous articles. Visifire can be embedded in pages such as Asp, Asp.net, Php, and Jsp, however, when using Visifire on these pages, splicing xmal strings in javascript or server code is inconvenient. If you do not pay attention to it, spelling an error may occur. To facilitate the use of the Visifire Statistical Chart on the Jsp page, a small project is created to automatically generate a string in the xaml format according to the set value.
Several Classes in the project correspond to the corresponding elements in Visifire respectively. Through this small project, Visifire can be conveniently used in jsp.
Below is a small example:
First, reference the JspFire. jar package in the jsp project, and then you can use JspFire in jsp to create a Visifire chart.
<% @ Page contentType = "text/html" import = "net. designbased. jspfire. *" pageEncoding = "UTF-8" %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd"> <% Chart chart = new Chart (); // create a Chart instance chart. setAnimationEnabled (true); chart. setView3D (true); chart. setHeight (300d); chart. setWidth (500d); Title title Title = new Title (); // create a title instance Title. setEnabled (true); title. setText ("Jsp Visifire example"); chart. addTitle (title); DataSeries series = new DataSeries (); // create a Pie chart series. setRenderAs (ChartType. pie); series. setBevel (true); DataPoint dp1 = new DataPoint (); // create a data node dp1.setYValue ("10"); dp1.setLegendText ("good"); series. addDataPoint (dp1); DataPoint dp2 = new DataPoint (); dp2.setYValue ("14"); dp2.setLegendText ("general"); series. addDataPoint (dp2); DataPoint dp3 = new DataPoint (); dp3.setYValue ("32"); dp3.setLegendText ("very powerful"); series. addDataPoint (dp3); DataPoint dp4 = new DataPoint (); dp4.setYValue ("21"); dp4.setLegendText ("very bad"); series. addDataPoint (dp4); chart. addSeries (series); String xaml = chart. toString (); %>
This project has not yet implemented all the functions of Visifire. I will gradually improve it until all the functions of Visifire are implemented, and I will also create an identical project for Asp.net.
Download Sample Code: JspFireExample.zip or http://zdd.me/myfiles