locked
Change chart series type on the fly RRS feed

  • Question

  • Hi,

    I have another problem concerning charts.

    I have multiple series, and I want to change their type after they've been created.

    For exemple, I have a columnSeries draw, and I want to change it to an areaSeries.

    In order to solve this problem I ve tryied the solution which consist in removing series, and recreate it with the right type, but it doesn't match my idea.

    So is it possible to cast or change type without removing the serie?

    Here is an extract of my current code:

    RadioButton rb = (sender as RadioButton);
    Series ser = myChart.Series.Cast<Series>().Where(s => s.Title.ToString() == rb.Tag.ToString()).ElementAtOrDefault(0);
    myChart.Series.Remove(ser);
    AddSeries(...);


     

     

    Regards.

    Friday, August 13, 2010 10:10 AM

Answers

  • Hi,

    No, you cannot cast it from ColumnSeries to AreaSeries. If you don't want to remove one and add another, you may try to add both series to the chart and toggle the Visibility of the two. 

    Sunday, August 15, 2010 10:57 PM

All replies

  • Hi,

    No, you cannot cast it from ColumnSeries to AreaSeries. If you don't want to remove one and add another, you may try to add both series to the chart and toggle the Visibility of the two. 

    Sunday, August 15, 2010 10:57 PM
  • Ok, thanks for your reply.

    I will try another way. 

    Monday, August 16, 2010 7:52 AM