前台界面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="FusionCharts/FusionCharts.js"> </script> </head> <body> <form id="form1" runat="server"> <div> <tr> <td> <%=xmlstr%> </td> </tr> </div> </form> </body> </html>
底层的东西都给封装了 #region 程序集 FusionCharts.dll, v2.0.50727 // D:\char2\Bin\FusionCharts.dll #endregion using System; namespace InfoSoftGlobal { public class FusionCharts { public FusionCharts(); public static string EncodeDataURL(string dataURL, bool noCacheStr); public static string RenderChart(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS); public static string RenderChart(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS, bool transparent); public static string RenderChart(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS, bool transparent, string bgColor, string scaleMode, string language); public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode); public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS); public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS, bool transparent); public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS, bool transparent, string bgColor, string scaleMode, string language); } }
下面试一下饼图
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using InfoSoftGlobal; public partial class _Default : System.Web.UI.Page { public string xmlstr = ""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { data(); } } public void data() { StringBuilder a =new StringBuilder(); a.Append("<chart caption='生命周期' pieSliceDepth='30' baseFontSize='12' formatNumberScale='0' bgAlpha='100' numberSuffix=''>"); a.Append("<set label='儿童' value='6' />"); a.Append("<set label='老年' value='686' />"); a.Append("<set label='青年' value='2318' />"); a.Append("<set label='少年' value='0' />"); a.Append("<set label='中年' value='7433' />"); a.Append("</chart>"); string c = a.ToString(); xmlstr = FusionCharts.RenderChart("/FusionCharts/Pie3D.swf", "", a.ToString(), "FactorySum5", "600", "480", false, false, true); }