I've store data for each collecting parameter in ObservableCollection<DataValue>
collection:
public sealed class DataValue: BaseModel
{
private int _id;
public int ID
{
get { return _id; }
set
{
_id = value;
NotifyPropertyChanged("ID");
}
}
private DateTime _timevalue;
public DateTime TimeValue
{
get { return _timevalue; }
set
{
_timevalue = value;
NotifyPropertyChanged("TimeValue");
}
}
private double _value;
public double Value
{
get { return _value; }
set
{
_value = value;
NotifyPropertyChanged("Value");
}
}
private string _name;
public string Name
{
get { return _name; }
set
{
_name = value;
NotifyPropertyChanged("Name");
}
}
}
From DB layer I've get similar data:
╔═══════════╦═════════════════════╦═══════════╦═════════╗
║ ID ║ Date ║ Value ║ Name ║
╠═══════════╬═════════════════════╬═══════════╬═════════╣
║ 1 ║ 2019-11-17 20:00:00 ║ 200.05 ║ Name1 ║
║ 1 ║ 2019-11-17 20:03:00 ║ 210.05 ║ Name1 ║
║ 1 ║ 2019-11-17 20:06:00 ║ 225.45 ║ Name1 ║
║ ... ║ ... ║ ... ║ ... ║
║ 2 ║ 2019-11-17 20:00:00 ║ 1500 ║ Name2 ║
║ 2 ║ 2019-11-17 20:03:00 ║ 1600 ║ Name2 ║
║ 2 ║ 2019-11-17 20:06:00 ║ 1550 ║ Name2 ║
║ ... ║ ... ║ ... ║ ... ║
║ 3 ║ 2019-11-17 20:00:00 ║ 0.105 ║ Name3 ║
║ 3 ║ 2019-11-17 20:03:00 ║ 0.267 ║ Name3 ║
║ 3 ║ 2019-11-17 20:06:00 ║ 0.560 ║ Name3 ║
║ ... ║ ... ║ ... ║ ... ║
╚═══════════╩═════════════════════╩═══════════╩═════════╝
And I want to transpose it with LINQ to view without any aggregation, only transform. I.e. I want each parameters name1, name2, name3 ... nameN turn to column with values, like this:
╔═════════════════════╦════════════╦════════════╦════════════╦═══════════╗
║ Date ║ Name1 ║ Name2 ║ Name3 ║ Name[n] ║
╠═════════════════════╬════════════╬════════════╬════════════╬═══════════╣
║ 2019-11-17 20:00:00 ║ 200.05 ║ 1500 ║ 0.105 ║ xxx.xx ║
║ 2019-11-17 20:03:00 ║ 210.05 ║ 1600 ║ 0.267 ║ xxx.xx ║
║ 2019-11-17 20:06:00 ║ 225.45 ║ 1550 ║ 0.560 ║ xxx.xx ║
║ ... ║ ... ║ ... ║ ... ║ ... ║
╚═════════════════════╩════════════╩════════════╩════════════╩═══════════╝
Any ideas how to do this ?