protected void setOptionDefaults(ApproachAggregationMetricOptions options)
 {
     options.SeriesWidth = 3;
     SetFilterSignal(options);
     options.ShowEventCount     = true;
     options.MetricFileLocation = ConfigurationManager.AppSettings["ImageLocation"];
 }
Esempio n. 2
0
 protected void CreateStackedColumnChart(ApproachAggregationMetricOptions options)
 {
     options.SelectedChartType       = SeriesChartType.StackedColumn;
     options.SelectedAggregationType = AggregationType.Sum;
     options.CreateMetric();
     options.SelectedAggregationType = AggregationType.Average;
     options.CreateMetric();
 }
Esempio n. 3
0
 public RouteSplitFailAggregationContainer(ApproachAggregationMetricOptions options)
 {
     //Approach = approach;
     //var splitFailAggregationRepository =
     //    MOE.Common.Models.Repositories.ApproachSplitFailAggregationRepositoryFactory.Create();
     //SplitFails = splitFailAggregationRepository.GetApproachSplitFailAggregationByApproachIdAndDateRange(
     //    approach.ApproachID, start, end);
 }
 private void CreateStackedColumnChart(ApproachAggregationMetricOptions options)
 {
     SetFilterSignal(options);
     options.SelectedChartType       = SeriesChartType.StackedColumn;
     options.SelectedAggregationType = AggregationType.Sum;
     options.CreateMetric();
     options.SelectedAggregationType = AggregationType.Average;
     options.CreateMetric();
 }
Esempio n. 5
0
        protected void SetFilterSignal(ApproachAggregationMetricOptions options)
        {
            List <FilterSignal> filterSignals = new List <FilterSignal>();
            var signal       = Db.Signals.FirstOrDefault();
            var filterSignal = new FilterSignal {
                SignalId = signal.SignalID, Exclude = false
            };

            foreach (var approach in signal.Approaches)
            {
                var filterApproach = new FilterApproach
                {
                    ApproachId  = approach.ApproachID,
                    Description = String.Empty,
                    Exclude     = false
                };
                filterSignal.FilterApproaches.Add(filterApproach);
                foreach (var detector in approach.Detectors)
                {
                    filterApproach.FilterDetectors.Add(new FilterDetector {
                        Id = detector.ID, Description = String.Empty, Exclude = false
                    });
                }
            }
            filterSignals.Add(filterSignal);
            options.FilterSignals    = filterSignals;
            options.FilterDirections = new List <FilterDirection>();
            options.FilterDirections.Add(new FilterDirection {
                Description = "", DirectionTypeId = 0, Include = true
            });
            options.FilterDirections.Add(new FilterDirection {
                Description = "", DirectionTypeId = 1, Include = true
            });
            options.FilterDirections.Add(new FilterDirection {
                Description = "", DirectionTypeId = 2, Include = true
            });
            options.FilterDirections.Add(new FilterDirection {
                Description = "", DirectionTypeId = 3, Include = true
            });
            options.FilterMovements = new List <FilterMovement>();
            options.FilterMovements.Add(new FilterMovement {
                Description = "", MovementTypeId = 0, Include = true
            });
            options.FilterMovements.Add(new FilterMovement {
                Description = "", MovementTypeId = 1, Include = true
            });
            options.FilterMovements.Add(new FilterMovement {
                Description = "", MovementTypeId = 2, Include = true
            });
            options.FilterMovements.Add(new FilterMovement {
                Description = "", MovementTypeId = 3, Include = true
            });
        }
Esempio n. 6
0
 protected override void LoadBins(ApproachAggregationMetricOptions options, Models.Signal signal)
 {
     for (var i = 0; i < BinsContainers.Count; i++)
     {
         for (var binIndex = 0; binIndex < BinsContainers[i].Bins.Count; binIndex++)
         {
             var bin = BinsContainers[i].Bins[binIndex];
             foreach (var approachSplitFailAggregationContainer in ApproachSplitFailures)
             {
                 bin.Sum += approachSplitFailAggregationContainer.BinsContainers[i].Bins[binIndex].Sum;
             }
             bin.Average = ApproachSplitFailures.Count > 0 ? bin.Sum / ApproachSplitFailures.Count : 0;
         }
     }
 }
