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,
后台实现:
Code [http://www.xueit.com]
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>"); } } } }
提供子报表数据的处理程序代码:
Code [http://www.xueit.com]
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; } } } }
精彩图集
精彩文章
热门标签
糗百图片
人数
unref()
事件管理
安装方
子程序
信号
导致定时器失
扩展插件
灾难性故障
strpos函数
循环集合
检测lvs
CDATA的作用说明
BMP
字
ORM
三元运算符
modu
直接
简单的
伪装
soap消
ff
id未定义
tar命令错误
coroutine
修改文件名
数目
磁盘管理
安装配置
竖排
对象指针
受访
提交事件
窗口传参
php php写
Socks5
控制符
js基础教程
opendir(
phpnow
排序去重
内存溢出
name
php PHP自
易理解
对象初始值
jsp文件
WPF
等待处理
文件上传控件
枚举窗口句柄
consistent
javascript知识
hashCode
时分秒
口语化
异步执行
动态图片
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229

