public void AoROptionsTest() { AoROptions options = new AoROptions("7185", _start, _end, true, 15); options.MetricFileLocation = @"C:\SPMImages\"; Assert.IsTrue(options.CreateMetric().Count > 1); }
public ArriveOnRedChart(AoROptions options, SignalPhase signalPhase) { Options = options; var reportTimespan = Options.EndDate - Options.StartDate; //Set the chart properties ChartFactory.SetImageProperties(chart); //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"; if (Options.YAxisMax != null) { chartArea.AxisY.Maximum = Options.YAxisMax.Value; } chartArea.AxisY.Minimum = 0; chartArea.AxisY.Title = "Volume (Vehicles Per Hour)"; chartArea.AxisY.Interval = 500; chartArea.AxisY2.Title = "Percent AoR"; chartArea.AxisY2.Maximum = 100; chartArea.AxisY2.Interval = 10; chartArea.AxisY2.Enabled = AxisEnabled.True; chartArea.AxisX.Title = "Time (Hour of Day)"; chartArea.AxisX.IntervalType = DateTimeIntervalType.Hours; chartArea.AxisX.LabelStyle.Format = "HH"; chartArea.AxisX2.LabelStyle.Format = "HH"; 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; chart.ChartAreas.Add(chartArea); //Add the point series var AoRSeries = new Series(); AoRSeries.ChartType = SeriesChartType.Line; AoRSeries.BorderDashStyle = ChartDashStyle.Dash; AoRSeries.Color = Color.Red; AoRSeries.Name = "Arrivals on Red"; AoRSeries.XValueType = ChartValueType.DateTime; var TVSeries = new Series(); TVSeries.ChartType = SeriesChartType.Line; TVSeries.BorderDashStyle = ChartDashStyle.Dash; TVSeries.Color = Color.Black; TVSeries.Name = "Total Vehicles"; TVSeries.XValueType = ChartValueType.DateTime; var PARSeries = new Series(); PARSeries.ChartType = SeriesChartType.Line; PARSeries.Color = Color.Red; PARSeries.Name = "Percent Arrivals on Red"; PARSeries.BorderWidth = 2; PARSeries.XValueType = ChartValueType.DateTime; PARSeries.YAxisType = AxisType.Secondary; var pointSeries = new Series(); pointSeries.ChartType = SeriesChartType.Point; pointSeries.Color = Color.White; pointSeries.Name = "Posts"; pointSeries.XValueType = ChartValueType.DateTime; pointSeries.IsVisibleInLegend = false; chart.Series.Add(pointSeries); chart.Series.Add(AoRSeries); chart.Series.Add(PARSeries); chart.Series.Add(TVSeries); //Add points at the start and and of the x axis to ensure //the graph covers the entire period selected by the user //whether there is data or not chart.Series["Posts"].Points.AddXY(Options.StartDate, 0); chart.Series["Posts"].Points.AddXY(Options.EndDate, 0); AddDataToChart(chart, signalPhase); SetPlanStrips(signalPhase.Plans, chart, Options.StartDate, Options.ShowPlanStatistics); }
public ArriveOnRedChart(AoROptions options, SignalPhase signalPhase) { Options = options; Chart = ChartFactory.CreateDefaultChart(options); //Set the chart properties ChartFactory.SetImageProperties(Chart); //Create the chart legend var chartLegend = new Legend(); chartLegend.Name = "MainLegend"; chartLegend.Docking = Docking.Left; Chart.Legends.Add(chartLegend); if (Options.YAxisMax != null) { Chart.ChartAreas[0].AxisY.Maximum = Options.YAxisMax.Value; } Chart.ChartAreas[0].AxisY.Minimum = 0; Chart.ChartAreas[0].AxisY.Title = "Volume (Vehicles Per Hour)"; Chart.ChartAreas[0].AxisY.Interval = 500; Chart.ChartAreas[0].AxisY2.Title = "Percent AoR"; Chart.ChartAreas[0].AxisY2.Maximum = 100; Chart.ChartAreas[0].AxisY2.Interval = 10; Chart.ChartAreas[0].AxisY2.Enabled = AxisEnabled.True; //Add the point series var AoRSeries = new Series(); AoRSeries.ChartType = SeriesChartType.Line; AoRSeries.BorderDashStyle = ChartDashStyle.Dash; AoRSeries.Color = Color.Red; AoRSeries.Name = "Arrivals on Red"; AoRSeries.XValueType = ChartValueType.DateTime; var TVSeries = new Series(); TVSeries.ChartType = SeriesChartType.Line; TVSeries.BorderDashStyle = ChartDashStyle.Dash; TVSeries.Color = Color.Black; TVSeries.Name = "Total Vehicles"; TVSeries.XValueType = ChartValueType.DateTime; var PARSeries = new Series(); PARSeries.ChartType = SeriesChartType.Line; PARSeries.Color = Color.Red; PARSeries.Name = "Percent Arrivals on Red"; PARSeries.BorderWidth = 2; PARSeries.XValueType = ChartValueType.DateTime; PARSeries.YAxisType = AxisType.Secondary; var pointSeries = new Series(); pointSeries.ChartType = SeriesChartType.Point; pointSeries.Color = Color.White; pointSeries.Name = "Posts"; pointSeries.XValueType = ChartValueType.DateTime; pointSeries.IsVisibleInLegend = false; Chart.Series.Add(pointSeries); Chart.Series.Add(AoRSeries); Chart.Series.Add(PARSeries); Chart.Series.Add(TVSeries); //Add points at the start and and of the x axis to ensure //the graph covers the entire period selected by the user //whether there is data or not Chart.Series["Posts"].Points.AddXY(Options.StartDate, 0); Chart.Series["Posts"].Points.AddXY(Options.EndDate, 0); AddDataToChart(Chart, signalPhase); SetPlanStrips(signalPhase.Plans, Chart, Options.StartDate, Options.ShowPlanStatistics); }