private void GenGraphData(List <Point> activeSegPts) { double disM = 0, prevHgt = 0; double prevDis = 0; GraphData.Clear(); const double peakTolerance = 100; const double distanceTolerance = 400; for (var c = 0; c != _slicesCalc.Count - 1; ++c) { for (var i = _slicesCalc[c].NPoint; i < _slicesCalc[c + 1].NPoint; ++i) { disM += Geo.DistanceExactMeters(activeSegPts[i], activeSegPts[i + 1]); var hgt = _srtmRepository.GetHeightForPoint(activeSegPts[i + 1]); if (!hgt.HasValue) { continue; } if (i == _slicesCalc[c + 1].NPoint - 1 || (c == 0 && i == _slicesCalc[c].NPoint)) { GraphData.SectionLabels.Add(new KeyValuePair <double, double>(disM, hgt.Value)); } if (i == _slicesCalc[c].NPoint || Math.Abs(prevHgt - hgt.Value) > peakTolerance || Math.Abs(prevDis - disM) > distanceTolerance) { GraphData.Profile.Add(new KeyValuePair <double, double>(disM, hgt.Value)); prevDis = disM; prevHgt = hgt.Value; } } } GraphData.NotifyOnDataUpdateFinished(); }
void ShowToolInformation() { GraphData.Clear(); int nSelected = nSelectedCount; int nSelectedTool = nSelectedToolNo; int nCurrentPanelCnt = 0; int nCurrentToolCnt = -1; bool saved = false; string[] lines = File.ReadAllLines(OpenedFilePath); string strOldToolName = "empty"; string strToolName = null; int nRefValue = 0; foreach (string lead in lines) { if (lead.Contains("Project")) { saved = false; if (nSelected == nCurrentPanelCnt) { saved = true; } nCurrentPanelCnt++; continue; } if (lead.Contains("-> Value")) { continue; } if (saved) { string tooltag = lead.Split('\t')[0]; string toolname = tooltag.Split(' ')[tooltag.Split(' ').Length - 2] + " " + tooltag.Split(' ')[tooltag.Split(' ').Length - 1]; if (strOldToolName == "empty" || strOldToolName != toolname) { nCurrentToolCnt++; strOldToolName = toolname; } if (nCurrentToolCnt == nSelectedTool) { string strRefValue = lead.Split(' ')[lead.Split(' ').Length - 1]; string strvalue = lead.Split('\t')[lead.Split('\t').Length - 2]; strvalue = strvalue.Replace("Value ", ""); GraphData.Add(Convert.ToInt32(strvalue)); nRefValue = Convert.ToInt32(strRefValue); strToolName = toolname; } else { continue; } } } if (strToolName != null) { ShowGraphData(strToolName, nRefValue); } }
private void RefreshGraph() { try { if (GraphType.ToValueAsString().Trim() == "") { ShowInformationMessage(PDMsg.NotEmpty("Graph Type")); return; } if (StartDate.ToValueAsString().Trim() == "") { ShowInformationMessage(PDMsg.NotEmpty("Start Date")); return; } if (EndDate.ToValueAsString().Trim() == "") { ShowInformationMessage(PDMsg.NotEmpty("End Date")); return; } if (StartDate > EndDate) { ShowInformationMessage("Start Date is Greater than End Date,Please Check it.!"); return; } if (GraphData != null) { GraphData.Clear(); } if (GraphData1 != null) { GraphData1.Clear(); NotifyPropertyChanged("GraphData1"); } if (GraphData2 != null) { GraphData2.Clear(); NotifyPropertyChanged("GraphData2"); } if (GraphData3 != null) { GraphData3.Clear(); NotifyPropertyChanged("GraphData3"); } if (GraphType == "FRC") { GraphData = _mopGraphBll.FeasibilityReportCount(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy")); GraphTitle = "Feasibility Reports Completed"; YAxisTitle = "No. of Costsheets Completed"; XAxisTitle = "Months"; SingleLegend = Visibility.Visible; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Collapsed; } else if (GraphType == "DPA") { GraphData = _mopGraphBll.DevelopmentPlanAdherence(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy")); GraphTitle = "Documents Completed"; YAxisTitle = "No. of Documents Released"; XAxisTitle = "Months"; SingleLegend = Visibility.Visible; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Collapsed; } else if (GraphType == "LTA") { GraphData = _mopGraphBll.LeadTimeAdherence(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "0"); GraphData1 = _mopGraphBll.LeadTimeAdherence(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "1"); GraphTitle = "Design Lead Time"; YAxisTitle = "Lead Time"; XAxisTitle = "Month"; SingleLegend = Visibility.Collapsed; DoubleLegend = Visibility.Visible; TripleLegend = Visibility.Collapsed; } else if (GraphType == "DE") { GraphData = _mopGraphBll.DesignEffectiveness(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy")); GraphTitle = "Feasibility Reports Completed"; YAxisTitle = "No. of Costsheets Completed"; XAxisTitle = "Month"; SingleLegend = Visibility.Visible; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Collapsed; } else if (GraphType == "CTS") { GraphData = _mopGraphBll.ConformanceToSpecification(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy")); GraphTitle = "Feasibility Reports Completed"; YAxisTitle = "No. of Costsheets Completed"; XAxisTitle = "Month"; SingleLegend = Visibility.Visible; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Collapsed; } else if (GraphType == "CE") { GraphData = _mopGraphBll.CostEffectiveness(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy")); GraphTitle = "Feasibility Reports Completed"; YAxisTitle = "No. of Costsheets Completed"; XAxisTitle = "Month"; SingleLegend = Visibility.Visible; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Collapsed; } else if (GraphType == "RAC") { GraphData = _mopGraphBll.RequestVsAgreedAndCompleted(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy")); GraphTitle = "Feasibility Reports Completed"; YAxisTitle = "No. of Costsheets Completed"; XAxisTitle = "Month"; SingleLegend = Visibility.Visible; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Collapsed; } else if (GraphType == "PGCDR") { GraphData = _mopGraphBll.PGCForDocumentReleased(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "1"); GraphData1 = _mopGraphBll.PGCForDocumentReleased(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "2"); GraphData2 = _mopGraphBll.PGCForDocumentReleased(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "3"); GraphData3 = _mopGraphBll.PGCForDocumentReleased(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "TOTAL"); GraphTitle = "Product Group Category For Document Released"; XAxisTitle = "Month"; YAxisTitle = "Number of Products"; LegendTitle = "PG 1"; LegendTitle1 = "PG 2"; LegendTitle2 = "PG 3"; LegendTitle3 = "Total"; SingleLegend = Visibility.Collapsed; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Visible; } else if (GraphType == "PGCSSP") { GraphData = _mopGraphBll.PGCForSampleSubmittedProducts(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "1"); GraphData1 = _mopGraphBll.PGCForSampleSubmittedProducts(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "2"); GraphData2 = _mopGraphBll.PGCForSampleSubmittedProducts(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "3"); GraphData3 = _mopGraphBll.PGCForSampleSubmittedProducts(Convert.ToDateTime(StartDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(EndDate).ToString("dd/MM/yyyy"), "TOTAL"); GraphTitle = "Product Group Category For Sample Submitted Products"; XAxisTitle = "Month"; LegendTitle = "PG 1"; LegendTitle1 = "PG 2"; LegendTitle2 = "PG 3"; LegendTitle3 = "Total"; SingleLegend = Visibility.Collapsed; DoubleLegend = Visibility.Collapsed; TripleLegend = Visibility.Visible; } } catch (Exception ex) { throw ex.LogException(); } }