11 Answers, 1 is accepted
You can retrieve data from database using a technology of your choice (like Ado.NET, Linq to SQL, Entity Framework, etc.) and store this data in objects. Then you can bind your RadChart to the collection of these objects and set the SeriesMapping accordingly.
Here is an example:
Imagine that you have retrieved data from your database. Your class has one property that is called Quantity.
<
telerik:RadChart
x:Name
=
"radChart"
>
<
telerik:RadChart.SeriesMappings
>
<
telerik:SeriesMapping
LegendLabel
=
"Product Sales"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:PieSeriesDefinition
/>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Quantity"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
</
telerik:RadChart.SeriesMappings
>
</
telerik:RadChart
>
This markup will create a pie chart that binds to the Quantity property of your class.
You can read more on how to databind RadChart in this topic in the online help system.
Yavor Ivanov
the Telerik team

When I try to add a chart from the toolbox
I got the attached window?
How can I resolve that?

If you are using local libs and not from GAC you can try deleting local libs and using only those from GAC. Try clean / rebuild and see if you still get this error.
You can also find additional information in a similar thread in our forum here.
Hope this helps!
Yavor Ivanov
the Telerik team

How can I bind the data to sql?
Thanks in advance
I suggest that you follow our help topic and use ADO.NET Data Service to bind the Chart to an SQL database as Northwind for example. Feel free to modify the code snippets so that they meet your requirements.
Greetings,
Evgenia
the Telerik team

Is there is any other direct way instead of using services and reference?
Thanks in advance

Can’t we use sqldatasource and connection String is it possible or no way rather than using services.
I need wpf chart for desktop application
I believe you understand that consuming data from SQL database is beyond the support scope of our controls. We can guide you to our help topics or demos where there are samples using different approaches but it's up to you to choose how you will do it. Here you may find helpful information how to populate RadControls with data. You may also take a look at our RadChart documentation where we demonstrated how to bind RadChart to Northwind sample database using WCF service or ADO.NET Data Service.
Regards,
Evgenia
the Telerik team

Do you have any sample to bind to DataTable?
Thanks in advance
The way you bind RadChart to DataTable is the same as you would bind it to List of Business objects. Here is an example:
InitializeComponent();
DataTable table = new DataTable();
table.Columns.Add(new DataColumn("Name1", typeof(string)));
table.Columns.Add(new DataColumn("Value1", typeof(int)));
table.Columns.Add(new DataColumn("Name2", typeof(string)));
table.Columns.Add(new DataColumn("Value2", typeof(int)));
table.Rows.Add(new object[] { "C1", 12, "C24", 30 });
table.Rows.Add(new object[] { "C2", 14, "Dist", 90 });
table.Rows.Add(new object[] { "C12", 25, "site", 24 });
DataSeries chartSeries1 = new DataSeries();
radChart1.ItemsSource = table;
Regards,
Evgenia
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>