public static void ClearFast(this DataPointCollection collection) { collection.SuspendUpdates(); while (collection.Count > 0) { collection.RemoveAt(collection.Count - 1); } collection.ResumeUpdates(); collection.Clear(); }
/// <summary> /// Speed up MSChart data points clear operations. /// </summary> /// <param name="sender"></param> public static void ClearPoints(this Series sender) { DataPointCollection points = sender.Points; points.SuspendUpdates(); while (points.Count > 0) { points.RemoveAt(points.Count - 1); } points.ResumeUpdates(); points.Clear(); //Force refresh. }