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

  • 相关阅读:
    Python中常见字符串去除空格的方法总结
    Python多版本pip安装库的问题
    报错No module named IPython的解决方法
    Win10家庭版如何启用本地组策略
    Oracle 11gR2新建空表不分配Segment
    Hadoop Balance
    Hive报错之java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonFactory
    Hive文件格式
    Hive报错之java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value
    Oracle之Union与Union all的区别
  • 原文地址:https://www.cnblogs.com/ZHF/p/1326831.html
Copyright © 2011-2022 走看看