/// <summary> /// Initializes a new instance of the <see cref="measureTrend"/> class. /// </summary> /// <param name="samples">The samples.</param> /// <param name="__trendTaker">The trend taker.</param> /// <param name="__timePeriod">The time period.</param> public measureTrend(IEnumerable <double> samples, measureTrendTaker __trendTaker, TimeSpan __timePeriod) { sampledPeriod = __timePeriod.TotalMinutes; trendTaker = __trendTaker; deploySample(samples); }
/// <summary> /// Gets the trend from set of objects /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sampleset">Set of objects to take measure from</param> /// <param name="selector">Expresion that takes the property value from an object in the <c>sampleset</c></param> /// <param name="trendTaker">The trend taker definition</param> /// <param name="span">The time span to recalculate mean values for.</param> /// <returns></returns> public static measureTrend GetTrend <T>(this IEnumerable <T> sampleset, Func <T, double> selector, measureTrendTaker trendTaker, TimeSpan span) { int sC = sampleset.Count(); int sT = Math.Min(sC, trendTaker.MacroSampleSize); var sValues = (from num in sampleset select selector(num)); //sampleset.Take(sT).GetTimeSpan measureTrend trend = new measureTrend(sValues, trendTaker, span); return(trend); }
/// <summary> /// Initializes a new instance of the <see cref="measureTrend"/> class. /// </summary> /// <param name="samples">The samples.</param> /// <param name="__name">The name.</param> /// <param name="__unit">The unit.</param> /// <param name="__macroSampleSize">Size of the macro sample.</param> /// <param name="__zeroMargin">The zero margin.</param> /// <param name="__microSampleSize">Size of the micro sample.</param> /// <param name="__spearSampleSize">Size of the spear sample.</param> public measureTrend(IEnumerable <double> samples, string __name, string __unit, int __macroSampleSize, double __zeroMargin, int __microSampleSize = -1, int __spearSampleSize = -1) { trendTaker = new measureTrendTaker(__name, __unit, __macroSampleSize, __microSampleSize, __spearSampleSize, __zeroMargin); deploySample(samples); }