Selection of bar on combo selectin change

2 posts, 0 answers
  1. Ramya
    Ramya avatar
    27 posts
    Member since:
    Jan 2011

    Posted 28 Apr 2011 Link to this post

    Hi,

        i have all the x axis values on a graph within the combo. suppose i select a value in the combox tht corresponding bar should be selected in the chart suppose i have mango,apple in the x-axis and the same name appears in my combo box too.so when i select mango on the combo box the corresponding bar realted to mango shld be selected.is der a possibility any help?

    regards
    Muneer


  2. Missing user
    Missing user avatar

    Posted 03 May 2011 Link to this post

    Hello Ramya,

    First you need to define the InteractivitySettings of the SeriesDefinition:
    <telerik:BarSeriesDefinition>
        <telerik:BarSeriesDefinition.InteractivitySettings>
            <telerik:InteractivitySettings HoverScope="None" SelectionScope="Item" />
        </telerik:BarSeriesDefinition.InteractivitySettings>
    </telerik:BarSeriesDefinition>

    After that you can set the RadChart.DefaultView.ChartArea.SelectItem(int itemIndex) in the ComboBox.SelectionChanged event. In this case the itemIndex will be the ComboBox.SelectedIndex.
    private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        RadChart.DefaultView.ChartArea.SelectItem(((ComboBox)sender).SelectedIndex);
    }

    Please note that you need to sort the Items of the ComboBox, so that their order will be like the order of the items on the XAxis. This will ensure that when you select an item from the ComboBox its index will be the same as the needed item in the RadChart.

    I hope this helps

    Greetings,
    Polina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top