Sorry for the noob question, but why don't I see a pie chart ?
<
UserControl
x:Class
=
"radPie.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadChart
Name
=
"myPie"
/>
<
Button
Content
=
"Next"
Click
=
"ShowChart"
Width
=
"50"
Height
=
"25"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
/>
</
Grid
>
</
UserControl
>
using System;
using System.Collections.Generic;
using System.Windows.Controls;
using Telerik.Windows.Controls.Charting;
namespace radPie
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
myPie.DefaultView.ChartTitle.Content = "My Pie";
myPie.DefaultSeriesDefinition = new PieSeriesDefinition();
ShowChart(null,null);
}
public void ShowChart(object sender, System.Windows.RoutedEventArgs e)
{
Random random = new Random();
List<
string
> fruits = new List<
string
>() { "Apples", "Oranges", "Pears", "Peaches", "Bananas", "Grapes" };
myPie.DefaultView.ChartArea.DataSeries.Clear();
foreach (string s in fruits)
{
DataSeries series = new DataSeries() { LegendLabel = s };
series.Add(new DataPoint(random.Next(0, 50)));
myPie.DefaultView.ChartArea.DataSeries.Add(series);
}
}
}
}