This is a migrated thread and some comments may be shown as answers.

Creating a Pie chart

1 Answer 84 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 28 May 2009, 12:21 AM
Hi,

I have the following code:

            PieSeriesDefinition definition = new PieSeriesDefinition();  
            definition.LegendDisplayMode = LegendDisplayMode.DataPointLabel;  
            radChart1.DefaultSeriesDefinition = definition;  
 
            DataSeries DS = new DataSeries();  
            DataPoint DP = new DataPoint();  
 
            DS.LegendLabel = "Over25";  
            DP.YValue = 66;  
            DS.Add(DP);  
            radChart1.DefaultView.ChartArea.DataSeries.Add(DS);  
 
            DataSeries DS2 = new DataSeries();  
            DataPoint DP2 = new DataPoint();  
            DS2.LegendLabel = "Over20";  
            DP2.YValue = 100;  
            DS2.Add(DP2);  
            radChart1.DefaultView.ChartArea.DataSeries.Add(DS2);  
 
            DataSeries DS3 = new DataSeries();  
            DataPoint DP3 = new DataPoint();  
            DS3.LegendLabel = "Over15";  
            DP3.YValue = 120;  
            DS3.Add(DP3);  
            radChart1.DefaultView.ChartArea.DataSeries.Add(DS3);  
 
            DataSeries DS4 = new DataSeries();  
            DataPoint DP4 = new DataPoint();  
            DS4.LegendLabel = "Over10";  
            DP4.YValue = 113;  
            DS4.Add(DP4);  
            radChart1.DefaultView.ChartArea.DataSeries.Add(DS4);  
 
            DataSeries DS5 = new DataSeries();  
            DataPoint DP5 = new DataPoint();  
            DS5.LegendLabel = "Under10";  
            DP5.YValue = 178;  
            DS5.Add(DP5);  
            radChart1.DefaultView.ChartArea.DataSeries.Add(DS5); 

But this is producing a bar chart. how do I make it a Pie chart?

Cheers,
Kevin.

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 28 May 2009, 10:28 AM
Hi Kevin,

RadChart.DefaultSeriesDefinition is taken into account in databinding scenarios. When you are creating the DataSeries manually, you need to set the respective DataSeries.Definition property for each series.

Hope this helps.


Regards,
Manuel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart
Asked by
Kevin
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or