Example #1
0
        private void AddTitleAndLegend(Chart chart, int PreemptNumber)
        {
            chart.ImageStorageMode       = ImageStorageMode.UseImageLocation;
            chart.ImageType              = ChartImageType.Jpeg;
            chart.Height                 = 350;
            chart.Width                  = 1100;
            chart.BorderSkin.SkinStyle   = BorderSkinStyle.None;
            chart.BorderSkin.BorderColor = Color.Black;
            chart.BorderSkin.BorderWidth = 1;

            //Set the chart title
            chart.Titles.Add(ChartTitleFactory.GetChartName(Options.MetricTypeID));
            chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(Options.SignalID,
                                                                             Options.StartDate, Options.EndDate));
            if (PreemptNumber > 0)
            {
                chart.Titles.Add(ChartTitleFactory.GetBoldTitle(" Preempt Number: " + PreemptNumber.ToString()));
            }

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

            chartLegend.Name    = "MainLegend";
            chartLegend.Docking = Docking.Left;
            chart.Legends.Add(chartLegend);
        }
Example #2
0
 private void SetChartTitle(string direction1, string direction2)
 {
     Chart.Titles.Add(ChartTitleFactory.GetChartName(Options.MetricTypeID));
     Chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(
                          Options.SignalID, Options.StartDate, Options.EndDate));
     Chart.Titles.Add(ChartTitleFactory.GetBoldTitle(direction1 + " and " + direction2 + " Approaches"));
 }
Example #3
0
 private void SetChartTitle(Models.LaneType laneType, Models.DirectionType direction, Models.MovementType movementType)
 {
     chart.Titles.Add(ChartTitleFactory.GetChartName(Options.MetricTypeID));
     chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(
                          Options.SignalID, Options.StartDate, Options.EndDate));
     chart.Titles.Add(ChartTitleFactory.GetBoldTitle(direction.Description + " " +
                                                     movementType.Description + " " + laneType.Description + " Lanes"));
 }
Example #4
0
 private void SetChartTitle(LaneType laneType, DirectionType direction, MovementType movementType)
 {
     chart.Titles.Add(ChartTitleFactory.GetChartName(Options.MetricTypeID));
     chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(
                          Options.SignalID, Options.StartDate, Options.EndDate));
     chart.Titles.Add(ChartTitleFactory.GetBoldTitle(direction.Description + " " +
                                                     movementType.Description + " " + laneType.Description +
                                                     " Lanes"));
     if (movementType.MovementTypeID == 2 || movementType.MovementTypeID == 3)
     {
         chart.ChartAreas[0].AxisY.Maximum = Options.Y2AxisMax.Value;
     }
 }
Example #5
0
        //public static void SetSimplePlanStrips(List<Plan> plans, Chart chart, DateTime startDate, ControllerEventLogs eventLog)
        //{
        //    int backGroundColor = 1;
        //    foreach (Plan plan in plans)
        //    {
        //        StripLine stripline = new StripLine();
        //        //Creates alternating backcolor to distinguish the plans
        //        if (backGroundColor % 2 == 0)
        //        {
        //            stripline.BackColor = Color.FromArgb(120, Color.LightGray);
        //        }
        //        else
        //        {
        //            stripline.BackColor = Color.FromArgb(120, Color.LightBlue);
        //        }

        //        //Set the stripline properties
        //        stripline.IntervalOffsetType = DateTimeIntervalType.Hours;
        //        stripline.Interval = 1;
        //        stripline.IntervalOffset = (plan.StartTime - startDate).TotalHours;
        //        stripline.StripWidth = (plan.EndTime - plan.StartTime).TotalHours;
        //        stripline.StripWidthType = DateTimeIntervalType.Hours;

        //        chart.ChartAreas["ChartArea1"].AxisX.StripLines.Add(stripline);

        //        //Add a corrisponding custom label for each strip
        //        CustomLabel plannumberlabel = new CustomLabel();
        //        plannumberlabel.FromPosition = plan.StartTime.ToOADate();
        //        plannumberlabel.ToPosition = plan.EndTime.ToOADate();
        //        switch (plan.PlanNumber)
        //        {
        //            case 254:
        //                plannumberlabel.Text = "Free";
        //                break;
        //            case 255:
        //                plannumberlabel.Text = "Flash";
        //                break;
        //            case 0:
        //                plannumberlabel.Text = "Unknown";
        //                break;
        //            default:
        //                plannumberlabel.Text = "Plan " + plan.PlanNumber.ToString();

        //                break;
        //        }
        //        plannumberlabel.LabelMark = LabelMarkStyle.LineSideMark;
        //        plannumberlabel.ForeColor = Color.Black;
        //        plannumberlabel.RowIndex = 6;


        //        chart.ChartAreas[0].AxisX2.CustomLabels.Add(plannumberlabel);

        //        CustomLabel planPreemptsLabel = new CustomLabel();
        //        planPreemptsLabel.FromPosition = plan.StartTime.ToOADate();
        //        planPreemptsLabel.ToPosition = plan.EndTime.ToOADate();

        //        var c = from Models.Controller_Event_Log r in eventLog.Events
        //                where r.EventCode == 107 && r.Timestamp > plan.StartTime && r.Timestamp < plan.EndTime
        //                select r;


        //        string premptCount = c.Count().ToString();
        //        planPreemptsLabel.Text = "Preempts Serviced During Plan: " + premptCount;
        //        planPreemptsLabel.LabelMark = LabelMarkStyle.LineSideMark;
        //        planPreemptsLabel.ForeColor = Color.Red;
        //        planPreemptsLabel.RowIndex = 7;

        //        chart.ChartAreas[0].AxisX2.CustomLabels.Add(planPreemptsLabel);

        //        backGroundColor++;

        //    }
        //}

        private void AddTitleAndLegend(Chart chart, int preemptNumber)
        {
            ChartFactory.SetImageProperties(chart);
            chart.BorderSkin.SkinStyle   = BorderSkinStyle.None;
            chart.BorderSkin.BorderColor = Color.Black;
            chart.BorderSkin.BorderWidth = 1;

            //Set the chart title
            chart.Titles.Add(ChartTitleFactory.GetChartName(Options.MetricTypeID));
            chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRange(Options.SignalID,
                                                                             Options.StartDate, Options.EndDate));
            if (preemptNumber > 0)
            {
                chart.Titles.Add(ChartTitleFactory.GetBoldTitle(" Preempt Number: " + preemptNumber));
            }

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

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