Creating a Pie chart

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    26 posts
    Member since:
    Apr 2009

    Posted 27 May 2009 Link to this post

    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.
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 28 May 2009 Link to this post

    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.
Back to Top