Esempio n. 7
0
 public AggregationByApproach(Approach approach, ApproachAggregationMetricOptions options, DateTime startDate,
                              DateTime endDate, bool getProtectedPhase, AggregatedDataType dataType)
 {
     BinsContainers = BinFactory.GetBins(options.TimeOptions);
     Approach       = approach;
     if (options.ShowEventCount)
     {
         ApproachEventCountAggregations = GetApproachEventCountAggregations(options, approach, true);
         if (approach.PermissivePhaseNumber != null)
         {
             ApproachEventCountAggregations.AddRange(GetApproachEventCountAggregations(options, approach, false));
         }
     }
     LoadBins(approach, options, getProtectedPhase, dataType);
 }
Esempio n. 8
0
 protected override void LoadBins(ApproachAggregationMetricOptions options, Models.Signal signal)
 {
     for (var i = 0; i < BinsContainers.Count; i++)
     {
         for (var binIndex = 0; binIndex < BinsContainers[i].Bins.Count; binIndex++)
         {
             var bin = BinsContainers[i].Bins[binIndex];
             foreach (var speedAggregationByApproach in ApproachSpeedEvents)
             {
                 bin.Sum += speedAggregationByApproach.BinsContainers[i].Bins[binIndex].Sum;
             }
             bin.Average = ApproachSpeedEvents.Count > 0 ? bin.Sum / ApproachSpeedEvents.Count : 0;
         }
     }
 }
Esempio n. 9
0
        public SplitFailAggregationByRoute(ApproachAggregationMetricOptions options)
        {
            Container = new List <SplitFailAggregationBySignal>();

            //foreach (var sig in options.Signals)
            //{
            //    options.SignalID = sig.SignalID;
            //    var signalRepository = MOE.Common.Models.Repositories.SignalsRepositoryFactory.Create();
            //    Models.Signal signal = signalRepository.GetVersionOfSignalByDate(sig.SignalID, options.StartDate);

            //    SpliFailAggregationBySignal signalAggregation = new SpliFailAggregationBySignal(options);

            //    Container.Add(signalAggregation);
            //}
        }
Esempio n. 10
0
 protected override void LoadBins(Approach approach, ApproachAggregationMetricOptions options, bool getProtectedPhase,
                                  AggregatedDataType dataType)
 {
     for (var i = 0; i < BinsContainers.Count; i++)
     {
         for (var binIndex = 0; binIndex < BinsContainers[i].Bins.Count; binIndex++)
         {
             var bin = BinsContainers[i].Bins[binIndex];
             foreach (var detectorAggregationByDetector in detectorAggregationByDetectors)
             {
                 bin.Sum += detectorAggregationByDetector.BinsContainers[i].Bins[binIndex].Sum;
             }
             bin.Average = detectorAggregationByDetectors.Count > 0
                 ? bin.Sum / detectorAggregationByDetectors.Count
                 : 0;
         }
     }
 }
