Extra white space in pie

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Extra white space in pie

Post by qcrnd » Tue Feb 09, 2010 3:22 pm

Hi,

I have a problem where the pie has too much space between its' start (on the left) and the actual border of the panel (I've added an image to demonstrate).

Could you please advice me on how to control that space or eliminate it all together.

Thank you,

Jonathan
Attachments
Pie chart.jpg
Pie chart.jpg (24.83 KiB) Viewed 4173 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Extra white space in pie

Post by Sandra » Thu Feb 11, 2010 10:13 am

Hello gcrnd,

I found a simple code that I think you could use in your application to control space there are between pie and margins. Please, check next code works as you want:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private Steema.TeeChart.Styles.Pie pie1;
        private void InitializeChart()
        {
           //tChart1.Legend.Visible = false;
            pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
            pie1.FillSampleValues(4);
            tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
            tChart1.Draw();

        }
        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            Rectangle rect = tChart1.Chart.ChartRect;
            int w = tChart1.Legend.Visible ? tChart1.Legend.Left - rect.Left : rect.Width;
            pie1.CustomXRadius = (w / 2) - getWidestMark(pie1);
            pie1.CustomYRadius = rect.Height / 2;
        }
        private int getWidestMark(Steema.TeeChart.Styles.Series s)
        {
            int tmp = 0; 

            if (s.Marks.Visible)
            {
                for (int i = 0; i < s.Marks.Positions.Count; i++)
                {
                    tmp = Math.Max(tmp,s.Marks.Positions[i].Width);
                }
            }

            return tmp;
        }
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply