/// <summary> /// Generate new Intermediate with baselining values /// ${Appbeheer_01_Inloggen_br // reference (baseline value) /// ${Appbeheer_01_Inloggen_be // evaluated value (difference from baseline in %) /// ${Appbeheer_01_Inloggen_be_c // colorcode, mark when current value exceeds threshold th1, green when diff > -15%, red when diff > +15% /// </summary> /// <param name="intermediate"></param> /// <param name="baselineIntermediate"></param> /// <param name="baselineReferenceIntermediate"></param> /// <param name="colorcodeBetter"></param> /// <param name="colorcodeWorse"></param> /// <returns></returns> public Intermediate GenerateBaselineEvaluationValues(Intermediate intermediate, Intermediate baselineIntermediate, Intermediate baselineReferenceIntermediate, string colorcodeBetter, string colorcodeWorse) { Intermediate result = new Intermediate(); // voor alle items in de baseline reference: doe evaluatie foreach (KeyValuePair <string, string> baselinePair in baselineReferenceIntermediate) { // add _br value from baseline reference result.AddValue(GetBaselineReferenceKey(baselinePair.Key), baselinePair.Value); // evaluate and generate _be and _be_c values if (intermediate.ContainsKey(baselinePair.Key)) { string baselineValueSeries = baselineIntermediate.GetValue(baselinePair.Key); string baselineThresholdValueSeries = baselineIntermediate.GetValue(Thresholds.GetThresholdColorKey(baselinePair.Key)); string currentValueSeries = intermediate.GetValue(baselinePair.Key); string currentThresholdValueSeries = intermediate.GetValue(Thresholds.GetThresholdColorKey(baselinePair.Key)); // generate _be and _be_c values Intermediate evalResult = GenerateEvaluation(baselinePair.Key, baselineValueSeries, currentValueSeries, baselineThresholdValueSeries, currentThresholdValueSeries, colorcodeBetter, colorcodeWorse); result.Add(evalResult); } } return(result); }
/// <summary> /// Perform the evaluation /// </summary> /// <param name="baselineValueStr"></param> /// <param name="evaluateValueStr"></param> /// <param name="beValues"></param> /// <param name="becValues"></param> /// <param name="colorcodeBetter"></param> /// <param name="colorcodeWorse"></param> private void DoEvaluate(string baselineValueStr, string evaluateValueStr, List <string> beValues, List <string> becValues, string colorcodeBetter, string colorcodeWorse) { string evalStr = ""; string colorCode = ""; try { double baselineValue = Thresholds.StringValueToDouble(baselineValueStr); double evaluateValue = Thresholds.StringValueToDouble(evaluateValueStr); // give up if input is nonsense if (!double.IsNaN(baselineValue) && !double.IsNaN(evaluateValue)) { //Log.Write("DEBUG baseline evaluation: "); double evalValue = 100 * ((evaluateValue - baselineValue) / baselineValue); //Log.Write(string.Format("curvalue={0} baselinevalue={1} delta={2} ", evaluateValue, baselineValue, evalValue)); // only color value if overshoot > +-15% colorCode = (evalValue > 15) ? colorcodeWorse : (evalValue < -15) ? colorcodeBetter : string.Empty; if (colorCode != string.Empty) { Log.Write("."); //evalStr = string.Format("{0:+0.0;-0.0;0}%", evalValue); evalStr = string.Format("{0:+0.0;-0.0;0}", evalValue); // format to intermediate standard } //Log.WriteLine("deltaformatted=" + evalStr); } } catch (Exception) { } // always add value beValues.Add(evalStr); becValues.Add(colorCode); }