zoukankan      html  css  js  c++  java
  • TeeChart绘制多个饼图

    最近一段时间在学习使用TeeChart

    private void DrawPie()
        {
            Chart chart1 = WebChart1.Chart;
            WebChart1.PictureFormat = Steema.TeeChart.Export.PictureFormats.Bitmap;
            //设置保存数据形式,默认File,一般选session。Chart.Aspect(外观属性)
            WebChart1.TempChart = Steema.TeeChart.Web.TempChartStyle.Session;
            WebChart1.GetChartFile = "GetChart.aspx";

            chart1.Header.Text = "饼图";
            //是否显示图例
            chart1.Legend.Visible = false;

            Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie();
            Steema.TeeChart.Styles.Pie pie2 = new Steema.TeeChart.Styles.Pie();
            Steema.TeeChart.Styles.Pie pie3 = new Steema.TeeChart.Styles.Pie();

            chart1.Series.Add(pie1);  
            chart1.Series.Add(pie2);
            chart1.Series.Add(pie3);
           

            //WebChart1.Chart.ChartRect = new Rectangle(10, 10, 10, 10);
            chart1.Series[0].Add(1, 120);
            chart1.Series[0].Add(2, 320);
            //pie1.BeforeDrawValues += new PaintChartEventHandler(pie1_BeforeDrawValues);
            

            chart1.Series[1].Add(1, 120);
            chart1.Series[1].Add(2, 320);
            chart1.Series[1].Add(3, 420);
            chart1.Series[1].Add(4, 220);
            //pie2.BeforeDrawValues += new PaintChartEventHandler(pie2_BeforeDrawValues);  

            chart1.Series[2].Add(1, 120);
            chart1.Series[2].Add(2, 320);
            chart1.Series[2].Add(3, 420);
            chart1.Series[2].Add(4, 220);

            for (int i = 0; i < 3; i++)
            {
                //显示标注
                chart1.Series[i].Marks.Visible = true;
            }
        }

       或者固定显示位置:

       void pie2_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            WebChart1.Chart.ChartRect = new Rectangle(WebChart1.Chart.Width / 2, 10, WebChart1.Chart.Width / 2 - 20, WebChart1.Chart.Height / 2 - 20);
        }

        void pie1_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            WebChart1.Chart.ChartRect = new Rectangle(10, 10, WebChart1.Chart.Width / 2 - 20, WebChart1.Chart.Height / 2 - 20);
        }

    如果大家有其它关于TeeChart的知识及帮助,希望能共同交流、学习~

  • 相关阅读:
    【技术评网】说说豆瓣的URL设计
    在这一刻,还是忍不住满眼泪水
    装Sybase,装WAS 6.1的时候报错java.exe损坏的图象
    JasperRepor导出报表通用类
    XSS跨站攻击
    sql 脚本
    解决在无线网络下本机无法连接linux(红帽)虚拟机问题
    pl /sql导入导出表结构,表数据,sql脚本
    asp.net关于WEB端用户重复提交问题。禁用服务器控件按钮问题。
    MQ命令学习总结大全MQ常用命令
  • 原文地址:https://www.cnblogs.com/ZHF/p/1326831.html
Copyright © 2011-2022 走看看