예제 #1
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));
        }
예제 #2
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();
        }