namespace HStation.WinFrmUI
{
///
/// 精度比例视图
///
public class SimulationPrintAccuracyScaleViewModel
{
///
///
///
public SimulationPrintAccuracyScaleViewModel() { }
///
///
///
public SimulationPrintAccuracyScaleViewModel(List allItemList)
{
var items = allItemList?.Where(x => x.EvaluateError.HasValue).ToList();
if (items == null || items.Count < 1)
{
return;
}
this.AvgError = Math.Round(items.Average(x => x.EvaluateError.Value), 1);
var groupList = items.GroupBy(x => x.EvaluateItem).ToList();
this.Items = new List();
foreach (var group in groupList)
{
var item = new SimulationPrintAccuracyScaleItemViewModel
(group.Key, group.Count(), group.Average(x => x.EvaluateError.Value));
this.Items.Add(item);
}
}
///
/// 平均误差
///
public double? AvgError { get; set; }
///
/// 子级列表
///
public List Items { get; set; }
}
}