Exemple #1
0
 public PedDelaySignal(string signalID, DateTime startDate,
                       DateTime endDate)
 {
     _SignalID  = signalID;
     _StartDate = startDate;
     _EndDate   = endDate;
     try
     {
         _Plans = new PlansBase(signalID, startDate, endDate);
         var pedPhaseNumbers = ControllerEventLogs.GetPedPhases(signalID, startDate, endDate);
         ConcurrentBag <PedPhase> pedPhases = new ConcurrentBag <PedPhase>();
         Parallel.ForEach(pedPhaseNumbers, currentPhase =>
                          //foreach(int currentPhase in pedPhaseNumbers)
         {
             var pedPhase = new PedPhase(currentPhase, signalID, startDate, endDate, _Plans);
             pedPhases.Add(pedPhase);
         });
         _PedPhases = pedPhases.OrderBy(x => x.PhaseNumber).ToList();
     }
     catch (Exception e)
     {
         var errorLog = ApplicationEventRepositoryFactory.Create();
         errorLog.QuickAdd(System.Reflection.Assembly.GetExecutingAssembly().GetName().ToString(),
                           this.GetType().DisplayName(), e.TargetSite.ToString(), ApplicationEvent.SeverityLevels.High, e.Message);
     }
 }
Exemple #2
0
        private void SetChartTitle(Chart chart, PedPhase pp, PedDelayOptions options)
        {
            chart.Titles.Add(ChartTitleFactory.GetChartName(options.MetricTypeID));
            chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(
                                 options.SignalID, options.StartDate, options.EndDate));
            chart.Titles.Add(ChartTitleFactory.GetPhase(pp.PhaseNumber));
            var statistics = new Dictionary <string, string>();

            statistics.Add("Ped Actuations(PA)", pp.PedActuations.ToString());
            statistics.Add("Min Delay", DateTime.Today.AddMinutes(pp.MinDelay / 60).ToString("mm:ss"));
            statistics.Add("Max Delay", DateTime.Today.AddMinutes(pp.MaxDelay / 60).ToString("mm:ss"));
            statistics.Add("Average Delay(AD)", DateTime.Today.AddMinutes(pp.AverageDelay / 60).ToString("mm:ss"));
            chart.Titles.Add(ChartTitleFactory.GetStatistics(statistics));
        }
Exemple #3
0
        public PEDDelayChart(PedDelayOptions options,
                             PedPhase pp)
        {
            Chart    = ChartFactory.CreateDefaultChartNoX2AxisNoY2Axis(options);
            PedPhase = pp;
            var reportTimespan = options.EndDate - options.StartDate;

            //Set the chart properties
            ChartFactory.SetImageProperties(Chart);


            SetChartTitle(Chart, pp, options);

            //Create the chart legend
            var chartLegend = new Legend();

            chartLegend.Name    = "MainLegend";
            chartLegend.Docking = Docking.Left;
            Chart.Legends.Add(chartLegend);


            //Create the chart area
            //var chartArea = new ChartArea();
            //chartArea.Name = "ChartArea1";
            Chart.ChartAreas[0].AxisY.Title        = "Pedestrian Delay\nby Actuation(minutes)";
            Chart.ChartAreas[0].AxisY.IntervalType = DateTimeIntervalType.Minutes;
            //chartArea.AxisY.Interval = 1;
            Chart.ChartAreas[0].AxisY.Minimum           = DateTime.Today.ToOADate();
            Chart.ChartAreas[0].AxisY.LabelStyle.Format = "mm:ss";
            if (options.YAxisMax != null)
            {
                Chart.ChartAreas[0].AxisY.Maximum = DateTime.Today.AddMinutes(options.YAxisMax.Value).ToOADate();
            }

            //chartArea.AxisX.Title = "Time (Hour of Day)";
            //chartArea.AxisX.IntervalType = DateTimeIntervalType.Hours;
            //chartArea.AxisX.LabelStyle.Format = "HH";
            //chartArea.AxisX2.LabelStyle.Format = "HH";
            //chartArea.AxisX.Minimum = PedPhase.StartDate.ToOADate();
            //chartArea.AxisX.Maximum = PedPhase.EndDate.ToOADate();
            //if (reportTimespan.Days < 1)
            //    if (reportTimespan.Hours > 1)
            //    {
            //        chartArea.AxisX2.Interval = 1;
            //        chartArea.AxisX.Interval = 1;
            //    }
            //    else
            //    {
            //        chartArea.AxisX.LabelStyle.Format = "HH:mm";
            //        chartArea.AxisX2.LabelStyle.Format = "HH:mm";
            //    }
            //chartArea.AxisX2.Enabled = AxisEnabled.True;
            //chartArea.AxisX2.MajorTickMark.Enabled = true;
            //chartArea.AxisX2.IntervalType = DateTimeIntervalType.Hours;
            //chartArea.AxisX2.LabelAutoFitStyle = LabelAutoFitStyles.None;
            //chartArea.AxisX2.Minimum = PedPhase.StartDate.ToOADate();
            //chartArea.AxisX2.Maximum = PedPhase.EndDate.ToOADate();

            //Chart.ChartAreas.Add(chartArea);


            //Add the point series
            var PedestrianDelaySeries = new Series();

            PedestrianDelaySeries.ChartType       = SeriesChartType.Column;
            PedestrianDelaySeries.BorderDashStyle = ChartDashStyle.Dash;
            PedestrianDelaySeries.Color           = Color.Blue;
            PedestrianDelaySeries.Name            = "Pedestrian Delay\nby Actuation";
            PedestrianDelaySeries.XValueType      = ChartValueType.DateTime;
            Chart.Series.Add(PedestrianDelaySeries);
            Chart.Series["Pedestrian Delay\nby Actuation"]["PixelPointWidth"] = "2";
            AddDataToChart();
            SetPlanStrips();
        }
