Get x-axis data in RadChart Click Event

Thread is closed for posting
3 posts, 0 answers
  1. Kim
    Kim avatar
    6 posts
    Member since:
    May 2009

    Posted 27 Aug 2009 Link to this post

    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. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 31 Aug 2009 Link to this post

    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.
  3. Kim
    Kim avatar
    6 posts
    Member since:
    May 2009

    Posted 31 Aug 2009 Link to this post

    Thanks, that's exactly what I was looking for.
Back to Top