Can I include/exclude certain points from a SeriesMapping Itemsource from being drawn

3 posts, 0 answers
  1. Rob
    Rob avatar
    8 posts
    Member since:
    Jan 2013

    Posted 19 Nov 2013 Link to this post

    Suppose I have a the following class

    public class DataRow
        public int X { get; set; }
        public int Y { get; set; }
        public bool Exclude;

    I want to plot this on a RadChart using a seriesmapping, which I do like this.

    ObservableCollection<DataRow> SeriesSource = new ObservableCollection<DataRow>();
    SeriesMapping series = new SeriesMapping();
    series.ItemsSource = source;
    series.ItemMappings.Add(new ItemMapping("X", DataPointMember.XValue));
    series.ItemMappings.Add(new ItemMapping("Y", DataPointMember.YValue));

    Is there any way that I can include/exclude data points being plotted based on the value of 'Exclude'? I wish to be able to include/exclude certain points from the plotted line.

    The only other solution I can think of is to scan through the collection and create a second collection just containing members which aren't excluded. This doesn't seem very efficient though.
  2. Rob
    Rob avatar
    8 posts
    Member since:
    Jan 2013

    Posted 20 Nov 2013 Link to this post

    I've found the feature I need, I'm adding a ChartFilterDescriptor to the series like this....

    ChartFilterDescriptor filter = new ChartFilterDescriptor();
    filter.Member = "Excluded";
    filter.Operator = FilterOperator.IsEqualTo;
    filter.Value = false;

    This works, but only when the series is originally drawn. If I change the value of Exclude (calling NotifyPropertyChanged etc) this isn't reflected in the chart, the plots change correctly when I change the X & Y values though.

    Is there something I'm missing to will I have to recreate the series each time the value of Exclude changes?
  3. Petar Marchev
    Petar Marchev avatar
    996 posts

    Posted 22 Nov 2013 Link to this post

    Hello Craig,

    I suggest you go with your original idea about creating a second items source collection that you update when needed. It will not be more efficient if you use a filter descriptor.

    On a side note - if you have not integrated the old RadChart into your project, I suggest you consider using the new ChartView which has a higher performance rate and generally it is more flexible.

    Petar Marchev
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top