/// <summary>
        /// Updates the canvas constantly.
        /// </summary>
        private void DispatcherLoop()
        {
            DispatcherTimer dispatcher = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };

            dispatcher.Tick += (s, e) =>
            {
                // create all points of the column up to this "time" for both feature & correlated feature
                PointCollection points     = vm.GetPointsByCol((string)ColNames.SelectedItem);
                PointCollection pointsCorr = vm.GetPointsByCol(vm.CorrData[(string)ColNames.SelectedItem]);
                // connect them with a line
                Polyline polyline = new Polyline
                {
                    StrokeThickness = 0.5,
                    Stroke          = Brushes.LightSkyBlue,
                    Points          = points
                };
                canGraph.Children.Add(polyline);
                Polyline polyline1 = new Polyline
                {
                    StrokeThickness = 0.5,
                    Stroke          = Brushes.LightSkyBlue,
                    Points          = pointsCorr
                };
                corrGraph.Children.Add(polyline1);

                // create the regression line:
                Polyline polylineCorr = new Polyline
                {
                    StrokeThickness = 1,
                    Stroke          = Brushes.IndianRed,
                    Points          = vm.GetLineRegPoints((string)ColNames.SelectedItem, LinReg.Height, LinReg.Width)
                };
                LinReg.Children.Add(polylineCorr);

                // draw the correlates features' points on the regression graph:
                PointCollection points1 = vm.GetCorrelatedRegPoints((string)ColNames.SelectedItem, vm.CorrData[(string)ColNames.SelectedItem]);

                // delete the already-drawn graphs if user goes backwards
                if (nextLine > vm.VMCurrentLineIndex)
                {
                    canGraph.Children.RemoveRange(2, canGraph.Children.Count - 2);
                    corrGraph.Children.RemoveRange(2, corrGraph.Children.Count - 2);
                }
                // update the next line in the detector and in the vm
                abstractDetector.CurrentLineIndex = vm.VMCurrentLineIndex;
                nextLine = vm.VMCurrentLineIndex;
            };
            dispatcher.Start();
        }