Adding Data to Pie Chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 18
Joined: Thu Sep 12, 2013 12:00 am

Adding Data to Pie Chart

Post by lilo » Sat Sep 13, 2014 4:24 am

How do I add data for a pie chart from code?
For example, what are the x and y values?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Adding Data to Pie Chart

Post by Christopher » Mon Sep 15, 2014 7:54 am

Hello!
lilo wrote:How do I add data for a pie chart from code?
For example, what are the x and y values?
A simple example may look like this:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      Pie pie = new Pie(tChart1.Chart);

      pie.Add(2);
      pie.Add(3);
      pie.Add(4);

      pie.Circled = true;
    }
There are no 'x-values' in a pie series as such, as a pie series doesn't have axes. There are only 'y-values' which effectively represent the percentage of the pie taken.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

lilo
Newbie
Newbie
Posts: 18
Joined: Thu Sep 12, 2013 12:00 am

Re: Adding Data to Pie Chart

Post by lilo » Tue Sep 16, 2014 6:25 am

Hi Christopher,

Thanks, this is what I was looking for.

Post Reply