public GraphJob(string outputPath, GraphFactory gf) { Filename = outputPath; GraphFactory = gf; }
private GraphFactory CreateGraphFactory(Tuple <double[], double[]> tuple, int endPointA, int endPointB) { Interlocked.Increment(ref Added); var createGraphWorkItem = new GraphFactory { Title = String.Format("{0:00}-{1:00}", endPointA, endPointB), XAxis = tuple.Item1, YAxis = tuple.Item2, XTitle = "[dBm]", YTitle = "", Reverse = true, }; var lastIndex = tuple.Item1.Length - 1; var q = 0.25; foreach (var dBm in FindQuartiles(tuple)) { if (double.IsNaN(dBm)) { q += 0.25; continue; } var textObj = new TextObj(string.Format("{0:0.0} [dBm]", dBm), dBm, q) { Location = { AlignH = AlignH.Right, AlignV = AlignV.Bottom } }; createGraphWorkItem.TextObjs.Add(textObj); q += 0.25; } // create red and green boxes if (tuple.Item1[lastIndex] == -100) { var boxData = new GraphFactory.BoxData { Top = tuple.Item2[lastIndex], Bottom = tuple.Item1.Length > 1 ? tuple.Item2[lastIndex - 1] : 0, Fill = RedFill }; createGraphWorkItem.Boxes.Add(boxData); createGraphWorkItem.DroppedPackages = true; createGraphWorkItem.TextObjs.Add(new TextObj(string.Format("{0:0.0%} frame loss", 1 - boxData.Bottom), 0, boxData.Bottom) { Location = { AlignH = AlignH.Left, AlignV = AlignV.Top, CoordinateFrame = CoordType.XChartFractionYScale } }); if (boxData.Bottom != 0) { createGraphWorkItem.Boxes.Add(new GraphFactory.BoxData { Top = boxData.Bottom, Bottom = 0, Fill = GreenFill }); } } else { createGraphWorkItem.Boxes.Add(new GraphFactory.BoxData { Top = 1, Bottom = 0, Fill = GreenFill }); } return(createGraphWorkItem); }