Пример #1
0
        public void ResetGraph()
        {
            bufferedSeries.ClearPoints();

            foreach (TabPage page in graphTab.TabPages)
            {
                CtrlTestGraphPanel ctrl = page.Controls[0] as CtrlTestGraphPanel;

                ctrl.ResetRangeAxisX();
                ctrl.ViewGraph.MarkLine.Visible = false;
            }
        }
Пример #2
0
        public void Open(Int64 recNo)
        {
            db.Lock();

            try
            {
                this.recNo = recNo;
                bufferedSeries.ClearPoints();

                double             totalTime  = 0;
                DataBookDataSet    bookSet    = db.DataBookSet;
                DataRawUnitDataSet rawUnitSet = db.DataRawUnitSet;
                DataRawDataSet     rawSet     = db.DataRawSet;
                UnitConvert        unit       = new UnitConvert(EUnitType.None, 0, 0);

                bookSet.Select(recNo);

                if (bookSet.IsEmpty() == false)
                {
                    bookSet.Fetch();

                    scanTime = bookSet.ScanTime;
                    bufferedSeries.BaseTime = scanTime * 1000;

                    if (string.IsNullOrWhiteSpace(bookSet.TestName) == true)
                    {
                        fName = $"None_Line{bookSet.TestLine + 1}";
                    }
                    else
                    {
                        fName = $"{bookSet.TestName}_Line{bookSet.TestLine + 1}";
                    }

                    rawUnitSet.Select(bookSet.RecNo);

                    try
                    {
                        for (int i = 0; i < rawUnitSet.GetRowCount(); i++)
                        {
                            rawUnitSet.Fetch(i);

                            unit.Type = (EUnitType)rawUnitSet.UnitType;
                            unit.From = rawUnitSet.UnitFrom;
                            unit.To   = rawUnitSet.UnitTo;

                            SetMethodUnit((EUnitType)rawUnitSet.UnitType, rawUnitSet.UnitTo);
                            SetPlotSeriesUnit(i, (EUnitType)rawUnitSet.UnitType, rawUnitSet.UnitTo);

                            rawSet.Select(rawUnitSet.RecNo);
                            for (int j = 0; j < rawSet.GetRowCount(); j++)
                            {
                                rawSet.Fetch(j);
                                if (rawSet.DataRaw == null)
                                {
                                    break;
                                }

                                if (i == 0)
                                {
                                    totalTime += (rawSet.DataRaw.Length - 1) * bufferedSeries.BaseTime;
                                }

                                ConvertUnit(unit, rawSet.DataRaw);
                                bufferedSeries[i].Points.AddRange(rawSet.DataRaw);
                            }

                            Win32.SwitchToThread();
                        }
                    }
                    finally
                    {
                        foreach (TabPage page in graphTab.TabPages)
                        {
                            CtrlViewGraphPanel ctrl = page.Controls[0] as CtrlViewGraphPanel;

                            ctrl.Method = method;
                            ctrl.RefreshYAxesUnit();
                            ctrl.SetMaxRangeAxisX(totalTime);
                        }

                        InvalidateGraphSeries(graphTab.SelectedTab);
                    }
                }
            }
            finally
            {
                db.Unlock();
            }
        }