乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      mschart asp chart 用法,包括前臺(tái)寫(xiě)法與后臺(tái)寫(xiě)法,還有click事件,如何觸發(fā)。

       行走在理想邊緣 2019-07-10

      純后臺(tái)動(dòng)態(tài)生成aspchart ,這種方式?jīng)]辦法實(shí)現(xiàn)chart中click事件。click事件點(diǎn)擊沒(méi)有反應(yīng),用第二種可以實(shí)現(xiàn)點(diǎn)擊事件。


      兩種方式實(shí)現(xiàn)同一種效果圖:


      第一種寫(xiě)法:后臺(tái)動(dòng)態(tài)生成aspchart


      前臺(tái)代碼:


      復(fù)制代碼

          <div>
               <div class="h_10">
              </div>
               <table cellpadding="0" cellspacing="1" border="0" width="100%">
                      <tr>
                          <td>
                            
                              時(shí)間:<input id="S_BeTime" type="text" class="mycalendar" name="S_BeTime" style="width: 90px;" value="" runat="server" /><input id="S_EndTime" type="text" class="mycalendar" name="S_EndTime" style="width: 90px;" value="" runat="server" />
      
                              <asp:Button ID="btnSeach" runat="server" Text="查詢" OnClick="btnSeach_Click" class="mybutton" Width="60px" />&nbsp;
                         
      
                          </td>
                      </tr>
                  </table>
               <div id="tab" runat="server"></div>
               <div class="h_10">
              </div>
                <table  id="tabMain"  runat="server" style="width: 100%; height: 700px; text-align: center; vertical-align:text-top; border: 1px solid #BFDAEF;">
                      
                  
                  </table>
          </div>

      復(fù)制代碼

      后臺(tái)代碼:


      復(fù)制代碼

      using System;
      using System.Collections.Generic;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Web;
      using System.Web.UI;
      using System.Web.UI.DataVisualization.Charting;
      using System.Web.UI.HtmlControls;
      using System.Web.UI.WebControls;
      
      namespace WebForm.HSE.COUNTTABLE
      {
          public partial class CIndex : Common.BasePage
          {
              RoadFlow.Platform.Organize mc = new RoadFlow.Platform.Organize();
              RoadFlow.Platform.HSE_VIS_CHECKBLL HSEBLL = new RoadFlow.Platform.HSE_VIS_CHECKBLL();
              private string parentID = "04f12beb-d99d-43df-ac9a-3042957d6bda";//廠的父節(jié)點(diǎn)id
              RoadFlow.Platform.Organize ORGBLL = new RoadFlow.Platform.Organize();
              protected void Page_Load(object sender, EventArgs e)
              {
                  if (!IsPostBack)
                  {
                      BindData();
                  }
              }
      
      
              protected void btnSeach_Click(object sender, EventArgs e)
              {
                  BindData();
              }
      
              private void BindData()
              {
                  string strSql = CreateStrWhere();
                  DataSet ds = HSEBLL.GetList(strSql);
      
                  DataTable BindCharDtOne = new DataTable();//綁定圖表的dt 檢查問(wèn)題明細(xì)
                  BindCharDtOne.Columns.Add("DeptName");//部門姓名
                  BindCharDtOne.Columns.Add("Colum");//數(shù)量
      
                  DataTable BindCharDtTwo = new DataTable();//綁定圖表的dt 未整改
                  BindCharDtTwo.Columns.Add("DeptName");//部門姓名
                  BindCharDtTwo.Columns.Add("Colum");//數(shù)量
      
                  List<RoadFlow.Data.Model.Organize> ORGModel = ORGBLL.GetChilds(parentID.ToGuid());
                  for (int i = 0; i < ORGModel.Count; i++)
                  {
                      string orgid= ORGModel[i].ID.ToString();
                      string orgname = ORGModel[i].Name.ToString();
                      //檢查問(wèn)題數(shù)
                      int countOne = SortDataTable(ds.Tables[0], " CK_CKORG ='" + orgid + "' and (CK_ISFLOW ='1' or CK_ISFLOW='2')", "CREATETIME Desc", 2);
                      DataRow drOne;
                      drOne = BindCharDtOne.NewRow();
                      drOne["DeptName"] = orgname;
                      drOne["Colum"] = countOne.ToString();
                      BindCharDtOne.Rows.Add(drOne);
      
                      //未整改數(shù)
                      int countTwo = SortDataTable(ds.Tables[0], " CK_CKORG ='" + orgid + "' and (CK_ISFLOW ='1' or CK_ISFLOW='2') AND PH_CHECKRELATION ='132ec6dc-7424-4f71-9b79-45b70f000644'", "CREATETIME Desc", 2);
                      DataRow drTwo;
                      drTwo = BindCharDtTwo.NewRow();
                      drTwo["DeptName"] = orgname;
                      drTwo["Colum"] = countTwo.ToString();
                      BindCharDtTwo.Rows.Add(drTwo);
      
                  }
                  DrawTable(BindCharDtOne,"檢查問(wèn)題統(tǒng)計(jì)表",0);
                  DrawTable(BindCharDtTwo, "未整改問(wèn)題統(tǒng)計(jì)表", 5);
              }
              //畫(huà)圖
              private void DrawTable(DataTable dt,string name,int j)
              {
                  HtmlTableRow tbRow = new HtmlTableRow();
                  HtmlTableCell tbCell = new HtmlTableCell();
                  tbCell.VAlign = "Top";
                  tbCell.Align = "center";
                  Chart Chart1 = new Chart();
      
      
                  Chart1.Click += new ImageMapEventHandler(Chart1_Click);
      
               
                  Chart1.BackColor = Color.FromArgb(211, 223, 240);
                  Chart1.Height = 356;
                  Chart1.Width = 1224;
                  Chart1.BorderlineDashStyle = ChartDashStyle.Solid;
                  Chart1.BackGradientStyle = GradientStyle.TopBottom;
                  Chart1.BorderlineColor = Color.FromArgb(26, 59, 105);
                  Chart1.IsSoftShadows = false;
      
      
                  BorderSkin bdsk = new BorderSkin();
                  bdsk.SkinStyle = BorderSkinStyle.Emboss;
                  Chart1.BorderSkin = bdsk;
      
                  Series series = new Series("columSeries");   //實(shí)例Series 集合 對(duì)象
                  series.ChartType = SeriesChartType.Column;
                  series.XValueType = ChartValueType.Double;
                  //Series的邊框顏色
                  series.BorderColor = Color.FromArgb(180, 26, 59, 105);
                  //線條寬度
                  series.BorderWidth = 1;
                  //線條陰影顏色
                  series.ShadowColor = Color.Black;
                  //陰影寬度
                  series.ShadowOffset = 2;
                  //是否顯示數(shù)據(jù)說(shuō)明
                  series.IsVisibleInLegend = true;
                  //線條上數(shù)據(jù)點(diǎn)上是否有數(shù)據(jù)顯示
                  series.IsValueShownAsLabel = true;
                  //線條上的數(shù)據(jù)點(diǎn)標(biāo)志類型
                  series.MarkerStyle = MarkerStyle.Circle;
                  //線條數(shù)據(jù)點(diǎn)的大小
                  series.MarkerSize = 8;
                  //鼠標(biāo)懸停顯示內(nèi)容
                  series.ToolTip = "單位:#AXISLABEL \\n次數(shù):#VAL";
                  //設(shè)置柱子的寬度
                  series.CustomProperties = "PointWidth=0.5";
                  Font sf = new Font("微軟雅黑", 10F, FontStyle.Bold);
                  series.Font = sf;
      
                  //線條顏色
                  //線條顏色
                  switch (j)
                  {
                      case 0:
                          series.Color = Color.FromArgb(220, 65, 140, 240);
                          break;
                      case 1:
                          series.Color = Color.FromArgb(220, 224, 64, 10);
                          break;
                      case 3:
                          series.Color = Color.FromArgb(220, 120, 150, 20);
                          break;
                      case 4:
                          series.Color = Color.FromArgb(220, 120, 130, 40);
                          break;
                      case 5:
                          series.Color = Color.FromArgb(220, 120, 190, 120);
                          break;
                      case 6:
                          series.Color = Color.FromArgb(220, 120, 140, 29);
                          break;
                      case 7:
                          series.Color = Color.FromArgb(220, 120, 150, 20);
                          break;
                      case 8:
                          series.Color = Color.FromArgb(220, 120, 150, 20);
                          break;
                      case 9:
                          series.Color = Color.FromArgb(220, 120, 150, 20);
                          break;
                  }
                  ////設(shè)置圖表Y軸對(duì)應(yīng)項(xiàng)
                  series.YValueMembers = "Colum";
                  ////設(shè)置圖表X軸對(duì)應(yīng)項(xiàng)
                  series.XValueMember = "DeptName";
                  series.PostBackValue = "#AXISLABEL";
                  Chart1.Series.Add(series);
      
      
                  ChartArea area = new ChartArea("columArea");   //實(shí)例 ChartArea 對(duì)象
                
                  //背景色
                  area.BackColor = Color.FromArgb(64, 165, 191, 228);
                  //背景漸變方式
                  area.BackGradientStyle = GradientStyle.TopBottom;
                  //漸變和陰影的輔助背景色
                  area.BackSecondaryColor = Color.White;
                  //邊框顏色
                  area.BorderColor = Color.FromArgb(64, 64, 64, 64);
                  //陰影顏色
                  area.ShadowColor = Color.Transparent;
      
                  //設(shè)置X軸和Y軸線條的顏色和寬度
                  area.AxisX.LineColor = Color.FromArgb(64, 64, 64, 64);
                  area.AxisX.LineWidth = 1;
                  area.AxisY.LineColor = Color.FromArgb(64, 64, 64, 64);
                  area.AxisY.LineWidth = 1;
      
                  //設(shè)置X軸和Y軸的標(biāo)題
                  area.AxisX.Title = "X:單位";
                  area.AxisY.Title = "Y:次數(shù)";
      
                  //設(shè)置圖表區(qū)網(wǎng)格橫縱線條的顏色和寬度
                  area.AxisX.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
                  area.AxisX.MajorGrid.LineWidth = 1;
                  area.AxisY.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
                  area.AxisY.MajorGrid.LineWidth = 1;
      
                  area.AxisX.Interval = 1;   //設(shè)置X軸坐標(biāo)的間隔為1
                  area.AxisX.IntervalOffset = 1;  //設(shè)置X軸坐標(biāo)偏移為1
                  area.AxisX.LabelStyle.Angle = 90;
                  area.AxisX.LabelStyle.IsStaggered = false;   //設(shè)置是否交錯(cuò)顯示,比如數(shù)據(jù)多的時(shí)間分成兩行來(lái)顯示                
      
      
                  area.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.WordWrap;
      
                  //設(shè)置X軸文字大小
                  area.AxisX.LabelAutoFitMinFontSize = 16;
                  area.AxisX.TitleFont = new Font("微軟雅黑", 10F, FontStyle.Regular);
                  area.AxisY.TitleFont = new Font("微軟雅黑", 10F, FontStyle.Regular);
                  Chart1.ChartAreas.Add(area);   // 將ChartArea 對(duì)象添加到chart 對(duì)象中
      
      
      
      
      
      
      
                  //添加標(biāo)題
                  Title tile = new Title();
                  tile.Text = string.Format("{0} ", name);
                  //標(biāo)題的字體
                  tile.Font = new System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold);
                  //標(biāo)題字體顏色
                  tile.ForeColor = Color.FromArgb(26, 59, 105);
                  //標(biāo)題陰影顏色
                  tile.ShadowColor = Color.FromArgb(32, 0, 0, 0);
                  //標(biāo)題陰影偏移量
                  tile.ShadowOffset = 3;
                  Chart1.Titles.Add(tile);
                  //------------
      
      
                  //設(shè)置圖表的數(shù)據(jù)源
                  Chart1.DataSource = dt;
                  //綁定數(shù)據(jù)
                  Chart1.DataBind();
                  Panel pan = new Panel();//顯示滾動(dòng)條的panel
                  pan.Width = 1200;
                  pan.ScrollBars = ScrollBars.Horizontal;
                  pan.Attributes.Add("style", "overflow-y: hidden;");//隱藏Y軸滾動(dòng)條
                
                  pan.Controls.Add(Chart1);
                  tbCell.Controls.Add(pan);
      
                  tbRow.Cells.Add(tbCell);
                  this.tabMain.Controls.Add(tbRow);
                  this.tab.InnerHtml = "";
              }
      
              /// <summary>
              /// Handles the Click event of the Chart1 control.
              /// </summary>
              /// <param name="sender">The source of the event.</param>
              /// <param name="e">The <see cref="System.Web.UI.WebControls.ImageMapEventArgs"/> instance containing the event data.</param>
              protected void Chart1_Click(object sender, ImageMapEventArgs e)
              {
                
                  string[] input = e.PostBackValue.Split(':');
          
              }
      
              private string CreateStrWhere()
              {
                  string strwhere = " 1=1 ";
                  string date1 = S_BeTime.Value;
                  string date2 = S_EndTime.Value;
                  if (date1.IsDateTime())
                  {
                      strwhere += " AND CK_TIME >=to_date('" + date1.ToDateTime().ToString("yyyy-MM-dd 00:00:00") + "','yyyy-mm-dd hh24:mi:ss')";
      
                  }
      
                  if (date2.IsDateTime())
                  {
                      strwhere += " AND CK_TIME <=to_date('" + date2.ToDateTime().AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "','yyyy-mm-dd hh24:mi:ss')";
      
                  }
                  strwhere += "  order by createtime  desc ";
                  return strwhere;
              }
      
      
              #region DataTable篩選,排序返回符合條件行組成的新DataTable或直接用DefaultView按條件返回
              /// <summary> 
              /// DataTable篩選,排序返回符合條件行組成的新DataTable或直接用DefaultView按條件返回 
              /// eg:SortExprDataTable(dt,"Sex='男'","Time Desc",1) 
              /// </summary> 
              /// <param name="dt">傳入的DataTable</param> 
              /// <param name="strExpr">篩選條件</param> 
              /// <param name="strSort">排序條件</param> 
              /// <param name="mode">1,直接用DefaultView按條件返回,效率較高;2,DataTable篩選,排序返回符合條件行組成的新DataTable</param> 
              public int SortDataTable(DataTable dt, string strExpr, string strSort, int mode)
              {
                  int Count = 0;
                  switch (mode)
                  {
                      case 1:
                          //方法一 直接用DefaultView按條件返回 
                          dt.DefaultView.RowFilter = strExpr;
                          dt.DefaultView.Sort = strSort;
                          Count = dt.Rows.Count;
                          return Count;
                      case 2:
                          //方法二 DataTable篩選,排序返回符合條件行組成的新DataTable 
                          DataTable dt1 = new DataTable();
                          DataRow[] GetRows = dt.Select(strExpr, strSort);
                          //復(fù)制DataTable dt結(jié)構(gòu)不包含數(shù)據(jù) 
                          dt1 = dt.Clone();
                          foreach (DataRow row in GetRows)
                          {
                              dt1.Rows.Add(row.ItemArray);
                          }
                          Count = dt1.Rows.Count;
                          return Count;
                      default:
                          return Count;
                  }
              }
              #endregion
          }
      
      }

      復(fù)制代碼

      第二種寫(xiě)法:前臺(tái)代碼編寫(xiě)asp:chart,后臺(tái)寫(xiě)代碼,并實(shí)現(xiàn)點(diǎn)擊事件Click


      前臺(tái)代碼:2個(gè)chart


      復(fù)制代碼

          <form id="form1" runat="server">
              <div>
                  <div class="h_10">
                  </div>
                  <table cellpadding="0" cellspacing="1" border="0" width="100%">
                      <tr>
                          <td>時(shí)間:<input id="S_BeTime" type="text" class="mycalendar" name="S_BeTime" style="width: 90px;" value="" runat="server" /><input id="S_EndTime" type="text" class="mycalendar" name="S_EndTime" style="width: 90px;" value="" runat="server" />
      
                              <asp:Button ID="btnSeach" runat="server" Text="查詢" OnClick="btnSeach_Click" class="mybutton" Width="60px" />&nbsp;
                         
      
                          </td>
                      </tr>
                  </table>
                  <div id="tab" runat="server"></div>
                  <div class="h_10">
                  </div>
                  <table id="tabMain" runat="server" style="width: 100%; height: 700px; text-align: center; vertical-align: text-top; border: 1px solid #BFDAEF;">
                      --%>
              <tr>
                  <td>
                      <asp:Panel runat="server" Width="1200" ScrollBars="Horizontal " Style="overflow-y: hidden;">
                          <asp:Chart ID="Chart1" Width="1224" runat="server" ImageType="Png"
                              Height="356" BorderlineDashStyle="Solid" BorderlineColor="26, 59, 105"
                              BackGradientStyle="TopBottom" BorderWidth="2" BackColor="211, 223, 240" IsSoftShadows="false"
                              OnClick="Chart1_Click">
      
                              <Legends>
                                  <asp:Legend BackColor="Transparent" Alignment="Center" Docking="Bottom" Font="Trebuchet MS, 8.25pt, style=Bold" IsTextAutoFit="False" Name="Default" LegendStyle="Row"></asp:Legend>
                              </Legends>
                              <BorderSkin SkinStyle="Emboss"></BorderSkin>
                              <Series>
                                  <asp:Series Name="Series1" ChartType="Column" XValueType="Double" BorderColor="180, 26, 59, 105"
                                      BorderWidth="1" ShadowColor="Black" ShadowOffset="2" IsVisibleInLegend="true" IsValueShownAsLabel="true"
                                      MarkerStyle="Circle" MarkerSize="8" ToolTip="單位:#AXISLABEL \\n數(shù)量:#VAL"
                                      CustomProperties="PointWidth=0.5"
                                      ChartArea="ChartArea1" Color="220, 65, 140, 240"
                                      YValueMembers="Colum" XValueMember="DeptName">
                                  </asp:Series>
                              </Series>
                              <ChartAreas>
                                  <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="White"
                                      BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                                      <AxisX LineColor="64, 64, 64, 64" LineWidth="1" Title="X:單位" Interval="1" IntervalOffset="1" LabelAutoFitStyle="WordWrap">
                                          <MajorGrid LineColor="64, 64, 64, 64" LineWidth="1" />
                                          <LabelStyle Angle="90" IsStaggered="false" />
      
                                      </AxisX>
                                      <AxisY LineColor="64, 64, 64, 64" LineWidth="1" Title="Y:次數(shù)">
                                          <MajorGrid LineColor="64, 64, 64, 64" LineWidth="1" />
                                      </AxisY>
      
                                  </asp:ChartArea>
                              </ChartAreas>
                          </asp:Chart>
                      </asp:Panel>
      
                  </td>
              </tr>
                      <tr>
                          <td>
                              <asp:Panel runat="server" Width="1200" ScrollBars="Horizontal " Style="overflow-y: hidden;">
                                  <asp:Chart ID="Chart2" Width="1224" runat="server" ImageType="Png"
                                      Height="356" BorderlineDashStyle="Solid" BorderlineColor="26, 59, 105"
                                      BackGradientStyle="TopBottom" BorderWidth="2" BackColor="211, 223, 240" IsSoftShadows="false"
                                      OnClick="Chart2_Click">
      
                                      <Legends>
                                          <asp:Legend BackColor="Transparent" Alignment="Center" Docking="Bottom" Font="Trebuchet MS, 8.25pt, style=Bold" IsTextAutoFit="False" Name="Default" LegendStyle="Row"></asp:Legend>
                                      </Legends>
                                      <BorderSkin SkinStyle="Emboss"></BorderSkin>
                                      <Series>
                                          <asp:Series Name="Series2" ChartType="Column" XValueType="Double" BorderColor="180, 26, 59, 105"
                                              BorderWidth="1" ShadowColor="Black" ShadowOffset="2" IsVisibleInLegend="true" IsValueShownAsLabel="true"
                                              MarkerStyle="Circle" MarkerSize="8" ToolTip="單位:#AXISLABEL \\n數(shù)量:#VAL"
                                              CustomProperties="PointWidth=0.5"
                                              ChartArea="ChartArea2" Color="220, 65, 140, 240"
                                              YValueMembers="Colum" XValueMember="DeptName">
                                          </asp:Series>
                                      </Series>
                                      <ChartAreas>
                                          <asp:ChartArea Name="ChartArea2" BorderColor="64, 64, 64, 64" BackSecondaryColor="White"
                                              BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                                              <AxisX LineColor="64, 64, 64, 64" LineWidth="1" Title="X:單位" Interval="1" IntervalOffset="1" LabelAutoFitStyle="WordWrap">
                                                  <MajorGrid LineColor="64, 64, 64, 64" LineWidth="1" />
                                                  <LabelStyle Angle="90" IsStaggered="false" />
      
                                              </AxisX>
                                              <AxisY LineColor="64, 64, 64, 64" LineWidth="1" Title="Y:次數(shù)">
                                                  <MajorGrid LineColor="64, 64, 64, 64" LineWidth="1" />
                                              </AxisY>
      
                                          </asp:ChartArea>
                                      </ChartAreas>
                                  </asp:Chart>
                              </asp:Panel>
      
                          </td>
                      </tr>
                  </table>
              </div>
          </form>

      復(fù)制代碼

      后臺(tái)代碼:


      復(fù)制代碼

      using System;
      using System.Collections.Generic;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Web;
      using System.Web.UI;
      using System.Web.UI.DataVisualization.Charting;
      using System.Web.UI.HtmlControls;
      using System.Web.UI.WebControls;
      
      
      namespace WebForm.HSE.COUNTTABLE
      {
          public partial class CTest : Common.BasePage
          {
              RoadFlow.Platform.Organize mc = new RoadFlow.Platform.Organize();
              RoadFlow.Platform.HSE_VIS_CHECKBLL HSEBLL = new RoadFlow.Platform.HSE_VIS_CHECKBLL();
              private string parentID = "04f12beb-d99d-43df-ac9a-3042957d6bda";//廠的父節(jié)點(diǎn)id
              RoadFlow.Platform.Organize ORGBLL = new RoadFlow.Platform.Organize();
              protected void Page_Load(object sender, EventArgs e)
              {
                  this.Chart1.Series["Series1"].PostBackValue = "#AXISLABEL";
                  this.Chart2.Series["Series2"].PostBackValue = "#AXISLABEL";
                  if (!IsPostBack)
                  {
                      BindData();
                  }
              }
      
      
              protected void btnSeach_Click(object sender, EventArgs e)
              {
                  BindData();
              }
      
              private void BindData()
              {
                  string strSql = CreateStrWhere();
                  DataSet ds = HSEBLL.GetList(strSql);
      
                  DataTable BindCharDtOne = new DataTable();//綁定圖表的dt 檢查問(wèn)題明細(xì)
                  BindCharDtOne.Columns.Add("DeptName");//部門姓名
                  BindCharDtOne.Columns.Add("Colum");//數(shù)量
      
                  DataTable BindCharDtTwo = new DataTable();//綁定圖表的dt 未整改
                  BindCharDtTwo.Columns.Add("DeptName");//部門姓名
                  BindCharDtTwo.Columns.Add("Colum");//數(shù)量
      
                  List<RoadFlow.Data.Model.Organize> ORGModel = ORGBLL.GetChilds(parentID.ToGuid());
                  for (int i = 0; i < ORGModel.Count; i++)
                  {
                      string orgid = ORGModel[i].ID.ToString();
                      string orgname = ORGModel[i].Name.ToString();
                      //檢查問(wèn)題數(shù)
                      int countOne = SortDataTable(ds.Tables[0], " CK_CKORG ='" + orgid + "' and (CK_ISFLOW ='1' or CK_ISFLOW='2')", "CREATETIME Desc", 2);
                      DataRow drOne;
                      drOne = BindCharDtOne.NewRow();
                      drOne["DeptName"] = orgname;
                      drOne["Colum"] = countOne.ToString();
                      BindCharDtOne.Rows.Add(drOne);
      
                      //未整改數(shù)
                      int countTwo = SortDataTable(ds.Tables[0], " CK_CKORG ='" + orgid + "' and (CK_ISFLOW ='1' or CK_ISFLOW='2') AND PH_CHECKRELATION ='132ec6dc-7424-4f71-9b79-45b70f000644'", "CREATETIME Desc", 2);
                      DataRow drTwo;
                      drTwo = BindCharDtTwo.NewRow();
                      drTwo["DeptName"] = orgname;
                      drTwo["Colum"] = countTwo.ToString();
                      BindCharDtTwo.Rows.Add(drTwo);
      
                  }
                  DrawOne(BindCharDtOne, "檢查問(wèn)題統(tǒng)計(jì)表", 0);
                  DrawTwo(BindCharDtTwo, "未整改問(wèn)題統(tǒng)計(jì)表", 5);
              }
              private void DrawOne(DataTable dt, string name, int j)
              {
                  double[] yValues = new double[dt.Rows.Count];
                  string[] xValues = new string[dt.Rows.Count];
                  for (int i = 0; i < dt.Rows.Count; i++)
                  {
                      yValues[i] = Convert.ToDouble(dt.Rows[i]["Colum"]);
                      xValues[i] = dt.Rows[i]["DeptName"].ToString();
                  }
                  Chart1.Series["Series1"].Points.DataBindXY(xValues, yValues);
      
                  Font sf = new Font("微軟雅黑", 10F, FontStyle.Bold);
                  Chart1.Series["Series1"].Font = sf;
                  Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new Font("微軟雅黑", 10F, FontStyle.Regular);
                  Chart1.ChartAreas["ChartArea1"].AxisY.TitleFont = new Font("微軟雅黑", 10F, FontStyle.Regular);
                  //添加標(biāo)題
                  Title tile = new Title();
                  tile.Text = string.Format("{0} ", name);
                  //標(biāo)題的字體
                  tile.Font = new System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold);
                  //標(biāo)題字體顏色
                  tile.ForeColor = Color.FromArgb(26, 59, 105);
                  //標(biāo)題陰影顏色
                  tile.ShadowColor = Color.FromArgb(32, 0, 0, 0);
                  //標(biāo)題陰影偏移量
                  tile.ShadowOffset = 3;
                  Chart1.Titles.Add(tile);
             
      
              }
              private void DrawTwo(DataTable dt, string name, int j)
              {
                  double[] yValues = new double[dt.Rows.Count];
                  string[] xValues = new string[dt.Rows.Count];
                  for (int i = 0; i < dt.Rows.Count; i++)
                  {
                      yValues[i] = Convert.ToDouble(dt.Rows[i]["Colum"]);
                      xValues[i] = dt.Rows[i]["DeptName"].ToString();
                  }
                  Chart2.Series["Series2"].Points.DataBindXY(xValues, yValues);
      
                  Font sf = new Font("微軟雅黑", 10F, FontStyle.Bold);
                  Chart2.Series["Series2"].Font = sf;
                  Chart2.ChartAreas["ChartArea2"].AxisX.TitleFont = new Font("微軟雅黑", 10F, FontStyle.Regular);
                  Chart2.ChartAreas["ChartArea2"].AxisY.TitleFont = new Font("微軟雅黑", 10F, FontStyle.Regular);
                  //添加標(biāo)題
                  Title tile = new Title();
                  tile.Text = string.Format("{0} ", name);
                  //標(biāo)題的字體
                  tile.Font = new System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold);
                  //標(biāo)題字體顏色
                  tile.ForeColor = Color.FromArgb(26, 59, 105);
                  //標(biāo)題陰影顏色
                  tile.ShadowColor = Color.FromArgb(32, 0, 0, 0);
                  //標(biāo)題陰影偏移量
                  tile.ShadowOffset = 3;
                  Chart2.Titles.Add(tile);
      
      
              }
              protected void Chart1_Click(object sender, ImageMapEventArgs e)
              {
                  string str = Server.UrlEncode(e.PostBackValue.Split(':')[0]);
                  string date1 = Server.UrlEncode(S_BeTime.Value);
                  string date2 = Server.UrlEncode(S_EndTime.Value);
                  BindData();
                  Response.Write(" <script   language=javascript> window.open   ( 'CDetail.aspx?name=" + str.ToString() + "&date1=" + date1 + "&date2=" + date2 + "&type=1 ',  '查看詳細(xì)',   'height=420,   width=900,   top=200,left=270,   toolbar=yes,   menubar=no,   scrollbars=yes,   resizable=no,  location=no,   status=no ') </script> ");
      
              }
              protected void Chart2_Click(object sender, ImageMapEventArgs e)
              {
      
                  string str = Server.UrlEncode(e.PostBackValue.Split(':')[0]);
                  string date1 = Server.UrlEncode(S_BeTime.Value);
                  string date2 = Server.UrlEncode(S_EndTime.Value);
                  BindData();
                  Response.Write(" <script   language=javascript> window.open   ( 'CDetail_NoRepair.aspx?name=" + str.ToString() + "&date1=" + date1 + "&date2=" + date2 + "&type=2 ',  '查看詳細(xì)',   'height=420,   width=1000,   top=200,left=270,   toolbar=no,   menubar=no,   scrollbars=yes,   resizable=no,  location=no,   status=no ') </script> ");
      
              }
      
              private string CreateStrWhere()
              {
                  string strwhere = " 1=1 ";
                  string date1 = S_BeTime.Value;
                  string date2 = S_EndTime.Value;
                  if (date1.IsDateTime())
                  {
                      strwhere += " AND CK_TIME >=to_date('" + date1.ToDateTime().ToString("yyyy-MM-dd 00:00:00") + "','yyyy-mm-dd hh24:mi:ss')";
      
                  }
      
                  if (date2.IsDateTime())
                  {
                      strwhere += " AND CK_TIME <=to_date('" + date2.ToDateTime().AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "','yyyy-mm-dd hh24:mi:ss')";
      
                  }
                  strwhere += "  order by createtime  desc ";
                  return strwhere;
              }
      
      
              #region DataTable篩選,排序返回符合條件行組成的新DataTable或直接用DefaultView按條件返回
              /// <summary> 
              /// DataTable篩選,排序返回符合條件行組成的新DataTable或直接用DefaultView按條件返回 
              /// eg:SortExprDataTable(dt,"Sex='男'","Time Desc",1) 
              /// </summary> 
              /// <param name="dt">傳入的DataTable</param> 
              /// <param name="strExpr">篩選條件</param> 
              /// <param name="strSort">排序條件</param> 
              /// <param name="mode">1,直接用DefaultView按條件返回,效率較高;2,DataTable篩選,排序返回符合條件行組成的新DataTable</param> 
              public int SortDataTable(DataTable dt, string strExpr, string strSort, int mode)
              {
                  int Count = 0;
                  switch (mode)
                  {
                      case 1:
                          //方法一 直接用DefaultView按條件返回 
                          dt.DefaultView.RowFilter = strExpr;
                          dt.DefaultView.Sort = strSort;
                          Count = dt.Rows.Count;
                          return Count;
                      case 2:
                          //方法二 DataTable篩選,排序返回符合條件行組成的新DataTable 
                          DataTable dt1 = new DataTable();
                          DataRow[] GetRows = dt.Select(strExpr, strSort);
                          //復(fù)制DataTable dt結(jié)構(gòu)不包含數(shù)據(jù) 
                          dt1 = dt.Clone();
                          foreach (DataRow row in GetRows)
                          {
                              dt1.Rows.Add(row.ItemArray);
                          }
                          Count = dt1.Rows.Count;
                          return Count;
                      default:
                          return Count;
                  }
              }
              #endregion
          }
      
      }

      復(fù)制代碼

      注意:


       this.Chart1.Series["Series1"].PostBackValue = "#AXISLABEL";      這句話是實(shí)現(xiàn)click事件的關(guān)鍵

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多