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

Chart Databinding

1 Answer 198 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 13 Aug 2008, 05:39 PM
Hello all -

I'm currently evaluating Telerik Reporting and am attempting to create a simple chart.  I have a TableAdapter on the reporting surface as well as a Chart control.  When I bring up the ChartUI I am unable to databind it to the TableAdapter (I'm assuming this is possible?).  The following message is displayed: To dynamically populate the chart with data use the NeedDataSource event.

Is it not possible to define the databindings at design time rather than from within code-behind?  I'm sure I'm just doing something silly but if someone could shed some light on my problem that would be great!

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Chavdar
Telerik team
answered on 14 Aug 2008, 12:45 PM
Hello Gary,

Currently the Chart item does not support binding to data adapters. For the full list of supported data sources you can refer to the Data Binding Chart documentation article.

At this moment the NeedDataSource event is the only place where you can feed the chart with data. You can easily fill a DataSet or a DataTable object by using the design time generated data components. Here is an example:

        private void chart1_NeedDataSource(object sender, System.EventArgs e)
    {
       Telerik.Reporting.Processing.Chart chart =
                (Telerik.Reporting.Processing.Chart)sender;

       ChartDataSet.CurrencyRateDataTable dataTable = new ChartDataSet.CurrencyRateDataTable();
       ChartDataSetTableAdapters.CurrencyRateTableAdapter tableAdapter = new CurrencyRateTableAdapter();
       tableAdapter.Fill(dataTable);
       chart.DataSource = dataTable;
    }


Sincerely yours,
Chavdar
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Gary
Top achievements
Rank 1
Answers by
Chavdar
Telerik team
Share this question
or