SeriesMapping and weird behavior with XCategory

2 posts, 0 answers
  1. Jatinder
    Jatinder avatar
    12 posts
    Member since:
    Oct 2011

    Posted 28 Dec 2011 Link to this post

    I have a SeriesMapping bound to IList<Tuple<string,int>>. The XAxis is bound to the string as a XCategory and the yaxis to the int.

    Below is my xaml and my viewmodel.

    The data is presented just as i want to but with a strange thing happening when i bound to a large list. It seems that the xcategory breaks down once the collection is past 200 items (in code below the for loop where i<190 - change that to say 210 and hell breaks loose). The xcategory gets messed up to numbers and not categorized anymore. See the 2 screenshots. 

    <chart:RadChart x:Name="RadChart1" ItemsSource="{Binding Items}">
                            <charting:ScatterSeriesDefinition ShowItemToolTips="True" LegendDisplayMode="None"/>
                        <charting:ItemMapping FieldName="Item1" DataPointMember="XCategory" />
                        <charting:ItemMapping FieldName="Item2" DataPointMember="YValue" />
                            <charting:ChartArea ItemToolTipOpening="ChartArea_ItemToolTipOpening">
                                    <charting:AxisX />
                                    <charting:AxisY MinorTicksVisibility="Collapsed" />

    private Random ran;
            public DetailsViewModel()
                ran = new Random();
            private void createName()
                names = new List<string>()
            private void createData()
                int count = names.Count;
                var t = new ObservableCollection<Tuple<string, int>>();
                for (int i = 0; i < 190; i++)
                    int val = ran.Next(5000);
                    t.Add(new Tuple<string, int>(names[val % count], val));
                Items = t;
            public List<string> names { get; set; }
            public ObservableCollection<Tuple<string, int>> Items { get; set; }
  2. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 29 Dec 2011 Link to this post

    Hello Jatinder,

    200 is the default sampling threshold value for RadChart. You will need to set the SamplingThreshold value to 0 in the sampling settings to disable the built-in sampling mechanism ( and your chart should work as expected.

Back to Top