ChartSherp.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace OTSExtremum
  12. {
  13. public partial class ChartSherp : Form
  14. {
  15. List<double[]> parameters { get; set; }
  16. double delta { get; set; }
  17. double lambda { get; set; }
  18. public ChartSherp(List<double[]> come,double D, double L)
  19. {
  20. parameters = come;
  21. delta = D;
  22. lambda = L;
  23. InitializeComponent();
  24. }
  25. private void ChartSherp_Load(object sender, EventArgs e)
  26. {
  27. int n = parameters[0].Length;
  28. //画data
  29. for (int i = 0; i < n; i++)
  30. {
  31. chart1.Series[0].Points.AddXY(parameters[1][i], parameters[0][i]);
  32. chart1.Series[1].Points.AddXY(parameters[2][i], parameters[0][i]);
  33. chart1.Series[2].Points.AddXY(parameters[3][i], parameters[0][i]);
  34. chart1.Series[3].Points.AddXY(parameters[4][i], parameters[0][i]);
  35. }
  36. double se = (11.61 * delta) / Math.Sqrt(parameters[0].Length);
  37. double max = 6.91 * delta + lambda;
  38. chart1.Series[1].Points.AddXY(max, 6.907);
  39. chart1.Series[2].Points.AddXY(max - se, 6.907);
  40. chart1.Series[3].Points.AddXY(max + se, 6.907);
  41. label1.Text = "Lmax="+Math.Round(max,1).ToString() +"+-"+ Math.Round(se,1).ToString();
  42. label2.Text = "L=" + Math.Round(delta, 3).ToString() + "Rel.Var+" + Math.Round(lambda, 3).ToString();
  43. //chart1.Controls.Add(label1);
  44. //string GR_Path = @"E:";
  45. //string fullFileName = GR_Path + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
  46. //chart1.SaveImage(fullFileName, System.Windows.Forms.DataVisualization.Charting.ChartImageFormat.Png);
  47. //Bitmap image = new Bitmap(this.Width, this.Height);
  48. //this.DrawToBitmap(image, new Rectangle(0, 0, this.Width, this.Height));
  49. //image.Save(fullFileName);
  50. }
  51. }
  52. }