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

Get x-axis data in RadChart Click Event

2 Answers 122 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 27 Aug 2009, 03:49 PM
I have a stacked bar chart that is bound to a SQLDataSource. The dataset has 3 columns: Project, StartDate, Hours. StartDate is on the x-axis, hours is on the y-axis, and the data is grouped by project. When I added a click event for the chart to the code behind, each stacked bar piece became clickable. In the click event code, I want to be able to access the project name, date, and hours for the item that was clicked. So far I was able to figure out how to get project name using args.Series.Name and hours using args.seriesItem.yvalue. However, I can't figure out a way to get the date of the clicked item.

I'm new to the telerik controls, so it's possible I'm not binding the chart properly. When I bind the chart to the datasource, I set

 

RadChart1.DataGroupColumn = "Project"

RadChart1.PlotArea.XAxis.DataLabelsColumn = "StartDate"

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 31 Aug 2009, 10:48 AM
Hi Kim Quigley,

You can retrieve the item's index from args.SeriesItem.Index. You can then use the retrieved value to get the corresponding X axis item:

RadChart1.PloatArea.XAxis.Items[args.SeriesItem.Index].TextBlock.Text

Kind regards,
Ves
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
Kim
Top achievements
Rank 1
answered on 31 Aug 2009, 07:52 PM
Thanks, that's exactly what I was looking for.
Tags
Chart (Obsolete)
Asked by
Kim
Top achievements
Rank 1
Answers by
Ves
Telerik team
Kim
Top achievements
Rank 1
Share this question
or