RDLC 折线图

需求一到,要折腾趋势图。

打开RDLC一看,发现有折线图,曲线图,可用。

说一下折腾RDLC的简单步骤:

一:前台页面折腾控件

1.新建项目->DataSet数据集->新建DataTable,把要显示的字段先设计好

2.新建报表RDLC->选择工具箱->拖出图表到报表设计界面上。

3.右键图表属性->数据->数据集名称->选择刚才的表。

4.对着图表右键->图型类型->折线图

5.选择中图表->出现上右下三个数据框->将字段分别往里拖(上面为值字段[如数据值];右边为序列字段[如分类];下面为类别[如日期])

6.将上面的值右键属性->把=Count(Fields!GatherValue.Value) 改成=Sum(Fields!GatherValue.Value) 不改就显示不出来了

7.页面里拖出一个ReportViewer:

 

 <rsweb:ReportViewer ID="reportViewer" runat="server" DocumentMapCollapsed="True" Font-Names="Verdana" Font-Size="8pt"
            Height
="100%" ShowBackButton="True" Width="99%">
        
</rsweb:ReportViewer>

 

 

二:后台折腾代码,就几行。

 

ExpandedBlockStart.gif代码
 protected void Page_Load(object sender, EventArgs e)
        {
             DataTable dt 
= ExeCustomSQL(Module.RUnit.RunitCustomSQL.RUnitTrend);
            dt.TableName 
= "RUnitTrend";//表名
            
//绑定RDLC报表
            BindRDLCReport(dt);
        }

        
private void BindRDLCReport(DataTable dt)
        {
            reportViewer.ProcessingMode 
= ProcessingMode.Local;
            LocalReport localReport 
= reportViewer.LocalReport;
            localReport.ReportPath 
= "App_Data/RUnitTrend.rdlc";//报表路径

            ReportDataSource dsSalesOrder 
= new ReportDataSource();
            dsSalesOrder.Name 
= "Tables_RUnitTrend";//DataSet名_表名
            dsSalesOrder.Value = dt;
            localReport.DataSources.Add(dsSalesOrder);
        }

 

到此保存运行。效果如下图:

转载于:https://www.cnblogs.com/cyq1162/archive/2010/04/20/1716058.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值