Reputation:
I am trying to create a chart with Microcharts. The problem is that I get the points from a List called PriceList. First take a look at this website: https://blog.xamarin.com/microcharts-elegant-cross-platform-charts-for-any-app/
So, I have to make something like this:
foreach (var p in PriceList)
{
List<Microcharts.Entry> entries = new List<Microcharts.Entry>
{
new Entry(212)
{
Label = "UWP",
ValueLabel = "212",
Color = SKColor.Parse("#2c3e50")
}
}
}
First of all, it gives an error on the word Entry. "The type or namespace 'Entry' does not exist in the namespace 'Microcharts' (Are you missing an assembly reference?)"
Second, I need the correct values from the List in the points. This is the List class:
public class price
{
public string NAME { get; set; }
public string PRICE { get; set; }
public string TIMESTAMP { get; set; }
}
I get multiple Prices and Timestamps, so I want all the Prices in 1 List orderby Timestamp. I made this:
var singleNameWithOldestPrice =
from p in PriceList
where p.NAME.Contains(SelectedProduct, StringComparison.OrdinalIgnoreCase)
group p by p.NAME into grp
select grp.OrderBy(a => a.TIMESTAMP);
Now I have a short list with all the prices and timestamps by 1 name.
How can I put every price in the chart orderby timestamp? I hope my story has become a bit clear, if not... Please let me know?
PS: This is not going to work:
var singleNameWithOldestPrice =
from p in PriceList
where p.NAME.Contains(SelectedProduct, StringComparison.OrdinalIgnoreCase)
group p by p.NAME into grp
select grp.OrderBy(a => a.TIMESTAMP).ToArray();
foreach (var p in singleNameWithOldestPrice)
{
List<Microcharts.Entry> entries = new List<Microcharts.Entry>
{
new Entry(p)
{
Label = "p.NAME",
ValueLabel = "p.PRICE",
Color = SKColor.Parse("#2c3e50")
}
}
}
Upvotes: 0
Views: 1691
Reputation: 11
I found out that if you installed the Microcharts.Forms plugin, you also need to install the Microcharts plugin.
Upvotes: 1