/// <summary>
 ///A test for AddGraph
 ///</summary>
 //[TestMethod()]
 public void AddGraphTest()
 {
     Random rnd = new Random();
     GraphForm target = new GraphForm();
     double[] iDataArray = new double[100];
     for (int i = 0; i < 100; i++)
         iDataArray[i] = (double)rnd.Next(-100, 100) / 10.0;
     ConsoleColor iColor = ConsoleColor.Green;
     string iName = "Random #1";
     target.AddGraph(iDataArray, iColor,iName : iName, iOffset: -10);
     iDataArray = new double[50];
     for (int i = 0; i < 50; i++)
         iDataArray[i] = (double)rnd.Next(-50, 50) / 10.0;
     iColor = ConsoleColor.Red;
     iName = "Random #2";
     target.AddGraph(iDataArray, iColor, iName : iName, iOffset: 30.0, iInterval:0.5);
     while (target.ShowDialog() == DialogResult.None)
         ;
 }
Example #2
0
		private void ShowSingleGraph(params double[][] data)
		{
			GraphForm form = new GraphForm();

			double labelMax;
			double[] label = GetLabel(out labelMax);

			for(int i=0; i<data.Length; ++i)
			{
				int k = i % pens.Length;
				form.Graph.AddEntry(label, data[i], pens[k]);
			}

			form.Graph.SetXAxis(0, labelMax, 4, font, brush);
			if(this.checkYAxisAuto.Checked)
			{
				form.Graph.SetYAxis(0, 0, 5, font, brush);
				form.Graph.AutoScaleY();
			}
			else
			{
				double min = double.Parse(this.textYMin.Text);
				double max = double.Parse(this.textYMax.Text);
				form.Graph.SetYAxis(min, max, 5, font, brush);
			}

			form.Text = this.Text;
			form.MdiParent = this.MdiParent;
			form.Show();
		}