Jquery实现FusionCharts遮罩效果,很不错(2)
后台实现: Code [http://www.xueit.com] using System; namespace FusionCharts_Jquery打造交换报表{ public partial class _Default : System.Web.UI.Page { protected void Page_Load( object sender,
后台实现:

using System; namespace FusionCharts_Jquery打造交换报表 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { System.Random rand = new Random();//保证得到最新的数据 RegisterStartupScript("c", "<script>ShowReport(" 550 "," 600 ",'Column','../Source/MonthReport.xml?id=" rand.Next(6000) "');</script>"); } } } }
提供子报表数据的处理程序代码:

using System.Web; using System.Data; using System.Text; using Newtonsoft.Json; using System.IO; namespace FusionCharts_Jquery打造交换报表.Model { public class GetDrill : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //获取参数,返回子报表数据,数据格式为Json if (!string.IsNullOrEmpty(context.Request.QueryString.GetValues("ParMonth")[0])) { string month = context.Request.QueryString.GetValues("ParMonth")[0]; context.Response.Write(GetDrillData(month)); } } //获取子报表数据,返回JSON数据 private string GetDrillData(string month) { //构建数据 DataTable table = new DataTable(); table.Columns.Add("First",typeof(string)); table.Columns.Add("Second", typeof(string)); table.Columns.Add("Third", typeof(string)); table.Columns.Add("Fourth", typeof(string)); for (int n = 1; n < 5; n ) { DataRow row = table.NewRow(); row[0] = month "月,第" n.ToString() "周,第1列!"; row[1] = month "月,第" n.ToString() "周,第2列!"; row[2] = month "月,第" n.ToString() "周,第3列!"; row[3] = month "月,第" n.ToString() "周,第4列!"; table.Rows.Add(row); } //使用第三方控件Newtonsoft.Json,解析DataTable为Json数据格式 StringBuilder sb = new StringBuilder(); System.IO.StringWriter sw = new StringWriter(sb); using (JsonWriter jw = new JsonTextWriter(sw)) { JsonSerializer ser = new JsonSerializer(); jw.WriteStartObject(); jw.WritePropertyName("DrillTable"); jw.WriteStartArray(); foreach (DataRow dr in table.Rows) { jw.WriteStartObject(); foreach (DataColumn dc in table.Columns) { jw.WritePropertyName(dc.ColumnName); ser.Serialize(jw, dr[dc].ToString()); } jw.WriteEndObject(); } jw.WriteEndArray(); jw.WriteEndObject(); sw.Close(); jw.Close(); } return sb.ToString(); } //// <summary> // //自定义方法,将DataTable转化为Json数据格式 // //</summary> // //<param name="dt">数据表</param> // //<returns>JSON字符串</returns> //public string CreateJsonParameters(DataTable dt) //{ // StringBuilder JsonString = new StringBuilder(); // if (dt != null && dt.Rows.Count > 0) // { // JsonString.Append("{ "); // JsonString.Append("\"TableInfo\":[ "); // for (int i = 0; i < dt.Rows.Count; i ) // { // JsonString.Append("{ "); // for (int j = 0; j < dt.Columns.Count; j ) // { // if (j < dt.Columns.Count - 1) // { // JsonString.Append("\"" dt.Columns[j].ColumnName.ToString() "\":" "\"" dt.Rows[i][j].ToString() "\","); // } // else if (j == dt.Columns.Count - 1) // { // JsonString.Append("\"" dt.Columns[j].ColumnName.ToString() "\":" "\"" dt.Rows[i][j].ToString() "\""); // } // } // if (i == dt.Rows.Count - 1) // { // JsonString.Append("} "); // } // else // { // JsonString.Append("}, "); // } // } // JsonString.Append("]}"); // return JsonString.ToString(); // } // else // { // return null; // } //} public bool IsReusable { get { return false; } } } }
精彩图集
精彩文章
热门标签
抓取网页正文
改变
指定日期
XML操作
自动增长列
最大Id
php php自定
数据库名
跨iframe
find函数
数据存储
按比例
创建目录
指令
选不中
注入数据库
JS多语言
twisted
select加锁
脚本自身修改
__setattr__
主从
DDL
Too
可逆加密算法
sup方法
线程并发
自增长
段空间
Oracle字符集
网络打印
svn
复制文件夹
横屏
Promise
php php写入
python函数
页面宽度
memcach
context
百度热词
发布apk
相
django-suit
for语句
四叉树
目录传输
无法解析
Tab_control控
android设计模式
ForLinux2.6
memcpy()
草稿
发布项目
iis配置php
打
分页问题
注解
$符
UDP
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229