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

Concatenating DataLabelsColumn for pie chart

1 Answer 110 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 05 May 2009, 06:12 PM
I have a datatable that I am using to populate a pie chart.  It has two columns Fund and Amount.  I want the labels to populate with the Fund name AND the #%...i.e. "American Funds 10%"

The problem I am having is retrieving the Fund name from the data row.  My chart uses a table adapter as the datasource.

private void chart1_NeedDataSource(object sender, EventArgs e) 
        { 
            Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart; 
            chart.DataSource = this.richPlayDBDataSetTableAdapter1.GetData(Convert.ToString(chart.Report.Parameters["SSN"])); 
                         
             
            DataRowView row = (DataRowView)chart.DataItem; 
             
            Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)chart.ItemDefinition; 
            defChart.Series[0].DefaultLabelValue = string.Format("{0} #%", row["Fund"]); 
        } 

I keep getting "Object reference not set to an instance of an object" error.  The above code works perfectly if I substitute row["fund"] for just a normal string. How can I capture the actual row value?

Rich



1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 06 May 2009, 08:34 AM
Hello Richard,

The DataItem property is obsolete - please use DataObject instead. This KB article should shed more light on the changes introduced in the Q1 release.

Regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or