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

Dynamically Populating Chart using Data Source

1 Answer 110 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tara
Top achievements
Rank 1
Tara asked on 24 Apr 2012, 03:01 PM
Hi, 

I have dragged a chart object onto my design view. I have also set up a datasource that returns relatively simple data, e.g. A DVD title, and Quantity Sold. 

I have set this data source in the 'Data Source' property of the chart. I have also inserted the following code in the .cs file, e.g.

private void chart1_NeedDataSource(object sender, EventArgs e)
 {
Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
procChart.DataSource = ChartExample1;
 }

From looking at the following post, this appears to be all I should need to do in order to populate the chart, however it doesn't appear to be the case. 

Can someone help?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 26 Apr 2012, 11:19 AM
Hello Tara,

The code is correct, but you have not posted your data source. It should contain numeric values as the YAxis is numeric. Another thing to make sure is whether the event is fired i.e. if you have copy pasted this code from our documentation, then you would need to wire the event up:

this.chart1.NeedDataSource += new System.EventHandler(this.chart1_NeedDataSource);

I've attached a sample report that works as expected for your convenience.

Regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Tara
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or