Set ChartType Dynamically

Thread is closed for posting
2 posts, 0 answers
  1. John
    John avatar
    24 posts
    Member since:
    May 2008

    Posted 25 Jun 2008 Link to this post


    I have a Chart.. and a combobox that contains two items viz. 'Bar' and 'Line'. On select of the combobox item, i need to change my chart type. Since ChartType is and Enum... how can i change the ChartType based on the Combobox selected value?
    Thanks in Advance
  2. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 25 Jun 2008 Link to this post

    Hello John,

    You can use the Enum.Parse(...) method to achieve the desired effect:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
        RadChart1.Series[0].Type = (ChartSeriesType) Enum.Parse(typeof(ChartSeriesType), DropDownList1.SelectedValue); 

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top