public DateAxisSampleDemo() : base("Code Project Date Axis Sample", "Date Axis Sample", DemoType.Tutorial) { GraphPane myPane = base.GraphPane; // Set the titles and axis labels myPane.Title.Text = "My Test Date Graph"; myPane.XAxis.Title.Text = "Date"; myPane.YAxis.Title.Text = "My Y Axis"; // Make up some data points based on the Sine function PointPairList list = new PointPairList(); for ( int i=0; i<36; i++ ) { double x = (double) new XDate( 1995, 5, i+11 ); double y = Math.Sin( (double) i * Math.PI / 15.0 ); list.Add( x, y ); } // Generate a red curve with diamond // symbols, and "My Curve" in the legend LineItem myCurve = myPane.AddCurve( "My Curve", list, Color.Red, SymbolType.Diamond ); // Set the XAxis to date type myPane.XAxis.Type = AxisType.Date; base.ZedGraphControl.AxisChange(); }
private void IterativePrepare(double xs) { zedIterative.GraphPane.CurveList.Clear(); MyExtension.Function f = (x =>Math.Pow(Math.Abs(Math.Cos(x)),0.5)); zedIterative.Graph(f, -10, 10, 0.1, Color.Red); zedIterative.Graph(x => x, -10, 10, 1, Color.Blue); PointPairList list = new PointPairList(); double x0,x1 = xs; iterativeLogger.Items.Clear(); list.Add(x1, f(x1)); do { x0 = x1; x1 = f(x0); list.Add(x0, x1); iterativeLogger.Items.Add( String.Format("X = + {0:0.#####} + ; f(x) = + {1:0.########}", x1, f(x1))); } while (Math.Abs(x1 - x0) > Eps); LineItem line = zedIterative.GraphPane.AddCurve("", list, Color.Green, SymbolType.Diamond); line.Line.IsVisible = false; zedIterative.AxisChange(); }
public void polowienia() { //p1 i p2 to przedziały ( początkowy i końcowy ) Number p1 = new Number(1.0, 2.0); Number p2 = new Number(3.0, 2.0); // Random rnd = new Random(); Number epsilon = new Number(rnd.Next(2, 7), 100.0); polowienieBox.AppendText("epsilon wynosi " + epsilon.value + "\nkolejne podziały: \n"); Function f_p1 = new Function(p1.value); Function f_p2 = new Function(p2.value); if (f_p1.val * f_p2.val < 0.0) { PointPairList lista = new PointPairList(); Random random = new Random(); for (int i = 0; i < 15; i++) { // dodawanie przedzialow na wykresie lista.Add(f_p1.arg, 0); lista.Add(f_p1.arg, -20 + i * 2.5); lista.Add(f_p2.arg, -20 + i * 2.5); lista.Add(f_p2.arg, 0); System.Threading.Thread.Sleep(25); LineItem myCurve = zedGraphControl1.GraphPane.AddCurve("", lista, Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)), SymbolType.None); myCurve.Line.Width = 1.0f; zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); zedGraphControl1.Refresh(); // polowienieBox.AppendText(i+1 + ". " + f_p1.arg + " - " + f_p2.arg + "\n"); Function srodek = new Function((f_p1.arg + f_p2.arg) / 2.0); if (srodek.modulus() < epsilon.value) { polowienieBox.AppendText("\n\nMiejsce zerowe znalezione!\nPrzybliżone miejsce zerowe (" + srodek.val.ToString("0.###") + " < " + epsilon.value + ") znaleziono w x = " + srodek.arg.ToString("#.###")); //dodawanie strzalki na wykresie ArrowObj strzalka = new ArrowObj(Color.Black, 10.0f, srodek.arg, srodek.val + 45, srodek.arg, srodek.val + 5); zedGraphControl1.GraphPane.GraphObjList.Add(strzalka); zedGraphControl1.Refresh(); break; } else { if (f_p1.val * srodek.val < 0) f_p2 = new Function(srodek.arg); else f_p1 = new Function(srodek.arg); } } } else { MessageBox.Show("Kryczyny błąd", "wartosci funkcji dla tego przedziału są tego samego znaku - algorytm nie może kontynuować", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button2_Click(object sender, EventArgs e) { double sigma = Convert.ToDouble(textBox1.Text); int N = Convert.ToInt32(textBox3.Text); int n = elem.val.Length; double[] interval = new double[N + 1]; double[] value = new double[N]; double[] f = new double[N]; //строим функции распределения ZedGraph.PointPairList F_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList Fn_list = new ZedGraph.PointPairList(); zedGraphControl1.GraphPane.Title.Text = "График функций распределения"; zedGraphControl1.GraphPane.XAxis.Title.Text = "X"; zedGraphControl1.GraphPane.YAxis.Title.Text = "F(x)"; double D = 0.0; double h = elem.val[n - 1] / 1000.0; int sum = 0; for (int i = 0; i < 1000; i++) { sum = 0; for (int j = 0; j < n; j++) { double temp = elem.val[0] + h * i; if (elem.val[j] < elem.val[0] + h * i) { sum++; } } if (Fn_list.Count != 0) { Fn_list.Add(elem.val[0] + h * i, Fn_list[Fn_list.Count - 1].Y); } Fn_list.Add(elem.val[0] + h * i, (double)sum / (double)n); F_list.Add(elem.val[0] + h * i, 1 - Math.Exp(-(elem.val[0] + h * i) * (elem.val[0] + h * i) / (2 * sigma * sigma))); D = Math.Max(D, Math.Abs((double)sum / (double)n - (1 - Math.Exp(-(elem.val[0] + h * i) * (elem.val[0] + h * i) / (2 * sigma * sigma))))); } zedGraphControl1.GraphPane.CurveList.Clear(); textBox4.Text = D.ToString(); ZedGraph.LineItem CurveF = zedGraphControl1.GraphPane.AddCurve("F", F_list, Color.FromName("Red"), ZedGraph.SymbolType.None); ZedGraph.LineItem CurveFn = zedGraphControl1.GraphPane.AddCurve("Fвыб", Fn_list, Color.FromName("Green"), ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
public AxisMarkerCurveItem(double value, bool isXAxis) { Value = value; IsXAxisMarker = isXAxis; var points = new PointPairList(); if(isXAxis) points.Add(value, PointPair.Missing); else points.Add(PointPair.Missing, value); Points = points; PenColor = Color.Red; }
private void Draw(int[] x, int[] y, int[] z) { GraphPane pane = zgcHist.GraphPane; pane.CurveList.Clear(); PointPairList list = new PointPairList(); PointPairList list2 = new PointPairList(); for (long j = 0; j < x.Length; j++) { if (x[j] != 0) { list.Add(x[j], y[j]); list2.Add(x[j], z[j]); } } //BurlyWood Coral DarkMagenta LineItem myCurve = pane.AddCurve("Гистограмма", list, Color.Coral, SymbolType.None); //Color color = Color.FromArgb(100, Color.Coral); //myCurve.Line.Fill = new ZedGraph.Fill(color); pane.AddCurve("Ожидаемый результат", list2, Color.BurlyWood, SymbolType.None); pane.YAxis.Scale.Min = 0; pane.YAxis.Scale.Max = 1.1*y.Max(); pane.Title.Text = filename; zgcHist.AxisChange(); zgcHist.Invalidate(); }
public Form2(Form1 f2) { InitializeComponent(); GraphPane pane = zedGraph.GraphPane; // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы pane.CurveList.Clear(); // Создадим список точек PointPairList list = new PointPairList(); PointPairList list2 = new PointPairList(); // Заполняем список точек // Создадим кривую с названием "Функція", // которая будет рисоваться голубым цветом (Color.Blue), // Опорные точки выделяться не будут (SymbolType.None) LineItem myCurve = pane.AddCurve("Функція Y", list, Color.Blue, SymbolType.None); LineItem myCurve2 = pane.AddCurve("Функція Y(точ)", list2, Color.Red, SymbolType.None); for (int i = 0; i < f2.dataGridView1.RowCount-1; i++) { list.Add(Convert.ToDouble( f2.dataGridView1[0, i].Value),Convert.ToDouble( f2.dataGridView1[1, i].Value)); list2.Add(Convert.ToDouble(f2.dataGridView1[0, i].Value), Convert.ToDouble(f2.dataGridView1[2, i].Value)); } zedGraph.AxisChange(); pane.Title.Text = "Графік"; // Обновляем график zedGraph.Invalidate(); }
public PointPairList Histogram(PictureBox pb) { int width, height; width = pb.Image.Width; height = pb.Image.Height; byte[] inputBytes = GetBytes((Bitmap)pb.Image); int[] intencity = new int[256]; int index; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { byte r = inputBytes[4 * (width * y + x) + 0]; byte g = inputBytes[4 * (width * y + x) + 1]; byte b = inputBytes[4 * (width * y + x) + 2]; index = (int)(0.3 * r + 0.59 * g + 0.11 * b); intencity[index]++; } } PointPairList points = new PointPairList(); for (int i = 0; i < 256; i++) { points.Add(i, intencity[i]); } return points; }
/// <summary> /// Constructs with the details of teh function regression problem to be visualized. /// </summary> /// <param name="func">The function being regressed.</param> /// <param name="xMin">The minimum value of the input range being sampled.</param> /// <param name="xIncr">The increment between input sample values.</param> /// <param name="sampleCount">The number of samples over the input range.</param> /// <param name="genomeDecoder">Genome decoder.</param> public FunctionRegressionView2D(IFunction func, double xMin, double xIncr, int sampleCount, IGenomeDecoder<NeatGenome,IBlackBox> genomeDecoder) { InitializeComponent(); InitGraph(string.Empty, string.Empty, string.Empty); _func = func; _xMin = xMin; _xIncr = xIncr; _sampleCount = sampleCount; _genomeDecoder = genomeDecoder; // Prebuild plot point objects. _plotPointListTarget = new PointPairList(); _plotPointListResponse = new PointPairList(); double[] args = new double[]{xMin}; for(int i=0; i<sampleCount; i++, args[0] += xIncr) { _plotPointListTarget.Add(args[0], _func.GetValue(args)); _plotPointListResponse.Add(args[0], 0.0); } // Bind plot points to graph. zed.GraphPane.AddCurve("Target", _plotPointListTarget, Color.Black, SymbolType.None); zed.GraphPane.AddCurve("Network Response", _plotPointListResponse, Color.Red, SymbolType.None); }
private void btnCalc_Click(object sender, EventArgs e) { int seed = int.Parse(Seed.Text); IRandomMethod method = new MethodMiddleOfSquare(seed); if (radioButton1.Checked) method = new MethodMiddleOfSquare(seed); if (radioButton2.Checked) method = new MultiplicativeCongruentialMethod(seed, 3453, 5675673); int countNumbers = int.Parse(CountNumbers.Text); int countNumbers2 = int.Parse(CountNumbers2.Text); int numberSections = int.Parse(textBox1.Text); ITestingMethod testingMethod = new EasyTesting(); double M, D; double[] values = testingMethod.TestingUniformity(method, numberSections, countNumbers2, out M, out D); double C = testingMethod.TestingtestingIndependence(method, countNumbers); Correlation.Text = string.Format("Correlation = {0}", C); MValue.Text = string.Format("M = {0}", M); DValue.Text = string.Format("D = {0}", D); ZedGraph.PointPairList table = new PointPairList(); for(int i=0;i<numberSections;i++) { table.Add(i,values[i]); } zedGraphControl1.GraphPane.AddCurve("", table, Color.Blue, SymbolType.Square); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
public StepChartDemo() : base("A sample step chart", "Step Chart Demo", DemoType.Line) { GraphPane myPane = base.GraphPane; // Set the title and axis labels myPane.Title.Text = "Demo for Step Charts"; myPane.XAxis.Title.Text = "Time, Days"; myPane.YAxis.Title.Text = "Widget Production (units/hour)"; // Generate some sine-based data values PointPairList list = new PointPairList(); for ( double i=0; i<36; i++ ) { double x = i * 5.0; double y = Math.Sin( i * Math.PI / 15.0 ) * 16.0; list.Add( x, y ); } // Add a red curve with circle symbols LineItem curve = myPane.AddCurve( "Step", list, Color.Red, SymbolType.Circle ); curve.Line.Width = 1.5F; // Fill the area under the curve curve.Line.Fill = new Fill( Color.White, Color.FromArgb( 60, 190, 50), 90F ); // Fill the symbols with white to make them opaque curve.Symbol.Fill = new Fill( Color.White ); curve.Symbol.Size = 5; // Set the curve type to forward steps curve.Line.StepType = StepType.ForwardStep; base.ZedGraphControl.AxisChange(); }
private void Draw() { int[] x = { 1, 2, 3, 4, 5 }; int[] y = { 5, 4, 3, 2, 1 }; GraphPane pane = zgcHist.GraphPane; pane.CurveList.Clear(); PointPairList list = new PointPairList(); for (long j = 0; j < x.Length; j++) { if (x[j] != 0) { list.Add(x[j], y[j]); } } //BurlyWood Coral DarkMagenta LineItem myCurve = pane.AddCurve("Curve", list, Color.Coral, SymbolType.None); //Color color = Color.FromArgb(100, Color.Coral); //myCurve.Line.Fill = new ZedGraph.Fill(color); pane.YAxis.Scale.Min = 0; pane.YAxis.Scale.Max = 1.1 * y.Max(); zgcHist.AxisChange(); zgcHist.Invalidate(); }
public void DrawSorted(SeriesList list, string title, string subTitle,string xAxisTitle) { Clear(); if (list.Count == 0) { return; } for (int i = 0; i < list.Count; i++) { PointPairList pairs = new PointPairList(); foreach (var pt in list[i]) { pairs.Add(pt.Percent, pt.Value); } var color = Default.GetSeriesColor(pane.CurveList.Count); LineItem myCurve = pane.AddCurve(list[i].Appearance.LegendText, pairs, color); myCurve.Symbol.IsVisible = false; myCurve.Line.Width = Default.GetSeriesWidth(pane.CurveList.Count); } pane.Title.Text = title + "\n" + subTitle; pane.XAxis.Title.Text = xAxisTitle; FormatBottomAxisNumeric(); pane.XAxis.Scale.Format = ""; pane.XAxis.Scale.MajorStep = 5; FormatYAxisStandard(); SetPaneVisible(true); LabelYaxis(list); RefreshChart(chart1); }
private void DrawGraphics() { int length = resultsList.Count(); PointPairList avgsValues = new PointPairList(); PointPairList sigmasValues = new PointPairList(); foreach (double d in resultsList[length - 1].trajectoryAvgs.Keys) { avgsValues.Add(d, resultsList[length - 1].trajectoryAvgs[d]); } foreach (double d in resultsList[length - 1].trajectorySigmas.Keys) { sigmasValues.Add(d, resultsList[length - 1].trajectorySigmas[d]); } avgsGraphic.GraphPane.Legend.FontSpec.Size = 8; LineItem avgsL = avgsGraphic.GraphPane.AddCurve(resultsList[length - 1].parameterLine, avgsValues, currentColor, SymbolType.Circle); avgsL.IsVisible = this.currentPointView; avgsGraphic.AxisChange(); avgsGraphic.Invalidate(); avgsGraphic.Refresh(); sigmasGraphic.GraphPane.Legend.FontSpec.Size = 8; LineItem sigmasL = sigmasGraphic.GraphPane.AddCurve(resultsList[length - 1].parameterLine, sigmasValues, currentColor, SymbolType.Circle); sigmasL.IsVisible = this.currentPointView; sigmasGraphic.AxisChange(); sigmasGraphic.Invalidate(); sigmasGraphic.Refresh(); }
/// <summary> /// Filters the <see cref="DataFrameBuilder.Points"/> down to just those that are /// visible if the graph has been zoomed in. /// This method only filters based on the value on the Base Axis /// (i.e. the X-Axis for most curves). /// </summary> public virtual DataFrameBuilder FilterToZoomedRange(DataFrameBuilder dataFrameBuilder) { var graphPane = dataFrameBuilder.GraphPane; var pointList = dataFrameBuilder.Points; var baseAxis = dataFrameBuilder.CurveItem.BaseAxis(graphPane); if (baseAxis.Scale.IsAnyOrdinal) { // If the Scale is either Ordinal or Text, then don't // filter the PointList, because the point values // are derived from their position in the list. return dataFrameBuilder; } Func<PointPair, double> valueOfPointFunc = ValueOfPointFuncForAxis(dataFrameBuilder, baseAxis); if (null == valueOfPointFunc) { return dataFrameBuilder; } double min = baseAxis.Scale.Min; double max = baseAxis.Scale.Max; var pointPairList = new PointPairList(); for (int i = 0; i < pointList.Count; i++) { var pointPair = pointList[i]; double value = valueOfPointFunc(pointPair); if (value < min || value > max) { continue; } pointPairList.Add(pointPair); } return dataFrameBuilder.SetPoints(pointPairList); }
private void FormEnergyCurve_Load(object sender, EventArgs e) { if (CoeffList.Count < 2) return; string curveName = ""; int counter = 0; foreach (double coeff in CoeffList) { curveName += coeff.ToString("E") + " * x^" + counter.ToString() + " + "; counter++; } curveName = curveName.Substring(0, curveName.Length - 3); Det.EnergyCurveCoefficients.Clear(); Det.EnergyCurveCoefficients.AddRange(CoeffList); GraphPane pane = graph.GraphPane; PointPairList list = new PointPairList(); for (int i = 0; i < Det.CurrentNumChannels; i++) list.Add((double)i, Det.GetEnergy(i)); LineItem energyCurve = pane.AddCurve(curveName, list, Color.Green, SymbolType.None); graph.RestoreScale(pane); graph.AxisChange(); graph.Refresh(); }
public HiLowBarDemo() : base("A demo demonstrating HiLow Bars.\n" + "These are bars in which the top and the bottom of the bar is defined with user data", "Hi-Low Bar", DemoType.Bar) { GraphPane myPane = base.GraphPane; // Set the title and axis labels myPane.Title.Text = "Hi-Low Bar Graph Demo"; myPane.XAxis.Title.Text = "Event"; myPane.YAxis.Title.Text = "Range of Values"; // Make up some data points based on the Sine function PointPairList list = new PointPairList(); for ( int i=1; i<45; i++ ) { double y = Math.Sin( (double) i * Math.PI / 15.0 ); double yBase = y - 0.4; list.Add( (double) i, y, yBase ); } // Generate a red bar with "Curve 1" in the legend HiLowBarItem myCurve = myPane.AddHiLowBar( "Curve 1", list, Color.Red ); // Fill the bar with a red-white-red gradient for a 3d look myCurve.Bar.Fill = new Fill( Color.Red, Color.White, Color.Red, 0 ); // Make the bar width based on the available space, rather than a size in points // myCurve.Bar.IsAutoSize = true; // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill( Color.White, Color.FromArgb( 255, 255, 166), 45.0F ); base.ZedGraphControl.AxisChange(); }
public void AddNewCurve(string CurveName, double[] CurveData_X, double[] CurveData_Y) { // Make up some data points from the Sine function int NumofPoints = CurveData_X.Length; PointPairList list = new PointPairList(); for (int x = 0; x < NumofPoints; x++) { list.Add(CurveData_X[x], CurveData_Y[x]); } Color Clr = Color.FromArgb(ClrRnd.Next(255), ClrRnd.Next(255), ClrRnd.Next(255)); // Generate a random-colored curve with circle symbols, and CurveName in the legend LineItem myCurve = myPane.AddCurve(CurveName, list, Clr,SymbolType.Circle); // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F); // Fill the pane background with a color gradient myPane.Fill = new Fill(Color.White, Color.Pink, 45F); // Calculate the Axis Scale Ranges _zedObject.AxisChange(); }
void EveryNumCycleLoad(object sender, EventArgs e) { MasterPane myMaster = zedGraphControl1 .MasterPane ; myMaster.PaneList.Clear(); myMaster.Title.Text = "MasterPane Test"; myMaster.Title.IsVisible = true; myMaster.Fill = new Fill( Color.White, Color.MediumSlateBlue, 45.0F ); int[][] everyRes = DataProcess .AllSingleCycle (MainForm .arr ) ; for ( int j=0; j< 10; j++ ) { GraphPane myPane = new GraphPane(); myPane.Title.Text = "My Test Graph #" + (j+1).ToString(); myPane.XAxis.Title.Text = "X Axis"; myPane.YAxis.Title.Text = "Y Axis"; //myPane.Fill = new Fill( Color.White, Color.LightYellow, 45.0F ); //myPane.BaseDimension = 6.0F; PointPairList list = new PointPairList(); for ( int i=0; i < everyRes [j ].Length ; i++ ) { int x = i ; int y = everyRes [j ][i ] ; list.Add( x, y ); } LineItem myCurve = myPane.AddCurve( "label" + j.ToString(),list, Color.Red, SymbolType.Diamond ); myMaster.Add( myPane ); } using ( Graphics g = this.CreateGraphics() ) { myMaster .SetLayout( g, PaneLayout.SquareColPreferred ); } }
void DrawSolve(List <double> xi, List <double> ui, List <double> vi) { ZedGraph.PointPairList v_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList u_list = new ZedGraph.PointPairList(); for (int i = 0; i < xi.Count; i++) { v_list.Add(xi[i], vi[i]); u_list.Add(xi[i], ui[i * 2]); if (i % ((n / 1000) + 1) == 0) { dataGridView1.Rows.Add(i, xi[i], vi[i], ui[i * 2], Math.Abs(vi[i] - ui[i * 2])); } } zedGraphControl2.GraphPane.XAxis.Min = -0.01; zedGraphControl2.GraphPane.XAxis.Max = 1.0; zedGraphControl2.GraphPane.CurveList.Clear(); zedGraphControl2.GraphPane.Title = "Решение"; ZedGraph.LineItem CurveV = zedGraphControl2.GraphPane.AddCurve("v(x)", v_list, colors[1], ZedGraph.SymbolType.None); ZedGraph.LineItem CurveU = zedGraphControl2.GraphPane.AddCurve("v2(x)", u_list, colors[4], ZedGraph.SymbolType.None); zedGraphControl2.AxisChange(); zedGraphControl2.Invalidate(); }
void DrawError(List <double> xi, List <double> dif) { ZedGraph.PointPairList err_list = new ZedGraph.PointPairList(); xdifference = dif[0]; xPoint = xi[0]; for (int i = 1; i < xi.Count; i++) { err_list.Add(xi[i], dif[i]); if (xdifference < dif[i]) { xdifference = dif[i]; xPoint = xi[i]; } } zedGraphControl1.GraphPane.XAxis.Min = -0.01; zedGraphControl1.GraphPane.XAxis.Max = 1.0; zedGraphControl1.GraphPane.CurveList.Clear(); zedGraphControl1.GraphPane.Title = "Погрешность"; ZedGraph.LineItem CurveV = zedGraphControl1.GraphPane.AddCurve("error in scheme`s values", err_list, colors[1], ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
void DrawError(List <double> xi, List <double> dif, string task) { ZedGraph.PointPairList err_list = new ZedGraph.PointPairList(); int n = xi.Count(); for (int i = 1; i < n; i++) { err_list.Add(xi[i], dif[i]); } zedGraphControl1.GraphPane.XAxis.Min = -0.1; zedGraphControl1.GraphPane.XAxis.Max = 1.0; zedGraphControl1.GraphPane.CurveList.Clear(); ZedGraph.LineItem CurveV = zedGraphControl1.GraphPane.AddCurve("error in scheme`s values", err_list, Color.FromName("Green"), ZedGraph.SymbolType.None); if (task == "test") { zedGraphControl1.GraphPane.YAxis.Title = "|u(x) - v(x)|"; } else if (task == "main") { zedGraphControl1.GraphPane.YAxis.Title = "|v(x) - v2(x)|"; } zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
public HistogramXY(int [] x, String axis) { int i; InitializeComponent(); // get a reference to the GraphPane GraphPane myPane = zedGraphControl1.GraphPane; //Set the titles myPane.Title.Text = "Histograma"; myPane.XAxis.Title.Text = axis; myPane.YAxis.Title.Text = "Contagem"; //list points PointPairList list1 = new PointPairList(); for (i = 0; i < x.Length; i++) { list1.Add(i, x[i]); } //add bar series myPane.AddCurve(axis, list1, Color.Gray, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = x.Length-1; zedGraphControl1.AxisChange(); }
public InitialSampleDemo() : base("Code Project Initial Sample", "Initial Sample", DemoType.Tutorial) { GraphPane myPane = base.GraphPane; // Set the title and axis labels myPane.Title.Text = "My Test Graph\n(For CodeProject Sample)"; myPane.XAxis.Title.Text = "My X Axis"; myPane.YAxis.Title.Text = "My Y Axis"; // Make up some data arrays based on the Sine function PointPairList list1 = new PointPairList(); PointPairList list2 = new PointPairList(); for ( int i=0; i<36; i++ ) { double x = (double) i + 5; double y1 = 1.5 + Math.Sin( (double) i * 0.2 ); double y2 = 3.0 * ( 1.5 + Math.Sin( (double) i * 0.2 ) ); list1.Add( x, y1 ); list2.Add( x, y2 ); } // Generate a red curve with diamond // symbols, and "Porsche" in the legend LineItem myCurve = myPane.AddCurve( "Porsche", list1, Color.Red, SymbolType.Diamond ); // Generate a blue curve with circle // symbols, and "Piper" in the legend LineItem myCurve2 = myPane.AddCurve( "Piper", list2, Color.Blue, SymbolType.Circle ); base.ZedGraphControl.AxisChange(); }
private void CreateGraph( ZedGraphControl zgc ) { GraphPane myPane = zgc.GraphPane; // Set the titles and axis labels myPane.Title.Text = "My Test Graph"; myPane.XAxis.Title.Text = "X Value"; myPane.YAxis.Title.Text = "My Y Axis"; // Make up some data points from the Sine function PointPairList list = new PointPairList(); for ( double x = 0; x < 36; x++ ) { double y = Math.Sin( x * Math.PI / 15.0 ); list.Add( x, y ); } // Generate a blue curve with circle symbols, and "My Curve 2" in the legend LineItem myCurve = myPane.AddCurve( "My Curve", list, Color.Blue, SymbolType.Circle ); // Fill the area under the curve with a white-red gradient at 45 degrees myCurve.Line.Fill = new Fill( Color.White, Color.Red, 45F ); // Make the symbols opaque by filling them with white myCurve.Symbol.Fill = new Fill( Color.White ); // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow, 45F ); // Fill the pane background with a color gradient myPane.Fill = new Fill( Color.White, Color.FromArgb( 220, 220, 255 ), 45F ); // Calculate the Axis Scale Ranges zgc.AxisChange(); }
public StickItemDemo() : base("A demonstration of the 'StickItem', which is a single line for " + "each point running from the XAxis to the data value", "Stick Item Demo", DemoType.Bar) { GraphPane myPane = base.GraphPane; // Set the titles and axis labels myPane.Title.Text = "StickItem Demo Chart"; myPane.XAxis.Title.Text = "X Label"; myPane.YAxis.Title.Text = "My Y Axis"; PointPairList list = new PointPairList(); for ( int i=0; i<100; i++ ) { double x = (double) i; double y = Math.Sin( i / 8.0 ); double z = Math.Abs(Math.Cos( i / 8.0 )) * y; list.Add( x, y, z ); } StickItem myCurve = myPane.AddStick( "Some Sticks", list, Color.Blue ); myCurve.Line.Width = 2.0f; myPane.XAxis.MajorGrid.IsVisible = true; myPane.XAxis.Scale.Max = 100; // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow, 45.0F ); base.ZedGraphControl.AxisChange(); }
private void DrawLine() { ZedGraph1.Type = AnalyticsType.Line; ZedGraph1.Title = DateTime.Now.Year.ToString() + " . " + DateTime.Now.Month.ToString(); ZedGraph1.XAxisTitle = "Month"; ZedGraph1.YAxisTitle = "Amount"; ZedGraph1.ZGWidth = 780; ZedGraph1.ZGHeight = 250; ZedGraph1.IsChangeColor = false; ZedGraph.PointPairList ppl = new ZedGraph.PointPairList(); DateTime current = DateTime.Now; ArrayList al = new ArrayList(); for (int i = 0; i < 12; i++) { int iMM = i + 1; DateTime start = new DateTime(current.Year, iMM, 1); DateTime end = new DateTime(current.Year, iMM, DateTime.DaysInMonth(current.Year, iMM)); string where = string.Empty; where = "StatusID>0 and StatusID<4 and CreateDate >='" + start.ToString("yyyy-MM-dd") + " 00:00:00' and CreateDate <='" + end.ToString("yyyy-MM-dd") + " 23:59:59'"; decimal iCount = MojoCube.Web.Sql.GetResultSum("Order_List", "Amount", where); double x = i; double y = (double)iCount; ppl.Add(x, y); } ZedGraph1.DataSource.Add(ppl); ZedGraph1.CurveNameList.Add(""); }
public void Page_Load(object sender, EventArgs e) { Double donnéeDeCourbe = 6.5; double[] x = new double[100]; double[] maximum = new double[100]; double[] minimum = new double[100]; double[] moyenne = new double[100]; double[] variable = new double[100]; for (int i = 0; i < x.Length; i++) { x[i] = i; maximum[i] = 9; minimum[i] = 3; moyenne[i] = 6; variable[i] = donnéeDeCourbe; } // This is to remove all plots zedGraphControl1.GraphPane.CurveList.Clear(); GraphPane myPane = zedGraphControl1.GraphPane; // Définis la liste des points PointPairList spl1 = new PointPairList(x, maximum); PointPairList spl2 = new PointPairList(x, minimum); PointPairList spl3 = new PointPairList(x, moyenne); PointPairList spl4 = new PointPairList(x, variable); PointPairList Ppl = new PointPairList(); int y =0; foreach (Ech_Resultat Er in Ech_ResultatDB.List()) { y++; PointPair Pp = new PointPair(y, Er.Resultat, EchantillonDB.Get(Er.ID_Echantillon).NumLot); Ppl.Add(Pp); } // Ajouter les lignes a mon graphique LineItem myCurve1 = myPane.AddCurve("", spl1, Color.DarkBlue, SymbolType.None); LineItem myCurve2 = myPane.AddCurve("Minimum Maximum", spl2, Color.DarkBlue, SymbolType.None); LineItem myCurve3 = myPane.AddCurve("moyenne", spl3, Color.Black, SymbolType.None); LineItem myCurve4 = myPane.AddCurve("Resultat", Ppl, Color.ForestGreen, SymbolType.Diamond); myCurve1.Line.Width = 2.0F; myCurve2.Line.Width = 2.0F; myCurve3.Line.Width = 2.0F; myCurve4.Line.Width = 2.0F; myPane.Title.Text = "Graphique épaisseur peinture"; myPane.XAxis.Title.Text = "Test"; myPane.YAxis.Title.Text = "Epaisseur peinture"; myPane.Legend.Position = ZedGraph.LegendPos.Bottom; // I add all three functions just to be sure it refeshes the plot. zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); zedGraphControl1.Refresh(); }
public void UpdateGraph() { zedGraphControl.GraphPane.GraphObjList.Clear(); zedGraphControl.GraphPane.CurveList.Clear(); var currentRow = bindingSource.Current as DataRow; var target = comboTarget.SelectedItem; if (currentRow != null) { var refinedPoints = new PointPairList(); var outliers = new PointPairList(); var regression = currentRow.Refined ?? currentRow.Unrefined; if (regression != null && regression.OriginalTimes.Count > 0) { var outlierIndexes = regression.OutlierIndexes; for (int i = 0; i < regression.TotalCount; i++) { var point = new PointPair(regression.OriginalTimes[i], regression.TargetTimes[i], currentRow.RegressedPeptides[i]); if (outlierIndexes.Contains(i)) { outliers.Add(point); } else { refinedPoints.Add(point); } } var refinedScatter = zedGraphControl.GraphPane.AddCurve("Refined Points", refinedPoints, Color.Black, SymbolType.Diamond); refinedScatter.Symbol.Size = 8f; refinedScatter.Line.IsVisible = false; refinedScatter.Symbol.Border.IsVisible = false; refinedScatter.Symbol.Fill = new Fill(Color.DarkBlue); if (outliers.Count > 0) { var outlierScatter = zedGraphControl.GraphPane.AddCurve("Outliers", outliers, Color.Black, SymbolType.Diamond); outlierScatter.Symbol.Size = 8f; outlierScatter.Line.IsVisible = false; outlierScatter.Symbol.Border.IsVisible = false; outlierScatter.Symbol.Fill = new Fill(Color.BlueViolet); } double xMin = regression.OriginalTimes.Min(); double xMax = regression.OriginalTimes.Max(); var regressionLine = zedGraphControl.GraphPane .AddCurve("Regression line", new[] { xMin, xMax }, new[] { xMin * regression.Slope + regression.Intercept,xMax * regression.Slope + regression.Intercept}, Color.Black); regressionLine.Symbol.IsVisible = false; zedGraphControl.GraphPane.Title.Text = string.Format("Alignment of {0} to {1}", currentRow.MsDataFile, target); zedGraphControl.GraphPane.XAxis.Title.Text = string.Format("Time from {0}", currentRow.DataFile); zedGraphControl.GraphPane.YAxis.Title.Text = "Aligned time"; zedGraphControl.GraphPane.AxisChange(); zedGraphControl.Invalidate(); } } }
private void button3_Click(object sender, EventArgs e) { PointPairList list = new PointPairList(); GraphPane myPane = zedGraphControl1.GraphPane; //GraphPane myPane = zedGraphControl1.GraphPane; LineItem myCurve; //zgl.GraphPane.CurveList.Remove(my); list.Clear(); this.zedGraphControl1.GraphPane.CurveList.Clear();//折线图清空 this.zedGraphControl1.GraphPane.GraphObjList.Clear(); this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh(); if ( comboBox12.SelectedItem != null && comboBox13.SelectedItem != null && comboBox5.SelectedItem != null && comboBox6.SelectedItem != null && comboBox7.SelectedItem != null&& comboBox8.SelectedItem != null) { string date_begin = dateTimePicker1.Text.ToString(); date_begin += " " + comboBox5.Text.ToString() + ":" + comboBox7.Text.ToString(); date_begin += ":00"; string date_over = dateTimePicker2.Text.ToString(); date_over += " " + comboBox6.Text.ToString() + ":" + comboBox8.Text.ToString(); date_over += ":00"; DateTime d_begin = DateTime.Parse(date_begin); DateTime d_over = DateTime.Parse(date_over); string sql4data = "SELECT * FROM 锚杆锚索传感器信息表 WHERE ([锚杆锚索观测时间] Between #" + d_begin + "# And #" + d_over + "#) and [锚杆锚索传感器编号]='" + comboBox13.Text.ToString() + "'order by 锚杆锚索观测时间"; OleDbDataReader dr1 = db.Query_reader(sql4data); if (dr1.HasRows) //判断记录集是否包含一行或多行 { while (dr1.Read()) { double y = double.Parse((dr1["锚杆锚索data"]).ToString()); //取得字段的值 DateTime dt = (DateTime)dr1["锚杆锚索观测时间"]; double x = (double)new XDate(dt); list.Add(x, y); } } else MessageBox.Show("无数据"); dr1.Close(); string mycurve =comboBox12.Text.ToString() + "分站" + comboBox13.Text.ToString(); myCurve = zedGraphControl1.GraphPane.AddCurve(mycurve, list, Color.DarkGreen, SymbolType.None); this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh(); } else { MessageBox.Show("请填写完整!!"); } }
public static PointPairList Translate(this PointPairList list, int x, int y) { PointPairList temp = new PointPairList(); for (int i = 0; i < list.Count; i++) { temp.Add(new PointPair(list[i].X + x, list[i].Y + y)); } return temp; }
private void Window_Load(object sender, EventArgs e) { GraphPane myPane = graph.GraphPane; // Set the titles and axis labels myPane.Title.Text = "Time Blocks"; myPane.XAxis.Title.Text = "Time of Day"; myPane.YAxis.Title.Text = "Travel Time"; myPane.XAxis.Type = AxisType.Date; myPane.XAxis.Scale.Min = new XDate(2000, 0, 0, 4, 0, 0); myPane.XAxis.Scale.MajorStep = 30; myPane.XAxis.Scale.MajorUnit = DateUnit.Minute; myPane.XAxis.Scale.Max = new XDate(2000, 0, 0, 24, 0, 0); myPane.XAxis.Scale.Format = "%h"; // Make up some data points from the Sine function PointPairList list = new PointPairList(); // for (double x = 4; x < 24; x++) // { // double y = Math.Sin(x * Math.PI / 45.0); // // list.Add(new XDate(2000, 0, 0, Convert.ToInt32(x), 15, 0), y); // } foreach (XDate date in points.Keys) { list.Add(date, points[date]); } PointPairList list2 = new PointPairList(); for (double x = 4; x < 24; x++) { double y = Math.Sin(x * Math.PI / 30.0); list2.Add(new XDate(2000, 0, 0, Convert.ToInt32(x), 0, 0), y); } LineItem myCurve = myPane.AddCurve("Average", list, Color.Blue, SymbolType.None); // LineItem myCurve2 = myPane.AddCurve("Average", list, Color.Blue, // SymbolType.None); myCurve.Line.Fill = new Fill(Color.FromArgb(100, Color.DodgerBlue)); // myCurve2.Line.Fill = new Fill(Color.FromArgb(100, Color.DimGray)); // myCurve.Points = list; // myCurve2.Points = list2; BarItem item = myPane.AddBar(null, list, Color.DodgerBlue); item.Bar.Fill = new Fill(Color.FromArgb(100, Color.DodgerBlue)); item.Bar.Border.Width = 0; myPane.BarSettings.MinBarGap = 0; myPane.BarSettings.MinClusterGap = 0; myPane.BarSettings.MinClusterGap = 0.55f; graph.AxisChange(); }
/// <summary> /// Method to build pointpair list according to time interval and data doe double datatype /// </summary> /// <param name="data"></param> /// <returns></returns> private PointPairList buildPointPairList(double[] data) { PointPairList pt = new ZedGraph.PointPairList(); for (int counter = 0; counter < data.Length; counter++) { pt.Add(counter, (data[counter])); } return(pt); }
private void stackBar(ZedGraphControl zg, string labelName, int val, Color clr) { ZedGraph.PointPairList listStack = new ZedGraph.PointPairList(); listStack.Add(val, 0); BarItem barC = zg.GraphPane.AddBar(labelName, listStack, clr); barC.Bar.Fill = new Fill(clr); zg.AxisChange(); zg.Refresh(); }
public static Bitmap GetGraph(List<int> data, List<DateTime> date, string xAxis, string yAxis, string graphName) { ZedGraphControl zedGraph = new ZedGraphControl(); if (data.Count == 0) { return null; } if (data.Count == 1) { data.Add(data[0]); date.Add(date[0].AddSeconds(1)); } GraphPane myPane = zedGraph.GraphPane; myPane.CurveList.Clear(); PointPairList list1 = new PointPairList(); DateTime l, r; l = date.First(); r = date.Last(); for (int i = 0; i < data.Count; i++) { list1.Add(date[i].ToOADate(), data[i]); } LineItem myCurve = myPane.AddCurve("Line1", list1, Color.Red, SymbolType.Diamond); myPane.XAxis.Type = AxisType.Date; myPane.YAxis.MajorGrid.IsVisible = true; myPane.YAxis.MajorGrid.DashOff = 0; myPane.YAxis.MajorGrid.Color = Color.DarkGray; myPane.XAxis.Scale.Min = l.ToOADate(); myPane.XAxis.Scale.Max = r.ToOADate(); myPane.XAxis.Scale.Format = "dd-MMM-yy"; myPane.XAxis.Title.Text = xAxis; myPane.YAxis.Title.Text = yAxis; myPane.Title.Text = graphName; myPane.Legend.IsVisible = false; zedGraph.Enabled = false; myCurve.Line.Width = 4.0F; myCurve.Line.Color = Color.FromArgb(189, 43, 43); myCurve.Line.Fill = new Fill(Color.FromArgb(100, 207, 236, 255), Color.FromArgb(200, 145, 213, 255), 90F); myCurve.Symbol.Size = 12.0F; myCurve.Symbol.Fill = new Fill(Color.FromArgb(145, 16, 16)); myCurve.Symbol.Border.Color = Color.FromArgb(99, 4, 4); zedGraph.AxisChange(); zedGraph.Invalidate(); Bitmap bmp = zedGraph.MasterPane.GetImage(1024, 768, 96); return bmp; }
private void BtnDisplayRandomDigit_Click(object sender, EventArgs e) { if (!_modelImplementation.Ready) { return; } PnlLoadData.BackColor = Color.LightCoral; Application.DoEvents(); var aDigit = _modelImplementation.GetRandomTrainingData(); if (aDigit == null) { return; } var digitShouldBe = aDigit["Label"].ToString(); LblRandomDigit.Text = digitShouldBe; PointPairList pointPairList = new ZedGraph.PointPairList(); for (int row = 0; row < 28; row++) { for (int col = 0; col < 28; col++) { var key = "Cell" + (col + 1).ToString("00") + (row + 1).ToString("00"); var aCell = aDigit[key].ToString(); if (double.TryParse(aCell, out double val)) { if (val > 128) { pointPairList.Add(x: row, y: col); } } } } GraphPane myPane = zedGraphControl1.GraphPane; myPane.CurveList.Clear(); LineItem myCurve = myPane.AddCurve("Performance", pointPairList, Color.Black, SymbolType.Square); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Firebrick); myCurve.Symbol.Size = 15; zedGraphControl1.Refresh(); //https://web.archive.org/web/20110215041641/http://zedgraph.org/wiki/index.php?title=Scatter_Plot_Demo PnlLoadData.BackColor = Color.LightGreen; }
public StackedBarsWithLabelsDemo() : base("A stacked bar graph that includes a text label inside each bar", "Stacked Bars with Labels Demo", DemoType.Bar) { GraphPane myPane = base.GraphPane; // Set the title and axis labels myPane.Title.Text = "Stacked Bars with Value Labels Inside Each Bar"; myPane.XAxis.Title.Text = "Position Number"; myPane.YAxis.Title.Text = "Some Random Thing"; // Create points for three BarItems PointPairList list1 = new PointPairList(); PointPairList list2 = new PointPairList(); PointPairList list3 = new PointPairList(); // Use random data values Random rand = new Random(); for ( int i=1; i<5; i++ ) { double y = (double) i; double x1 = 100.0 + rand.NextDouble() * 100.0; double x2 = 100.0 + rand.NextDouble() * 100.0; double x3 = 100.0 + rand.NextDouble() * 100.0; list1.Add( x1, y ); list2.Add( x2, y ); list3.Add( x3, y ); } // Create the three BarItems, change the fill properties so the angle is at 90 // degrees for horizontal bars BarItem bar1 = myPane.AddBar( "Bar 1", list1, Color.Red ); bar1.Bar.Fill = new Fill( Color.Red, Color.White, Color.Red, 90 ); BarItem bar2 = myPane.AddBar( "Bar 2", list2, Color.Blue ); bar2.Bar.Fill = new Fill( Color.Blue, Color.White, Color.Blue, 90 ); BarItem bar3 = myPane.AddBar( "Bar 3", list3, Color.Green ); bar3.Bar.Fill = new Fill( Color.Green, Color.White, Color.Green, 90 ); // Set BarBase to the YAxis for horizontal bars myPane.BarSettings.Base = BarBase.Y; // Make the bars stack instead of cluster myPane.BarSettings.Type = BarType.Stack; // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill( Color.White, Color.FromArgb( 255, 255, 166), 45.0F ); base.ZedGraphControl.AxisChange(); // Create TextObj's to provide labels for each bar CreateBarLabels( myPane, true, "N0" ); }
private PointPairList makePoints() { PointPairList list = new PointPairList(); double x, y; for (int i = 0; i < 20; i++) { x = AssetValue + i; y = 1; list.Add(x, y); } return list; }
private void BtnEvaluateModelUsingTestData_Click(object sender, EventArgs e) { TxtboxAssessmentResults.Text = string.Empty; if (!_modelImplementer.Ready) { return; } PnlLoadTestingDataAndEvaluate.BackColor = Color.LightCoral; Application.DoEvents(); var assessModel = _modelImplementer.AssessModel(); if (assessModel.Count == 0) { return; } PointPairList pointPairList = new ZedGraph.PointPairList(); foreach (var singleRow in assessModel) { if (singleRow.ActualValue > 1000) { pointPairList.Add(x: singleRow.ActualValue, y: singleRow.PredictedValue); } } GraphPane myPane = zedGraphControl1.GraphPane; myPane.CurveList.Clear(); LineItem myCurve = myPane.AddCurve("Performance", pointPairList, Color.Black, SymbolType.Square); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Firebrick); myCurve.Symbol.Size = 5; zedGraphControl1.Refresh(); if (_modelImplementer.ErrorHasOccured) { ShowMessageAlert(_modelImplementer.FailureInformation); } else { } PnlLoadTestingDataAndEvaluate.BackColor = Color.LightSeaGreen; }
} // Выборочные характеристики void DrawF(double lmb, List <double> rand_val) { ZedGraph.PointPairList F_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList Fn_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList f_list = new ZedGraph.PointPairList(); double D = 0.0; // Мера расхождения double Fn; //for (int i = 0; i < n; i++) //{ // Fn = (double)i / (double)n; // Fn_list.Add(rand_val[i], Fn); // D = Math.Max(D, Math.Abs(Fn - F(rand_val[i], lmb))); //} //textBox3.Text = D.ToString(); double h = rand_val[n - 1] / 1000.0; int sum = 0; for (int i = 0; i < 1000; i++) { sum = 0; for (int j = 0; j < n; j++) { double temp = rand_val[0] + h * i; if (rand_val[j] < rand_val[0] + h * i) { sum++; } } Fn_list.Add(rand_val[0] + h * i, (double)sum / (double)n); F_list.Add(rand_val[0] + h * i, F(h * i, lmb)); D = Math.Max(D, Math.Abs((double)sum / (double)n - F(rand_val[0] + h * i, lmb))); } textBox3.Text = D.ToString(); zedGraphControl1.GraphPane.CurveList.Clear(); ZedGraph.LineItem CurveF = zedGraphControl1.GraphPane.AddCurve("F", F_list, Color.FromName("Red"), ZedGraph.SymbolType.None); ZedGraph.LineItem CurveFn = zedGraphControl1.GraphPane.AddCurve("Fn", Fn_list, Color.FromName("Blue"), ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); } // График функций распределения
private void BtnDisplayRandomDigit_Click(object sender, EventArgs e) { if (!_accordImplementer.Ready) { return; } TxtboxLoadInformation.Clear(); var aDigit = _accordImplementer.GetRandomTrainingData(); if (aDigit == null) { TxtboxLoadInformation.Text = "Load the data first!"; return; } LblRandomDigit.Text = aDigit.Item1.ToString(); PointPairList pointPairList = new ZedGraph.PointPairList(); for (int row = 0; row < 28; row++) { for (int col = 0; col < 28; col++) { var element = row + col * 28; if (aDigit.Item2[element] > 128) { pointPairList.Add(x: row, y: col); } } } GraphPane myPane = zedGraphControl1.GraphPane; myPane.CurveList.Clear(); LineItem myCurve = myPane.AddCurve("Performance", pointPairList, Color.Black, SymbolType.Square); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Firebrick); myCurve.Symbol.Size = 15; zedGraphControl1.Refresh(); }
} // График функций распределения void Drawf(double lmb, List <double> rand_val) { ZedGraph.PointPairList f_list = new ZedGraph.PointPairList(); double h = 10.0 / 1000.0; for (int i = 0; i < 1000; i++) { f_list.Add(h * i, f(h * i, lmb)); } zedGraphControl3.GraphPane.CurveList.Clear(); ZedGraph.LineItem Curvef = zedGraphControl3.GraphPane.AddCurve("f", f_list, Color.FromName("Red"), ZedGraph.SymbolType.None); zedGraphControl3.GraphPane.YAxis.Scale.Min = 0.0; zedGraphControl3.GraphPane.XAxis.Scale.Max = 5.001; zedGraphControl3.AxisChange(); zedGraphControl3.Invalidate(); } // График функции плотности
private void DrawLine() { ZedGraph1.Type = AnalyticsType.Line; ZedGraph1.Title = DateTime.Now.Year.ToString() + " . " + DateTime.Now.Month.ToString(); ZedGraph1.XAxisTitle = "Date"; ZedGraph1.YAxisTitle = "Clicks"; ZedGraph1.ZGWidth = 800; ZedGraph1.ZGHeight = 250; ZedGraph1.IsChangeColor = false; ZedGraph.PointPairList ppl = new ZedGraph.PointPairList(); DateTime current = DateTime.Now; int iMM = current.Month; DateTime start = new DateTime(current.Year, iMM, 1); DateTime end = new DateTime(current.Year, iMM, DateTime.DaysInMonth(current.Year, iMM)); int iDays = (int)((TimeSpan)(end - start)).TotalDays + 1; ArrayList al = new ArrayList(); int nowDay = DateTime.Now.Day; if (iMM != current.Month) { nowDay = iDays; } for (int i = 0; i < iDays; i++) { string where = string.Empty; string timeShort = start.AddDays(i).ToString("yyyy-MM-dd"); where = "LogTime >='" + timeShort + " 00:00:00' and LogTime <='" + timeShort + " 23:59:59'"; int iCount = MojoCube.Web.Sql.GetResultCount("Site_Log", where); double x = i; double y = (double)iCount; ppl.Add(x, y); } ZedGraph1.DataSource.Add(ppl); ZedGraph1.CurveNameList.Add(""); }
void DrawTestError(double[] v, ZedGraphControl graph) { ZedGraph.PointPairList err_list = new ZedGraph.PointPairList(); double h = 1.0 / n; double x = 0.0; eps1 = 0.0; double exact; double temp; x_eps1 = x; for (int i = 0; i < n + 1; i++) { exact = ExactTestSolve(x); temp = Math.Abs(exact - v[i]); err_list.Add(x, temp); if (temp > eps1) { eps1 = temp; x_eps1 = x; } x += h; } graph.GraphPane.XAxis.Min = -0.01; graph.GraphPane.XAxis.Max = 1.0; graph.GraphPane.CurveList.Clear(); graph.GraphPane.Title = "Погрешность"; ZedGraph.LineItem CurveV = graph.GraphPane.AddCurve("|ui-vi|", err_list, colors[1], ZedGraph.SymbolType.None); graph.AxisChange(); graph.Invalidate(); }
void DrawTestSolve(double[] v, ZedGraphControl graph, DataGridView tab) { ZedGraph.PointPairList v_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList u_list = new ZedGraph.PointPairList(); double h = 1.0 / n; double x = 0.0; double exact; double temp; for (int i = 0; i < n + 1; i++) { exact = ExactTestSolve(x); u_list.Add(x, exact); v_list.Add(x, v[i]); temp = Math.Abs(exact - v[i]); if (i % ((n / 1000) + 1) == 0) { tab.Rows.Add(i, x, v[i], exact, temp); } x += h; } graph.GraphPane.XAxis.Min = -0.01; graph.GraphPane.XAxis.Max = 1.0; graph.GraphPane.CurveList.Clear(); graph.GraphPane.Title = "Решение"; ZedGraph.LineItem CurveV = graph.GraphPane.AddCurve("v(x)", v_list, colors[1], ZedGraph.SymbolType.None); ZedGraph.LineItem CurveU = graph.GraphPane.AddCurve("u(x)", u_list, colors[4], ZedGraph.SymbolType.None); graph.AxisChange(); graph.Invalidate(); }
//Функции для работы с графиками void DrawSolve(List <double> xi, List <double> ui, List <double> vi, string task) { ZedGraph.PointPairList v_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList u_list = new ZedGraph.PointPairList(); int m = task == "test" ? 1 : 2; // в случае основной задачи нужно перепрыгивать значения от половинного шага int n = xi.Count(); for (int i = 0; i < n; i++) { v_list.Add(xi[i], vi[i]); u_list.Add(xi[i], ui[i * m]); } zedGraphControl2.GraphPane.XAxis.Min = -0.1; zedGraphControl2.GraphPane.XAxis.Max = 1.0; zedGraphControl2.GraphPane.CurveList.Clear(); if (task == "test") { ZedGraph.LineItem CurveV = zedGraphControl2.GraphPane.AddCurve("num solve", v_list, Color.FromName("Blue"), ZedGraph.SymbolType.None); ZedGraph.LineItem CurveU = zedGraphControl2.GraphPane.AddCurve("exact solve", u_list, Color.FromName("Red"), ZedGraph.SymbolType.None); zedGraphControl2.GraphPane.YAxis.Title = "u(x), v(x)"; } else if (task == "main") { zedGraphControl2.GraphPane.YAxis.Title = "v(x), v2(x)"; ZedGraph.LineItem CurveV = zedGraphControl2.GraphPane.AddCurve("v(x)", v_list, Color.FromName("Blue"), ZedGraph.SymbolType.None); ZedGraph.LineItem CurveU = zedGraphControl2.GraphPane.AddCurve("v2(x)", u_list, Color.FromName("Red"), ZedGraph.SymbolType.None); } zedGraphControl2.AxisChange(); zedGraphControl2.Invalidate(); }
private void BUT_run_Click(object sender, EventArgs e) { Utilities.FFT2 fft = new FFT2(); using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "*.wav|*.wav"; ofd.ShowDialog(); if (!File.Exists(ofd.FileName)) { return; } var st = File.OpenRead(ofd.FileName); int bins = 10; double[] buffer = new double[1 << bins]; int a = 0; while (st.Position < st.Length) { byte[] temp = new byte[2]; var read = st.Read(temp, 0, temp.Length); var val = (double)BitConverter.ToInt16(temp, 0); buffer[a] = val; a++; if (a == (1 << bins)) { var fftanswer = fft.rin(buffer, (uint)bins); var freqt = fft.FreqTable(buffer.Length, 1000); ZedGraph.PointPairList ppl = new ZedGraph.PointPairList(); for (int b = 0; b < fftanswer.Length; b++) { ppl.Add(freqt[b], fftanswer[b]); } double xMin, xMax, yMin, yMax; var curve = new LineItem("FFT", ppl, Color.Red, SymbolType.Diamond); curve.GetRange(out xMin, out xMax, out yMin, out yMax, true, false, zedGraphControl1.GraphPane); zedGraphControl1.GraphPane.XAxis.Title.Text = "Freq Hz"; zedGraphControl1.GraphPane.YAxis.Title.Text = "Amplitude"; zedGraphControl1.GraphPane.Title.Text = "FFT"; zedGraphControl1.GraphPane.CurveList.Clear(); zedGraphControl1.GraphPane.CurveList.Add(curve); zedGraphControl1.Invalidate(); zedGraphControl1.AxisChange(); zedGraphControl1.Refresh(); int width = Console.WindowWidth - 1; int height = Console.WindowHeight - 1; int r = 1; foreach (var ff in fftanswer) { int col = (int)((r / (double)fftanswer.Length) * width); int row = (int)((ff * 0.2) + 0.5); //Console.SetCursorPosition(col, height - row); Console.Write("*"); r++; } // 50% overlap st.Seek(-(1 << bins) / 2, SeekOrigin.Current); a = 0; buffer = new double[buffer.Length]; //Console.Clear(); } } } }
private void draw_yoriginalline() { //获取引用 GraphPane myPane1 = zedGraphControl1.GraphPane; double x = 0; string CHname; //清空原图像 myPane1.CurveList.Clear(); myPane1.GraphObjList.Clear(); zedGraphControl1.Refresh(); //设置标题 myPane1.Title.Text = ""; //设置X轴说明文字 myPane1.XAxis.Title.Text = "距离/mm"; //设置Y轴说明文字 myPane1.YAxis.Title.Text = "磁场变化/nT"; myPane1.XAxis.Scale.Min = 0; //X轴最小值0 myPane1.XAxis.Scale.Max = length; //X轴最大值 myPane1.XAxis.Scale.MinorStep = 0; myPane1.XAxis.Scale.MajorStep = 500; PointPairList mylist0 = new ZedGraph.PointPairList(); ZedGraph.LineItem myCurve0; for (int i = 0; i < original_num - 1; i++) { x = (float)i * length / (original_num - 1); if (Channel.SelectedIndex == 0) { mylist0.Add(x, ysdata[0, i]); mylist0.Add(x, ysdata[3, i]); mylist0.Add(x, ysdata[6, i]); mylist0.Add(x, ysdata[9, i]); } if (Channel.SelectedIndex == 1) { mylist0.Add(x, ysdata[1, i]); mylist0.Add(x, ysdata[4, i]); mylist0.Add(x, ysdata[7, i]); mylist0.Add(x, ysdata[10, i]); } if (Channel.SelectedIndex == 2) { mylist0.Add(x, ysdata[2, i]); mylist0.Add(x, ysdata[5, i]); mylist0.Add(x, ysdata[8, i]); mylist0.Add(x, ysdata[11, i]); } } CHname = "Abnormal Signal"; myCurve0 = zedGraphControl1.GraphPane.AddCurve(CHname, mylist0, Color.Red, ZedGraph.SymbolType.None); myPane1.AxisChange(); zedGraphControl1.Invalidate(); }
private void test_Load(object sender, EventArgs e) { checkBox2.Text = "Kütüphanedeki Toplam Kitap Sayısı" + Environment.NewLine + "Grafiğini Göster/Gizle"; checkBox3.Text = "Kütüphanede Verilmeye Hazır Kitap Sayısı" + Environment.NewLine + "Grafiğini Göster/Gizle"; //ms access bağlantısı OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\kutuphane.accdb"); //query sorgusu OleDbDataAdapter da = new OleDbDataAdapter("SELECT *from odunc_kitap", con); DataSet ds; ds = new DataSet(); da.Fill(ds, "odunc_kitap"); this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //tüm sütunları datagridview'e sığdırma dataGridView1.DataSource = ds.Tables["odunc_kitap"]; //db'deki ödünçkitap tablosunu datagridview'e çekme dataGridView1.ReadOnly = true; dataGridView1.Columns[0].DefaultCellStyle.BackColor = Color.White; // DATAGRİDVİEW 0.SÜTUNU YANİ ID SUTUNUNU DOLAŞIP ÖDÜNÇ KİTAP SAYISINI BULMA if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells[0].Value != DBNull.Value) { string rak = Convert.ToString((dataGridView1.Rows[i].Cells[0].Value)); if (rak == null) { MessageBox.Show("odunc kitap yok"); } else { toplam = toplam + 1; } } } } label1.Text = "Toplam ödünç kitap sayısı = " + (toplam - 1); GraphPane grafik1 = zedGraphControl1.GraphPane; //graphane sınıfından grafik1 adında yeni bir graphane türet. grafik1.Title.Text = "Toplam Ödünç Kitap Sayısı"; //grafik1 adı grafik1.YAxis.Title.Text = "Kitap Sayısı"; //grafik1 y eksen adı grafik1.XAxis.Title.Text = " "; //grafik1 x eksen adı ZedGraph.PointPairList liste1 = new ZedGraph.PointPairList(); //pointpairlist sınıfından liste1 adında yeni bir pointpairlist türet. liste1.Add(0, toplam - 1); BarItem bar1 = zedGraphControl1.GraphPane.AddBar("Toplam Ödünç Kitap Sayısı", liste1, Color.Red); bar1.Bar.Fill = new Fill(Color.Green); grafik1.BarSettings.Type = BarType.Cluster; // bar tipi grafik1.BarSettings.ClusterScaleWidth = 1; //bar sıklığı zedGraphControl1.AxisChange(); // grafiği güncelle OleDbCommand xy = new OleDbCommand("SELECT COUNT(id) FROM kitap", con); // kitap tablosundaki id'i sayıp kütüphanedeki toplam- con.Open(); //kitap sayısını bulma Int32 zt = (Int32)xy.ExecuteScalar(); GraphPane grafik2 = zedGraphControl2.GraphPane; //graphane sınıfından grafik2 adında yeni bir graphane türet. grafik2.Title.Text = "Kütüphanedeki Toplam Kitap Sayısı"; //grafik2 adı grafik2.YAxis.Title.Text = "Kitap Sayısı"; //grafik2 y eksen adı grafik2.XAxis.Title.Text = " "; //grafik2 x eksen adı ZedGraph.PointPairList liste2 = new ZedGraph.PointPairList(); //pointpairlist sınıfından liste2 adında yeni bir pointpairlist türet. liste2.Add(0, zt); BarItem bar2 = zedGraphControl2.GraphPane.AddBar("Kütüphanedeki Toplam Kitap Sayısı", liste2, Color.Red); bar2.Bar.Fill = new Fill(Color.Yellow); grafik2.BarSettings.Type = BarType.Cluster; // bar tipi grafik2.BarSettings.ClusterScaleWidth = 1; //bar sıklığı zedGraphControl2.AxisChange(); // grafiği güncelle label2.Text = "Toplam Kitap sayısı = " + zt; GraphPane grafik3 = zedGraphControl3.GraphPane; //graphane sınıfından grafik1 adında yeni bir graphane türet. grafik3.Title.Text = "Kütüphanede Verilmeye Hazır Kitap Sayısı"; //grafik3 adı grafik3.YAxis.Title.Text = "Kitap Sayısı"; //grafik3 y eksen adı grafik3.XAxis.Title.Text = " "; //grafik1 x eksen adı ZedGraph.PointPairList liste3 = new ZedGraph.PointPairList(); //pointpairlist sınıfından liste1 adında yeni bir pointpairlist türet. //KÜTÜPHANEDEKİ TOPLAM KİTAP SAYISINDAN ÖDÜNÇ KİTAP SAYISI ÇIKARILDI. liste3.Add(0, zt - toplam + 1); BarItem bar3 = zedGraphControl3.GraphPane.AddBar("Kütüphanede Verilmeye Hazır Kitap Sayısı", liste3, Color.Orange); bar3.Bar.Fill = new Fill(Color.Orange); grafik3.BarSettings.Type = BarType.Cluster; // bar tipi grafik3.BarSettings.ClusterScaleWidth = 1; //bar sıklığı zedGraphControl3.AxisChange(); // grafiği güncelle label3.Text = "Toplam Kitap sayısı = " + (zt - toplam + 1); }
private void BUT_run_Click(object sender, EventArgs e) { Utilities.FFT2 fft = new FFT2(); using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "*.wav|*.wav"; ofd.ShowDialog(); if (!File.Exists(ofd.FileName)) { return; } var st = File.OpenRead(ofd.FileName); int bins = (int)NUM_bins.Value; List <double[]> avg = new List <double[]> { new double[1 << bins] }; Color[] color = new Color[] { Color.Red, Color.Green, Color.Black, Color.Violet, Color.Blue, Color.Orange }; int hz = 8000; InputBox.Show("fft sample rate", "nter source file sample rate", ref hz); double[] buffer = new double[1 << bins]; int a = 0; int samples = 0; while (st.Position < st.Length) { byte[] temp = new byte[2]; var read = st.Read(temp, 0, temp.Length); var val = (double)BitConverter.ToInt16(temp, 0); buffer[a] = val; a++; if (a == (1 << bins)) { samples++; var fftanswer = fft.rin(buffer, (uint)bins); var freqt = fft.FreqTable(buffer.Length, hz); ZedGraph.PointPairList ppl = new ZedGraph.PointPairList(); for (int b = 0; b < fftanswer.Length; b++) { ppl.Add(freqt[b], fftanswer[b]); } double xMin, xMax, yMin, yMax; var curve = new LineItem("FFT", ppl, Color.Red, SymbolType.Diamond); curve.GetRange(out xMin, out xMax, out yMin, out yMax, true, false, zedGraphControl1.GraphPane); zedGraphControl1.GraphPane.XAxis.Title.Text = "Freq Hz"; zedGraphControl1.GraphPane.YAxis.Title.Text = "Amplitude"; zedGraphControl1.GraphPane.Title.Text = "FFT - " + hz; zedGraphControl1.GraphPane.Y2Axis.IsVisible = true; zedGraphControl1.GraphPane.CurveList.Clear(); zedGraphControl1.GraphPane.CurveList.Add(curve); for (int b = 0; b < (1 << bins) / 2; b++) { avg[0][b] = avg[0][b] * (1.0 - (1.0 / samples)) + fftanswer[b] * (1.0 / samples); } // 0 out all data befor cutoff for (int b = 0; b < 1 << bins / 2; b++) { if (freqt[b] < (double)NUM_startfreq.Value) { avg[0][b] = 0; continue; } break; } ppl = new ZedGraph.PointPairList(freqt, avg[0]); curve = new LineItem("Avg", ppl, color[1], SymbolType.None) { IsY2Axis = true }; zedGraphControl1.GraphPane.CurveList.Add(curve); zedGraphControl1.Invalidate(); zedGraphControl1.AxisChange(); zedGraphControl1.Refresh(); // 50% overlap st.Seek(-(1 << bins) / 2, SeekOrigin.Current); a = 0; buffer = new double[buffer.Length]; } } } }
public void DrawGraph(int z, int n, double a, double b) { ZedGraph.PointPairList F = new ZedGraph.PointPairList(); ZedGraph.PointPairList S = new ZedGraph.PointPairList(); ZedGraph.PointPairList F1 = new ZedGraph.PointPairList(); ZedGraph.PointPairList S1 = new ZedGraph.PointPairList(); ZedGraph.PointPairList F2 = new ZedGraph.PointPairList(); ZedGraph.PointPairList S2 = new ZedGraph.PointPairList(); ZedGraph.PointPairList e = new ZedGraph.PointPairList(); ZedGraph.PointPairList e1 = new ZedGraph.PointPairList(); ZedGraph.PointPairList e2 = new ZedGraph.PointPairList(); double h = (b - a) / n; for (int i = 0; i < n + 1; i++) { if (i % 4 == 0 && i != 0 && i != n) { continue; } double x0 = a + i * h; double FF = Function(x0, z); double SS = Spline(z, n, a, b, x0); double FF1 = Function1(x0, z); double SS1 = Spline1(z, n, a, b, x0); double FF2 = Function2(x0, z); double SS2 = Spline2(z, n, a, b, x0); double E = FF - SS; double E1 = FF1 - SS1; double E2 = FF2 - SS2; F.Add(x0, FF); S.Add(x0, SS); F1.Add(x0, FF1); S1.Add(x0, SS1); F2.Add(x0, FF2); S2.Add(x0, SS2); e.Add(x0, E); e1.Add(x0, E1); e2.Add(x0, E2); } ZedGraph.GraphPane.CurveList.Clear(); if (comboBox1.SelectedIndex == 0) { LineItem Curve = ZedGraph.GraphPane.AddCurve("F(x)", F, Color.Green, SymbolType.None); LineItem SCurve = ZedGraph.GraphPane.AddCurve("S(x)", S, Color.Blue, SymbolType.None); LineItem ECurve = ZedGraph.GraphPane.AddCurve("F(x)-S(x)", e, Color.Red, SymbolType.None); } if (comboBox1.SelectedIndex == 1) { LineItem Curve = ZedGraph.GraphPane.AddCurve("F'(x)", F1, Color.Green, SymbolType.None); LineItem SCurve = ZedGraph.GraphPane.AddCurve("S'(x)", S1, Color.Blue, SymbolType.None); LineItem ECurve = ZedGraph.GraphPane.AddCurve("F'(x)-S'(x)", e1, Color.Red, SymbolType.None); } if (comboBox1.SelectedIndex == 2) { LineItem Curve = ZedGraph.GraphPane.AddCurve("F''(x)", F2, Color.Green, SymbolType.None); LineItem SCurve = ZedGraph.GraphPane.AddCurve("S''(x)", S2, Color.Blue, SymbolType.None); LineItem ECurve = ZedGraph.GraphPane.AddCurve("F''(x)-S''(x)", e2, Color.Red, SymbolType.None); } ZedGraph.AxisChange(); ZedGraph.Invalidate(); }
private void Draw(ZedGraphControl pane, double[] vals) { double sigma = Convert.ToDouble(textBox1.Text); int N = Convert.ToInt32(textBox3.Text); int n = vals.Length; double[] interval = new double[N + 1]; double[] value = new double[N]; double[] f = new double[N]; //строим функции распределения ZedGraph.PointPairList F_list = new ZedGraph.PointPairList(); ZedGraph.PointPairList Fn_list = new ZedGraph.PointPairList(); zedGraphControl1.GraphPane.Title.Text = "График функций распределения"; zedGraphControl1.GraphPane.XAxis.Title.Text = "X"; zedGraphControl1.GraphPane.YAxis.Title.Text = "F(x)"; double D = 0.0; // Мера расхождения double h = vals[n - 1] / 1000; int sum = 0; for (int i = 0; i < 1000; i++) { sum = 0; for (int j = 0; j < n; j++) { double temp = vals[0] + h * i; if (vals[j] < vals[0] + h * i) { sum++; } } Fn_list.Add(vals[0] + h * i, (double)sum / (double)n); F_list.Add(vals[0] + h * i, 1 - Math.Exp(-(vals[0] + h * i) * (vals[0] + h * i) / (2 * sigma * sigma))); D = Math.Max(D, Math.Abs((double)sum / (double)n - (1 - Math.Exp(-(vals[0] + h * i) * (vals[0] + h * i) / (2 * sigma * sigma))))); } zedGraphControl1.GraphPane.CurveList.Clear(); textBox4.Text = D.ToString(); ZedGraph.LineItem CurveF = zedGraphControl1.GraphPane.AddCurve("F", F_list, Color.FromName("Red"), ZedGraph.SymbolType.None); ZedGraph.LineItem CurveFn = zedGraphControl1.GraphPane.AddCurve("Fn", Fn_list, Color.FromName("Blue"), ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); //гистограмма double h2 = (vals[n - 1] - vals[0]) / N; for (int i = 0; i < N; i++) { interval[i] = vals[0] + (double)i * h2; } interval[N] = vals[n - 1]; int sum2; for (int i = 0; i < N; i++) { sum2 = 0; for (int j = 0; j < n; j++) { if ((interval[i] < vals[j]) && (vals[j] <= interval[i + 1])) { sum2++; } } value[i] = (double)sum2 / (h2 * (double)n); } GraphPane pane1 = zedGraphControl2.GraphPane; pane1.CurveList.Clear(); BarItem curve1 = pane1.AddBar(null, null, value, Color.Blue); zedGraphControl2.GraphPane.Title.Text = "Гистограмма"; pane1.YAxis.Scale.Min = 0.0; pane1.YAxis.Scale.Max = value.Max() + 0.001; pane1.BarSettings.MinClusterGap = 0.0f; zedGraphControl2.AxisChange(); zedGraphControl2.Invalidate(); //3 таблица double max = 0.0; for (int i = 0; i < N; i++) { dataGridView3.ColumnCount = N; dataGridView3.RowCount = 3; dataGridView3.Rows[0].HeaderCell.Value = "z [ j ] "; dataGridView3.Rows[1].HeaderCell.Value = "f ( z [ j ] )"; dataGridView3.Rows[2].HeaderCell.Value = "n [ j ] / n ∆[ j ] "; dataGridView3.Columns[i].HeaderText = string.Format("z" + (i + 1), i); dataGridView3.Rows[0].Cells[i].Value = interval[i] + h2 * 0.5; f[i] = ((interval[i] + h2 * 0.5) * Math.Exp(-(interval[i] + h2 * 0.5) * (interval[i] + h2 * 0.5) / (2 * sigma * sigma))) / (sigma * sigma); dataGridView3.Rows[1].Cells[i].Value = f[i]; dataGridView3.Rows[2].Cells[i].Value = value[i]; if (Math.Abs(value[i] - f[i]) > max) { max = Math.Abs(value[i] - f[i]); } } textBox5.Text = max.ToString(); }