Sunshinecharts is a simple and practical report. Its deployment and practical tutorials are as follows:
Http://blog.csdn.net/arjick/article/details/6702268
This article mainly teaches you how to use the sunshinecharts pie chart.
Pie chart data XML:
<? XML version = "1.0" encoding = "UTF-8"?> <Data DEBUG = "off" showdatatips = "true" legend = "true" autorefreshpolicy = "off" labelposition = "NONE" autorefreshtime = "180" Title = "" showalldatatips = "false "clicktype =" pop "backgroudcolor =" 0 xffffff "> <node value =" 31403000 "label =" unknown _ 8 hours 43 minutes 23 seconds "Description =" unknown _ 8 hours 43 minutes 23 seconds "color =" 0x454926 "/> <node value =" 8728000 "label =" available _ 2 hours 25 minutes 28 seconds "Description =" available _ 2 hours 25 minute 28 seconds "color =" 0x00ff00 "/> <node value =" 360000 "label =" unavailable _ 6 minutes "Description =" unavailable _ 6 minutes "color =" 0X000000 "/> </data>
1. Data
Debug: whether to enable the debugging mode
Showdatatips: Indicates whether a pie chart displays a prompt.
Legend: whether to display the legend:
Autorefreshpolicy: whether to enable automatic refresh
Labelposition: indicates the position of the rock block.
Title: Title
Showalldatatips: whether to display all prompts
Clicktype: Click the pie chart.
Backgroudcolor: Background Color
2. Node
Value: the number of squares.
Description: The color of the square.
Color: block color
HTML embedding mode:
HTML source code
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"width="100%" height="100%" id="pieChart"><param name="movie" value="SunshineCharts.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="flashvars"value="type=pieChart&dataUrl=xml/PieChartData.xml&cleanCache=off" /><!--[if !IE]>--><object type="application/x-shockwave-flash"data="SunshineCharts.swf" width="100%" height="100%"><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="flashvars"value="type=pieChart&dataUrl=xml/PieChartData.xml&cleanCache=off" /><!--<![endif]--><!--[if gte IE 6]>--><p>Either scripts and active content are not permitted to run or AdobeFlash Player version 10.0.0 or greater is not installed.</p><!--<![endif]--><a href="http://www.adobe.com/go/getflashplayer"> </a><!--[if !IE]>--></object><!--<![endif]--></object>
Tag embedding code:
<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%><%@taglib uri="/WEB-INF/chartsTagLib" prefix="chart"%><%String path = request.getContextPath();String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Java code:
Package COM. shine. framework. charts. coffercharts. piecharts; public class piechartexample {/*** pie chart example ** @ Param ARGs */public static void main (string [] ARGs) {piechartshelper helper = new piechartshelper (); helper. addpiechart ("p1", 10, "0xffff00", "Pie 1"); helper. addpiechart ("p2", 10, "0xff00ff", "Pie 2"); helper. addpiechart ("P3", 10, "0x00ffff", "Pie 3"); system. out. println (helper. getdataxml ());}}
Source code of the data generation class
Package COM. shine. framework. charts. coffercharts. piecharts; import Java. util. arraylist; import Java. util. list; import Org. dom4j. document; import Org. dom4j. export enthelper; import Org. dom4j. element; import COM. shine. framework. charts. coffercharts. linecharts. line; import COM. shine. framework. core. util. xmluitl; public class piechartshelper {private String title = ""; private string autorefreshpolicy = "on"; private string autorefreshtime = "180"; private string DEBUG = "off "; private string clicktype = "pop"; private string backgroudcolor = "0 xffffff"; private string showdatatips = "true"; private string showalldatatips = "false "; private string labelposition = "callout"; private string legend = "true"; private list <piechartmodel> pielist = NULL; Public piechartshelper () {pielist = new arraylist <piechartmodel> ();} /*** Add a pie chart ** @ Param label * @ Param value * @ Param color * @ Param Description */Public void addpiechart (string label, int value, string color, string description) {piechartmodel model = new piechartmodel (Label, value, color, description); pielist. add (model);} Public String getdataxml () {document = incluenthelper. createdocument (); element dataelement = document. addelement ("data"); dataelement. addattribute ("title", title); dataelement. addattribute ("autorefreshpolicy", autorefreshpolicy); dataelement. addattribute ("autorefreshtime", autorefreshtime); dataelement. addattribute ("debug", debug); dataelement. addattribute ("backgroudcolor", backgroudcolor); dataelement. addattribute ("clicktype", clicktype); dataelement. addattribute ("showdatatips", showdatatips); dataelement. addattribute ("showalldatatips", showalldatatips); dataelement. addattribute ("labelposition", labelposition); dataelement. addattribute ("legend", legend); For (piechartmodel model: pielist) {element nodeelement = dataelement. addelement ("Node"); nodeelement. addattribute ("label", model. getlabel (); nodeelement. addattribute ("value", String. valueof (model. getvalue (); nodeelement. addattribute ("color", model. getcolor (); nodeelement. addattribute ("Description", model. getdescription ();} return xmluitl.doc 2 string (document);} Public String gettitle () {return title;} public void settitle (String title) {This. title = title;} Public String getautorefreshpolicy () {return autorefreshpolicy;} public void setautorefreshpolicy (string autorefreshpolicy) {This. autorefreshpolicy = autorefreshpolicy;} Public String getautorefreshtime () {return autorefreshtime;} public void setautorefreshtime (string autorefreshtime) {This. autorefreshtime = autorefreshtime;} Public String getdebug () {return debug;} public void setdebug (string Debug) {This. DEBUG = debug;} Public String getclicktype () {return clicktype;} public void setclicktype (string clicktype) {This. clicktype = clicktype;} Public String getbackgroudcolor () {return backgroudcolor;} public void setbackgroudcolor (string backgroudcolor) {This. backgroudcolor = backgroudcolor;} Public String getshowdatatips () {return showdatatips;} public void setshowdatatips (string showdatatips) {This. showdatatips = showdatatips;} Public String getshowalldatatips () {return showalldatatips;} public void setshowalldatatips (string showalldatatips) {This. showalldatatips = showalldatatips;} Public String getlegend () {return legend;} public void setlegend (string legend) {This. legend = legend;} Public String getlabelposition () {return labelposition;} public void setlabelposition (string labelposition) {This. labelposition = labelposition ;}}
: