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; } } } }
精彩图集
精彩文章
热门标签
Iisftp.vbs
linux使用
360
见解
scp
使用指南
menu
测试
宽字节字符
字母数字组合
httpclient
判断编
SqlServer200
0day
JVM性能优化
nfc应用
引擎
开发环境
SWF动画截图
独立
goto函数
delegate
infile
LIFO
promise化
总记录
Parse
后台运
80004005
Nginx访问日志
细粒度审计
文件编码
SQL-INJECTIO
选项值
变量命名
linux安装mysql
MySQL索引
倒计时跳转
调整列宽
数字相加
触摸事件
元素移动
索引器
c异或运算
远程拷贝
应用程序开发
行政区划数据
强制不换行
编译python
$.post
文件目录操作
添加CSS类
ListActivity
开启curl
动态树
彩图
filter
essential
NGEN
双网关
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229