Esempio n. 11
0
 protected bool IsValidCombination(ApproachAggregationMetricOptions options)
 {
     if (options.SelectedXAxisType == XAxisType.TimeOfDay &&
         (options.TimeOptions.SelectedBinSize == BinFactoryOptions.BinSize.Day ||
          options.TimeOptions.SelectedBinSize == BinFactoryOptions.BinSize.Month ||
          options.TimeOptions.SelectedBinSize == BinFactoryOptions.BinSize.Year))
     {
         return(false);
     }
     if (options.SelectedXAxisType == XAxisType.Direction && options.SelectedSeries == SeriesType.PhaseNumber)
     {
         return(false);
     }
     if (options.SelectedXAxisType == XAxisType.Phase && options.SelectedSeries == SeriesType.Direction)
     {
         return(false);
     }
     if (options.SelectedXAxisType == XAxisType.Detector)
     {
         return(false);
     }
     if (options.SelectedSeries == SeriesType.Detector)
     {
         return(false);
     }
     if ((options.SelectedXAxisType == XAxisType.Direction || options.SelectedXAxisType == XAxisType.Phase) &&
         (options.SelectedSeries == SeriesType.Signal || options.SelectedSeries == SeriesType.Route))
     {
         return(false);
     }
     if (options.SelectedXAxisType == XAxisType.Signal && options.SelectedSeries == SeriesType.Route)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 12
0
        protected override void LoadBins(Approach approach, ApproachAggregationMetricOptions options,
                                         bool getProtectedPhase,
                                         AggregatedDataType dataType)
        {
            var approachSpeedAggregationRepository =
                ApproachSpeedAggregationRepositoryFactory.Create();
            var speedAggregations =
                approachSpeedAggregationRepository.GetSpeedsByApproachIDandDateRange(approach.ApproachID, options.StartDate, options.EndDate);

            if (speedAggregations != null)
            {
                var concurrentBinContainers = new ConcurrentBag <BinsContainer>();
                //foreach (var binsContainer in binsContainers)
                Parallel.ForEach(BinsContainers, binsContainer =>
                {
                    var tempBinsContainer =
                        new BinsContainer(binsContainer.Start, binsContainer.End);
                    var concurrentBins = new ConcurrentBag <Bin>();
                    //foreach (var bin in binsContainer.Bins)
                    Parallel.ForEach(binsContainer.Bins, bin =>
                    {
                        if (speedAggregations.Any(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End))
                        {
                            double speedAggregationCount = 0;
                            switch (dataType.DataName)
                            {
                            case "AverageSpeed":
                                if (speedAggregations.Any(s =>
                                                          s.BinStartTime >= bin.Start && s.BinStartTime < bin.End))
                                {
                                    double summedSpeed = speedAggregations.Where(s =>
                                                                                 s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                                         .Sum(s => s.SummedSpeed);
                                    double summedVolume = speedAggregations.Where(s =>
                                                                                  s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                                          .Sum(s => s.SpeedVolume);
                                    if (summedVolume > 0)
                                    {
                                        speedAggregationCount = summedSpeed / summedVolume;
                                    }
                                }
                                break;

                            case "SpeedVolume":
                                speedAggregationCount =
                                    speedAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.SpeedVolume);
                                break;

                            case "Speed85Th":
                                speedAggregationCount =
                                    speedAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.Speed85Th);
                                break;

                            case "Speed15Th":
                                speedAggregationCount =
                                    speedAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.Speed15Th);
                                break;

                            default:

                                throw new Exception("Unknown Aggregate Data Type for Split Failure");
                            }

                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = Convert.ToInt32(Math.Round(speedAggregationCount)),
                                Average = speedAggregationCount
                            });
                        }
                        else
                        {
                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = 0,
                                Average = 0
                            });
                        }
                    });
                    tempBinsContainer.Bins = concurrentBins.OrderBy(c => c.Start).ToList();
                    concurrentBinContainers.Add(tempBinsContainer);
                });
                BinsContainers = concurrentBinContainers.OrderBy(b => b.Start).ToList();
            }
        }
Esempio n. 13
0
 protected abstract void LoadBins(ApproachAggregationMetricOptions options, Models.Signal signal);
Esempio n. 14
0
 protected override void LoadBins(ApproachAggregationMetricOptions options, Models.Signal signal)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
        protected override void LoadBins(Approach approach, ApproachAggregationMetricOptions options,
                                         bool getProtectedPhase,
                                         AggregatedDataType dataType)
        {
            var splitFailAggregationRepository =
                ApproachSplitFailAggregationRepositoryFactory.Create();
            var splitFails =
                splitFailAggregationRepository.GetApproachSplitFailsAggregationByApproachIdAndDateRange(
                    approach.ApproachID, options.StartDate, options.EndDate, getProtectedPhase);

            if (splitFails != null)
            {
                var concurrentBinContainers = new ConcurrentBag <BinsContainer>();
                //foreach (var binsContainer in binsContainers)
                Parallel.ForEach(BinsContainers, binsContainer =>
                {
                    var tempBinsContainer =
                        new BinsContainer(binsContainer.Start, binsContainer.End);
                    var concurrentBins = new ConcurrentBag <Bin>();
                    //foreach (var bin in binsContainer.Bins)
                    Parallel.ForEach(binsContainer.Bins, bin =>
                    {
                        if (splitFails.Any(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End))
                        {
                            var splitFailCount = 0;
                            switch (dataType.DataName)
                            {
                            case "SplitFails":
                                splitFailCount =
                                    splitFails.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.SplitFailures);
                                break;

                            default:

                                throw new Exception("Unknown Aggregate Data Type for Split Failure");
                            }

                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = splitFailCount,
                                Average = splitFailCount
                            });
                        }
                        else
                        {
                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = 0,
                                Average = 0
                            });
                        }
                    });
                    tempBinsContainer.Bins = concurrentBins.OrderBy(c => c.Start).ToList();
                    concurrentBinContainers.Add(tempBinsContainer);
                });
                BinsContainers = concurrentBinContainers.OrderBy(b => b.Start).ToList();
            }
        }
