先要建一个ReportService.aspx 代码如下:

XDesigner.Report.ReportHtmlBuilder hb = this.Session["htmlbuilder"] as XDesigner.Report.ReportHtmlBuilder;
        if (hb == null)
            return;

        if (this.Request.QueryString["imageindex"] != null)
        {
            System.Drawing.Imaging.ImageFormat f = System.Drawing.Imaging.ImageFormat.Png;

            string imagType = this.Request.QueryString["imagetype"];
            if (imagType == "jpg")
                f = ImageFormat.Jpeg;

            hb.SaveReportImage(
                Convert.ToInt32(this.Request.QueryString["imageindex"]),
                this.Response.OutputStream,
                f);
            return;
        }

        if (this.Request.QueryString["out"] == "doc")
        {
            // Output MS Word 2000 document
            hb.SaveWordDocument(this.Response.OutputStream);
            this.Response.ContentType = "application/msword";
            //this.Response.AppendHeader("Content-Disposition","attachment;filename=" + System.Web.HttpUtility.UrlEncode( hb.Title ) + ".doc");
        }
        else if (this.Request.QueryString["out"] == "xls")
        {
            // Output MS Excel2000 document
            hb.SaveExcelDocument(this.Response.OutputStream);
            this.Response.ContentType = "application/vnd.ms-excel";
            //this.Response.AppendHeader("Content-Disposition","attachment;filename=" + System.Web.HttpUtility.UrlEncode( hb.Title ) + ".xls");
        }
        else if (this.Request.QueryString["out"] == "pdf")
        {
            hb.SavePDFDocument(this.Response.OutputStream);
            this.Response.ContentType = "application/pdf";
        }
        else
            hb.Save(this.Response.Output);

再建一个页面画大饼咯:

//先增一个报表
        DesignReportDocument doc = new DesignReportDocument();
        doc.Title = "动态报表";

        //Lable
        DesignReportLabel lbl = doc.CreateLabelElement();
        lbl.Text = "动态报表演示";
        lbl.TextColor = System.Drawing.Color.Yellow;
        lbl.Font = new Font("宋体", 20, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic);
        lbl.Align = StringAlignment.Center;
        lbl.PrintDockStyle = PrintDockStyle.Top;
        lbl.Height = 120;
        lbl.Border.BackColor = Color.SkyBlue;
        doc.Add(lbl);

        //一个大饼
        DesignReportPie pie = doc.CreatePieElement();
        pie.Bounds = new Rectangle(169, 775, 1363, 954);
        pie.Thickness = 60;
        pie.BorderWidth = 1;
        pie.LeftBorder = false;
        pie.TopBorder = false;
        pie.RightBorder = false;
        pie.BottomBorder = false;
        doc.Add(pie);

        //增加列
        for (int i = 1; i < 5; i++)
        {
            DesignReportPieItem pieItem = doc.CreatePieItemElement();
            pieItem.ID = "pieItem" + i;
            pieItem.Value = i.ToString();
            pieItem.Text = i.ToString() + "_" + i.ToString();
            pieItem.FillColor = System.Drawing.Color.FromArgb((i * 1000) % 255, (i * 100) % 255, (i * 10) % 255);
            //pieItem.BackColor = System.Drawing.Color.FromArgb(255, 255, (i * 100) % 255);
            pie.AppendChild(pieItem);
        }

        DesignReportLabelList reportpietext1 = doc.CreateLabelListElement();
        doc.AppendChild(reportpietext1);
        reportpietext1.ID = "reportpietext1";
        reportpietext1.Bounds = new System.Drawing.Rectangle(215, 24, 1175, 731);
        reportpietext1.BorderWidth = 1;
        reportpietext1.ItemSpacing = 30;
        reportpietext1.ItemHeight = 50;
        reportpietext1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold);
        reportpietext1.BarSize = 60;

        XDesigner.Report.ReportBuilder rb = new ReportBuilder();
        rb.LoadReport(doc);

        XDesigner.Report.ReportHtmlBuilder hb = rb.CreateHtmlBuilder();
        hb.ImgSrcFormatString = "reportservice.aspx?imageindex={0}";
        hb.Refresh();
        hb.ContentEncoding = this.Response.ContentEncoding;

        this.Session["htmlbuilder"] = hb;
        hb.Save(this.Response.Output);

转载于:https://www.cnblogs.com/tonyboy/archive/2007/06/13/782407.html

