Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > Creating a Pie chart

Not answered Creating a Pie chart

Feed from this thread
  • Posted on May 27, 2009 (permalink)

    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.

    Reply

  • Giuseppe Giuseppe admin's avatar

    Posted on May 28, 2009 (permalink)

    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.

    Reply

  • Q1 Webinar Week

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > Creating a Pie chart
Related resources for "Creating a Pie chart"

WPF Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]