I need a chartitemdatabound event handler to change how my labels are displayed for a pie chart. The following code I saw in another forum is throwing an error.
this.chart1.ItemDataBound += new EventHandler<ChartItemDataBoundEventArgs>(chart1_ItemDataBound);
Cannot implicitly convert type 'System.EventHandler<Telerik.Reporting.Charting.ChartItemDataBoundEventArgs>' to 'System.EventHandler'
Am I missing a using directive or something obvious?
Rich
this.chart1.ItemDataBound += new EventHandler<ChartItemDataBoundEventArgs>(chart1_ItemDataBound);
Cannot implicitly convert type 'System.EventHandler<Telerik.Reporting.Charting.ChartItemDataBoundEventArgs>' to 'System.EventHandler'
Am I missing a using directive or something obvious?
Rich
5 Answers, 1 is accepted
0
Hi Richard,
Here is the proper way to attach an event handler:
However you do not have to do this manually, but can wire it up from the events tab in the properties grid (see attached screenshot).
All the best,
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.
Here is the proper way to attach an event handler:
this.chart1.ItemDataBound += new EventHandler(chart1_ItemDataBound); |
private void chart1_ItemDataBound(object sender, EventArgs e) |
{ |
} |
However you do not have to do this manually, but can wire it up from the events tab in the properties grid (see attached screenshot).
All the best,
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.
0

Richard
Top achievements
Rank 1
answered on 05 May 2009, 12:47 PM
Thanks for the response, however, what I am trying to do will not work with the normal system.eventargs.
The following link is a post on the telerik forums that describes what I am trying to do, however, it is related to the radchart for winforms.
I would like to implement this for the chart in a telerik report.
http://www.telerik.com/community/forums/winforms/chart/xaxis-label-inside-the-bar.aspx
Thanks,
Rich
The following link is a post on the telerik forums that describes what I am trying to do, however, it is related to the radchart for winforms.
I would like to implement this for the chart in a telerik report.
http://www.telerik.com/community/forums/winforms/chart/xaxis-label-inside-the-bar.aspx
Thanks,
Rich
0
Accepted
Hi Richard,
You have two options:
Greetings,
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.
You have two options:
- Do this through the report designer by using the chart's ChartSeriesItem Editor (see attached screenshots)
- Through code - however you would need to use the NeedDataSource event when you want to alter the chart definition item and not the ItemDataBound event. The code is almost identical:
private void chart2_NeedDataSource(object sender, EventArgs e) { Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender; Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)procChart.ItemDefinition; defChart.Series[0].Items[0].Label.TextBlock.Text = "New Label"; defChart.Series[0].Items[0].Label.Appearance.LabelLocation = Telerik.Reporting.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside; }
Note that we set those properties to the definition chart item and not to its processing counterpart. More info on definition vs. processing is available in this help article.
Greetings,
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.
0

Richard
Top achievements
Rank 1
answered on 05 May 2009, 03:07 PM
Thanks.
The screen shots did not post, however.
Rich
The screen shots did not post, however.
Rich
0
Hello Richard,
They have been omitted from my previous post for some reason - here they are again.
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.
They have been omitted from my previous post for some reason - here they are again.
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.