12-04-2006 07:05 AM
12-04-2006 01:04 PM
12-05-2006 04:44 AM
12-06-2006 12:42 PM
Thank you very much. The code you have supplied helped us immensely in narrowing down the problem. The problem has been fixed and will be available in the release of Measurement Studio after 8.1. In the meanwhile, you will need to continue using custom drawing (by overriding OnBeforeDraw) to draw the plot. You can also use the following decimation algorithm to further improve the performance of the drawing of MyPlot:
protected static PointF[] Decimate(PointF[] points, int boundsWidth) { if (points.Length < boundsWidth * 2) { return points; } else { PointF[] decimatedPoints = new PointF[points.Length / 2]; int j = 0; for (int i = 0; i < points.Length && j < decimatedPoints.Length; ++i) { decimatedPoints[j++] = points[i]; if ((i + 1 < points.Length) && (points[i].X == points[i + 1].X)) { float x = points[i].X; float y = points[i].Y; float first = y; float last = y; float min = y; float max = y; do { last = points[i + 1].Y; min = Math.Min(min, last); max = Math.Max(max, last); ++i; } while ((i + 1 < points.Length) && (x == points[i + 1].X)); if ((j < decimatedPoints.Length) && (max != first) && (max != last) && (max != min)) { decimatedPoints[j++] = new PointF(x, max); } if ((j < decimatedPoints.Length) && (min != first) && (min != last)) { decimatedPoints[j++] = new PointF(x, min); } if ((j < decimatedPoints.Length) && (last != first)) { decimatedPoints[j++] = new PointF(x, last); } } } if (j >= decimatedPoints.Length) { return points; } else { PointF[] exactDecimatedPoints = new PointF[j]; Array.Copy(decimatedPoints, exactDecimatedPoints, j); return exactDecimatedPoints; } } }
You can add a call to this Decimate function after calling MapDataPoints in your MyPlot.OnBeforeDraw.
Thanks.
12-07-2006 10:53 AM
12-07-2006 11:17 AM
12-08-2006 12:17 AM