Use the Visifire Statistical Chart in Jsp

Source: Internet
Author: User

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

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.