public void DisconnectPlotModel()
        {
            plotBasicGraph.ResetAllAxes();
            LineSerie.Points.Clear();
            LineSerie.ClearSelection();
            plotBasicGraph.Series.Clear();
            plotBasicGraph = new PlotModel();

            PlotCorrelatedGraph.ResetAllAxes();
            LineSerieCorrelated.Points.Clear();
            LineSerieCorrelated.ClearSelection();
            PlotCorrelatedGraph.Series.Clear();
            PlotCorrelatedGraph = new PlotModel();

            PlotBothFeaturesGraph.ResetAllAxes();
            LineRegression.Points.Clear();
            LineRegression.ClearSelection();
            LineSerieBothFeatures.Points.Clear();
            LineSerieBothFeatures.ClearSelection();
            PlotBothFeaturesGraph.Series.Clear();
            PlotBothFeaturesGraph = new PlotModel();

            plotBasicGraph.InvalidatePlot(true);
            PlotCorrelatedGraph.InvalidatePlot(true);
            PlotBothFeaturesGraph.InvalidatePlot(true);
        }
        public void UpdateModelCorrelatedGraph()
        {
            int index = this.model.GetCorrelatedIndex(ChosenValue);

            if (index != -1)
            {
                (DateTime, float)LastData = model.GetLiveData().Last()[index];
                LineSerieCorrelated.Points.Add(new DataPoint(DateTimeAxis.ToDouble(LastData.Item1), LastData.Item2));
                PlotCorrelatedGraph.InvalidatePlot(true);
            }
        }
        public void GraphValueButton(string option)
        {
            ChosenValue = option;
            int valueIndex = -1;

            if (model.GetXmlValue().Count() > 0)
            {
                if (model.GetXmlValue().ContainsKey(option))
                {
                    valueIndex = model.GetXmlValue()[option];
                }
            }
            if (valueIndex == -1)
            {
                ChosenValusIndex = valueIndex;
            }
            else
            {
                PlotBasicGraph.Axes[1].Title  = ChosenValue;
                ButtonChosenValueGraphPressed = true;
                //update the index in the vm
                ChosenValusIndex = valueIndex;
                //add all the data until now to the graph
                UpdateOldData();
                if (VMGetCorrelatedValue() == null)
                {
                    PlotCorrelatedGraph.Axes[1].Title   = "null";
                    PlotBothFeaturesGraph.Axes[0].Title = "null";
                    PlotBothFeaturesGraph.Axes[1].Title = "null";
                    LineSerieBothFeatures.Points.Clear();
                    Line30LastPoints.Points.Clear();
                    LineRegression.Points.Clear();
                    LineSerieCorrelated.Points.Clear();
                    PlotCorrelatedGraph.InvalidatePlot(true);
                    PlotBothFeaturesGraph.InvalidatePlot(true);
                    return;
                }

                PlotCorrelatedGraph.Axes[1].Title   = VMGetCorrelatedValue();
                PlotBothFeaturesGraph.Axes[0].Title = ChosenValue;
                PlotBothFeaturesGraph.Axes[1].Title = VMGetCorrelatedValue();

                UpdateOldDataCorrelated();
                UpdateOldDataBothFeaturesGraph();
            }
        }