Exemple #4
0
        public PEDDelayChart(MOE.Common.Business.WCFServiceLibrary.PedDelayOptions options,
                             PedPhase pp)
        {
            PedPhase = pp;
            string   extendedDirection = string.Empty;
            TimeSpan reportTimespan    = options.EndDate - options.StartDate;

            //Set the chart properties
            chart.ImageStorageMode = ImageStorageMode.UseImageLocation;
            chart.ImageType        = ChartImageType.Jpeg;
            chart.Height           = 550;
            chart.Width            = 1100;


            SetChartTitle(chart, pp, options);

            //Create the chart legend
            Legend chartLegend = new Legend();

            chartLegend.Name    = "MainLegend";
            chartLegend.Docking = Docking.Left;
            chart.Legends.Add(chartLegend);


            //Create the chart area
            ChartArea chartArea = new ChartArea();

            chartArea.Name               = "ChartArea1";
            chartArea.AxisY.Title        = "Pedestrian Delay\nby Actuation(minutes)";
            chartArea.AxisY.IntervalType = DateTimeIntervalType.Minutes;
            //chartArea.AxisY.Interval = 1;
            chartArea.AxisY.Minimum           = DateTime.Today.ToOADate();
            chartArea.AxisY.LabelStyle.Format = "mm:ss";
            if (options.YAxisMax != null)
            {
                chartArea.AxisY.Maximum = DateTime.Today.AddMinutes(options.YAxisMax.Value).ToOADate();
            }

            chartArea.AxisX.Title              = "Time (Hour of Day)";
            chartArea.AxisX.IntervalType       = DateTimeIntervalType.Hours;
            chartArea.AxisX.LabelStyle.Format  = "HH";
            chartArea.AxisX2.LabelStyle.Format = "HH";
            chartArea.AxisX.Minimum            = PedPhase.StartDate.ToOADate();
            chartArea.AxisX.Maximum            = PedPhase.EndDate.ToOADate();
            if (reportTimespan.Days < 1)
            {
                if (reportTimespan.Hours > 1)
                {
                    chartArea.AxisX2.Interval = 1;
                    chartArea.AxisX.Interval  = 1;
                }
                else
                {
                    chartArea.AxisX.LabelStyle.Format  = "HH:mm";
                    chartArea.AxisX2.LabelStyle.Format = "HH:mm";
                }
            }
            chartArea.AxisX2.Enabled = AxisEnabled.True;
            chartArea.AxisX2.MajorTickMark.Enabled = true;
            chartArea.AxisX2.IntervalType          = DateTimeIntervalType.Hours;
            chartArea.AxisX2.LabelAutoFitStyle     = LabelAutoFitStyles.None;
            chartArea.AxisX2.Minimum = PedPhase.StartDate.ToOADate();
            chartArea.AxisX2.Maximum = PedPhase.EndDate.ToOADate();

            chart.ChartAreas.Add(chartArea);


            //Add the point series
            Series PedestrianDelaySeries = new Series();

            PedestrianDelaySeries.ChartType       = SeriesChartType.Column;
            PedestrianDelaySeries.BorderDashStyle = ChartDashStyle.Dash;
            PedestrianDelaySeries.Color           = Color.Blue;
            PedestrianDelaySeries.Name            = "Pedestrian Delay\nby Actuation";
            PedestrianDelaySeries.XValueType      = ChartValueType.DateTime;


            chart.Series.Add(PedestrianDelaySeries);
            chart.Series["Pedestrian Delay\nby Actuation"]["PixelPointWidth"] = "2";


            AddDataToChart();
            SetPlanStrips();
        }