How to identify the click event when XCategory having more then one barseries

2 posts, 0 answers
  1. Prabhu
    Prabhu avatar
    25 posts
    Member since:
    Feb 2008

    Posted 26 Jun 2012 Link to this post

    Hi,

    I have radchart with BarSeriesDefinition, Each Xcategory have many barseries. When i click the barseries i need to get the Series name and value which is clicked by user. So that i can get the drill down option. Please provide the sample code also.
  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 29 Jun 2012 Link to this post

    Hi Prabhu,

    Have you seen the online demo and the online readings about the topic? Over there you can see how to achieve the drill down.

    About the clicking, check the code snippet below.
    SeriesMapping seriesMapping5 = new SeriesMapping { LegendLabel = "Some Label" };
    seriesMapping.SeriesDefinition.InteractivitySettings.SelectionMode = ChartSelectionMode.Single;
    seriesMapping.SeriesDefinition.InteractivitySettings.SelectionScope = InteractivityScope.Item;
     
    RadChart1.DefaultView.ChartArea.SelectionChanged += new EventHandler<ChartSelectionChangedEventArgs>(ChartArea_SelectionChanged);
     
    void ChartArea_SelectionChanged(object sender, ChartSelectionChangedEventArgs e)
    {
       // you can access the ChartSelectionChangedEventArgs
       //which gives you a variety of details about the clicked object
       var selectedItem = e.AddedItems.FirstOrDefault();
       var month = selectedItem.XCategory; // it could be the XValue, depending on the item mapping
       var value = selectedItem.YValue;
       var series = selectedItem.DataSeries.LegendLabel;
    }
    You need to set the LegendLabel of the series so that you can identify it after that.

    All the best,
    Rosko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top