I want to create a line chart where in x axis I will have dates and in y axis I will have prices.
I have createad an list of all the dates and prices from the database.
var ListOfDates = DBaccess.GetOperationToList().Select(x =>x.Data.ToString());
var ListOfPrices = DBaccess.GetOperationToList().Select(x => x.Price);
for (int i = 0; i < ListOfDates.Count(); i++)
{
chart2.Series["s1"].Points.AddXY(ListOfPrices, ListOfPrices);
}
When I want to create points I have the following mistake "Points od data doesn't work value type 'System.Linq.Enumerable+WhereSelectEnumerableIterator'. You can use Double, Decimal, Single, int, long, uint, ulong, String, Datetime, short, ushort."
But the Data in ListOfDates have Datetime type, and the Price have Double type. How do I change the type?
AddXY(ListOfDates[i], ListOfPrices)[i]);? But onit the ToString from the DataTime so it will add the real type, not strings!