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

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

1 Answer 80 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Prabhu
Top achievements
Rank 1
Prabhu asked on 26 Jun 2012, 10:29 AM
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.

1 Answer, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 29 Jun 2012, 07:54 AM
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 >>

Tags
Chart
Asked by
Prabhu
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Share this question
or