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的知识及帮助,希望能共同交流、学习~

  • 相关阅读:
    享受生命中的琐碎时光
    探秘无线路由高级选项 化解IP冲突
    企业无线路由器故障案例分析
    网络基础:无线网络技术规范
    optimize table 删除空洞MYSQL
    Python操作excel001(了解excel基本操作
    Python操作excel002(读取数据
    NopCommerce 自定义DataAnnotation DisplayAttribute
    asp.net mvc FluentValidation 的使用
    nopCommerce : Updating an existing entity. How to add a new property.
  • 原文地址:https://www.cnblogs.com/ZHF/p/1326831.html
Copyright © 2011-2022 走看看