示例#1
0
 public RawValueInfo(double data, double value, ValueMemberDefinition definition)
 {
     if (definition == null)
         throw new Exception("definition can't be null");
     Data = data;
     Value = value;
     ValueMember = definition;
 }
示例#2
0
 double? GetValueY(ValueMemberDefinition vm, double x)
 {
     if (rawData == null)
         return null;
     var leftVal = rawData.Where(v => v.ValueMember == vm & v.Data >= x).OrderBy(v => v.Data).FirstOrDefault();
     var rightVal = rawData.Where(v => v.ValueMember == vm & v.Data <= x).OrderByDescending(v => v.Data).FirstOrDefault();
     if (leftVal == null | rightVal == null)
         return null;
     return (leftVal.Value - rightVal.Value) / (leftVal.Data - rightVal.Data) * (x - leftVal.Data) + leftVal.Value;
 }