public void LoadFromRawFile(string filename)
        {
            // Displays plots defined in the given file, space-delimited with one row per variable
            StreamReader sr       = new StreamReader(filename);
            string       timeLine = sr.ReadLine();

            // Load time values for reference
            List <double> timeValues = new List <double>();

            string[] timeStrings = timeLine.Split('\t');
            if (timeStrings[0] != "Time")
            {
                MessageBox.Show("Unable to read raw data from " + filename + "; no time values given");
                return;
            }
            foreach (string timeString in timeStrings)
            {
                if (timeString != "Time")
                {
                    timeValues.Add(Convert.ToDouble(timeString.Trim()));
                }
            }

            // Load remaining values
            string line = "";

            while (!sr.EndOfStream)
            {
                line = sr.ReadLine();
                string[]  values  = line.Split('\t');
                string    name    = values[0];
                StatePlot newPlot = new StatePlot();
                newPlot.StateName = name;
                int ndx = 0;
                foreach (string value in values)
                {
                    if (value != name)
                    {
                        newPlot.AddPoint(timeValues[ndx], Convert.ToDouble(value.Trim()));
                        ndx++;
                    }
                }
                ShowPlot(newPlot);
            }
            sr.Close();
        }
 public void ClosePlot(StatePlot plot)
 {
     // Close given state plot, re-add to list of hidden states, and re-order current plots
     _shownStates.Remove(plot);
     _hiddenStates.Add(plot);
     hiddenStateListBox.Items.Add(plot.StateName);
     formContainer.Panel2.Controls.Remove(plot);
     _plotCount = 0;
     foreach (Control c in formContainer.Panel2.Controls)
     {
         if (c.GetType() == typeof(StatePlot))
         {
             Point newLocation = new Point(_plotBuffer, _plotCount * (_plotHeight + _plotBuffer) + _plotBuffer);
             c.Location = newLocation;
             _plotCount++;
         }
     }
 }
        public void ShowPlot(StatePlot plot)
        {
            // Adds plot to display list
            Point newLocation = new Point(_plotBuffer, _plotCount * (_plotHeight + _plotBuffer) + _plotBuffer);

            _plotCount++;
            plot.Location = newLocation;
            Controls.Add(plot);
            plot.Parent = formContainer.Panel2;
            plot.Show();
            _shownStates.Add(plot);

            // Make sure events are tied
            plot.Close       = ClosePlot;
            plot.MouseMove  += UpdateCursorHighlights;
            plot.MouseLeave += CancelCursorHighlights;

            // Remove plot from display list
            _hiddenStates.Remove(plot);
            hiddenStateListBox.Items.Remove(plot.StateName);
        }
 private void DoNothing(StatePlot plot)
 {
     // Control must be closed by parent; this method is blank
 }