Esempio n. 16
0
        protected override void LoadBins(Approach approach, ApproachAggregationMetricOptions options,
                                         bool getProtectedPhase,
                                         AggregatedDataType dataType)
        {
            var approachPcdAggregationRepository =
                ApproachPcdAggregationRepositoryFactory.Create();
            var pcdAggregations =
                approachPcdAggregationRepository.GetApproachPcdsAggregationByApproachIdAndDateRange(
                    approach.ApproachID, options.StartDate, options.EndDate, getProtectedPhase);

            if (pcdAggregations != null)
            {
                var concurrentBinContainers = new ConcurrentBag <BinsContainer>();
                //foreach (var binsContainer in binsContainers)
                Parallel.ForEach(BinsContainers, binsContainer =>
                {
                    var tempBinsContainer =
                        new BinsContainer(binsContainer.Start, binsContainer.End);
                    var concurrentBins             = new ConcurrentBag <Bin>();
                    var cycleAggregationRepository = Models.Repositories.ApproachCycleAggregationRepositoryFactory.Create();
                    var cycleAggregtaions          =
                        cycleAggregationRepository.GetApproachCyclesAggregationByApproachIdAndDateRange(
                            approach.ApproachID, options.StartDate, options.EndDate, getProtectedPhase);
                    //foreach (var bin in binsContainer.Bins)
                    Parallel.ForEach(binsContainer.Bins, bin =>
                    {
                        if (pcdAggregations.Any(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End))
                        {
                            double pcdCount = 0;
                            switch (dataType.DataName)
                            {
                            case "ArrivalsOnGreen":
                                pcdCount =
                                    pcdAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.ArrivalsOnGreen);
                                break;

                            case "ArrivalsOnRed":
                                pcdCount =
                                    pcdAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.ArrivalsOnRed);
                                break;

                            case "ArrivalsOnYellow":
                                pcdCount =
                                    pcdAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.ArrivalsOnYellow);
                                break;

                            case "PercentArrivalsOnGreen":
                                pcdCount = Convert.ToInt32(Math.Round(GetPercentArrivalOnGreen(bin, pcdAggregations) * 100));
                                break;

                            case "PlatoonRatio":
                                double percentArrivalOnGreen = GetPercentArrivalOnGreen(bin, pcdAggregations);
                                var aggregations             = cycleAggregtaions.Where(s =>
                                                                                       s.BinStartTime >= bin.Start && s.BinStartTime < bin.End).ToList();

                                double greenTime = aggregations.Sum(s => s.GreenTime);
                                double totalTime = greenTime + aggregations.Sum(s => s.YellowTime) + aggregations.Sum(s => s.RedTime);
                                if (greenTime > 0)
                                {
                                    pcdCount = percentArrivalOnGreen / (greenTime / totalTime);
                                }
                                break;

                            case "ApproachVolume":
                                pcdCount = pcdAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End).Sum(s => s.ArrivalsOnYellow)
                                           + pcdAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End).Sum(s => s.ArrivalsOnGreen)
                                           + pcdAggregations.Where(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End).Sum(s => s.ArrivalsOnRed);
                                break;

                            default:
                                throw new Exception("Unknown Aggregate Data Type for Split Failure");
                            }

                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = pcdCount,
                                Average = pcdCount
                            });
                        }
                        else
                        {
                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = 0,
                                Average = 0
                            });
                        }
                    });
                    tempBinsContainer.Bins = concurrentBins.OrderBy(c => c.Start).ToList();
                    concurrentBinContainers.Add(tempBinsContainer);
                });
                BinsContainers = concurrentBinContainers.OrderBy(b => b.Start).ToList();
            }
        }
Esempio n. 17
0
 protected abstract void LoadBins(Approach approach, ApproachAggregationMetricOptions options,
                                  bool getProtectedPhase, AggregatedDataType dataType);
Esempio n. 18
0
        protected List <ApproachEventCountAggregation> GetApproachEventCountAggregations(ApproachAggregationMetricOptions options, Approach approach, bool getProtectedPhase)
        {
            var approachEventCountAggregationRepository =
                MOE.Common.Models.Repositories.ApproachEventCountAggregationRepositoryFactory.Create();

            return
                (approachEventCountAggregationRepository.GetPhaseEventCountAggregationByPhaseIdAndDateRange(
                     Approach.ApproachID, options.TimeOptions.Start, options.TimeOptions.End, getProtectedPhase));
        }
