RadChart SeriesMapping Visibility

4 posts, 0 answers
  1. Max
    Max avatar
    20 posts
    Member since:
    Mar 2010

    Posted 11 May 2010 Link to this post

    I have a RadChart with four SeriesMappings that I've added to it.  I want to show or hide them based on the user clicking a button.  Here is the code that I'm using, but the SeriesMappings do not disappear:

    foreach (SeriesMapping sm in radChart.SeriesMappings) 
         sm.SeriesDefinition.Visibility = SeriesVisibility.Collapsed; 
     

    I would expect the lines to disappear from the chart buy they do not.  Am I missing something?


  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 14 May 2010 Link to this post

    Hello Max,

    Currently the SeriesMapping's SeriesDefinitions are being copied in the data series.

    In order to show/hide series, you will need to directly access the:
    RadChart.DefaultView.ChartArea.DataSeries[i].Definition.Visibility

    Regards,
    Joshua
    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.
  3. Max
    Max avatar
    20 posts
    Member since:
    Mar 2010

    Posted 14 May 2010 Link to this post

    OK, is there a way I can access the DataSeries.Definition's underlying name?  I don't want to show/hide all of them at once, only the one that the user has selected.

    For example:

    SeriesMapping sm1 = new SeriesMapping(); 
    sm1.SeriesDefinition = new SplineSeriesDefinition(); 
    sm1.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XValue)); 
    sm1.ItemMappings.Add(new ItemMapping("NumberOfSales", DataPointMember.YValue)); 
    sm1.LegendLabel = "NumberOfSales"
     
    radChart.SeriesMappings.Add(sm1); 

    How can I hide/show just the "NumberOfSales" SeriesMapping?

    Thanks,

    Max


  4. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 19 May 2010 Link to this post

    Hello Max,

    Until we solve the issue with the series definitions being copied, you will have to find the corresponding DataSeries and modify the visibility of it's definition. For each mapping there is a data series generated in the RadChart.DefaultView.ChartArea.DataSeries collection.

    Best,
    Joshua
    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