Page 1 of 1

Adding Data to Pie Chart

Posted: Sat Sep 13, 2014 4:24 am
by 15666968
How do I add data for a pie chart from code?
For example, what are the x and y values?

Re: Adding Data to Pie Chart

Posted: Mon Sep 15, 2014 7:54 am
by Christopher
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.

Re: Adding Data to Pie Chart

Posted: Tue Sep 16, 2014 6:25 am
by 15666968
Hi Christopher,

Thanks, this is what I was looking for.