Recently, we have seen useful things in the case of chaos in csdn. We have used jfreechart to achieve a lot of complex graphics,
Reprinted URL: http://www.java2000.net/f30
Below are a few simple examples:
<% @ Page Language = "Java" pageencoding = "UTF-8" %> <br/> <% @ page import = "org. jfree. data. category. *, org. jfree. chart. *, org. jfree. chart. plot. * "%> <br/> <% <br/> out. clearbuffer (); <br/> response. setcontenttype ("image/JPEG"); <br/> defaultcategorydataset dataset = new defaultcategorydataset (); <br/> dataset. addvalue (610, "Taian", "test1"); <br/> dataset. addvalue (540, "Taian", "Test2"); <br/> dataset. addvalue (320, "Taian", "test3"); <br/> dataset. addvalue (370, "Taian", "test4"); <br/> dataset. addvalue (130, "Taian", "test5"); <br/> jfreechart chart = chartfactory. createbarchart ("biangji", "xiaoliang", "roulei", dataset, plotorientation. vertical, false); <br/> JAVA. io. outputstream OS = response. getoutputstream (); <br/> javax. imageIO. imageIO. write (chart. createbufferedimage (500,300), "Jpeg", OS); <br/> OS. flush (); <br/> OS. close (); <br/>%> <br/>
Import Org. jfree. chart. chartfactory; <br/> Import Org. jfree. chart. chartframe; <br/> Import Org. jfree. chart. jfreechart; <br/> Import Org. jfree. data. general. defaultpiedataset; <br/> public class first {<br/> Public static void main (string [] ARGs) {</P> <p> defaultpiedataset DATA = new defapipiedataset (); <br/> data. setvalue ("catagory 1", 43.2); <br/> data. setvalue ("catagory 2", 27.9); <br/> data. setvalue ("catagory 3", 79.5); <br/> jfreechart chart = chartfactory. createpiechart ("sample pie chart", Data, true, true, false); <br/> chartframe frame = new chartframe ("first", chart); <br/> frame. pack (); <br/> frame. setvisible (true); <br/>}< br/>