Esempio n. 19
0
        protected override void LoadBins(Approach approach, ApproachAggregationMetricOptions options,
                                         bool getProtectedPhase,
                                         AggregatedDataType dataType)
        {
            var approachCycleAggregationRepository =
                ApproachCycleAggregationRepositoryFactory.Create();
            var approachCycles =
                approachCycleAggregationRepository.GetApproachCyclesAggregationByApproachIdAndDateRange(
                    approach.ApproachID, options.StartDate, options.EndDate, getProtectedPhase);

            if (approachCycles != null)
            {
                var concurrentBinContainers = new ConcurrentBag <BinsContainer>();
                //foreach (var binsContainer in binsContainers)
                Parallel.ForEach(BinsContainers, binsContainer =>
                {
                    var tempBinsContainer =
                        new BinsContainer(binsContainer.Start, binsContainer.End);
                    var concurrentBins = new ConcurrentBag <Bin>();
                    //foreach (var bin in binsContainer.Bins)
                    Parallel.ForEach(binsContainer.Bins, bin =>
                    {
                        if (approachCycles.Any(s => s.BinStartTime >= bin.Start && s.BinStartTime < bin.End))
                        {
                            var approachCycleCount = 0;
                            switch (dataType.DataName)
                            {
                            case "TotalCycles":
                                approachCycleCount =
                                    approachCycles.Where(s =>
                                                         s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.TotalCycles);
                                break;

                            case "RedTime":
                                approachCycleCount =
                                    (int)approachCycles.Where(s =>
                                                              s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.RedTime);
                                break;

                            case "YellowTime":
                                approachCycleCount =
                                    (int)approachCycles.Where(s =>
                                                              s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.YellowTime);
                                break;

                            case "GreenTime":
                                approachCycleCount =
                                    (int)approachCycles.Where(s =>
                                                              s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.GreenTime);
                                break;

                            case "PedActuations":
                                approachCycleCount =
                                    approachCycles.Where(s =>
                                                         s.BinStartTime >= bin.Start && s.BinStartTime < bin.End)
                                    .Sum(s => s.PedActuations);
                                break;

                            default:

                                throw new Exception("Unknown Aggregate Data Type for Approach Cycle");
                            }
                            Bin newBin = new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = approachCycleCount,
                                Average = approachCycleCount
                            };
                            concurrentBins.Add(newBin);
                        }
                        else
                        {
                            concurrentBins.Add(new Bin
                            {
                                Start   = bin.Start,
                                End     = bin.End,
                                Sum     = 0,
                                Average = 0
                            });
                        }
                    });
                    tempBinsContainer.Bins = concurrentBins.OrderBy(c => c.Start).ToList();
                    concurrentBinContainers.Add(tempBinsContainer);
                });
                BinsContainers = concurrentBinContainers.OrderBy(b => b.Start).ToList();
            }
        }
Esempio n. 20
0
 public CycleAggregationByApproach(Approach approach, ApproachAggregationMetricOptions options, DateTime startDate,
                                   DateTime endDate,
                                   bool getProtectedPhase, AggregatedDataType dataType) : base(approach, options, startDate, endDate,
                                                                                               getProtectedPhase, dataType)
 {
 }
