0

How do I bind my oxyplot graph to a specific property in my model?

Allan Kendall 8 years ago 0

I've started working with Oxyplot for my mobile application. Whilst I can get it working with static values that I define I'm struggling to get it to work with my model.


My model grabs data from my Azure database, the model looks like this.


using System;

namespace MyProject
{
public class tbl_utilisation
{

public string id { get; set; }
public string psv { get; set; }
public string ahts { get; set; }
}
}


I'd like to return `ahts` to my line graph as one series and `psv` to my line graph as another series. I thought perhaps something like

    <oxy:PlotView Model="{Binding tbl_utilisation}">
<oxy:Plot>
<oxy:Plot.Series>
<oxy:LineSeries ItemsSource="{Binding ahts}" />
<oxy:LineSeries ItemsSource="{Binding psv}" />
</oxy:Plot.Series>
</oxy:Plot>
</oxy:PlotView>

This however throws an exception of:

`System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.`

Can anyone help me understand where I've gone wrong and perhaps assist me in getting this graph working? The documentation on the site is'nt the best at the moment so I am finding my way in the dark just now.



Many thanks