Beispiel #1
0
        private void AddAdditionalSeries(List <GraphSeries> series, int chartIndex, CustomReport.Phase phase)
        {
            //Add the user defined series
            int i = 0;

            foreach (GraphSeries g in series)
            {
                string chartName    = "Custom Series " + i.ToString();
                Series customSeries = new Series();
                customSeries.ChartType  = g.SeriesType;
                customSeries.Color      = g.SeriesColor;
                customSeries.Name       = chartName;
                customSeries.XValueType = ChartValueType.DateTime;
                Charts[chartIndex].Series.Add(customSeries);
                i++;

                foreach (CustomReport.Cycle c in phase.Cycles)
                {
                    List <Models.Controller_Event_Log> customPoints =
                        (from ge in phase.Events
                         where ge.EventCode == g.EventCode &&
                         ge.Timestamp > c.CycleStart &&
                         ge.Timestamp < c.ChangeToRed
                         select ge).ToList();

                    foreach (Models.Controller_Event_Log l in customPoints)
                    {
                        Charts[chartIndex].Series[chartName].Points.AddXY(
                            l.Timestamp.ToOADate(), (l.Timestamp - c.CycleStart).TotalSeconds);
                    }
                }
            }
        }
Beispiel #2
0
        private void GetChart(DateTime StartDate, DateTime EndDate, CustomReport.Phase phase, string location, int FirstSecondsOfRed, bool ShowFailLines, bool ShowAvgLines, bool ShowPercentFailLines, double?YAxisMax, string chartName, List <string> returnString, bool isPermissivePhase)
        {
            MOE.Common.Business.SplitFail.SplitFailChart sfChart =
                new MOE.Common.Business.SplitFail.SplitFailChart(this, phase);

            if (isPermissivePhase)
            {
                sfChart.chart.BackColor      = Color.LightGray;
                sfChart.chart.Titles[2].Text = "Permissive " + sfChart.chart.Titles[2].Text + " " + phase.Approach.GetDetectorsForMetricType(12).FirstOrDefault().MovementType.Description;
            }
            else
            {
                sfChart.chart.Titles[2].Text = "Protected " + sfChart.chart.Titles[2].Text + " " + phase.Approach.GetDetectorsForMetricType(12).FirstOrDefault().MovementType.Description;
            }

            System.Threading.Thread.Sleep(300);

            chartName = chartName.Replace(".", (phase.ApproachDirection + "."));

            try
            {
                sfChart.chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg);
            }
            catch
            {
                try
                {
                    sfChart.chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg);
                }
                catch
                {
                    Models.Repositories.IApplicationEventRepository appEventRepository =
                        Models.Repositories.ApplicationEventRepositoryFactory.Create();
                    Models.ApplicationEvent applicationEvent = new ApplicationEvent();
                    applicationEvent.ApplicationName = "SPM Website";
                    applicationEvent.Description     = MetricType.ChartName + " Failed While Saving File";
                    applicationEvent.SeverityLevel   = ApplicationEvent.SeverityLevels.Medium;
                    applicationEvent.Timestamp       = DateTime.Now;
                    appEventRepository.Add(applicationEvent);
                }
            }



            returnString.Add(MetricWebPath + chartName);
        }
Beispiel #3
0
        private void AddRedYellowGreen(CustomReport.Phase phase, int chartIndex)
        {
            //Add the green series
            Series greenSeries = new Series();

            greenSeries.ChartType   = SeriesChartType.Line;
            greenSeries.Color       = Color.DarkGreen;
            greenSeries.Name        = "Change to Green";
            greenSeries.XValueType  = ChartValueType.DateTime;
            greenSeries.BorderWidth = 1;
            Charts[chartIndex].Series.Add(greenSeries);

            //Add the yellow series
            Series yellowSeries = new Series();

            yellowSeries.ChartType  = SeriesChartType.Line;
            yellowSeries.Color      = Color.Yellow;
            yellowSeries.Name       = "Change to Yellow";
            yellowSeries.XValueType = ChartValueType.DateTime;
            Charts[chartIndex].Series.Add(yellowSeries);

            //Add the red series
            Series redSeries = new Series();

            redSeries.ChartType  = SeriesChartType.Line;
            redSeries.Color      = Color.Red;
            redSeries.Name       = "Change to Red";
            redSeries.XValueType = ChartValueType.DateTime;
            Charts[chartIndex].Series.Add(redSeries);

            foreach (CustomReport.Cycle cycle in phase.Cycles)
            {
                Charts[chartIndex].Series["Change to Green"].Points.AddXY(
                    cycle.ChangeToGreen, (cycle.ChangeToGreen - cycle.CycleStart).TotalSeconds);
                Charts[chartIndex].Series["Change to Yellow"].Points.AddXY(
                    cycle.BeginYellowClear, (cycle.BeginYellowClear - cycle.CycleStart).TotalSeconds);
                Charts[chartIndex].Series["Change to Red"].Points.AddXY(
                    cycle.ChangeToRed, (cycle.ChangeToRed - cycle.CycleStart).TotalSeconds);
            }
        }