Beispiel #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();
            }
        }
Beispiel #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();
        }