The Jfreechart plugin shows the data as pie, histogram, and line charts.

Source: Internet
Author: User

This paper introduces the histogram as an example, of course, this is only a method; There are many ways to show charts, such as customizing chart labels, using Jfreechart plug-ins, and so on;

1, import JS file, including a lot of display methods:

The code is as follows:

<script type= "Text/javascript" Src=<select:link page= "/js/chartobject.js"/>></script> < Script type= "Text/javascript" Src=<select:link page= "/js/fusioncharts.js"/>></script>

2, from the background to obtain data:

1 2 3 4 5 6 7 8 9 function init () {var name3= "<%=request.getattribute" ("")%> "; var value3=" <%= Request.getattribute ("accountlist.values")%> "; var rate3= "<%=request.getattribute (" ACCOUNTLIST.VALUESHB ")%>"; SHOWCHART4 (Name3,rate3);   ShowChart3 (Name3,value3, ""); }

3. Assign the data to the legend:

1 2 3 4 5 6 7 8 9 10 11-12 function ShowChart4 (names,values) {var chartobj = new ChartObject (); var xmlstring= ""; chartobj.caption= "vehicle sales ratio map of each carrier unit"; chartobj.showvalues= ' 0 '; chartobj.showlabels= ' 1 '; chartobj.snumbersuffix= '%25 '; xmlstring = Chartobj.createdualymscolumnxmlbyvalues (Names,values, "", "pin ratio = Cigarette sales% vehicle capacity;", ""); var chart = new Fusioncharts ("charts/mscolumn3dlinedy.swf", "ChartId2", "1000", "230", "0", "0"); Chart.setdataxml (xmlstring); Chart.render ("ChartDiv2"); }

4, in the JSP page just write:


code is as follows:

&lt;div style= "MARGIN-TOP:3PX;MARGIN-LEFT:3PX;" &gt;&lt;span id= "ChartDiv2" style= "width:100%;" &gt;&lt;/span&gt;&lt;/div&gt;

5. The results are shown below:

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.