Пример #1
0
        public void Load(Meas[] _MMeas, double _gain, SignalViewPars _pars, Color _color_dead, double[] _borders, bool _IsOn)
        {
            pars = _pars;
            IsOn = _IsOn;
            DataPointCollection pp = series.Points;

            pp.Clear();
            box.Visible    = IsOn;
            series.Enabled = IsOn;
            bline.Visible  = IsOn;
            bline1.Visible = IsOn;
            if (!IsOn)
            {
                return;
            }

            series.Color   = _pars.SColor;
            series.Enabled = _pars.View;
            box.Checked    = _pars.View;
            box.ForeColor  = _pars.View ? _pars.SColor : Color.Black;
            if (_MMeas == null)
            {
                return;
            }
            for (int i = 0; i < _MMeas.Length; i++)
            {
                double v = 0;
                Meas   m = _MMeas[i];
                switch (type)
                {
                case EType.Source:
                    v = m.Source;
                    break;

                case EType.Median:
                    v = m.Median;
                    break;

                case EType.Filter:
                    v = m.Filter;
                    break;

                case EType.FilterIn:
                    v = -m.FilterIn;
                    break;
                }
                v *= _gain;
                DataPoint p = new DataPoint(i, v);
                p.Color = m.Dead ? _color_dead : _pars.SColor;
                pp.Add(p);
            }
            bline.SetBorders(_borders);
            bline.Visible = box.Checked;
            bline1.SetBorders(new double[2] {
                -_borders[0], -_borders[1]
            });
            bline1.Visible = box.Checked;
        }
Пример #2
0
        public void InitRange(ResultDef _resultDef, int _iz0, int _iz1, int _is, double _gain)
        {
            chart1.Series.SuspendUpdates();
            Clear();
            TypeSize ts = ParAll.ST.TSSet.Current;

            resultDef = _resultDef;
            iz0       = _iz0;
            iz1       = _iz1;
            ise       = _is;
            Color DeviderColor      = ParAll.ST.Some.SignalsView.DeviderColor;
            DataPointCollection p   = chart1.Series[0].Points;
            DataPointCollection pIn = chart1.Series[0].Points;
            int ip     = 0;
            int ipIn   = 0;
            int istrip = 0;

            chart1.ChartAreas[0].AxisX.StripLines.Clear();
            DefCL dcl  = new DefCL(_resultDef.Tp);
            bool  IsIn = dcl.IsFinterIn;

            for (int ii = _iz0; ii <= _iz1; ii++)
            {
                Meas[] MMeas = _resultDef.MZone[ii].MSensor[ise].MMeas;
                if (istrip > 0)
                {
                    StripLine sl = new StripLine();
                    sl.BorderColor    = DeviderColor;
                    sl.BorderWidth    = 2;
                    sl.IntervalOffset = ip;
                    chart1.ChartAreas[0].AxisX.StripLines.Add(sl);
                }
                istrip++;
                for (int i = 0; i < MMeas.Length; i++)
                {
                    Meas      m  = MMeas[i];
                    DataPoint dp = new DataPoint(ip, m.FilterABC * _gain);
                    dp.Color = m.Dead ? Classer.GetColor(EClass.None) : Classer.GetColor(m.Class);
                    dp.Tag   = new PointSubj(ii, ise, i);
                    p.Add(dp);
                    ip++;
                    if (IsIn)
                    {
                        pIn.AddXY(ipIn, -m.FilterInABC * _gain);
                        p[ipIn].Color = m.Dead ? Classer.GetColor(EClass.None) : Classer.GetColor(m.ClassIn);
                        ipIn++;
                    }
                }
                istrip++;
            }
            if (bline != null)
            {
                bline.Visible = false;
            }
            if (blineIn != null)
            {
                blineIn.Visible = false;
            }
            bline   = new BorderLine(chart1.ChartAreas[0].AxisY, Classer.GetColor(EClass.Brak), Classer.GetColor(EClass.Class2));
            blineIn = new BorderLine(chart1.ChartAreas[0].AxisY, Classer.GetColor(EClass.Brak), Classer.GetColor(EClass.Class2));
            bline.SetBorders(dcl.Borders);
            bline.Visible = true;

            if (IsIn)
            {
                double[] borders = new double[2];
                borders[0] = -dcl.Border1In;
                borders[1] = -dcl.Border2In;
                blineIn.SetBorders(borders);
                blineIn.Visible = true;
            }
            chart1.ChartAreas[0].AxisY.Maximum = 100;
            if (IsIn)
            {
                chart1.ChartAreas[0].AxisY.Minimum = -100;
            }
            else
            {
                chart1.ChartAreas[0].AxisY.Minimum = 0;
            }
            if (cursor.Visible)
            {
                OnMove(cursor.Position);
            }
            chart1.Series[0].Enabled = true;
            chart1.Series[1].Enabled = IsIn;
            chart1.Series.ResumeUpdates();
        }