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

RadChart SeriesMapping Visibility

3 Answers 184 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 11 May 2010, 02:01 PM
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?


3 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 14 May 2010, 09:21 AM
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.
0
Max
Top achievements
Rank 1
answered on 14 May 2010, 03:10 PM
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


0
Dwight
Telerik team
answered on 19 May 2010, 08:03 AM
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.
Tags
Chart
Asked by
Max
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Max
Top achievements
Rank 1
Share this question
or