protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZLEnum.Auth.other, "ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } string ChartID = base.Request.QueryString["ChartID"]; chart = B_ADZone.getChartByChartID(DataConverter.CLng(ChartID)); int ChartWidth = chart.ChartWidth; int ChartHeight = chart.ChartHeight; string ChartTitle = chart.ChartTitle; string ChartUnit = chart.ChartUnit; string strUrl = HttpContext.Current.Request.Url.Authority.ToString(); //string strRaw = HttpContext.Current.Request.Url.PathAndQuery.ToString(); string ChartType = Request["ChartType"]; strUrl = "http://" + strUrl; string str = ""; str += "<iframe src=\"" + strUrl; str += "/Plugins/Chart/Show.aspx?Did=" + ChartID; str += "\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" scrolling=\"no\" "; str += "width=\"" + (ChartWidth + 80) + "\"" + " height=\"" + (ChartHeight + 80) + "\"" + ">"; str += "</iframe>"; TxtChartCode.Text = str; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + customPath2 + "Plus/ADManage.aspx'>广告管理</a></li><li><a href='../Plus/ChartManage.aspx'>图表管理</a></li><li class='active'>获取图表代码</li>"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string src = ""; chart = B_ADZone.getChartByChartID(DataConverter.CLng(Request.QueryString["Did"])); try { if (chart.ChartType == "线状图")//曲线 { if (Request.QueryString["width"] == null || Request.QueryString["height"] == null) { src = "Line.aspx?Cid=" + Request.QueryString["Did"]; Bbiao.Attributes.Add("width", chart.ChartWidth.ToString()); Bbiao.Attributes.Add("height", chart.ChartHeight.ToString()); } else { src = "Line.aspx?Cid=" + Request.QueryString["Did"] + "&width=" + Request.QueryString["width"] + "&height=" + Request.QueryString["height"]; Bbiao.Attributes.Add("width", Request.QueryString["width"]); Bbiao.Attributes.Add("height", Request.QueryString["height"]); } } else if (chart.ChartType == "柱状图")//柱状 { if (Request.QueryString["width"] == null || Request.QueryString["height"] == null) { src = "colum.aspx?Cid=" + Request.QueryString["Did"]; Bbiao.Attributes.Add("width", chart.ChartWidth.ToString()); Bbiao.Attributes.Add("height", chart.ChartHeight.ToString()); } else { src = "colum.aspx?Cid=" + Request.QueryString["Did"] + "&width=" + Request.QueryString["width"] + "&height=" + Request.QueryString["height"]; Bbiao.Attributes.Add("width", Request.QueryString["width"]); Bbiao.Attributes.Add("height", Request.QueryString["height"]); } } else if (chart.ChartType == "饼状图")//饼状 { if (Request.QueryString["width"] == null || Request.QueryString["height"] == null) { src = "pie-basic.aspx?Cid=" + Request.QueryString["Did"]; Bbiao.Attributes.Add("width", chart.ChartWidth.ToString()); Bbiao.Attributes.Add("height", chart.ChartHeight.ToString()); } else { src = "pie-basic.aspx?Cid=" + Request.QueryString["Did"] + "&width=" + Request.QueryString["width"] + "&height=" + Request.QueryString["height"]; Bbiao.Attributes.Add("width", Request.QueryString["width"]); Bbiao.Attributes.Add("height", Request.QueryString["height"]); } } } catch (Exception) { Response.Write("数据不存在!"); } Bbiao.Attributes.Add("src", src); } }
private static ChartCall GetChartInfos(SqlDataReader rdr) { ChartCall info = new ChartCall(); info.ChartTitle = rdr["ChartTitle"].ToString(); info.ChartType = rdr["ChartType"].ToString(); info.ChartUnit = rdr["ChartUnit"].ToString(); info.ChartHeight = DataConverter.CLng(rdr["ChartHeight"]); info.ChartWidth = DataConverter.CLng(rdr["ChartWidth"]); info.CharData = rdr["CharData"].ToString(); rdr.Close(); return(info); }
private static void GetChartParameter(ChartCall chart, ref SqlParameter[] parameter) { parameter = new SqlParameter[] { new SqlParameter("@ChartID", SqlDbType.Int, 4), new SqlParameter("@ChartTitle", SqlDbType.NVarChar, 255), new SqlParameter("@ChartType", SqlDbType.NVarChar, 255), new SqlParameter("@ChartUnit", SqlDbType.NVarChar, 255), new SqlParameter("@ChartWidth", SqlDbType.Int, 4), new SqlParameter("@ChartHeight", SqlDbType.Int, 4), new SqlParameter("@CharData", SqlDbType.NText) }; parameter[0].Value = chart.ChartID; parameter[1].Value = chart.ChartTitle; parameter[2].Value = chart.ChartType; parameter[3].Value = chart.ChartUnit; parameter[4].Value = chart.ChartWidth; parameter[5].Value = chart.ChartHeight; parameter[6].Value = chart.CharData; }
public static bool Chart_Update(ChartCall Chart) { return(false); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Did"] != null) { string src = ""; chart = B_ADZone.getChartByChartID(DataConverter.CLng(Request.QueryString["Did"])); if (chart.ChartType == "线状图")//曲线 { src = "Line.aspx?Cid=" + Request.QueryString["Did"]; } else if (chart.ChartType == "柱状图")//柱状 { src = "colum.aspx?Cid=" + Request.QueryString["Did"]; } else if (chart.ChartType == "饼状图")//饼状 { src = "pie-basic.aspx?Cid=" + Request.QueryString["Did"]; } Response.Write(chart.ChartWidth + "|" + chart.ChartHeight + "|" + src); Response.End(); } if (Request.QueryString["Datas"] == null) { if (Request.QueryString["Cid"] == "0") { string[] wihi = Request.QueryString["wihi"] == null ? "300|200".Split('|') : Request.QueryString["wihi"].Split('|'); try { BiaoS.Width = wihi[0]; BiaoS.Height = wihi[1]; BiaoS.Title = "示例"; BiaoS.unit = ""; BiaoS.X = "['a',1],['b',2],['c',3]"; } catch (Exception) { Response.Write("<font color='red'>数据错误!</font>"); } } else { chart = B_ADZone.getChartByChartID(DataConverter.CLng(Request.QueryString["Cid"])); if (Request.QueryString["width"] == null || Request.QueryString["height"] == null) { BiaoS.Width = chart.ChartWidth.ToString(); BiaoS.Height = chart.ChartHeight.ToString(); } else { BiaoS.Width = Request.QueryString["width"]; BiaoS.Height = Request.QueryString["height"]; } BiaoS.Title = chart.ChartTitle; BiaoS.unit = chart.ChartUnit; string[] Datas = chart.CharData.Split('|'); string[] y = Datas[1].Split(','); string Xy = ""; string[] x = Datas[0].Split(','); for (int i = 0; i < y.Length; i++) { Xy += "['" + y[i] + "'," + x[i] + "],"; } BiaoS.Y = ""; BiaoS.X = Xy.TrimEnd(','); } } else { string[] Bases = Request.QueryString["Bases"].Split('|'); string[] Coordinate = Request.QueryString["Datas"].Split('|'); BiaoS.Width = Bases[0]; BiaoS.Height = Bases[1]; BiaoS.Title = Bases[2]; BiaoS.unit = Bases[3]; string[] y = Coordinate[1].Split(','); string Xy = ""; string[] x = Coordinate[0].Split(','); for (int i = 0; i < y.Length; i++) { Xy += "['" + y[i] + "'," + x[i] + "],"; } BiaoS.Y = ""; BiaoS.X = Xy.TrimEnd(','); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Datas"] != null) { type = Request.QueryString["type"] == null ? "1" : Request.QueryString["type"]; Bases = Request.QueryString["Bases"].Split('|'); Coordinate = Request.QueryString["Datas"].Split('^'); try { string[] ys = { }; string x = ""; string y = ""; bool yis = false; for (int i = 0; i < Coordinate.Length; i++) { ys = Coordinate[i].Trim().TrimStart('{').TrimEnd('}').Split('|'); x += "{name:'" + ys[0] + "',marker:{symbol: 'square' }, data: [" + ys[1] + "]},"; if (!yis) { foreach (string item in ys[2].Split(',')) { y += "'" + item + "',"; yis = true; } } } if (type == "1") { BiaoS.Width = Bases[0]; BiaoS.Height = Bases[1]; BiaoS.Title = Bases[2]; BiaoS.unit = Bases[3]; BiaoS.Y = y; BiaoS.X = x.TrimEnd(','); } } catch (Exception) { Response.Write("<font color='red'>数据错误!</font>"); } } else { if (Request.QueryString["Cid"] == "0") { string[] wiHi = Request.QueryString["wihi"] == null ? "300|200".Split('|') : Request.QueryString["wihi"].Split('|'); try { BiaoS.Width = wiHi[0]; BiaoS.Height = wiHi[1]; BiaoS.Title = "示例"; BiaoS.unit = "位"; BiaoS.Y = "'a','b','c'"; BiaoS.X = "{name:'2011', data: [1,2,3]},{name:'2012', data: [2,4,7]}"; } catch (Exception) { Response.Write("<font color='red'>数据错误!</font>"); } } else { chart = B_ADZone.getChartByChartID(DataConverter.CLng(Request.QueryString["Cid"])); if (Request.QueryString["width"] == null || Request.QueryString["height"] == null) { BiaoS.Width = chart.ChartWidth.ToString(); BiaoS.Height = chart.ChartHeight.ToString(); } else { BiaoS.Width = Request.QueryString["width"]; BiaoS.Height = Request.QueryString["height"]; } BiaoS.Title = chart.ChartTitle; BiaoS.unit = chart.ChartUnit; string[] Datas = chart.CharData.Split('^'); string[] Cys = { }; string Cx = ""; string Cy = ""; bool Cyis = false; for (int i = 0; i < Datas.Length; i++) { Cys = Datas[i].Trim().TrimStart('{').TrimEnd('}').Split('|'); Cx += "{name:'" + Cys[0] + "', data: [" + Cys[1] + "]},"; if (!Cyis) { foreach (string item in Cys[2].Split(',')) { Cy += "'" + item + "',"; Cyis = true; } } } BiaoS.Y = Cy; BiaoS.X = Cx.TrimEnd(','); } } } }