Default2.aspx.cs
上传用户:yinyuehua
上传日期:2022-08-10
资源大小:17k
文件大小:7k
源码类别:

matlab例程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using Microsoft.VisualBasic;
  12. using System.Collections.Generic;
  13. public partial class Default2 : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             ViewState["ChartType"] = "Z";
  20.             ViewState["Width"] = "550";
  21.             ViewState["HeightSplit"] = "10";
  22.             ViewState["Thickness"] = "20";
  23.             ViewState["ChartWidth"] = "20";
  24.             ViewState["VML"] = "";
  25.             this.Bind();
  26.             Initi(ViewState["ChartType"].ToString(),
  27.             Convert.ToInt32(ViewState["Width"].ToString()),
  28.             Convert.ToInt32(ViewState["HeightSplit"].ToString()),
  29.             Convert.ToInt32(ViewState["Thickness"].ToString()),
  30.             Convert.ToInt32(ViewState["ChartWidth"].ToString()));
  31.         }
  32.     }
  33.     private void Bind()
  34.     {
  35.         this.Labelconvert.Text = "10000";
  36.         this.Labelmoney.Text = "39392";
  37.        
  38.         this.Labelbank.Text ="34324";
  39.        
  40.         this.Labelchoushui.Text = "34232";
  41.         this.Labelall.Text ="34324";
  42.     }
  43.      private void Initi(string ChartType, int Width, int HeightSplit, int Thickness, int ChartWidth)
  44.     {
  45.         string title = "统计报表";
  46.         object[,] total = new object[6, 3];  //三维数组 1:链接地址;2
  47.         List<string> listval = new List<string>();
  48.         total[0, 0] = "0,";
  49.         total[1, 0] = "玩家兑换总值,List.aspx";   //
  50.         total[2, 0] = "抽水总值,List.aspx";
  51.         total[3, 0] = "玩家游戏币总值,List.aspx";
  52.         total[4, 0] = "银行总值,List.aspx";
  53.         total[5, 0] = "充值总记录,List.aspx";
  54.         listval.Add((Convert.ToDouble(this.Labelconvert.Text)).ToString());
  55.         listval.Add((Convert.ToDouble(this.Labelchoushui.Text)).ToString());
  56.         listval.Add((Convert.ToDouble(this.Labelmoney.Text)).ToString());
  57.         listval.Add((Convert.ToDouble(this.Labelbank.Text)).ToString());
  58.         listval.Add((Convert.ToDouble(this.Labelall.Text)).ToString());
  59.         total[1, 1] = listval[0].ToString();
  60.         total[2, 1] = listval[1].ToString();
  61.         total[3, 1] = listval[2].ToString();
  62.         total[4, 1] = listval[3].ToString();
  63.         total[5, 1] = listval[4].ToString();
  64.         ViewState["VML"] = ChartPic(title, total, ChartType, Width, HeightSplit, Thickness, ChartWidth);
  65.     }
  66.     private string ChartPic(string title, object[,] total, string ChartType, int Width, int HeightSplit, int Thickness, int ChartWidth)
  67.     {
  68.         ChartModule Chart = new ChartModule();
  69.         Chart.sys_chart_title = "<b>VML统计图</b>";
  70.         Chart.sys_chart_left = 90;
  71.         Chart.sys_chart_top = 200;
  72.         Chart.sys_all_width = 550;
  73.         Chart.sys_all_height = 330;
  74.         Chart.sys_height_split = 10;
  75.         Chart.sys_thickness = 20;
  76.         Chart.sys_chart_width = 20;
  77.         Chart.sys_split_color = "#69f";
  78.         Chart.sys_chart_backcolor = "#9cf";
  79.         Chart.sys_chart_type = "Y";
  80.         Chart.sys_color_list = "#FF1919,#FFFF19,#1919FF,#19FF19,#FC0,#3CC,#FF19FF,#993300,#F60,#FF8C19,#AAAAAA,#333333";
  81.         Chart.VMLStyle = "style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1'";
  82.         Chart.CHART_title = "<b>" + title + "<b>";//图表标题
  83.         Chart.YTitle = "金额";
  84.         Chart.XTitle = "类别";
  85.         Chart.UNIT = "元";//单位
  86.         Chart.CHART_left = 90;//居左
  87.         Chart.CHART_top = 200;//居顶
  88.         Chart.ALL_width = Width;//图表宽度
  89.         Chart.All_height = 330;//图表高度
  90.         Chart.HEIGHT_split = HeightSplit;//隔线条数,饼的厚度
  91.         Chart.THICKNESS = Thickness;//柱子厚度,X 旋转角
  92.         Chart.CHART_width = ChartWidth;//柱子宽度,交错
  93.         Chart.SPLIT_color = "#69f";//隔线颜色
  94.         Chart.CHART_backcolor = "#9cf";//底板颜色
  95.         Chart.CHART_type = ChartType;//图表类型 'X 柱子横向 Y 柱子纵向 Z 饼图 L 折线图 
  96.         Chart.TOTAL = total;
  97.         ChartBLL obj = new ChartBLL();
  98.         return obj.csiVMLChart(Chart).ToString();
  99.     }
  100.     protected void btn_Column_ServerClick(object sender, EventArgs e)
  101.     {
  102.         ViewState["ChartType"] = "Y";
  103.         ViewState["Width"] = "550";
  104.         ViewState["HeightSplit"] = "10";
  105.         ViewState["Thickness"] = "20";
  106.         ViewState["ChartWidth"] = "20";
  107.         Initi(ViewState["ChartType"].ToString(),
  108.         Convert.ToInt32(ViewState["Width"].ToString()),
  109.         Convert.ToInt32(ViewState["HeightSplit"].ToString()),
  110.         Convert.ToInt32(ViewState["Thickness"].ToString()),
  111.         Convert.ToInt32(ViewState["ChartWidth"].ToString()));
  112.     }
  113.     protected void btn_Line_ServerClick(object sender, EventArgs e)
  114.     {
  115.         ViewState["ChartType"] = "L";
  116.         ViewState["Width"] = "550";
  117.         ViewState["HeightSplit"] = "10";
  118.         ViewState["Thickness"] = "60";
  119.         ViewState["ChartWidth"] = "0";
  120.         Initi(ViewState["ChartType"].ToString(),
  121.         Convert.ToInt32(ViewState["Width"].ToString()),
  122.         Convert.ToInt32(ViewState["HeightSplit"].ToString()),
  123.         Convert.ToInt32(ViewState["Thickness"].ToString()),
  124.         Convert.ToInt32(ViewState["ChartWidth"].ToString()));
  125.     }
  126.     protected void btn_Cake_ServerClick(object sender, EventArgs e)
  127.     {
  128.         ViewState["ChartType"] = "Z";
  129.         ViewState["Width"] = "550";
  130.         ViewState["HeightSplit"] = "15";
  131.         ViewState["Thickness"] = "60";
  132.         ViewState["ChartWidth"] = "0";
  133.         Initi(ViewState["ChartType"].ToString(),
  134.         Convert.ToInt32(ViewState["Width"].ToString()),
  135.         Convert.ToInt32(ViewState["HeightSplit"].ToString()),
  136.         Convert.ToInt32(ViewState["Thickness"].ToString()),
  137.         Convert.ToInt32(ViewState["ChartWidth"].ToString()));
  138.     }
  139.     protected void SelectWidth_SelectedIndexChanged(object sender, EventArgs e)
  140.     {
  141.         ViewState["Width"] = this.SelectWidth.SelectedValue;
  142.         Initi(ViewState["ChartType"].ToString(),
  143.         Convert.ToInt32(ViewState["Width"].ToString()),
  144.         Convert.ToInt32(ViewState["HeightSplit"].ToString()),
  145.         Convert.ToInt32(ViewState["Thickness"].ToString()),
  146.         Convert.ToInt32(ViewState["ChartWidth"].ToString()));
  147.     }
  148. }