Unable to display data (WP8)

Dec 4, 2013 at 2:59 PM
Edited Dec 4, 2013 at 3:35 PM
Hello,

I'm using Sparrow Toolkit to try displaying a chart. Up until now I have never been able to display any data.
If I don't fill the collection binded to the chart, an empty chart show up. But if I try to add values in the chart, then I get an exception that I don't understand. Stack trace is not deep enough to see what's wrong ...

In my XAML file :
<sparrow:SparrowChart>
                <sparrow:SparrowChart.XAxis>
                    <sparrow:DateTimeXAxis StringFormat="HH:mm" />
                </sparrow:SparrowChart.XAxis>
                <sparrow:SparrowChart.YAxis>
                    <sparrow:LinearYAxis />
                </sparrow:SparrowChart.YAxis>
                <sparrow:AreaSeries PointsSource="{Binding Measures}"
                                    StrokeThickness="1"
                                    Stroke="CadetBlue"
                                    Fill="Aquamarine"
                                    XPath="Time"
                                    YPath="Value" />
            </sparrow:SparrowChart>
In my ViewModel :
private IObservableCollection<MeasureModel> _measures;

public IObservableCollection<MeasureModel> Measures
{
get
            {
                return _measures;
            }
        }

public GraphPageViewModel()
{
            _measures = new BindableCollection<MeasureModel>();

            for (int i = 0; i < 24; i++)
                _measures.Add(new MeasureModel(DateTime.Now.AddHours(i), i * 3.0));
        }
And here's my model :
   public class MeasureModel
    {
        private DateTime _time;

        public DateTime Time
        {
            get { return _time; }
        }

        private double _value;

        public double Value
        {
            get { return _value; }
        }

        public MeasureModel(DateTime time, double value)
        {
            _time = time;
            _value = value;
        }
    }
When I do this and I launch to try to test it, I get the following exceptions :
A first chance exception of type 'System.ArgumentNullException' occurred in System.Core.ni.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.ni.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.ni.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.ni.dll
A first chance exception of type 'System.ArgumentException' occurred in Microsoft.Phone.ni.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in System.Windows.ni.dll
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.Windows.ni.dll
I don't understand what's going on since I compared with some examples I could find and I can't see anything ....

Thanks in advance
Dec 5, 2013 at 9:41 AM
I think I solved it ... In the model, properties need to have a setter also !