袁氏报表用代码画一个饼图相关推荐

  1. 用pyecharts画一个饼图

    pyecharts是一款Python的图表库,可以用来绘制各种类型的图表,包括饼图.下面是一个简单的例子,展示如何使用pyecharts来画一个饼图. 首先,需要安装pyecharts: pip in ...

  2. 用Python代码画一个足球(附完整代码)

    用Python代码画一个足球(附完整代码) C站举办了世界杯征文活动,本文用Python代码画一个足球. 实现方法介绍 本文的绘图工具使用Python的标准库turtle库,无需安装,导入即可使用. ...

  3. python月亮_如何用python代码画一个月亮

    如何用python代码画一个月亮 发布时间:2020-06-17 15:52:21 来源:亿速云 阅读:181 作者:元一 Python简介 Python是一种跨平台的计算机程序设计语言. 是一个高层 ...

  4. 震惊!Canvas原来还能这么搞!代码画一个时钟出来

    学会了Canvas之后,发现canvas几乎什么都能画,看着自己家里的时钟突发奇想,能不能利用canvas画一个时钟出来呢?说搞就搞! 直接上代码: <!DOCTYPE html> < ...

  5. java绘图基础 : 用java代码画一个房子

    网页左边,向下滑有目录索引,可以根据标题跳转到你想看的内容 一.概述 java绘图的主要核心类 1.Graphics类,此类可以画图形,线条等,但是设置到变形等就不行了,由此衍生出更强大的类,Grap ...

  6. 在圣诞及元旦的日子里如何用html代码画一个爱心树

    一.前言 在圣诞节以及元旦节日来临的日子里,如果能亲自为自己所爱的人画一个爱心树,这肯定是个很浪漫的事.那么如何用代码画出圣诞树呢?用我的办法就能很简单的实现,复制-粘贴-另存就可完成. 二.创意名 ...

  7. 生信小白7行代码画一个高颜值的世界地图

    不要害怕编程,它其实像泡方便面一样简单.先在百度搜索R,然后像安装QQ一样,一直选择下一步,安装成功后,双击打开桌面R的快捷方式. 复制粘贴下面代码,敲一个回车键,就能得到下面的世界地图.如果这个图上 ...

  8. iPhone 利用CG API画一个饼图(Pie chart)

    核心函数是:CGContextAddArc(CGContextRef c, CGFloat x, CGFloat y, CGFloat radius, CGFloat startAngle, CGFl ...

  9. 一行代码画一个数据分析图(lzdb 库)

    转载自公众号:python_shequ 看一下数据长什么样: 用excel打开的csv文件长这样: image 在python ide中直接显示长这样: image 看完数据长什么样,接下来就可以画图 ...

最新文章

  1. Sublime_正则查找替换
  2. codeforces808G Anthem of Berland(kmp+自动机+dp)
  3. linux下1sa 密码失效,SA口令
  4. android 拍照不能保存图片格式,Android 拍照后保存到手机里,在相册找不到
  5. 用仿ActionScript的语法来编写html5——终篇,LegendForHtml5Programming1.0开源库件
  6. web服务器中启用作业储存_如何在Kubernetes中启用无服务器计算
  7. 微软发布 .NET Core 卸载工具,适用于 Windows 和 Mac
  8. zabbix server报错:FATAL: password authentication failed for user zabbix
  9. 转载:别人使用的工具
  10. 商用密码产品认证(型号)概述
  11. 业务安全情报第四期:新能源车企重金打造的私域流量,成为黑灰产“掘金发财”的新目标
  12. 应届生面试应答需要注意哪些事项及技巧?
  13. 微信读书增长策略:“无限卡会员业务”
  14. 找不到www.jetbrains.com的服务器IP地址
  15. fatal: ‘origin‘ does not appear to be a git repository
  16. 从苏宁电器到卡巴斯基(第二部)第30篇:我当高校教师的这几年 VI
  17. 谷歌手机pixel4 夜景_如何在Google Pixel手机上使用实时字幕
  18. 【汇编】子程序调用实现多精度BCD码(十进制)相加
  19. 数据模型:概念数据模型,逻辑数据模型,物理数据模型
  20. 台式计算机用电量是多少,台式计算机的功率是多少?台式计算机多少电量[详细介绍]...

热门文章

  1. 【算法java版11】:实现求s = a + aa + aaa + aaaa + aa...a 的值,其中a是一个数字,几个数相加由键盘控制
  2. iOS 删除 SceneDelegeta.h
  3. Java一瓶可乐_Java实现可乐瓶问题
  4. 高可用性系统在大众点评的实践与经验
  5. 惠普dl20g9服务器系统分区,惠普商用笔记本预装WIN10系统如何分区
  6. 【知乎讨论】如何评价《上海生活垃圾管理条例》中的垃圾分类标准?
  7. 五福背后的 Web 3D 引擎 Oasis Engine 正式开源
  8. java for mac 10.7_java for mac|苹果java 7(jre7) u40 64位版 - 软件下载 - 绿茶软件园|33LC.com...
  9. EMNLP2021 | DeepBlueAI团队少量数据关系抽取论文被录用
  10. Android apk瘦身讲解