public void SetLine(String lineTitle, short[] values) { IPointListEdit ip = zgcGraph.GraphPane.CurveList[lineTitle].Points as IPointListEdit; int tmp = Math.Min(ip.Count, values.Length); int i = 0; peakX = values.Length; while (i < tmp) { if (values[i] > peakY) { peakY = values[i]; } ip[i].X = i; ip[i].Y = values[i]; i++; } while (ip.Count < values.Count) { if (values[i] > peakY) { peakY = values[i]; } ip.Add(i, values[i]); i++; } while (values.Count > ip.Count) { ip.RemoveAt(ip.Count - 1); } }
private void trim(IPointListEdit points, int start) { if (points.Count > 0) { while (points[points.Count - 1].X > start) { points.RemoveAt(points.Count - 1); } } }
public void AddDataToGraph(float q1, float q2, float q3, float q4) { index++; bool flag = false; if (index > 500) { flag = true; } //First Quaternion Redraw // Get the first CurveItem in the graph LineItem curve = zedGraphControl1.GraphPane.CurveList[0] as LineItem; // Get the PointPairList IPointListEdit list = curve.Points as IPointListEdit; if (flag) { list.RemoveAt(0); } // If this is null, it means the reference at curve.Points does not // support IPointListEdit, so we won't be able to modify it if (list == null) { return; } // add new data points to the graph list.Add(index, q1); // force redraw zedGraphControl1.Invalidate(); zedGraphControl1.AxisChange(); //Second Quaternion Redraw // Get the first CurveItem in the graph LineItem curve2 = zedGraphControl2.GraphPane.CurveList[0] as LineItem; // Get the PointPairList IPointListEdit list2 = curve2.Points as IPointListEdit; // If this is null, it means the reference at curve.Points does not // support IPointListEdit, so we won't be able to modify it if (list2 == null) { return; } // add new data points to the graph if (flag) { list2.RemoveAt(0); } list2.Add(index, q2); // force redraw zedGraphControl2.Invalidate(); zedGraphControl2.AxisChange(); //Third Quaternion Redraw // Get the first CurveItem in the graph LineItem curve3 = zedGraphControl3.GraphPane.CurveList[0] as LineItem; // Get the PointPairList IPointListEdit list3 = curve3.Points as IPointListEdit; // If this is null, it means the reference at curve.Points does not // support IPointListEdit, so we won't be able to modify it if (list3 == null) { return; } // add new data points to the graph if (flag) { list3.RemoveAt(0); } list3.Add(index, q3); // force redraw zedGraphControl3.Invalidate(); zedGraphControl3.AxisChange(); //Fourth Quaternion Redraw // Get the first CurveItem in the graph LineItem curve4 = zedGraphControl4.GraphPane.CurveList[0] as LineItem; // Get the PointPairList IPointListEdit list4 = curve4.Points as IPointListEdit; // If this is null, it means the reference at curve.Points does not // support IPointListEdit, so we won't be able to modify it if (list4 == null) { return; } // add new data points to the graph if (flag) { list4.RemoveAt(0); } list4.Add(index, q4); // force redraw zedGraphControl4.Invalidate(); zedGraphControl4.AxisChange(); }