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

SeriesMapping and weird behavior with XCategory

1 Answer 75 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jatinder asked on 28 Dec 2011, 10:22 PM

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; }

1 Answer, 1 is accepted

Sort by
Bartholomeo Rocca
Top achievements
Rank 1
answered on 29 Dec 2011, 12:25 PM
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.

Asked by
Top achievements
Rank 1
Answers by
Bartholomeo Rocca
Top achievements
Rank 1
Share this question