private void SetChartTitle(Chart chart) { chart.Titles.Add(ChartTitleFactory.GetChartName(this.MetricTypeID)); chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(this.SignalID, this.StartDate, this.EndDate)); chart.Titles.Add(ChartTitleFactory.GetTitle("Currently showing Force-Offs, Max-Outs and Gap-Outs with a consecutive occurrence of " + this.SelectedConsecutiveCount.ToString() + " or more. \n Pedestrian events are never filtered")); }
private void SetChartTitles(Chart chart, MOE.Common.Models.Detector detector) { chart.Titles.Add(ChartTitleFactory.GetChartName(this.MetricTypeID)); chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange( this.SignalID, this.StartDate, this.EndDate)); chart.Titles.Add(ChartTitleFactory.GetPhaseAndPhaseDescriptions(detector.Approach.ProtectedPhaseNumber, detector.Approach.DirectionType.Description)); chart.Titles.Add(ChartTitleFactory.GetTitle("Detection Type: " + detector.DetectionHardware.Name + "; Speed Accuracy +/- 2 mph" + "\n" + "Detector Distance from Stop Bar: " + detector.DistanceFromStopBar.ToString() + " feet; " + "\n" + "Includes records over 5mph that occur between 15s after start of green to start of yellow.")); }
private void SetChartTitles(Chart chart, Models.Detector detector) { chart.Titles.Add(ChartTitleFactory.GetChartName(MetricTypeID)); chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange( SignalID, StartDate, EndDate)); chart.Titles.Add(ChartTitleFactory.GetPhaseAndPhaseDescriptions(detector.Approach, false)); chart.Titles.Add(ChartTitleFactory.GetTitle("Detection Type: " + detector.DetectionHardware.Name + "; Speed Accuracy +/- 2 mph" + "\n" + "Detector Distance from Stop Bar: " + detector.DistanceFromStopBar + " feet; " + "\n" + "Includes records over 5mph that occur between 15s after start of green to start of yellow.")); }
private void AddDetectionTypeTitle(ApproachVolume approachVolume) { if (approachVolume.Detectors.Count > 0) { Models.Detector d = approachVolume.Detectors.FirstOrDefault(); if (d.DistanceFromStopBar != null && d.DistanceFromStopBar > 0) { Chart.Titles.Add(ChartTitleFactory.GetTitle(d.DetectionHardware.Name + " located " + d.DistanceFromStopBar + "ft. upstream of the stop bar")); } else { Chart.Titles.Add(ChartTitleFactory.GetTitle(d.DetectionHardware.Name + " at stop bar")); } } }
protected void AddDataToChart(Chart chart, List <MOE.Common.Business.ApproachVolume.Approach> approachDirectionCollection, DateTime startDate, DateTime endDate, string signalId, string direction1, string direction2, ApproachVolumeOptions options, bool useAdvance) { int D1vol = 0; int D2vol = 0; DateTime D1time = new DateTime(); DateTime D2time = new DateTime(); SortedDictionary <DateTime, int> D1volumes = new SortedDictionary <DateTime, int>(); SortedDictionary <DateTime, int> D2volumes = new SortedDictionary <DateTime, int>(); List <MOE.Common.Business.ApproachVolume.Approach> FilteredApproaches = (from r in approachDirectionCollection where r.Direction == direction1 || r.Direction == direction2 select r).ToList(); foreach (MOE.Common.Business.ApproachVolume.Approach approachDirection in FilteredApproaches) { if (useAdvance) { approachDirection.SetDetectorEvents(approachDirection.ApproachModel, startDate, endDate, true, false); } else { approachDirection.SetDetectorEvents(approachDirection.ApproachModel, startDate, endDate, false, true); } approachDirection.SetVolume(startDate, endDate, options.SelectedBinSize); } if (FilteredApproaches.Count > 0) { MOE.Common.Models.Detector d = FilteredApproaches[0].Detectors.ApproachCountDetectors[0]; if (d.DistanceFromStopBar != null && d.DistanceFromStopBar > 0) { Chart.Titles.Add(ChartTitleFactory.GetTitle(d.DetectionHardware.Name + " located " + d.DistanceFromStopBar.ToString() + "ft. upstream of the stop bar")); } else { Chart.Titles.Add(ChartTitleFactory.GetTitle(d.DetectionHardware.Name + " at stop bar")); } } foreach (MOE.Common.Business.ApproachVolume.Approach approachDirection in FilteredApproaches) { if (approachDirection.Volume.Items.Count > 0) { foreach (MOE.Common.Business.Volume v in approachDirection.Volume.Items) { //add Direction1 volumes if (approachDirection.Direction == direction1) { //Add the volumes and times to a collection so we can use them later if (!D1volumes.ContainsKey(v.XAxis)) { D1volumes.Add(v.XAxis, v.YAxis); D1TotalVolume = (D1TotalVolume + v.DetectorCount); } } //add Direction2 volumes if (approachDirection.Direction == direction2) { //Add the volumes and times to a collection so we can use them later if (!D2volumes.ContainsKey(v.XAxis)) { D2volumes.Add(v.XAxis, v.YAxis); D2TotalVolume = (D2TotalVolume + v.DetectorCount); } } } } if (options.ShowSBEBVolume) { foreach (KeyValuePair <DateTime, int> vol in D1volumes) { //This is the Thicker Solid Red line chart.Series[0].Points.AddXY(vol.Key, vol.Value); } } if (options.ShowNBWBVolume) { foreach (KeyValuePair <DateTime, int> vol in D2volumes) { //This is the Thicker Solid Blue line chart.Series[1].Points.AddXY(vol.Key, vol.Value); CheckAndCorrectConsecutiveXValues(chart.Series[1].Points); } } //add ratios //Match the times in the dir1 colleciton to the dir2 collection so we can get a ratio //of the values collected at the same point in time. foreach (KeyValuePair <DateTime, int> volRow in D1volumes) { D2vol = (from k in D2volumes where DateTime.Compare(k.Key, volRow.Key) == 0 select k.Value).FirstOrDefault(); D1vol = volRow.Value; D1time = volRow.Key; if (D1vol > 0 && D2vol > 0) { //ratio the values double D1DFactor = Convert.ToDouble(D1vol) / ((Convert.ToDouble(D2vol) + Convert.ToDouble(D1vol))); if (options.ShowDirectionalSplits) { //plot the ratio and time on the secondary Y axis //This is the Thin Dashed Red line chart.Series[2].Points.AddXY(D1time, D1DFactor); } } } CheckAndCorrectConsecutiveXValues(chart.Series[2].Points); //Match the times in the dir2 colleciton to the dir1 collection so we can get a ratio //of the values collected at the same point in time. foreach (KeyValuePair <DateTime, int> volRow in D2volumes) { D1vol = (from k in D1volumes where DateTime.Compare(k.Key, volRow.Key) == 0 select k.Value).FirstOrDefault(); D2vol = volRow.Value; D2time = volRow.Key; if (D2vol > 0 && D1vol > 0) { //ratio the values double D2DFactor = Convert.ToDouble(D2vol) / ((Convert.ToDouble(D2vol) + Convert.ToDouble(D1vol))); //plot the ratio and time on the secondary Y axis if (options.ShowDirectionalSplits) { //This is the Thin Dashed Blue line chart.Series[3].Points.AddXY(D2time, D2DFactor); } } } } foreach (Series s in chart.Series) { List <DataPoint> temppoints = CheckAndCorrectConsecutiveXValues(s.Points); s.Points.Clear(); foreach (DataPoint d in temppoints) { s.Points.Add(d); } } if (D1volumes.Count > 0 && D2volumes.Count > 0) { Table = CreateVolumeMetricsTable(direction1, direction2, D1TotalVolume, D2TotalVolume, D1volumes, D2volumes, options); } }