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

Chart needdatasource not databinding on refresh

3 Answers 203 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mohan
Top achievements
Rank 1
Mohan asked on 16 Sep 2009, 04:14 PM
I have a report with a simple bar chart. I am using report parameters to filter the queries. When i edit the parameter values and hit preview, the chart needdatasource event fires but the chart is not getting updated in the report.
 
below is the code in the  chart needdatasource event. I am populating the recordCount collection in the Report NeedDatasource event.
 private void chart1_NeedDataSource(object sender, EventArgs e)
        {

            Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
            Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)procChart.ItemDefinition;
            
            procChart.DataSource = null;
            procChart.DataSource = recordCount;
            
                     

            defChart.Series[1].DataYColumn = "Status";
            defChart.PlotArea.XAxis.DataLabelsColumn = "chartlbl";

            //defChart.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Inside;
            defChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Ariel", 8);

            
        }


Could you please let me know if I am doing anything wrong above.

Thanks

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 17 Sep 2009, 11:08 AM
Hi Mohan,

You've not posted the most important part - how you update the recordCount datasource in the event i.e. how the datasource changes and respectively the changes are reflected in the chart. You can review the Product Line Sales demo report, that updates 2 charts based on parameters for scenario similar to yours.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mohan
Top achievements
Rank 1
answered on 17 Sep 2009, 02:05 PM
The recordCount is updated in the report NeedDataSource event. When I step through code I confirmed that the recordCount in the chart1 NeedDataSource event has the updated values. but the values are not showing up in the Report chart.

Also want to clarify that the chart displays the value when the report runs the first time. But if I then change the parameters and hit preview the chart does not get updated.


0
Steve
Telerik team
answered on 18 Sep 2009, 03:51 PM
Hi Mohan,

Unfortunately the information you've provided is not sufficient for us to determine where the problem might be. Please review the Product Line Sales demo report, that shows you how we update 2 charts based on changed parameter values and see what differs in your case. If still having problems, please open a support ticket and attach a sample runnable report that shows the problem at hand.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Mohan
Top achievements
Rank 1
Answers by
Steve
Telerik team
Mohan
Top achievements
Rank 1
Share this question
or