using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace OTSExtremum { public partial class ChartSherp : Form { List parameters { get; set; } double delta { get; set; } double lambda { get; set; } public ChartSherp(List come,double D, double L) { parameters = come; delta = D; lambda = L; InitializeComponent(); } private void ChartSherp_Load(object sender, EventArgs e) { int n = parameters[0].Length; //画data for (int i = 0; i < n; i++) { chart1.Series[0].Points.AddXY(parameters[1][i], parameters[0][i]); chart1.Series[1].Points.AddXY(parameters[2][i], parameters[0][i]); chart1.Series[2].Points.AddXY(parameters[3][i], parameters[0][i]); chart1.Series[3].Points.AddXY(parameters[4][i], parameters[0][i]); } double se = (11.61 * delta) / Math.Sqrt(parameters[0].Length); double max = 6.91 * delta + lambda; chart1.Series[1].Points.AddXY(max, 6.907); chart1.Series[2].Points.AddXY(max - se, 6.907); chart1.Series[3].Points.AddXY(max + se, 6.907); label1.Text = "Lmax="+Math.Round(max,1).ToString() +"+-"+ Math.Round(se,1).ToString(); label2.Text = "L=" + Math.Round(delta, 3).ToString() + "Rel.Var+" + Math.Round(lambda, 3).ToString(); //chart1.Controls.Add(label1); //string GR_Path = @"E:"; //string fullFileName = GR_Path + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png"; //chart1.SaveImage(fullFileName, System.Windows.Forms.DataVisualization.Charting.ChartImageFormat.Png); //Bitmap image = new Bitmap(this.Width, this.Height); //this.DrawToBitmap(image, new Rectangle(0, 0, this.Width, this.Height)); //image.Save(fullFileName); } } }