Points not plotting correctly

Dec 13, 2013 at 3:26 PM
I have been going through the previous posts trying to find issues same as mine. I have implemented many things to try and get this working but it still isn't doing what i want it to...

I am creating a WP8 app and am hoping to use the chart function to display a line graph... very simple. The data for the graph is pulled from a REST service and fills a class as required. When debugging the application, i can see that the data is being loaded into the series, but it isn't plotting the data on the chart. My code is as below.
 public class ProductsGraphData
    {
        public double Value { get; set; }
        public string Date { get; set; }

        public ProductsGraphData()
        {
        }
}

                //Code for getting REST data removed

XDocument doc = XDocument.Parse(resultString.ToString());

                var products = from p in doc.Descendants(XName.Get("ProductPriceInformation", "http://schemas.datacontract.org/2004/07/REST_Service"))
                               select new ProductsGraphData
                               {
                                   Value = double.Parse(p.Element(XName.Get("Value", "http://schemas.datacontract.org/2004/07/REST_Service")).Value),
                                   Date = DateTime.Parse(p.Element(XName.Get("Date", "http://schemas.datacontract.org/2004/07/REST_Service")).Value).ToString("dd/MM/yyyy")
                               };

                Collection = new ObservableCollection<ProductsGraphData>();

                foreach (var p in products)
                {
                    ProductsGraphData pgd = new ProductsGraphData();
                    pgd.Date = p.Date;
                    pgd.Value = p.Value;
                    Collection.Add(pgd);
                }

                chart1.Series = series(Collection);
                chart1.OnApplyTemplate();
 private SeriesCollection series(ObservableCollection<ProductsGraphData> data)
        {
            SeriesCollection retval = new SeriesCollection();

            LineSeries line = new LineSeries();
            line.XPath = "Date";
            line.YPath = "Value";
            line.PointsSource = data;
            retval.Add(line);

            return retval;
        }
Any help with this would be much appreciated.
Dec 13, 2013 at 3:33 PM
further to this, i do get a {System.Windows.LayoutCycleException: Layout cycle detected. Layout could not complete.} error after the page finishes loading. The XAML for this app is
<sparrow:SparrowChart x:Name="chart1">
                <sparrow:SparrowChart.XAxis>
                    <sparrow:CategoryXAxis Header="Date" StringFormat="dd-MM-yyyy" />
                </sparrow:SparrowChart.XAxis>
                <sparrow:SparrowChart.YAxis>
                    <sparrow:LinearYAxis MinValue="1.00" MaxValue="3.00" Header="Value" StringFormat="£0.00"/>
                </sparrow:SparrowChart.YAxis>
            </sparrow:SparrowChart>
Dec 14, 2013 at 10:20 AM
Ok, so i have figured out what the issue is. When the Category XAxis value has more than 4 characters, it throws the error. If i set my 'Date' StringFormat to "dd" it works fine. when i do "dd-MM" or "dd-MM-yyyy" it throws the layout cycle error.

Is there any workaround in place for this, or can an update/workaround be created?