コード例 #1
0
ファイル: PreemptDetailChart.cs プロジェクト: gmonk/ATSPM
        protected void AddDataToChart(Chart chart, ControllerEventLogs dttb)
        {
            var engine = new PreemptCycleEngine();
            var cycles = engine.CreatePreemptCycle(dttb);

            foreach (var cycle in cycles)
            {
                if (cycle.HasDelay)
                {
                    var point = new DataPoint();
                    point.SetValueXY(cycle.CycleStart.ToOADate(), cycle.Delay);
                    chart.Series["Delay"].Points.Add(point);
                    chart.Series["Time to Service"].Points.AddXY(cycle.CycleStart.ToOADate(), cycle.TimeToService);
                    // point.AxisLabel = cycle.CycleStart.ToShortTimeString();
                }
                else
                {
                    var point = new DataPoint();
                    point.SetValueXY(cycle.CycleStart.ToOADate(), cycle.TimeToService);
                    chart.Series["Delay"].Points.AddXY(cycle.CycleStart.ToOADate(), 0);
                    chart.Series["Time to Service"].Points.Add(point);
                    // point.AxisLabel = cycle.CycleStart.ToShortTimeString();
                }
                chart.Series["Track Clear"].Points.AddXY(cycle.CycleStart.ToOADate(), cycle.TimeToTrackClear);
                chart.Series["Dwell Time"].Points.AddXY(cycle.CycleStart.ToOADate(), cycle.DwellTime);
                if (cycle.TimeToCallMaxOut > 0)
                {
                    chart.Series["Call Max Out"].Points.AddXY(cycle.CycleStart.ToOADate(), cycle.TimeToCallMaxOut);
                }
                if (cycle.TimeToGateDown > 0)
                {
                    chart.Series["Gate Down"].Points.AddXY(cycle.CycleStart.ToOADate(), cycle.TimeToGateDown);
                }
                foreach (var d in cycle.InputOn)
                {
                    if (d >= cycle.CycleStart && d <= cycle.CycleEnd)
                    {
                        chart.Series["Input On"].Points.AddXY(cycle.CycleStart.ToOADate(), (d - cycle.CycleStart).TotalSeconds);
                    }
                }
                foreach (var d in cycle.InputOff)
                {
                    if (d >= cycle.CycleStart && d <= cycle.CycleEnd)
                    {
                        chart.Series["Input Off"].Points.AddXY(cycle.CycleStart.ToOADate(), (d - cycle.CycleStart).TotalSeconds);
                    }
                }
            }
        }
コード例 #2
0
ファイル: PreemptDetailChart.cs プロジェクト: zfx1982/ATSPM
        protected void AddDataToChart(Chart chart, MOE.Common.Business.ControllerEventLogs DTTB, int preemptNumber)
        {
            PreemptCycleEngine  engine = new PreemptCycleEngine();
            List <PreemptCycle> cycles = engine.CreatePreemptCycle(DTTB);

            int x = 1;

            foreach (PreemptCycle cycle in cycles)
            {
                if (cycle.HasDelay)
                {
                    DataPoint point = new DataPoint();
                    point.SetValueXY(x, cycle.Delay);
                    chart.Series["Delay"].Points.Add(point);
                    chart.Series["Time to Service"].Points.AddXY(x, cycle.TimeToService);
                    point.AxisLabel = cycle.CycleStart.ToShortTimeString();
                }
                else
                {
                    DataPoint point = new DataPoint();
                    point.SetValueXY(x, cycle.TimeToService);
                    chart.Series["Delay"].Points.AddXY(x, 0);
                    chart.Series["Time to Service"].Points.Add(point);
                    point.AxisLabel = cycle.CycleStart.ToShortTimeString();
                }
                chart.Series["Track Clear"].Points.AddXY(x, cycle.TimeToTrackClear);
                chart.Series["Dwell Time"].Points.AddXY(x, cycle.DwellTime);


                if (cycle.TimeToCallMaxOut > 0)
                {
                    chart.Series["Call Max Out"].Points.AddXY(x, cycle.TimeToCallMaxOut);
                }

                if (cycle.TimeToGateDown > 0)
                {
                    chart.Series["Gate Down"].Points.AddXY(x, cycle.TimeToGateDown);
                }



                foreach (DateTime d in cycle.InputOn)
                {
                    if (d >= cycle.CycleStart && d <= cycle.CycleEnd)
                    {
                        chart.Series["Input On"].Points.AddXY(x, (d - cycle.CycleStart).TotalSeconds);
                    }
                }

                foreach (DateTime d in cycle.InputOff)
                {
                    if (d >= cycle.CycleStart && d <= cycle.CycleEnd)
                    {
                        chart.Series["Input Off"].Points.AddXY(x, (d - cycle.CycleStart).TotalSeconds);
                    }
                }

                x++;
            }


            if (x <= 6)
            {
                chart.ChartAreas[0].AxisX.Maximum = 8;
            }
        }