报表

SELECT [bid]
      ,[bname]
      ,[bdate]
      ,[state]
      ,[model]
      ,[bugcount]
      ,[pname]
  FROM [Bug].[dbo].[BugInfo]
 
1001	ddd	09 19 2010 12:18AM	待修复	用户管理	4	OA办公自动化
1002	bbbb	09 19 2010 12:18AM	以修复	个人设置	2	OA办公自动化
1003	eee	09 19 2010 12:18AM	待验证	BUG设置	7	OA办公自动化


 

DBHelper:

  public class DBHelper
    {
        SqlConnection conn = new SqlConnection("server=.;database=BUG;uid=sa;pwd=**");
        public DataSet GetBugInfo()
        {
            string sql = "select * from BugInfo";
            SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            da.Fill(ds);
            return ds;
        }
    }

Default.aspx:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Chart ID="Chart1" runat="server" Height="296px" Width="600px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)"
        Palette="BrightPastel" ImageType="Png" BorderDashStyle="Solid" BackSecondaryColor="White"
        BackGradientStyle="TopBottom" BorderWidth="2" BackColor="#D3DFF0" BorderColor="26, 59, 105">
        <Legends>
            <asp:Legend IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 9pt"
                TitleFont="Microsoft Sans Serif, 8pt">
            </asp:Legend>
        </Legends>
        <BorderSkin  SkinStyle="Emboss"></BorderSkin>
        <Titles>
            <asp:Title Font="Microsoft Sans Serif, 20pt" ForeColor="138, 175, 225" Name="Title1"
                Text="Bug模块分布">
            </asp:Title>
        </Titles>
        <Series>
            <asp:Series Name="Series1" BorderColor="180, 26, 59, 105" ChartType="Pie" IsValueShownAsLabel="True"
                LegendText="#AXISLABEL" Label="#PERCENT{P1}" ToolTip="模块:#AXISLABEL #VAL个">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
                BackSecondaryColor="White" BackColor="PowderBlue" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                <Area3DStyle Enable3D="True" />
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
    
    </div>
    </form>
</body>
</html>


Default:

   public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowProjectData();
        }
        #region IReport 成员

        public void ShowProjectData()
        {
            DBHelper db = new DBHelper();
            Series series = new Series("");
            series.ChartArea = "ChartArea1";
            series.ChartType = SeriesChartType.Pie;
            series.IsValueShownAsLabel = true;
            DataSet data = db.GetBugInfo();
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                series.Points.AddXY(data.Tables[0].Rows[i]["model"], String.Format("{0:F2}", data.Tables[0].Rows[i]["bugcount"]));
                series.Points[i].LegendText = data.Tables[0].Rows[i]["model"].ToString();
            }
            series.Label = "#PERCENT{P1}";
            series.ToolTip = "模块:#AXISLABEL #VAL个"; ;
            Chart1.Series.Add(series);
        }


        #endregion
    }


WebForm.aspx:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 <asp:Chart ID="Chart1" runat="server" Height="296px" Width="600px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)"
        Palette="BrightPastel" ImageType="Png" BorderDashStyle="Solid" BackSecondaryColor="White"
        BackGradientStyle="TopBottom" BorderWidth="2" BackColor="#D3DFF0" BorderColor="26, 59, 105">
        <Legends>
            <asp:Legend IsTextAutoFit="False" Name="Bug数量" BackColor="Transparent" Font="Trebuchet MS, 9pt"
                TitleFont="Microsoft Sans Serif, 8pt">
            </asp:Legend>
        </Legends>
        <BorderSkin SkinStyle="Emboss"></BorderSkin>
        <Titles>
            <asp:Title Font="Microsoft Sans Serif, 20pt" ForeColor="138, 175, 225" Name="Title1"
                Text="Bug状态分布">
            </asp:Title>
        </Titles>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
                BackSecondaryColor="White" BackColor="PowderBlue" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                <AxisY LineColor="204, 204, 204">
                    <MajorGrid LineColor="204, 204, 204" />
                </AxisY>
                <AxisX LineColor="204, 204, 204">
                    <MajorGrid LineColor="204, 204, 204" />
                </AxisX>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
    </form>
</body>
</html>


后台:

public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowProjectData();
        }
        #region IReport 成员

        public void ShowProjectData()
        {
            DBHelper db = new DBHelper();
            Series series = new Series("");
            series.ChartArea = "ChartArea1";
            series.ChartType = SeriesChartType.Column;
            series.IsValueShownAsLabel = true;
            series.IsVisibleInLegend = true;
            DataSet data = db.GetBugInfo();
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                series.Points.AddXY(data.Tables[0].Rows[i]["state"], String.Format("{0:F2}", data.Tables[0].Rows[i]["BugCount"]));
            }
            series.LegendText = "Bug数量";
            series.ToolTip = "状态:#AXISLABEL #VAL个";
            Chart1.Series.Add(series);
        }

        #endregion
    }


WebForm2.aspx:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
<asp:Chart ID="Chart1" runat="server" Height="296px" Width="600px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)"
        Palette="BrightPastel" ImageType="Png" BorderDashStyle="Solid" BackSecondaryColor="White"
        BackGradientStyle="TopBottom" BorderWidth="2" BackColor="#D3DFF0" BorderColor="26, 59, 105">
        <Legends>
            <asp:Legend IsTextAutoFit="False" Name="Bug数量" BackColor="Transparent" Font="Trebuchet MS, 9pt"
                TitleFont="Microsoft Sans Serif, 8pt">
            </asp:Legend>
        </Legends>
        <BorderSkin SkinStyle="Emboss"></BorderSkin>
        <Titles>
            <asp:Title Font="Microsoft Sans Serif, 20pt" ForeColor="138, 175, 225" Name="Title1"
                Text="Bug日期分布">
            </asp:Title>
        </Titles>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
                BackSecondaryColor="White" BackColor="PowderBlue" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                <AxisY LineColor="204, 204, 204">
                    <MajorGrid LineColor="204, 204, 204" />
                </AxisY>
                <AxisX LineColor="204, 204, 204">
                    <MajorGrid LineColor="204, 204, 204" />
                </AxisX>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
    </form>
</body>
</html>


后台:

  public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowProjectData();
        }
        #region IReport 成员

        public void ShowProjectData()
        {
            DBHelper db = new DBHelper();
            Series series = new Series("");
            series.ChartArea = "ChartArea1";
            series.ChartType = SeriesChartType.Spline;
            series.IsValueShownAsLabel = true;
            series.IsVisibleInLegend = true;
            DataSet data = db.GetBugInfo();
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                series.Points.AddXY(data.Tables[0].Rows[i]["bdate"], String.Format("{0:F2}", data.Tables[0].Rows[i]["BugCount"]));
            }
            series.LegendText = "Bug数量";
            series.BorderWidth = 3;
            series.ShadowOffset = 2;
            Chart1.Series.Add(series);
        }

        #endregion
    }



 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值