/// <summary> /// Should be dynamic object with properties name and value /// </summary> /// <param name="list"></param> /// <returns></returns> public void SetValuesDynamic(dynamic list) { try { List <string> Names = new List <string>(); List <ToPlot> data = new List <ToPlot>(); foreach (dynamic q in list) { var v = new ToPlot { Name = q.name, Value = q.value }; data.Add(v); Names.Add(q.name); } AssignPlateType(Names); double[,] dataToPlot = new double[PT.NumRows, PT.NumCols]; var cleanedData = from x in data where SimpleFunctions.IsARealNumber(x.Value) & x.Value != 0 select x; double max = cleanedData.Max((x) => x.Value); double min = cleanedData.Min((x) => x.Value); foreach (var d in cleanedData) { int index = -1; if (PT.CellNameToInts.TryGetValue(d.Name, out index)) { int row = PT.RowColArray[index, 0]; int col = PT.RowColArray[index, 1]; dataToPlot[row, col] = d.Value; } } this.SetMatrixForPlotting(dataToPlot, PT.RowNames, PT.ColNames); } catch (Exception thrown) { Console.WriteLine("Could not Make Plot\n" + thrown.Message); } }
public void SetValue(GrowthCurveDoubleValueGetter dataFunction) { if (pcurPlateType != PlateType.None) { double[,] dataToPlot = new double[PT.NumRows, PT.NumCols]; var data = from x in curGCC select new { Name = x.DataSetName, Value = SafeGet(dataFunction, x) }; var cleanedData = (from x in data where SimpleFunctions.IsARealNumber(x.Value) & x.Value != 0 select x).ToList(); double max = cleanedData.Max((x) => x.Value); double min = cleanedData.Min((x) => x.Value); foreach (var d in cleanedData) { int index = -1; if (PT.CellNameToInts.TryGetValue(d.Name, out index)) { int row = PT.RowColArray[index, 0]; int col = PT.RowColArray[index, 1]; dataToPlot[row, col] = d.Value; } } this.SetMatrixForPlotting(dataToPlot, PT.RowNames, PT.ColNames); } }