Esempio n. 21
0
 public static void SetTimeOptionsBasedOnBinSize(ApproachAggregationMetricOptions options,
                                                 BinFactoryOptions.BinSize binSize)
 {
     if (binSize == BinFactoryOptions.BinSize.Day)
     {
         options.StartDate   = Convert.ToDateTime("10/1/2017");
         options.EndDate     = Convert.ToDateTime("11/1/2017");
         options.TimeOptions = new BinFactoryOptions(
             Convert.ToDateTime("10/1/2017"),
             Convert.ToDateTime("11/1/2017"),
             null, null, null, null,
             new List <DayOfWeek>
         {
             DayOfWeek.Monday,
             DayOfWeek.Tuesday,
             DayOfWeek.Wednesday,
             DayOfWeek.Thursday,
             DayOfWeek.Friday,
             DayOfWeek.Saturday,
             DayOfWeek.Sunday
         },
             BinFactoryOptions.BinSize.Day,
             BinFactoryOptions.TimeOptions.StartToEnd);
     }
     else if (binSize == BinFactoryOptions.BinSize.Month)
     {
         options.StartDate   = Convert.ToDateTime("1/1/2017");
         options.EndDate     = Convert.ToDateTime("1/1/2018");
         options.TimeOptions = new BinFactoryOptions(
             Convert.ToDateTime("1/1/2017"),
             Convert.ToDateTime("1/1/2018"),
             null, null, null, null,
             new List <DayOfWeek>
         {
             DayOfWeek.Monday,
             DayOfWeek.Tuesday,
             DayOfWeek.Wednesday,
             DayOfWeek.Thursday,
             DayOfWeek.Friday,
             DayOfWeek.Saturday,
             DayOfWeek.Sunday
         },
             BinFactoryOptions.BinSize.Month,
             BinFactoryOptions.TimeOptions.StartToEnd);
     }
     else if (binSize == BinFactoryOptions.BinSize.Year)
     {
         options.StartDate   = Convert.ToDateTime("1/1/2016");
         options.EndDate     = Convert.ToDateTime("1/1/2018");
         options.TimeOptions = new BinFactoryOptions(
             Convert.ToDateTime("1/1/2016"),
             Convert.ToDateTime("1/1/2018"),
             null, null, null, null,
             new List <DayOfWeek>
         {
             DayOfWeek.Monday,
             DayOfWeek.Tuesday,
             DayOfWeek.Wednesday,
             DayOfWeek.Thursday,
             DayOfWeek.Friday,
             DayOfWeek.Saturday,
             DayOfWeek.Sunday
         },
             BinFactoryOptions.BinSize.Year,
             BinFactoryOptions.TimeOptions.StartToEnd);
     }
     else
     {
         options.StartDate   = Convert.ToDateTime("10/17/2017");
         options.EndDate     = Convert.ToDateTime("10/18/2017");
         options.TimeOptions = new BinFactoryOptions(
             Convert.ToDateTime("10/17/2017"),
             Convert.ToDateTime("10/18/2017"),
             null, null, null, null,
             new List <DayOfWeek>
         {
             DayOfWeek.Monday,
             DayOfWeek.Tuesday,
             DayOfWeek.Wednesday,
             DayOfWeek.Thursday,
             DayOfWeek.Friday,
             DayOfWeek.Saturday,
             DayOfWeek.Sunday
         },
             BinFactoryOptions.BinSize.FifteenMinute,
             BinFactoryOptions.TimeOptions.StartToEnd);
     }
     if (options.SelectedXAxisType == XAxisType.TimeOfDay)
     {
         options.TimeOptions.TimeOfDayStartHour   = 7;
         options.TimeOptions.TimeOfDayStartMinute = 0;
         options.TimeOptions.TimeOfDayEndHour     = 10;
         options.TimeOptions.TimeOfDayStartHour   = 0;
     }
 }
Esempio n. 22
0
 public virtual void CreateTimeMetricStartToFinishAllBinSizesAllAggregateDataTypesTest(ApproachAggregationMetricOptions options)
 {
     setOptionDefaults(options);
     foreach (var xAxisType in Enum.GetValues(typeof(XAxisType)).Cast <XAxisType>().ToList())
     {
         options.SelectedXAxisType = xAxisType;
         foreach (var seriesType in Enum.GetValues(typeof(SeriesType)).Cast <SeriesType>().ToList())
         {
             options.SelectedSeries = seriesType;
             foreach (var tempBinSize in Enum.GetValues(typeof(BinFactoryOptions.BinSize))
                      .Cast <BinFactoryOptions.BinSize>().ToList())
             {
                 SetTimeOptionsBasedOnBinSize(options, tempBinSize);
                 options.TimeOptions.SelectedBinSize = tempBinSize;
                 foreach (var aggregatedDataType in options.AggregatedDataTypes)
                 {
                     options.SelectedAggregatedDataType = aggregatedDataType;
                     try
                     {
                         if (IsValidCombination(options))
                         {
                             CreateStackedColumnChart(options);
                             Assert.IsTrue(options.ReturnList.Count == 2 || options.ReturnList.Count == 4);
                         }
                     }
                     catch (InvalidBinSizeException e)
                     {
                         Debug.WriteLine(e.Message);
                     }
                     options.ReturnList = new List <string>();
                 }
             }
         }
     }
 }
Esempio n. 23
0
 protected void setOptionDefaults(ApproachAggregationMetricOptions options)
 {
     options.SeriesWidth = 3;
     SetFilterSignal(options);
     options.ShowEventCount = true;
 }