Exemplo n.º 1
0
        private void PlotChart(Type xAxisType, DataRow[] rows, string str, string traceName)
        {
            SymtChartLib.Trace trace = new SymtChartLib.Trace();
            if (xAxisType == typeof(double))
            {
                string start = rows.Min(x => x.Field <double>(str)).ToString();
                string stop  = rows.Max(x => x.Field <double>(str)).ToString();
                if (lstXAxis.Where(x => x.Start == start && x.Stop == stop).Count() == 0)
                {
                    lstXAxis.Add(new SymtChartLib.XAxis()
                    {
                        Start = start, Stop = stop
                    });
                }
                trace.AxisIndex = lstXAxis.FindIndex(x => x.Start == start && x.Stop == stop);
            }
            int k = InterfaceChart2.Traces.Count;

            trace.Title = traceName;
            if (rows.Count() > 0)
            {
                Point[] point = new Point[rows.Count()];
                for (int i = 0; i < rows.Count(); i++)
                {
                    Point p = new Point()
                    {
                        X = Convert.ToDouble(rows[i][str]), Y = Convert.ToDouble(rows[i]["Y"])
                    };
                    point[i] = p;
                }
                trace.TraceData = point;
                InterfaceChart2.Traces.Add(trace);
                InterfaceChart2.XAxisList = lstXAxis;
                InterfaceChart2.UpdateData();
            }
        }
Exemplo n.º 2
0
        private void ShowChart(TestTrace tr, string str)
        {
            SymtChartLib.Trace trace = new SymtChartLib.Trace();
            if (lstXAxis.Where(x => x.Start == tr.XAxisInfo.Start && x.Stop == tr.XAxisInfo.Stop && x.Center == tr.XAxisInfo.Center).Count() == 0)
            {
                lstXAxis.Add(new SymtChartLib.XAxis()
                {
                    Start = tr.XAxisInfo.Start, Stop = tr.XAxisInfo.Stop, Center = tr.XAxisInfo.Center
                });
            }
            int k = InterfaceChart2.Traces.Count;

            trace.Title     = str;
            trace.AxisIndex = lstXAxis.FindIndex(x => x.Start == tr.XAxisInfo.Start && x.Stop == tr.XAxisInfo.Stop && x.Center == tr.XAxisInfo.Center);
            if (tr.ResultData != null)
            {
                List <XYData> xyData = tr.ResultData;
                if (xyData.Count > 0)
                {
                    Point[] point = new Point[xyData.Count];
                    for (int i = 0; i < xyData.Count; i++)
                    {
                        Point p = new Point()
                        {
                            X = xyData[i].X, Y = xyData[i].Y
                        };
                        point[i] = p;
                    }

                    trace.TraceData = point;
                    InterfaceChart2.Traces.Add(trace);
                }
            }
            if (tr.TestSpecList.Count > 0 && vm.SelectedSpecIndex >= 0)
            {
                XYTestLimit testLimit = tr.TestSpecList[vm.SelectedSpecIndex].TestLimit;
                if (testLimit != null)
                {
                    foreach (var limit in testLimit.LimitLine)
                    {
                        SymtChartLib.LimitLineTypeEnum type = new SymtChartLib.LimitLineTypeEnum();
                        if (limit.Type == LimitLineTypeEnum.Max)
                        {
                            type = SymtChartLib.LimitLineTypeEnum.Max;
                        }
                        else if (limit.Type == LimitLineTypeEnum.Min)
                        {
                            type = SymtChartLib.LimitLineTypeEnum.Min;
                        }
                        else
                        {
                            type = SymtChartLib.LimitLineTypeEnum.None;
                        }
                        trace.LimitLineList.Add(new SymtChartLib.LimitLine()
                        {
                            X1 = limit.X1, Y1 = limit.Y1, X2 = limit.X2, Y2 = limit.Y2, Type = type
                        });
                    }
                }
            }
            trace.Scale               = tr.Scale;
            trace.DivisionCount       = tr.DivCount;
            trace.ReferenceLevel      = tr.RefValue;
            trace.Unit                = tr.Unit;
            trace.ReferencePosition   = tr.RefPosition;
            InterfaceChart2.XAxisList = lstXAxis;
            InterfaceChart2.UpdateData();
        }
Exemplo n.º 3
0
        public void ShowChart(TestStep step)
        {
            windowChart.clearData();
            windowChart.Traces.Clear();
            this.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
            List <SymtChartLib.XAxis> lstXAxis = new List <SymtChartLib.XAxis>();
            int k = 0;

            if (step as LoopTestStep != null)
            {
                return;
            }
            foreach (TestTrace tr in step.ItemList.Where(x => x is TestTrace))
            {
                if (lstXAxis.Select(x => x.Start == tr.XAxisInfo.Start && x.Stop == tr.XAxisInfo.Stop && x.Unit == tr.XAxisInfo.Unit).Count() == 0)
                {
                    lstXAxis.Add(new SymtChartLib.XAxis()
                    {
                        Start = tr.XAxisInfo.Start, Stop = tr.XAxisInfo.Stop, Center = tr.XAxisInfo.Center
                    });
                }
                SymtChartLib.Trace trace = new SymtChartLib.Trace();

                k++;
                //trace.Title = step.Name + tr.TypeName + step.ItemList.IndexOf(tr);
                trace.Title     = step.Name + "_" + tr.TypeName;
                trace.AxisIndex = lstXAxis.FindIndex(x => x.Start == tr.XAxisInfo.Start && x.Stop == tr.XAxisInfo.Stop && x.Center == tr.XAxisInfo.Center);
                if (tr.ResultData != null)
                {
                    List <XYData> xyData = tr.ResultData;
                    if (xyData.Count > 0)
                    {
                        Point[] point = new Point[xyData.Count];
                        for (int i = 0; i < xyData.Count; i++)
                        {
                            Point p = new Point()
                            {
                                X = xyData[i].X, Y = xyData[i].Y
                            };
                            point[i] = p;
                        }

                        trace.TraceData = point;
                        windowChart.Traces.Add(trace);
                    }
                }
                if (tr.TestSpecList.Count > 0 && specIndex >= 0)
                {
                    XYTestLimit testLimit = tr.TestSpecList[specIndex].TestLimit;
                    if (testLimit != null)
                    {
                        foreach (var limit in testLimit.LimitLine)
                        {
                            SymtChartLib.LimitLineTypeEnum type = new SymtChartLib.LimitLineTypeEnum();
                            if (limit.Type == ModelBaseLib.LimitLineTypeEnum.Max)
                            {
                                type = SymtChartLib.LimitLineTypeEnum.Max;
                            }
                            else if (limit.Type == ModelBaseLib.LimitLineTypeEnum.Min)
                            {
                                type = SymtChartLib.LimitLineTypeEnum.Min;
                            }
                            else
                            {
                                type = SymtChartLib.LimitLineTypeEnum.None;
                            }
                            trace.LimitLineList.Add(new SymtChartLib.LimitLine()
                            {
                                X1 = limit.X1, Y1 = limit.Y1, X2 = limit.X2, Y2 = limit.Y2, Type = type
                            });
                        }
                    }
                }
                trace.Scale             = tr.Scale;
                trace.DivisionCount     = tr.DivCount;
                trace.ReferenceLevel    = tr.RefValue;
                trace.Unit              = tr.Unit;
                trace.ReferencePosition = tr.RefPosition;
            }
            windowChart.XAxisList = lstXAxis;
            windowChart.UpdateData();
        }