private void chart1_Click(object sender, EventArgs e) { MergeSort mergeSort = new MergeSort(this.chart1); recordIndex = 0; int[] unsortedArr = GetUnsortedNumbers().Length > 0 ? GetUnsortedNumbers() : new int[] { 7, 8, 5, 4, 12, 11, 14, 35, 2, 1, 5, 6, 8, 2, 3, 19, 10, 89, 87, 76, 56, 67, 57, 97, 67, 68, 79, 97, 89, 20, 10, 44, 55, 67, 87 }; this.chart1.Series["sorting1"].Points.DataBindY(unsortedArr); int[] sortedArr = mergeSort.sort(unsortedArr); List <List <int> > Iterations = mergeSort.GetIterations(); aTimer = new System.Timers.Timer(10000); // Hook up the Elapsed event for the timer. aTimer.Elapsed += (send, el) => OnTimedEvent(send, el, Iterations); // Set the Interval to 2 seconds (2000 milliseconds). aTimer.Interval = 2000; aTimer.Enabled = true; }