Beispiel #1
0
        public void ControlInit(PlotConfig config)
        {
            for (int i = 0; i < config.ChCount; i++)
            {
                tChart_timeBase.Series.Add(new FastLine()
                {
                    Title = "CH " + (i + 1), Active = i > 0 ? false : true, Color = PlotControl.colors[i]
                });
            }

            tChart_timeBase.MouseWheel += (s, e) =>
            {
                wheelAccum += e.Delta;
                if (Math.Abs(wheelAccum) > 200)
                {
                    tChart_timeBase.Axes.Left.Automatic = false;
                }
                var left   = tChart_timeBase.Axes.Left.Position;
                var top    = tChart_timeBase.Axes.Left.IStartPos + (wheelAccum > 0 ? 10 : -10);
                var right  = tChart_timeBase.Axes.Bottom.IEndPos;
                var bottom = tChart_timeBase.Axes.Bottom.Position + (wheelAccum > 0 ? -10 : 10);

                tChart_timeBase.Zoom.ZoomRect(new Rectangle(left, top, right - left, bottom - top));
                wheelAccum = 0;
            };
        }
Beispiel #2
0
        public void ControlInit(PlotConfig config)
        {
            KeyphasorMap = config.KeyphasorMap;
            if (config.Columns != null)
            {
                var chMembers = config.Columns.GetType().GetProperties().Where(x => x.Name.Contains("Ch")).ToArray();
                SWCorrectionValues = new float[chMembers.Length];

                for (int ch = 0; ch < SWCorrectionValues.Length; ch++)
                {
                    SWCorrectionValues[ch] = 1.0f;
                }

                ColumnObj = config.Columns;
                switch (config.Type)
                {
                case PlotType.RealTime:
                    gvTable.Columns.Add(new GridColumn()
                    {
                        Caption = "Time Stamp", FieldName = "TimeStamp", Visible = true
                    });
                    if (KeyphasorMap != null)
                    {
                        foreach (var p in KeyphasorMap)
                        {
                            gvTable.Columns.Add(new GridColumn()
                            {
                                Caption = p.Key, FieldName = p.Key, Visible = true
                            });
                        }
                    }
                    Members = chMembers;
                    foreach (var member in Members)
                    {
                        gvTable.Columns.Add(new GridColumn()
                        {
                            Caption = member.Name, FieldName = member.Name, Visible = true
                        });
                    }

                    break;

                case PlotType.WorkSheet:
                    Members = config.Columns.GetType().GetProperties().ToArray();
                    foreach (var member in Members)
                    {
                        gvTable.Columns.Add(new GridColumn()
                        {
                            Caption = member.Name, FieldName = member.Name, Visible = true
                        });
                    }
                    break;

                case PlotType.Correction:
                    Members = Members = chMembers;
                    gvTable.Columns.Add(new GridColumn()
                    {
                        Caption = "Ch", FieldName = "Ch", Visible = true
                    });
                    gvTable.Columns.Add(new GridColumn()
                    {
                        Caption = "Before", FieldName = "Before", Visible = true
                    });
                    gvTable.Columns.Add(new GridColumn()
                    {
                        Caption = "Correction Value", FieldName = "CV", Visible = true
                    });
                    gvTable.Columns.Add(new GridColumn()
                    {
                        Caption = "After", FieldName = "After", Visible = true
                    });
                    break;

                default: break;
                }
            }
        }