public CurveItem(string Name, ZedGraph.ZedGraphControl Graph, Color Color) { this.Name = Name; this.Graph = Graph; Curve = Graph.GraphPane.AddCurve(Name, null, null, Color, ZedGraph.SymbolType.None); Curve.IsVisible = false; }
private void график3ToolStripMenuItem_Click(object sender, EventArgs e) { ZedGraph.GraphPane graphPane = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairs = new ZedGraph.PointPairList(); graphPane.CurveList.Clear(); graphPane.Title.Text = "График 3"; for (double x = 0; x <= 1; x += 0.01) { if (x >= 0 && x < 0.07) { pointPairs.Add(x, 0.95); } else if (x >= 0.07 && x < 0.13) { pointPairs.Add(x, -30 * Math.Pow(x - 0.068, 2) + 0.95); } else if (x >= 0.13 && x <= 1) { pointPairs.Add(x, 2 / (100 * x - 10) + 0.05); } else { MessageBox.Show($"Missing {x}"); } } ZedGraph.LineItem lineItemResult = graphPane.AddCurve("График 3", pointPairs, Color.Red, ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
/// <summary> /// Draws the graph to the form /// </summary> /// <param name="o"></param> /// <param name="e"></param> public void PaintGraph(object o, PaintEventArgs e) { Graphics g = e.Graphics; // Create a new graph with topLeft at (40,40) and size 600x400 myPane = new ZedGraph.GraphPane(new Rectangle(this.Location.X, this.Location.Y + 210, 450, 325), "Allele Frequency\n", "Generations", "Frequency of A"); myPane.XAxis.Max = 100; //this.generation.Value; myPane.XAxis.Min = 0; myPane.YAxis.Max = 1; myPane.YAxis.Min = 0; ZedGraph.LineItem myCurve = myPane.AddCurve("1", list1, Color.Red, ZedGraph.SymbolType.None); ZedGraph.LineItem myCurve2 = myPane.AddCurve("2", list2, Color.Blue, ZedGraph.SymbolType.None); ZedGraph.LineItem myCurve3 = myPane.AddCurve("3", list3, Color.LimeGreen, ZedGraph.SymbolType.None); ZedGraph.LineItem myCurve4 = myPane.AddCurve("4", list4, Color.Black, ZedGraph.SymbolType.None); myPane.AxisChange(this.CreateGraphics()); myPane.Draw(e.Graphics); }
void DrawGraphics() { ZedGraph.PointPairList FkList = new ZedGraph.PointPairList(); ZedGraph.PointPairList SkList = new ZedGraph.PointPairList(); ZedGraph.PointPairList dFkList = new ZedGraph.PointPairList(); ZedGraph.PointPairList dSkList = new ZedGraph.PointPairList(); ZedGraph.PointPairList d2FkList = new ZedGraph.PointPairList(); ZedGraph.PointPairList d2SkList = new ZedGraph.PointPairList(); ZedGraph.PointPairList eList = new ZedGraph.PointPairList(); ZedGraph.PointPairList deList = new ZedGraph.PointPairList(); for (int i = 0; i < N + 1; i++) { if (i % 3 == 0 && i != 0 && i != N) { continue; } double xk = x0 + i * hN; double Fk = spline.F(xk); double Sk = spline.S(xk); double dFk = spline.dF(xk); double dSk = spline.dS(xk); double d2Fk = spline.d2F(xk); double d2Sk = spline.d2S(xk); double e = Fk - Sk; double de = dFk - dSk; FkList.Add(xk, Fk); SkList.Add(xk, Sk); dFkList.Add(xk, dFk); dSkList.Add(xk, dSk); d2FkList.Add(xk, d2Fk); d2SkList.Add(xk, d2Sk); eList.Add(xk, e); deList.Add(xk, de); } zedGraphFS.GraphPane.CurveList.Clear(); zedGraphdFdS.GraphPane.CurveList.Clear(); zedGraphError.GraphPane.CurveList.Clear(); zedGraphdError.GraphPane.CurveList.Clear(); zedGraphFS.GraphPane.AddCurve("F(x)", FkList, Color.FromName("Blue"), ZedGraph.SymbolType.None); zedGraphFS.GraphPane.AddCurve("S(x)", SkList, Color.FromName("Red"), ZedGraph.SymbolType.None); zedGraphdFdS.GraphPane.AddCurve("F'(x)", dFkList, Color.FromName("Blue"), ZedGraph.SymbolType.None); zedGraphdFdS.GraphPane.AddCurve("S'(x)", dSkList, Color.FromName("Red"), ZedGraph.SymbolType.None); zedGraphdFdS.GraphPane.AddCurve("F''(x)", d2FkList, Color.FromName("Green"), ZedGraph.SymbolType.None); zedGraphdFdS.GraphPane.AddCurve("S''(x)", d2SkList, Color.FromName("Black"), ZedGraph.SymbolType.None); ZedGraph.LineItem eCurve = zedGraphError.GraphPane.AddCurve("F(x) - S(x)", eList, Color.FromName("Blue"), ZedGraph.SymbolType.None); ZedGraph.LineItem deCurve = zedGraphdError.GraphPane.AddCurve("F'(x) - S'(x)", deList, Color.FromName("Blue"), ZedGraph.SymbolType.None); zedGraphFS.AxisChange(); zedGraphdFdS.AxisChange(); zedGraphError.AxisChange(); zedGraphdError.AxisChange(); zedGraphFS.Invalidate(); zedGraphdFdS.Invalidate(); zedGraphError.Invalidate(); zedGraphdError.Invalidate(); }
void Draw(ref ZedGraph.PointPairList f_list, double xmax = 1.0) // построение графиков { if (countCurves == 15) { graph.GraphPane.CurveList.Clear(); countCurves = 0; } string name; if (countCurves % 2 == 0) { name = "exact" + (countCurves / 2).ToString(); } else { name = "num" + (countCurves / 2).ToString(); } ZedGraph.GraphPane panel = graph.GraphPane; ZedGraph.LineItem Curve = panel.AddCurve(name, f_list, colors[countCurves], ZedGraph.SymbolType.None); if (countCurves == 0) { panel.XAxis.Min = -0.1; panel.XAxis.Max = xmax + 0.1; panel.YAxis.Min = -1; } countCurves++; graph.AxisChange(); graph.Invalidate(); }
public void Button1_Click(object sender, EventArgs e) { ZedGraph.PointPairList point_list = new ZedGraph.PointPairList(); Form1 tmp = new Form1(); int nmin = System.Convert.ToInt32(numericUpDown1.Value.ToString()); int nmax = System.Convert.ToInt32(numericUpDown2.Value.ToString()); int step = System.Convert.ToInt32(numericUpDown3.Value.ToString()); for (int i = nmin; i < nmax; i += step) { double h = 1.0 / i; List <double> xi = Form1.GetGrid(h); List <double> xi2 = Form1.GetAuxGrid(h); List <double> ai = Form1.TestGetAi(h, i, xi); List <double> di = Form1.TestGetDi(h, xi2); List <double> phii = Form1.TestGetPhii(h, xi2); List <List <double> > matrix = Form1.GetTridiagonalMatrix(i, h, ai, di, phii); List <double> vi = Form1.SolveDifScheme(i, matrix); List <double> ui = Form1.ExactSolve(xi); List <double> dif = Form1.GetAbsDif(vi, ui, "test"); point_list.Add(i, dif.Max()); } zedGraphControl1.GraphPane.CurveList.Clear(); ZedGraph.LineItem Curve1 = zedGraphControl1.GraphPane.AddCurve("", point_list, Color.FromName("Red"), ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
/* triple wave building codesnippet * * int length = (int)(SampleRate * BlockAlign * duration); * byte[] buffer = new byte[length]; * * double A = frequency * 2 * Math.PI / (double)SampleRate; * for (int i = 0; i < length; i++) * { * if (i > 1) buffer[i] = (byte)(2 * Math.Cos(A) * buffer[i - 1] - buffer[i - 2]); * else if (i > 0) buffer[i] = (byte)(2 * Math.Cos(A) * buffer[i - 1] - (Math.Cos(A))); * else buffer[i] = (byte)(2 * Math.Cos(A) * Math.Cos(A) - Math.Cos(2 * A)); * } * * public double CalculateGoertzel(byte[] sample, double frequency, int samplerate) * { * double Skn, Skn1, Skn2; * Skn = Skn1 = Skn2 = 0; * for (int i = 0; i < sample.Length; i++) * { * Skn2 = Skn1; * Skn1 = Skn; * Skn = 2 * Math.Cos(2 * Math.PI * frequency / samplerate) * Skn1 - Skn2 + sample[i]; * } * * double WNk = Math.Exp(-2 * Math.PI * frequency / samplerate); * * return 20 * Math.Log10(Math.Abs((Skn - WNk * Skn1))); * } * * public int TestGoertzel(int frequency, byte[] sample, int samplerate) * { * int stepsize = frequency / 5; * Dictionary<int, double> res = new Dictionary<int, double>(); * for (int i = 0; i < 10; i++) * { * int freq = stepsize * i; * res.Add(freq, CalculateGoertzel(sample, freq, samplerate)); * } * } */ private void BuildDiagram(ZedGraph.ZedGraphControl zg, byte[] _data) { ZedGraph.GraphPane myPane = zg.GraphPane; ZedGraph.LineItem curve = null; if (myPane.CurveList.Count >= 1) { curve = myPane.CurveList[0] as ZedGraph.LineItem; curve.Clear(); } else { curve = new ZedGraph.LineItem("SPS"); } // Make sure that the curvelist has at least one curve for (int i = 0; i < _data.Length; i++) { curve.AddPoint(i, _data[i]); } ZedGraph.IPointList list = curve.Points as ZedGraph.IPointList; if (myPane.CurveList.Count == 0) { myPane.AddCurve("Wave", list, Color.DimGray, ZedGraph.SymbolType.None); } zg.AxisChange(); zg.Invalidate(); }
/// <summary> /// Fill the graph with the Training set /// </summary> /// <param name="Training">Reference to the Training object to be plotted</param> private void DisplayDataGraph(GPModelingData gpData) { // // If nothing is selected, get the hell out of here if (lvFiles.SelectedItems.Count == 0) { return; } // // Initialize the graph pane InitialzeDataGraph(gpData); // // The the X & Y Values double[] XValues = null; double[] YValues = null; if (gpData.TimeSeries) { // // If time series, use a count as the X-Axis XValues = new double[gpData.Rows]; YValues = new double[gpData.Rows]; for (int Value = 0; Value < gpData.Rows; Value++) { XValues[Value] = Value + 1; YValues[Value] = gpData[Value, 0]; } } else { XValues = gpData.InputColumn(cbXAxis.SelectedIndex); YValues = gpData.ObjectiveColumn(0); } if (rdChartTypeXY.Checked || rdChartTypeScatter.Checked) { ZedGraph.LineItem line = graphData.GraphPane.AddCurve("Series 1", XValues, YValues, Color.Blue, ZedGraph.SymbolType.None); if (rdChartTypeScatter.Checked) { line.Line.IsVisible = false; line.Symbol.Type = ZedGraph.SymbolType.XCross; line.Symbol.Size = 3; } } else if (rdChartTypeBar.Checked) { graphData.GraphPane.AddBar("Series 1", XValues, YValues, Color.Blue); } // // Force the graph to visually update graphData.GraphPane.AxisChange(this.CreateGraphics()); graphData.Invalidate(); }
void Draw(ref ZedGraph.PointPairList f_list, string name, Color clr, double xmax = 1.0) // построение графиков { ZedGraph.GraphPane panel = zedGraph.GraphPane; ZedGraph.LineItem Curve = panel.AddCurve(name, f_list, clr, ZedGraph.SymbolType.None); panel.XAxis.Min = -0.1; panel.XAxis.Max = xmax + 0.1; panel.YAxis.Min = -1; zedGraph.AxisChange(); zedGraph.Invalidate(); }
private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e) { textBox1.Text = _curves[comboBoxName.SelectedIndex].Label.Text; pnlColor.BackColor = _curves[comboBoxName.SelectedIndex].Color; ZedGraph.LineItem curve = (ZedGraph.LineItem)_curves[comboBoxName.SelectedIndex]; ComBoxSymType.Text = curve.Symbol.Type.ToString(); if (curve.Line.Style != DashStyle.DashDotDot && curve.Line.Style != DashStyle.Custom) { ComBoxLine.Text = curve.Line.Style.ToString(); } bttnOk.Enabled = false; }
private void testToolStripMenuItem_Click(object sender, EventArgs e) { ZedGraph.GraphPane graphPane1 = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairs = new ZedGraph.PointPairList(); pointPairs.Add(0.5, 0); pointPairs.Add(0.5, Function1(0.5)); pointPairs.Add(0, Function1(0.5)); ZedGraph.LineItem lineItemResult1 = graphPane1.AddCurve("Альтернатива 1", pointPairs, Color.Blue, ZedGraph.SymbolType.None); zedGraphControl1.Invalidate(); }
private void bttnOk_Click(object sender, EventArgs e) { int ind = comboBoxName.SelectedIndex; ZedGraph.LineItem curve = (ZedGraph.LineItem)_curves[ind]; curve.Label.Text = textBox1.Text; curve.Color = pnlColor.BackColor; ZedGraph.SymbolType SmType = (ZedGraph.SymbolType)Enum.Parse(typeof(ZedGraph.SymbolType), ComBoxSymType.Items[ComBoxSymType.SelectedIndex].ToString()); curve.Symbol = new ZedGraph.Symbol(SmType, pnlColor.BackColor); DashStyle Dash = (DashStyle)Enum.Parse(typeof(DashStyle), ComBoxLine.Items[ComBoxLine.SelectedIndex].ToString()); curve.Line.Style = Dash; bttnOk.Enabled = false; EventChangedCurve(); LoadList(ind); }
private void button1_Click(object sender, EventArgs e) { double x0 = Double.Parse(textBox1.Text); //Начальное значение x double y0 = Double.Parse(textBox2.Text); //конечное значение x int n = Int32.Parse(textBox3.Text); //количество шагов //double _h = Double.Parse(textBox4.Text); double k1, k2, k3, k4, l1, l2, l3, l4, _h = 0.02, y1, y2, x1, x2; zedGraphControl1.MasterPane.PaneList.Clear(); ZedGraph.GraphPane pane = new ZedGraph.GraphPane(); pane.CurveList.Clear(); ZedGraph.PointPairList list = new ZedGraph.PointPairList(); do { y0 = y0 + _h; k1 = _h * fvx(y0, x0); l1 = _h * fvy(y0, x0); k2 = _h * fvx(y0 + l1 / 2, x0 + k1 / 2); l2 = _h * fvy(y0 + l1 / 2, x0 + k1 / 2); x1 = x0 + (k1 + k2) / 2; y1 = y0 + (l1 + l2) / 2; x0 = x1; y0 = y1; listBox1.Items.Add(x1); listBox1.Items.Add(y1); list.Add(x1, y1); //i++; //printf("\n %lf", x1); //printf("\n %lf", y1); }while (y0 > 0.02); // ((y0 > -0.00001));//(x1 <= n); ZedGraph.LineItem MyCurve = pane.AddCurve("func", list, Color.Blue); zedGraphControl1.MasterPane.Add(pane); using (Graphics g = CreateGraphics()) { zedGraphControl1.MasterPane.SetLayout(g, ZedGraph.PaneLayout.ExplicitCol12); } zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
private void BuildRankCloud() { ZedGraph.ZedGraphControl zg1 = new ZedGraph.ZedGraphControl(); zg1.Dock = DockStyle.Fill; zg1.IsShowPointValues = true; ZedGraph.GraphPane pane = zg1.GraphPane; pane.Fill = new ZedGraph.Fill(Color.Azure, Color.FromArgb(230, 220, 250), 90); pane.Chart.Fill = new ZedGraph.Fill(Color.FromArgb(225, 220, 245), Color.LightCyan, -90); pane.Title.Text = "Rank Cloud"; pane.Title.FontSpec.Size = 18; pane.Title.FontSpec.FontColor = Color.Maroon; pane.Title.FontSpec.Family = "Segoe UI Semibold"; pane.Title.FontSpec.IsBold = false; pane.Legend.IsVisible = false; pane.XAxis.Title.Text = "Ranks"; pane.XAxis.Title.FontSpec.Family = "Courier New"; pane.XAxis.Title.FontSpec.FontColor = Color.Maroon; pane.XAxis.Title.FontSpec.IsBold = false; pane.YAxis.Title.Text = "Problems"; pane.YAxis.Title.FontSpec.Family = "Courier New"; pane.YAxis.Title.FontSpec.FontColor = Color.Navy; pane.YAxis.Title.FontSpec.IsBold = false; pane.YAxis.Type = ZedGraph.AxisType.Linear; ZedGraph.LineItem curve = pane.AddCurve("Ranks", _RankCount, Color.Black, ZedGraph.SymbolType.Circle); curve.Symbol.Fill = new ZedGraph.Fill(Color.LightCyan, Color.DarkTurquoise); curve.Symbol.Border.IsVisible = true; curve.Symbol.Size = 5; curve.Line.IsVisible = false; pane.AxisChange(); this.rankCloudTab.Controls.Clear(); this.rankCloudTab.Controls.Add(zg1); }
private void frmMain_Load(object sender, EventArgs e) { LoadSettings(); double[] x = { 0, 1, 2, 3 }; double[] y = { 0, 0, 0, 0 }; lineRoll = graphAttitude.GraphPane.AddCurve("Roll", x, y, Color.Red, ZedGraph.SymbolType.None); linePitch = graphAttitude.GraphPane.AddCurve("Pitch", x, y, Color.Blue, ZedGraph.SymbolType.None); graphAttitude.GraphPane.Title.Text = "Attitude"; graphAttitude.GraphPane.XAxis.Title.Text = "Samples"; graphAttitude.GraphPane.XAxis.Scale.Min = 0; graphAttitude.GraphPane.XAxis.Scale.Max = 100; graphAttitude.GraphPane.YAxis.Title.Text = "Degrees"; graphAttitude.GraphPane.YAxis.Scale.Min = -90; graphAttitude.GraphPane.YAxis.Scale.Max = 90; graphAttitude.GraphPane.AxisChange(); graphAttitude.Refresh(); }
bool ZedGraphControl_MouseDownEvent( ZedGraph.ZedGraphControl sender, MouseEventArgs e ) { if( CurrentGraphForm == null || !peakIntegrationMode.Checked || !CurrentGraphForm.ZedGraphControl.Focused ) return false; if( e.Button == MouseButtons.Left ) { if( integratePeaksLine != null ) { double distanceToMouseDownLocation = Math.Sqrt( Math.Pow( e.Location.X - integratePeaksMouseDownLocation.X, 2.0 ) + Math.Pow( e.Location.Y - integratePeaksMouseDownLocation.Y, 2.0 ) ); if( distanceToMouseDownLocation < 5.0 ) { ZedGraph.PointPair tmp = integratePeaksLine.Points[1].Clone(); integratePeaksLine.Points[1].X = integratePeaksLine.Points[0].X; integratePeaksLine.Points[1].Y = integratePeaksLine.Points[0].Y; integratePeaksLine.Points[0].X = tmp.X; integratePeaksLine.Points[0].Y = tmp.Y; Point tmp2 = integratePeaksMouseUpLocation; integratePeaksMouseUpLocation = integratePeaksMouseDownLocation; integratePeaksMouseDownLocation = tmp2; return false; } else { double distanceToMouseUpLocation = Math.Sqrt( Math.Pow( e.Location.X - integratePeaksMouseUpLocation.X, 2.0 ) + Math.Pow( e.Location.Y - integratePeaksMouseUpLocation.Y, 2.0 ) ); if( distanceToMouseUpLocation >= 5.0 ) { // clear existing line and start a new one CurrentGraphForm.ZedGraphControl.GraphPane.CurveList.Remove( integratePeaksLine ); integratePeaksLine = null; foreach( ZedGraph.PolyObj obj in integratePeaksAreas ) CurrentGraphForm.ZedGraphControl.GraphPane.GraphObjList.Remove( obj ); integratePeaksAreas.Clear(); CurrentGraphForm.ZedGraphControl.Refresh(); } else return false; } } integratePeaksMouseDownLocation = e.Location; double x = CurrentGraphForm.ZedGraphControl.GraphPane.XAxis.Scale.ReverseTransform( (float) e.X ); double y = CurrentGraphForm.ZedGraphControl.GraphPane.YAxis.Scale.ReverseTransform( (float) e.Y ); x = Math.Min( CurrentGraphForm.ZedGraphControl.GraphPane.XAxis.Scale.Max, Math.Max( CurrentGraphForm.ZedGraphControl.GraphPane.XAxis.Scale.Min, x ) ); y = Math.Min( CurrentGraphForm.ZedGraphControl.GraphPane.YAxis.Scale.Max, Math.Max( CurrentGraphForm.ZedGraphControl.GraphPane.YAxis.Scale.Min, y ) ); integratePeaksLine = new ZedGraph.LineItem( "", new double[] { x, x }, new double[] { y, y }, Color.Black, ZedGraph.SymbolType.None ); integratePeaksLine.Line.IsAntiAlias = true; integratePeaksLine.Symbol.Type = ZedGraph.SymbolType.Square; integratePeaksLine.Symbol.IsVisible = true; integratePeaksLine.Symbol.Border.Width = 2; integratePeaksLine.Symbol.Border.Color = Color.Black; //integratePeaksLine.Location.CoordinateFrame = ZedGraph.CoordType.AxisXYScale; CurrentGraphForm.ZedGraphControl.GraphPane.CurveList.Add( integratePeaksLine ); } return false; }
private void clearCurrentIntegration_Click( object sender, EventArgs e ) { if( integratePeaksLine != null ) { // clear existing line and start a new one CurrentGraphForm.ZedGraphControl.GraphPane.CurveList.Remove( integratePeaksLine ); integratePeaksLine = null; foreach( ZedGraph.PolyObj obj in integratePeaksAreas ) CurrentGraphForm.ZedGraphControl.GraphPane.GraphObjList.Remove( obj ); integratePeaksAreas.Clear(); CurrentGraphForm.ZedGraphControl.Refresh(); } CurrentGraphForm.CurrentGraphItem.TotalIntegratedArea = 0.0; /*int currentIndex = scanNumberComboBox.SelectedIndex; object currentObject = scanNumberComboBox.SelectedItem; scanNumberComboBox.Items.RemoveAt( currentIndex ); scanNumberComboBox.Items.Insert( currentIndex, currentObject );*/ }
private void clearAllIntegrationsToolStripMenuItem_Click( object sender, EventArgs e ) { if( integratePeaksLine != null ) { // clear existing line and start a new one CurrentGraphForm.ZedGraphControl.GraphPane.CurveList.Remove( integratePeaksLine ); integratePeaksLine = null; foreach( ZedGraph.PolyObj obj in integratePeaksAreas ) CurrentGraphForm.ZedGraphControl.GraphPane.GraphObjList.Remove( obj ); integratePeaksAreas.Clear(); CurrentGraphForm.ZedGraphControl.Refresh(); } /*scanNumberComboBox.BeginUpdate(); scanNumberComboBox.Items.Clear(); foreach( GraphItem graphItem in ( dataSourceComboBox.SelectedItem as DataSource ).CurrentGraphItems ) { graphItem.TotalIntegratedArea = 0.0; scanNumberComboBox.Items.Add( graphItem ); } scanNumberComboBox.EndUpdate(); scanNumberComboBox.Refresh();*/ }
public void DrawGraphs() { ZedGraph.GraphPane graphPane1 = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairs1 = new ZedGraph.PointPairList(); graphPane1.CurveList.Clear(); graphPane1.Title.Text = "График 1"; for (double x = 0; x <= 1; x += 0.01) { pointPairs1.Add(x, Function1(x)); } ZedGraph.LineItem lineItemResult1 = graphPane1.AddCurve("График 1", pointPairs1, Color.Red, ZedGraph.SymbolType.None); graphPane1.XAxis.Scale.Min = 0; graphPane1.XAxis.Scale.Max = 1; graphPane1.YAxis.Scale.Min = 0; graphPane1.YAxis.Scale.Max = 1; zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); ZedGraph.GraphPane graphPane2 = zedGraphControl2.GraphPane; ZedGraph.PointPairList pointPairs2 = new ZedGraph.PointPairList(); graphPane2.CurveList.Clear(); graphPane2.Title.Text = "График 2"; for (double x = 0; x <= 1; x += 0.01) { pointPairs2.Add(x, Function2(x)); } ZedGraph.LineItem lineItemResult2 = graphPane2.AddCurve("График 2", pointPairs2, Color.Red, ZedGraph.SymbolType.None); graphPane2.XAxis.Scale.Min = 0; graphPane2.XAxis.Scale.Max = 1; graphPane2.YAxis.Scale.Min = 0; graphPane2.YAxis.Scale.Max = 1; zedGraphControl2.AxisChange(); zedGraphControl2.Invalidate(); ZedGraph.GraphPane graphPane3 = zedGraphControl3.GraphPane; ZedGraph.PointPairList pointPairs3 = new ZedGraph.PointPairList(); graphPane3.CurveList.Clear(); graphPane3.Title.Text = "График 3"; for (double x = 0; x <= 1; x += 0.01) { pointPairs3.Add(x, Function3(x)); } ZedGraph.LineItem lineItemResult3 = graphPane3.AddCurve("График 3", pointPairs3, Color.Red, ZedGraph.SymbolType.None); graphPane3.XAxis.Scale.Min = 0; graphPane3.XAxis.Scale.Max = 1; graphPane3.YAxis.Scale.Min = 0; graphPane3.YAxis.Scale.Max = 1; zedGraphControl3.AxisChange(); zedGraphControl3.Invalidate(); }
private void frmMain_Load(object sender, EventArgs e) { LoadSettings(); double[] x = { 0, 1, 2, 3 }; double[] y = { 0,0,0,0 }; lineRoll = graphAttitude.GraphPane.AddCurve("Roll", x, y, Color.Red, ZedGraph.SymbolType.None); linePitch = graphAttitude.GraphPane.AddCurve("Pitch", x, y, Color.Blue, ZedGraph.SymbolType.None); graphAttitude.GraphPane.Title.Text = "Attitude"; graphAttitude.GraphPane.XAxis.Title.Text = "Samples"; graphAttitude.GraphPane.XAxis.Scale.Min = 0; graphAttitude.GraphPane.XAxis.Scale.Max = 100; graphAttitude.GraphPane.YAxis.Title.Text = "Degrees"; graphAttitude.GraphPane.YAxis.Scale.Min = -90; graphAttitude.GraphPane.YAxis.Scale.Max = 90; graphAttitude.GraphPane.AxisChange(); graphAttitude.Refresh(); }
public void Calculate(string str) { Random random = new Random(); //----------------------------------------ЗАПОЛНЕНИЕ МАТРИЦ #region ЗАПОЛНЕНИЕ МАТРИЦ KritAlts = new List <double[, ]>(); if (str == "example") { KritAlts.Add(new double[, ] { { 1, 3, 2 }, { 0.33, 1, 0.33 }, { 0.5, 3, 1 } }); KritAlts.Add(new double[, ] { { 1, 0.25, 6 }, { 4, 1, 5 }, { 0.16, 0.2, 1 } }); KritAlts.Add(new double[, ] { { 1, 0.33, 2 }, { 3, 1, 5 }, { 0.5, 0.2, 1 } }); KritCompares = new double[, ] { { 1, 2, 3 }, { 0.5, 1, 4 }, { 0.33, 0.25, 1 } }; } else { double[,] krits = new double[AltsCount, AltsCount]; for (int count = 0; count < AltsCount; count++) { krits = new double[AltsCount, AltsCount]; for (int i = 0; i < AltsCount; i++) { for (int j = 0; j < AltsCount; j++) { if (i == j) { krits[i, j] = 1; } else if (i < j) { int ch = random.Next(2); if (ch == 0) { krits[i, j] = random.Next(1, 6); } else { krits[i, j] = random.NextDouble(); } } else { krits[i, j] = 1 / krits[j, i]; } } } KritAlts.Add(krits); } KritCompares = new double[KritsCount, KritsCount]; for (int i = 0; i < KritsCount; i++) { for (int j = 0; j < KritsCount; j++) { if (i == j) { KritCompares[i, j] = 1; } else if (i < j) { int ch = random.Next(2); if (ch == 0) { KritCompares[i, j] = random.Next(1, 6); } else { KritCompares[i, j] = random.NextDouble(); } } else { KritCompares[i, j] = 1 / KritCompares[j, i]; } } } } #region Вывод матриц foreach (double[,] d in KritAlts) { string strn = "Сравнение алтернатив по критериям\r\n"; for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { strn += $"{d[i, j]:0.00}\t"; } strn += "\r\n"; } MessageBox.Show(strn); } string strnK = "Сравнение критериев\r\n"; for (int i = 0; i < KritCompares.GetLength(0); i++) { for (int j = 0; j < KritCompares.GetLength(1); j++) { strnK += $"{KritCompares[i, j]:0.00}\t"; } strnK += "\r\n"; } MessageBox.Show(strnK); #endregion #endregion //---------------------------------РАСЧЁТ МАТРИЦ #region АСЧЁТ МАТРИЦ KritNormals = new List <double[]>(); foreach (double[,] d in KritAlts) { double Sum = 0; double[] sums = new double[d.GetLength(0)]; for (int i = 0; i < d.GetLength(0); i++) { double rowSum = 0; for (int j = 0; j < d.GetLength(1); j++) { rowSum += d[i, j]; } sums[i] = rowSum; Sum += rowSum; } for (int i = 0; i < sums.Length; i++) { sums[i] /= Sum; } KritNormals.Add(sums); #region Вывод нормированных критериев string ts1 = $"Общая сумма: {Sum:0.00}\r\n"; foreach (double db in sums) { ts1 += $"{db:0.00}\t"; } MessageBox.Show(ts1); #endregion } double sumsWeights = 0; KritWeigths = new double[KritsCount]; for (int i = 0; i < KritCompares.GetLength(0); i++) { double Sum = 0; for (int j = 0; j < KritCompares.GetLength(1); j++) { Sum += KritCompares[i, j]; } KritWeigths[i] = Sum; sumsWeights += Sum; } for (int i = 0; i < KritWeigths.Length; i++) { KritWeigths[i] /= sumsWeights; } #region Вывод весов string ts2 = $"Веса критериев, общая сумма: {sumsWeights:0.00}\r\n"; foreach (double d in KritWeigths) { ts2 += $"{d:0.00}\t"; } MessageBox.Show(ts2); #endregion #endregion //----------------------------------РАСЧЁТ ФУНКЦИЙ ПОЛЕЗНОСТИ И ЦЕН #region АСЧЁТ ФУНКЦИЙ ПОЛЕЗНОСТИ И ЦЕН Functions = new double[AltsCount]; MessageBox.Show("РАСЧЁТ ФУНКЦИЙ ПОЛЕЗНОСТИ"); for (int i = 0; i < AltsCount; i++) { double sum = 0; for (int normals = 0; normals < KritNormals.Count; normals++) { double res = KritNormals[normals][i] * KritWeigths[normals]; sum += res; MessageBox.Show($"RES: {res:0.00}; FIRST: {KritNormals[normals][i]:0.00}; SECOND: {KritWeigths[normals]:0.00}"); } Functions[i] = sum; MessageBox.Show($"Альтернатива {i + 1} : {sum:0.000}"); } if (str == "example") { Prices = new int[] { 10000, 15000, 8000 }; } else { Prices = new int[AltsCount]; for (int i = 0; i < AltsCount; i++) { Prices[i] = random.Next(5000, 20000); } } #region Вывод цен string ts3 = "Цены\r\n"; foreach (int i in Prices) { ts3 += $"{i}\t"; } ts3 += $"\r\nОбщая сумма: {Prices.Sum():0.00}"; MessageBox.Show(ts3); #endregion #endregion PricesNorm = new double[AltsCount]; for (int i = 0; i < AltsCount; i++) { double PricesSum = Prices.Sum(); double pr = Prices[i]; PricesNorm[i] = pr / PricesSum; MessageBox.Show($"Нормаль цены {i + 1} : {PricesNorm[i]:0.000}"); } Alters = new List <Alternatives>(); risks = new List <Risks>(); for (int i = 0; i < AltsCount; i++) { double cmpr = Functions[i] / PricesNorm[i]; Alters.Add(new Alternatives() { Compare = cmpr, Name = $"Альтернатива {i + 1}" }); double rk = Function1(PricesNorm[i]) + Function2(PricesNorm[i]) + Function3(PricesNorm[i]); risks.Add(new Risks() { Compare = rk, Name = $"Альтернатива {i + 1}" }); ZedGraph.GraphPane graphPane1 = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairs = new ZedGraph.PointPairList(); pointPairs.Add(PricesNorm[i], 0); pointPairs.Add(PricesNorm[i], Function1(PricesNorm[i])); pointPairs.Add(0, Function1(PricesNorm[i])); ZedGraph.LineItem lineItemResult1 = graphPane1.AddCurve($"Альтернатива {i + 1}", pointPairs, Color.Blue, ZedGraph.SymbolType.None); zedGraphControl1.Invalidate(); ZedGraph.GraphPane graphPane2 = zedGraphControl2.GraphPane; ZedGraph.PointPairList pointPairs2 = new ZedGraph.PointPairList(); pointPairs2.Add(PricesNorm[i], 0); pointPairs2.Add(PricesNorm[i], Function2(PricesNorm[i])); pointPairs2.Add(0, Function2(PricesNorm[i])); ZedGraph.LineItem lineItemResult2 = graphPane2.AddCurve($"Альтернатива {i + 1}", pointPairs2, Color.Green, ZedGraph.SymbolType.None); zedGraphControl2.Invalidate(); ZedGraph.GraphPane graphPane3 = zedGraphControl3.GraphPane; ZedGraph.PointPairList pointPairs3 = new ZedGraph.PointPairList(); pointPairs3.Add(PricesNorm[i], 0); pointPairs3.Add(PricesNorm[i], Function3(PricesNorm[i])); pointPairs3.Add(0, Function3(PricesNorm[i])); ZedGraph.LineItem lineItemResult3 = graphPane3.AddCurve($"Альтернатива {i + 1}", pointPairs3, Color.Purple, ZedGraph.SymbolType.None); zedGraphControl3.Invalidate(); } Alters.Sort(delegate(Alternatives a1, Alternatives a2) { if (a1.Compare > a2.Compare) { return(-1); } else if (a1.Compare < a2.Compare) { return(1); } else { return(0); } }); risks.Sort(delegate(Risks a1, Risks a2) { if (a1.Compare > a2.Compare) { return(-1); } else if (a1.Compare < a2.Compare) { return(1); } else { return(0); } }); string answer = "Ответ:\r\n"; foreach (Alternatives al in Alters) { answer += al.ToString() + "\r\n"; } answer += "\r\n"; foreach (Risks r in risks) { answer += r.ToString() + "\r\n"; } MessageBox.Show(answer); }
private void CoreEnvelopeCutForm_Load(object sender, EventArgs e) { 剪裁方式ToolStripMenuItem.SelectedIndex = nSelIndex; if (zedCutCoreEnvelopeLine == null) { for (int i = 0; i < 4; ++i) { zedCutCoreEnvelopeLine = new ZedGraph.LineItem(zedTitle[i]); zedCutCoreEnvelopeLine.Color = zedLineColor[i]; zedCutCoreEnvelopeLine.Line.Width = zedLineWidth[i]; zedCutCoreEnvelopeLine.Symbol.Type = zedLineSymType[i]; zedCutCoreEnvelopeLine.Symbol.Fill.Type = zedLineFillType[i]; zedGraphControlCoreEnvelope.GraphPane.CurveList.Add(zedCutCoreEnvelopeLine); } } if (bEditProject) { DesignName = data.cutResultName; 剪裁方式ToolStripMenuItem.Enabled = false; 剪裁ToolStripMenuItem.Enabled = true; UpdateCoreEnvelopeData(); foreach (CorePointData cpd in data.lstCutEnvelopeCore) { zedCutCoreEnvelopeLine.AddPoint(cpd.pointXValue, cpd.pointYValue); } UpdateEvaluation(); } }
private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { string sourcePath = null; string sourceType = null; int runIndex = 0; if (listView.SelectedItems.Count > 0) { List <string> dataSourceList = new List <string>(); foreach (ListViewItem item in listView.SelectedItems) { var sourceInfo = item.Tag as SourceInfo; if (sourceInfo != null) { dataSourceList.Add(sourceInfo.path.ToString()); sourcePath = sourceInfo.path.Filepath; sourceType = sourceInfo.type; runIndex = sourceInfo.path.RunIndex; } else { dataSourceList.Add(item.SubItems[0].Text); sourcePath = Path.Combine(CurrentDirectory, sourcePathTextBox.Text); sourceType = getSourceType(sourcePath); } } sourcePathTextBox.Text = $"\"{String.Join("\" \"", dataSourceList.ToArray())}\""; } ticGraphControl.GraphPane.GraphObjList.Clear(); ticGraphControl.GraphPane.CurveList.Clear(); if (listView.SelectedItems.Count != 1) { ticGraphControl.Visible = false; return; } if (!String.IsNullOrEmpty(sourceType) && sourceType != "File Folder") { using (MSData msd = new MSData()) { ReaderList.FullReaderList.read(sourcePath, msd, runIndex, SpectrumSource.GetReaderConfig()); using (ChromatogramList cl = msd.run.chromatogramList) { if (cl != null && !cl.empty() && cl.find("TIC") != cl.size()) { ticGraphControl.Visible = true; pwiz.CLI.msdata.Chromatogram tic = cl.chromatogram(cl.find("TIC"), true); Map <double, double> sortedFullPointList = new Map <double, double>(); IList <double> timeList = tic.binaryDataArrays[0].data; IList <double> intensityList = tic.binaryDataArrays[1].data; int arrayLength = timeList.Count; for (int i = 0; i < arrayLength; ++i) { sortedFullPointList[timeList[i]] = intensityList[i]; } ZedGraph.PointPairList points = new ZedGraph.PointPairList( new List <double>(sortedFullPointList.Keys).ToArray(), new List <double>(sortedFullPointList.Values).ToArray()); ZedGraph.LineItem item = ticGraphControl.GraphPane.AddCurve("TIC", points, Color.Black, ZedGraph.SymbolType.None); item.Line.IsAntiAlias = true; ticGraphControl.AxisChange(); ticGraphControl.Refresh(); } else { ticGraphControl.Visible = false; } } } } else { ticGraphControl.Visible = false; } }
/// <summary> /// Main loop for testing extrema algorithm. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer1_Tick_1(object sender, EventArgs e) { zedGraph.GraphPane.CurveList.Clear(); // Create maxima/minima finder SignalProcessing.LocalExtremaDetection maxMinDetect = new SignalProcessing.LocalExtremaDetection(); // Set search window size based on UI try { maxMinDetect.SetSearchWindowRadius(Convert.ToInt32(textBoxSearchWindowRadius.Text)); } catch { maxMinDetect.SetSearchWindowRadius(0); } // Enable thresholding if (checkBoxEnableThresholding.Checked == true) { maxMinDetect.EnableThresholding(true); } else { maxMinDetect.EnableThresholding(false); } // Set threshold dataIList based on UI try { maxMinDetect.SetThreshold(Convert.ToDouble(textBoxThresholdValue.Text)); } catch { maxMinDetect.SetThreshold(0.0); } if (checkBoxEnableAlternateExtremaRule.Checked) { maxMinDetect.EnforceAlternateExtrema(true); } else { maxMinDetect.EnforceAlternateExtrema(false); } int maxMinCounter = 0; int maxMinResetIndex = 0; // Loop through each data point for a particular capacitance channel, adding series ZedGraph.PointPairList pointPairList = new ZedGraph.PointPairList(); int filterLength; try { filterLength = Convert.ToInt32(textBoxFirFilterLength.Text); } catch { filterLength = 1; } // Filter List <double> filteredDataList = SignalProcessing.Averaging.MovingAverage(dataList.ToArray(), filterLength).ToList <double>(); // Get most recent numberOfPointsToPlot amount of data from the table for (int x = 0; x < dataList.Count; x++) { ZedGraph.PointPair pointPair = new ZedGraph.PointPair(); pointPair.X = (double)x; // Get capacitance pointPair.Y = filteredDataList[x]; //pointPair.Y = dataTable.Rows[x].Field<int>(dataNames[y-1]); pointPairList.Add(pointPair); } // Add line to graph with legend name ZedGraph.LineItem lineItem = zedGraph.GraphPane.AddCurve("Test data", pointPairList, Color.Blue); // Find local extrema labelNumExtrema.Text = Convert.ToString(maxMinDetect.FindLocalExtrema(filteredDataList)); // Retrieve indecies of extrema List <int> maxima = maxMinDetect.GetMaxima(); List <int> minima = maxMinDetect.GetMinima(); // Add maxima markers for (int i = 0; i < maxima.Count(); i++) { ZedGraph.LineItem line = new ZedGraph.LineItem("Point", new double[] { maxima[i] }, new double[] { filteredDataList[maxima[i]] }, Color.Black, ZedGraph.SymbolType.TriangleDown); line.Symbol.Size = 20; // Colour the same as the line line.Symbol.Fill = new ZedGraph.Fill(Color.Green); // Don't draw label on legend line.Label.IsVisible = false; // Add marker to graph zedGraph.GraphPane.CurveList.Add(line); } // Add minima markers for (int i = 0; i < minima.Count(); i++) { ZedGraph.LineItem line = new ZedGraph.LineItem("Point", new double[] { minima[i] }, new double[] { filteredDataList[minima[i]] }, Color.Black, ZedGraph.SymbolType.Triangle); line.Symbol.Size = 20; // Colour the same as the line line.Symbol.Fill = new ZedGraph.Fill(Color.Green); // Don't draw label on legend line.Label.IsVisible = false; // Add marker to graph zedGraph.GraphPane.CurveList.Add(line); } zedGraph.AxisChange(); this.SetBasicGraphColours(zedGraph, Color.Black, Color.White); // Re-draw graph zedGraph.Invalidate(); }
private void addPlot(DataTable plotData, Color lineColor, string Title, double NoDV, double upBnd, double lBnd, int yearstoadd=0, bool isY2Axis = false ) { int numRows = plotData.Rows.Count; ZedGraph.PointPairList ptList; //collection of points for the Time Series line ZedGraph.LineItem tsCurve; //Line object -> Time Series line that is added to the plot DateTime curDate; //Date of the current item -> x-value for the current point double? curValue; //Value of the curren item -> y-value for the current point ptList = new ZedGraph.PointPairList(); for (int i = 0; i <= numRows - 1; i++) { try { curDate = ((DateTime)plotData.Rows[i].ItemArray[3]).AddYears(yearstoadd);//["LocalDateTime"]; try { curValue = (double)plotData.Rows[i].ItemArray[4];//["DataValue"]; //if value should not be plotted set it to null if (curValue == NoDV || curValue < lBnd ||curValue > upBnd ) { curValue = null; ptList.Add(curDate.ToOADate(), curValue ?? double.NaN); } else ptList.Add(curDate.ToOADate(), curValue.Value); } catch (Exception ex) { curValue = null; ptList.Add(curDate.ToOADate(), curValue ?? double.NaN); } } catch (Exception ex){ } } //don't draw line if datavalues have been deleted( where gap is greater than 1 day) clsRemoveDataGaps.missingValues(ref ptList); List<object> tmplist = plotData.AsEnumerable().Select(x => x["DataValue"]).Distinct().ToList(); //get a list of all sections of code we dontwant to plot. > 1 day of the same data values foreach (clsInterval inter in clsRemoveDataGaps.calcGaps(ref tmplist, ref ptList)) { for (int j = inter.Start; j < inter.End; j++) { ptList[j].Y = double.NaN; } } tsCurve = new ZedGraph.LineItem(Title); tsCurve = gPane.AddCurve(Title, ptList, lineColor, ZedGraph.SymbolType.None); tsCurve.Line.Width = 5; if(isY2Axis) tsCurve.IsY2Axis = true; }
private void ПосчитатьсвоиТочкиToolStripMenuItem_Click(object sender, EventArgs e) { CountPoints countPoints = new CountPoints(); countPoints.ShowDialog(); if (countPoints.Ready) { ZedGraph.GraphPane graphPaneStart = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairsStart = new ZedGraph.PointPairList(); graphPaneStart.CurveList.Clear(); graphPaneStart.Title.Text = "Заданные значениия"; double xSum = 0d; double ySum = 0d; double xySum = 0d; double xSqSum = 0d; for (int i = 0; i < countPoints.Count; i++) { AddingPoint addingPoint = new AddingPoint(); addingPoint.ShowDialog(); if (addingPoint.Drop) { MessageBox.Show("Ввод данных прерван!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (addingPoint.Ready) { double x = addingPoint.X; double y = addingPoint.Y; pointPairsStart.Add(x, y); xSum += x; ySum += y; xySum += x * y; xSqSum += x * x; if (first) { first = false; min = max = x; minY = maxY = y; } else { if (x < min) { min = x; } if (x > max) { max = x; } if (y < minY) { minY = y; } if (y > maxY) { maxY = y; } } } } double a = (pointPairsStart.Count * xySum - xSum * ySum) / (pointPairsStart.Count * xSqSum - xSum * xSum); double b = (ySum - a * xSum) / pointPairsStart.Count; koefaTB.Text = a.ToString("0.0######"); koefbTB.Text = b.ToString("0.0#"); ZedGraph.GraphPane graphPaneResult = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairsResult = new ZedGraph.PointPairList(); graphPaneResult.XAxis.Scale.Min = min; graphPaneResult.XAxis.Scale.Max = max; if (min > 0) { min = 0; graphPaneResult.XAxis.Scale.Min = 0; } if (minY > 0) { minY = 0; graphPaneResult.YAxis.Scale.Min = 0; } for (double x = min; x <= max; x++) { pointPairsResult.Add(x, a * x + b); } if (max > maxY) { graphPaneResult.XAxis.Scale.Max = max; graphPaneResult.YAxis.Scale.Max = max; } else { graphPaneResult.XAxis.Scale.Max = maxY; graphPaneResult.YAxis.Scale.Max = maxY; } if (min < minY) { graphPaneResult.XAxis.Scale.Min = min; graphPaneResult.YAxis.Scale.Min = min; } else { graphPaneResult.XAxis.Scale.Min = minY; graphPaneResult.YAxis.Scale.Min = minY; } this.Size = new Size(568, 702); ZedGraph.LineItem lineItemResult = graphPaneResult.AddCurve("Линейная аппроксимация", pointPairsResult, Color.Red, ZedGraph.SymbolType.None); ZedGraph.LineItem lineItemStart = graphPaneStart.AddCurve("Заданные значения", pointPairsStart, Color.Blue, ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); } }
void Draw() { if (minTB.Text != "") { try { xmin = Convert.ToDouble(minTB.Text); } catch { MessageBox.Show("Задан неверный формат числа для минимума!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); minTB.Text = ""; return; } } if (maxTB.Text != "") { try { xmax = Convert.ToDouble(maxTB.Text); } catch { MessageBox.Show("Задан неверный формат числа для максимума!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); maxTB.Text = ""; return; } } if (stepTB.Text != "") { try { step = Convert.ToDouble(stepTB.Text); } catch { MessageBox.Show("Задан неверный формат числа для шага!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); stepTB.Text = ""; return; } } ZedGraph.GraphPane graphPane2 = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairs2 = new ZedGraph.PointPairList(); graphPane2.CurveList.Clear(); graphPane2.Title.Text = "Случайные значениия"; double xSum = 0d; double ySum = 0d; double xySum = 0d; double xSqSum = 0d; for (double x = xmin; x <= xmax; x += step) { double y = Random.NextDouble() + Random.Next(0, 10); pointPairs2.Add(x, y); xSum += x; ySum += y; xySum += x * y; xSqSum += x * x; } ZedGraph.LineItem lineItem2 = graphPane2.AddCurve("Случайные значения", pointPairs2, Color.Red, ZedGraph.SymbolType.None); double a = (pointPairs2.Count * xySum - xSum * ySum) / (pointPairs2.Count * xSqSum - xSum * xSum); double b = (ySum - a * xSum) / pointPairs2.Count; koefaTB.Text = a.ToString("0.0######"); koefbTB.Text = b.ToString("0.00"); ZedGraph.GraphPane graphPane3 = zedGraphControl1.GraphPane; ZedGraph.PointPairList pointPairs3 = new ZedGraph.PointPairList(); for (double x = xmin; x <= xmax; x++) { pointPairs3.Add(x, a * x + b); } ZedGraph.LineItem lineItem3 = graphPane3.AddCurve("Линейная аппроксимация", pointPairs3, Color.Purple, ZedGraph.SymbolType.None); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); }
private void UpdateCoreEnvelopeData() { if (data.lstBasicCoreEnvelope != null && data.lstBasicCoreEnvelope.Count > 0) { if (discreteset.nCircularPtCount < data.lstBasicCoreEnvelope.Count) { discreteset.nCircularPtCount = data.lstBasicCoreEnvelope.Count; } if (!BeClockWiseRotate(data.lstBasicCoreEnvelope)) { data.lstBasicCoreEnvelope.Reverse(); } fMaxWeight = data.lstBasicCoreEnvelope.Max(bce => bce.pointYValue); if (zedBasicCoreEnvelopeLine != null) { zedGraphControlCoreEnvelope.GraphPane.CurveList.Remove(zedBasicCoreEnvelopeLine); } zedBasicCoreEnvelopeLine = AddCurveToZedGraph1(zedGraphControlCoreEnvelope, "", data.lstBasicCoreEnvelope); DiscreteCore(); if (nSelIndex == 0) { ResetFuelList(); } zedGraphControlCoreEnvelope.AxisChange(); zedGraphControlCoreEnvelope.Refresh(); } }
private void LoadGraph() { if (lineProductionDatas.Count <= 0) { MessageBox.Show("Unable to load data from server.", "Line efficiency daily graph", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var bufferList = new List <ArticleProductionData>(); var pane = new ZedGraph.GraphPane(); pane.Title.Text = "EFF con " + Line + " (" + Department + ")"; pane.YAxis.Title.Text = "EFF %"; pane.XAxis.Title.Text = Month.ToString() + "/" + Year.ToString(); pane.XAxis.MajorTic.IsAllTics = true; pane.XAxis.Scale.MajorStep = 1; pane.XAxis.Scale.Min = 1; pane.XAxis.Scale.Max = 31; pane.Fill = new ZedGraph.Fill(Brushes.WhiteSmoke); ZedGraph.PointPairList list = new ZedGraph.PointPairList(); foreach (var lineProduction in lineProductionDatas) { var workEff = Math.Round((lineProduction.Qty / lineProduction.Producibili) * 100.0, 1); list.Add(lineProduction.Datex.Day, workEff); } pane.GraphObjList.Clear(); zedGraph.GraphPane.CurveList.Clear(); var curve = new ZedGraph.LineItem("EFF %", list, Color.SteelBlue, ZedGraph.SymbolType.Circle); curve.Line.IsVisible = true; curve.Symbol.Fill.Color = Color.SteelBlue; curve.Symbol.Fill.Type = ZedGraph.FillType.Solid; curve.Symbol.Size = 10; curve.Line.Width = 4; curve.Symbol.IsAntiAlias = true; curve.Line.IsSmooth = false; curve.Line.IsAntiAlias = true; curve.Line.Fill = new ZedGraph.Fill(Color.White, Color.LightSkyBlue, -45F); curve.Symbol.Size = 8.0F; curve.Symbol.Fill = new ZedGraph.Fill(Color.White); curve.Line.Width = 2.0F; pane.XAxis.MajorTic.IsBetweenLabels = true; pane.Chart.Fill = new ZedGraph.Fill(Color.White, Color.FromArgb(250, 250, 250), 90F); pane.Fill = new ZedGraph.Fill(Color.FromArgb(250, 250, 250)); zedGraph.GraphPane = pane; pane.Legend.IsVisible = false; ZedGraph.PointPairList articleRangeList = new ZedGraph.PointPairList(); ZedGraph.LineItem articleVertCurve = new ZedGraph.LineItem(""); for (var i = 0; i <= curve.Points.Count - 1; i++) { ZedGraph.PointPair pt = curve.Points[i]; ZedGraph.TextObj text = new ZedGraph.TextObj(pt.Y.ToString("f1"), pt.X, pt.Y, ZedGraph.CoordType.AxisXYScale, ZedGraph.AlignH.Left, ZedGraph.AlignV.Center); text.ZOrder = ZedGraph.ZOrder.D_BehindAxis; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; text.FontSpec.Angle = 90; pane.GraphObjList.Add(text); var art = articleProductions.LastOrDefault(x => x.Day == pt.X); var buf = bufferList.FirstOrDefault(x => x.Article == art.Article || x.Day == art.Day); if (art != null && buf == null) { bufferList.Add(art); ZedGraph.TextObj textArt = new ZedGraph.TextObj(art.Article, pt.X + 0.2f, pane.YAxis.Scale.Min + pt.Y / 2, ZedGraph.CoordType.AxisXYScale, ZedGraph.AlignH.Left, ZedGraph.AlignV.Center); textArt.ZOrder = ZedGraph.ZOrder.D_BehindAxis; textArt.FontSpec.Border.IsVisible = false; textArt.FontSpec.Fill.IsVisible = false; textArt.FontSpec.Size = 9; textArt.FontSpec.FontColor = Color.Black; var lastArt = articleProductions.LastOrDefault(x => x.Day == pt.X - 1); var nextArt = articleProductions.FirstOrDefault(x => x.Day == pt.X + 2); if (lastArt != null && lastArt.Article != art.Article || nextArt != null && nextArt.Article != art.Article) { textArt.FontSpec.Angle = 90; } else { textArt.FontSpec.Angle = 0; } pane.GraphObjList.Add(textArt); articleRangeList = new ZedGraph.PointPairList(); articleRangeList.Add(pt.X, pt.Y); articleRangeList.Add(pt.X, pane.YAxis.Scale.Min); var ac = new ZedGraph.LineItem(art.Article); ac.Line.Style = System.Drawing.Drawing2D.DashStyle.Dot; ac = pane.AddCurve(art.Article, articleRangeList, Color.Orange, ZedGraph.SymbolType.None); } } zedGraph.GraphPane.CurveList.Add(curve); zedGraph.AxisChange(); zedGraph.Refresh(); zedGraph.IsShowPointValues = true; zedGraph.PointValueFormat = "0"; zedGraph.Invalidate(); }
void OnUpdateTarget(GXDLMSObject value) { m_Target = (GXDLMSProfileGeneric)value; m_MyPane.GraphPane.CurveList.Clear(); GXDLMSObject obj; int index = 0; if (m_Target != null) { m_MyPane.GraphPane.Title.Text = m_Target.Description; DataTable table = ProfileGenericView.DataSource as DataTable; ProfileGenericView.DataSource = null; ProfileGenericView.Columns.Clear(); DataTable dt = new DataTable(); foreach (var it in m_Target.CaptureObjects) { DataColumn dc = dt.Columns.Add(index.ToString()); dc.Caption = it.Key.Description; int pos = ProfileGenericView.Columns.Add(index.ToString(), it.Key.Description); ProfileGenericView.Columns[pos].DataPropertyName = index.ToString(); ++index; } foreach (object[] it in m_Target.Buffer) { dt.LoadDataRow(it, true); } ProfileGenericView.DataSource = dt; if (m_Target.CaptureObjects.Count != 0 && m_Target.CaptureObjects[0].Value.AttributeIndex != 0) { //We can show graph only tables that are date based. if (m_Target.CaptureObjects[0].Key.GetUIDataType(m_Target.CaptureObjects[0].Value.AttributeIndex) == DataType.DateTime) { for (int col = 0; col < m_Target.CaptureObjects.Count; ++col) { //Do not shown Status' or Events index = m_Target.CaptureObjects[col].Value.AttributeIndex; if (index > 0 && ((index & 0x8) != 0 || (m_Target.CaptureObjects[col].Value.AttributeIndex & 0x10) != 0)) { continue; } obj = m_Target.CaptureObjects[col].Key; GXGraphItem item = GraphItems.Find(obj.LogicalName, index); if (item != null && item.Enabled && GXHelpers.IsNumeric(obj.GetUIDataType(index))) { ZedGraph.DataSourcePointList dspl = new ZedGraph.DataSourcePointList(); dspl.DataSource = m_Target.Buffer; dspl.XDataMember = m_Target.CaptureObjects[0].Key.Description; dspl.YDataMember = obj.Description; ZedGraph.LineItem myCurve = m_MyPane.GraphPane.AddCurve(obj.Description, dspl, item.Color); } } m_MyPane.GraphPane.XAxis.Title.Text = m_Target.CaptureObjects[0].Key.LogicalName; // Tell ZedGraph to refigure the axes since the data have changed m_MyPane.AxisChange(); } } } else { ProfileGenericView.DataSource = null; } //Set initial values... ReadFromRB.Enabled = ReadLastRB.Enabled = ReadEntryBtn.Enabled = m_Target.CaptureObjects.Count != 0; ReadFromRB.Checked = ReadLastRB.Checked = ReadEntryBtn.Checked = false; StartEntry.Value = 0; EndEntry.Value = 1; ReadLastTB.Value = 0; StartPick.Value = ToPick.Value = DateTime.Now; if (!ReadFromRB.Enabled) { return; } index = m_Target.CaptureObjects[0].Value.AttributeIndex; obj = m_Target.CaptureObjects[0].Key; if (index != 0 && obj.GetUIDataType(index) != DataType.DateTime) { ReadFromRB.Enabled = ReadLastRB.Enabled = false; m_Target.AccessSelector = AccessRange.Entry; m_Target.From = 0; m_Target.To = 1; } else { ReadFromRB.Enabled = ReadLastRB.Enabled = true; } if (m_Target.AccessSelector == AccessRange.Entry) { StartEntry.Value = Convert.ToInt32(m_Target.From); EndEntry.Value = Convert.ToInt32(m_Target.To); ReadEntryBtn.Checked = true; } else if (m_Target.AccessSelector == AccessRange.Last) { TimeSpan diff = (DateTime)m_Target.To - (DateTime)m_Target.From; ReadLastTB.Value = diff.Days - 1; ReadLastRB.Checked = true; } else { if ((DateTime)m_Target.From == DateTime.MinValue) { StartPick.Checked = false; } else { StartPick.Value = (DateTime)m_Target.From; } if ((DateTime)m_Target.To == DateTime.MaxValue) { ToPick.Checked = false; } else { ToPick.Value = (DateTime)m_Target.To; } ReadFromRB.Checked = true; } }
private void DesenhaPerfil() { zedPerfil.GraphPane.CurveList.Clear(); zedPerfil.GraphPane.GraphObjList.Clear(); double h = (double)numH.Value; double[] sols = AreaPerimeter.Solve(lstProfile, h); if (sols.Length % 2 == 0) { double[] start = new double[sols.Length >> 1]; double[] stop = new double[sols.Length >> 1]; double totalLength = 0; for (int k = 0; k < sols.Length; k += 2) { start[k >> 1] = sols[k]; stop[k >> 1] = sols[k + 1]; totalLength += sols[k + 1] - sols[k]; double[] xx = new double[] { sols[k], sols[k + 1] }; double[] yy = new double[] { h, h }; //ZedGraph.LineItem li3 = zedPerfil.GraphPane.AddCurve(k == 0 ? "Nível de água" : "", xx, yy, Color.LightBlue, ZedGraph.SymbolType.None); ZedGraph.LineItem li3 = zedPerfil.GraphPane.AddCurve(k == 0 ? "Water level" : "", xx, yy, Color.LightBlue, ZedGraph.SymbolType.None); li3.Line.Width = 3; } double p2; double area = AreaPerimeter.GetArea(lstProfile, h, start, stop, out p2); lblArea.Text = Math.Round(area, 3).ToString(); lblPerim.Text = Math.Round(p2, 3).ToString(); lblSurfLen.Text = Math.Round(totalLength, 3).ToString(); } #region Graficos double[] x = lstProfile.Keys.ToArray(); double[] y = lstProfile.Values.ToArray(); ZedGraph.LineItem li = zedPerfil.GraphPane.AddCurve("", x, y, Color.SandyBrown); li.Line.Width = 3; double[] xNivel = new double[] { 10, 20 }; double[] yNivel = new double[] { -1, -1 }; //ZedGraph.LineItem li2 = zedPerfil.GraphPane.AddCurve("", xNivel, yNivel, Color.LightBlue); //, ZedGraph.SymbolType.None); //li2.Line.Fill = new ZedGraph.Fill(Color.Blue, Color.Blue, 45F); List <ZedGraph.PointD> lstPt = new List <ZedGraph.PointD>(); lstPt.Add(new ZedGraph.PointD(2, -1)); lstPt.Add(new ZedGraph.PointD(8, -1)); lstPt.Add(new ZedGraph.PointD(9, -3)); lstPt.Add(new ZedGraph.PointD(0, -3.5)); ZedGraph.PolyObj pObj = new ZedGraph.PolyObj(lstPt.ToArray(), Color.LightBlue, Color.Blue, Color.Blue); //zedPerfil.GraphPane.GraphObjList.Add(pObj); zedPerfil.AxisChange(); zedPerfil.Refresh(); #endregion }
private bool ComputeFuelEvaluation() { if (lstLeftEnvelope == null || lstRightEnvelope == null) { if (!GetLeftRightEnvelope()) { return false; } if (zedLeftEnvelopeLine != null) { zedGraphControlCoreEnvelope.GraphPane.CurveList.Remove(zedLeftEnvelopeLine); } if (zedRightEnvelopeLine != null) { zedGraphControlCoreEnvelope.GraphPane.CurveList.Remove(zedRightEnvelopeLine); } zedLeftEnvelopeLine = AddCurveToZedGraph(zedGraphControlCoreEnvelope, "边界线", lstLeftEnvelope, Color.Purple, ZedGraph.SymbolType.None, false); zedLeftEnvelopeLine.Line.Width = 2; zedRightEnvelopeLine = AddCurveToZedGraph(zedGraphControlCoreEnvelope, "", lstRightEnvelope, Color.Purple, ZedGraph.SymbolType.None, false); zedRightEnvelopeLine.Line.Width = 2; zedGraphControlCoreEnvelope.Refresh(); } data.lstCoreEvaluation.Clear(); if (data.lstDiscreteCore.Count == 0) { return false; } foreach (CorePointData cpd in data.lstDiscreteCore) { data.lstCoreEvaluation.Add((cpd.pointXValue >= getXValueFromList(cpd.pointYValue, lstLeftEnvelope) && cpd.pointXValue <= getXValueFromList(cpd.pointYValue, lstRightEnvelope)) ? 1 : 0); } return true; }
private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (listView.SelectedItems.Count > 1) { List <string> dataSourceList = new List <string>(); foreach (ListViewItem item in listView.SelectedItems) { if (item.SubItems[1].Text != "File Folder") { dataSourceList.Add(String.Format("\"{0}\"", item.SubItems[0].Text)); } } sourcePathTextBox.Text = String.Join(" ", dataSourceList.ToArray()); ticGraphControl.GraphPane.GraphObjList.Clear(); ticGraphControl.GraphPane.CurveList.Clear(); ticGraphControl.Visible = false; } else if (listView.SelectedItems.Count > 0) { sourcePathTextBox.Text = listView.SelectedItems[0].SubItems[0].Text; ticGraphControl.GraphPane.GraphObjList.Clear(); ticGraphControl.GraphPane.CurveList.Clear(); string sourcePath = Path.Combine(CurrentDirectory, sourcePathTextBox.Text); string sourceType = getSourceType(sourcePath); if (!String.IsNullOrEmpty(sourceType) && sourceType != "File Folder") { using (MSDataFile msData = new MSDataFile(sourcePath)) using (ChromatogramList cl = msData.run.chromatogramList) { if (cl != null && !cl.empty() && cl.find("TIC") != cl.size()) { ticGraphControl.Visible = true; pwiz.CLI.msdata.Chromatogram tic = cl.chromatogram(cl.find("TIC"), true); Map <double, double> sortedFullPointList = new Map <double, double>(); IList <double> timeList = tic.binaryDataArrays[0].data; IList <double> intensityList = tic.binaryDataArrays[1].data; int arrayLength = timeList.Count; for (int i = 0; i < arrayLength; ++i) { sortedFullPointList[timeList[i]] = intensityList[i]; } ZedGraph.PointPairList points = new ZedGraph.PointPairList( new List <double>(sortedFullPointList.Keys).ToArray(), new List <double>(sortedFullPointList.Values).ToArray()); ZedGraph.LineItem item = ticGraphControl.GraphPane.AddCurve("TIC", points, Color.Black, ZedGraph.SymbolType.None); item.Line.IsAntiAlias = true; ticGraphControl.AxisChange(); ticGraphControl.Refresh(); } else { ticGraphControl.Visible = false; } } } else { ticGraphControl.Visible = false; } } else { sourcePathTextBox.Text = ""; } }
private void calculation() { if (_Station == null || Sensor == null) { zedGraphControl1.GraphPane.CurveList.Clear(); zedGraphControl2.GraphPane.CurveList.Clear(); zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); zedGraphControl2.AxisChange(); zedGraphControl2.Invalidate(); if (_Station == null) { userControl_RingLaserOrientation1.SiteLocation = null; } if (Sensor == null) { userControl_RingLaserOrientation1.NormalVector = null; } return; } myPane1.CurveList.Clear(); myPane2.CurveList.Clear(); richTextBox1.Clear(); richTextBox1.Text = "Location : " + StationName + Environment.NewLine; richTextBox1.Text += " Longitude [°] : " + _Station.Location.Longitude.ToString("0.000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine; richTextBox1.Text += " Latitude [°] : " + _Station.Location.Latitude.ToString("0.000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine + Environment.NewLine; richTextBox1.Text += "Instrument : " + Sensor.Name + Environment.NewLine; richTextBox1.Text += " Azimuth [°]: " + Sensor.Azimut.ToString("0.000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine; richTextBox1.Text += " Dip [°]: " + Sensor.Dip.ToString("0.000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine; richTextBox1.Text += " Side length [m]: " + Sensor.RingLaser.SideLength.ToString("0.000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine; richTextBox1.Text += " Shape : " + Sensor.RingLaser.Shape.ToString() + Environment.NewLine; richTextBox1.Text += " Lambda [Hz]: " + Sensor.RingLaser.Lambda.ToString("0.0000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine + Environment.NewLine; richTextBox1.Text += "Calculations :" + Environment.NewLine; // ------------------------------------------------------------------------------------------------- RingLaserPrediction rlg = new RingLaserPrediction() { SiteLocation = new RingLaserPrediction.Location(_Station.Name, _Station.Location.Longitude, _Station.Location.Latitude, _Station.Location.Height), SideLength = Sensor.RingLaser.SideLength, Lambda = (Sensor.RingLaser.Lambda * 1e-9), }; userControl_RingLaserOrientation1.NormalVector = new UserControl_RingLaserOrientation.Vector_AzimuthDip(Sensor.Azimut, Sensor.Dip); if (radioButtonTriangular.Checked) { rlg.ScaleFactor = rlg.ScaleFactorTriangle(); } else if (radioButtonSquared.Checked) { rlg.ScaleFactor = rlg.ScaleFactorSquare(); } richTextBox1.Text += " Scale factor : " + rlg.ScaleFactor.ToString("0.000000", PreAnalyseExtended.Constants.NumberFormatEN) + Environment.NewLine; /* ************************************************************ * **** Test calculation / validation for "G" ***************** * Steps: * 1. Definition of the orientation in local Coordinate System. * x = to South direction * y = to East direction * z = opposite to g-vector, parallel to Earth radius * Loop over the azimuth: * 2. Transformation from sperical to cartesian coordinates. * 3. Rotation of the local coordinate system around z-axis * (vertical-axis) adjusting the local orientation against * North. * 4. Rotation of the local coordinate system around y-axis * with the co-latutude of the location into the global * system. * 5. Rotation of the glogal system to the right latitude of * the location. * 6. Calculation of the nominal Sagnac-frequency of the * triangular ring, using the given parameter. * ************************************************************/ // Definition of the orientation of "G" within the local coordinate system, normal vector parallel to z-axis RingLaserPrediction.Coordinate_Sperical RL_LocalOrientationSperical = new RingLaserPrediction.Coordinate_Sperical() { R = 1, Theta = RingLaserPrediction.RAD(90.0 - Sensor.Dip), Phi = RingLaserPrediction.RAD(Sensor.Azimut + 180.0), }; // Conversion from sperical to cartesien coordinates RingLaserPrediction.Coordinate_Cartesian RL_LocalOrientationCartesien = rlg.CoordinateTransformation_SphericalToCartesion(RL_LocalOrientationSperical); if (checkBoxRotateAroundVertical.Checked && checkBoxRotateAroundVertical.Enabled) { string tmp = Environment.NewLine; tmp += " Lobal orientation" + Environment.NewLine; tmp += " of normal " + Environment.NewLine; tmp += "Alpha Latitude Longitude Sagnac-frequency" + Environment.NewLine; tmp += " [°] [°] [°] [Hz]" + Environment.NewLine; ZedGraph.PointPairList calcsSagnac = new ZedGraph.PointPairList(); ZedGraph.PointPairList calcsCoords = new ZedGraph.PointPairList(); for (double alpha = 0; alpha < 360.0; alpha++) { // Locale Rotation arround the vertical for azimuth of rings RingLaserPrediction.Coordinate_Cartesian RL_GlobalOrientationCartesien = rlg.CoordinateRotation(RL_LocalOrientationCartesien, RingLaserPrediction.RAD(alpha), RingLaserPrediction.RotationAround.Z); // Rotation around co-latitude RL_GlobalOrientationCartesien = rlg.CoordinateRotation(RL_GlobalOrientationCartesien, RingLaserPrediction.RAD(90.0 - rlg.SiteLocation.Latitude), RingLaserPrediction.RotationAround.Y); // Rotation around longitude - Not nesseccary, but well for proofing RL_GlobalOrientationCartesien = rlg.CoordinateRotation(RL_GlobalOrientationCartesien, RingLaserPrediction.RAD(-rlg.SiteLocation.Longitude), RingLaserPrediction.RotationAround.Z); // Conversion from cartesien to sperical coordinates RingLaserPrediction.Coordinate_Sperical RL_GlobalOrientationSperical = rlg.CoordinateTransformation_CartesionToSpherical(RL_GlobalOrientationCartesien); // Calculation of Sagnac-frequency of "G": 'Scale factor' * 'Earth rotation' * Cos('co-latitude of normal vector within the global coordinate system') double Sagnac = (rlg.ScaleFactor * RingLaserPrediction.EarthRotationIERS * Math.Abs(Math.Cos(RingLaserPrediction.RAD(90.0) - RL_GlobalOrientationSperical.Theta))); // Output tmp += String.Format(PreAnalyseExtended.Constants.NumberFormatEN, "{0,5:0} {1,10:0.0000} {2,10:0.0000} {3,17:0.000}" + Environment.NewLine, alpha, RingLaserPrediction.DEG(RL_GlobalOrientationSperical.Phi), RingLaserPrediction.DEG(RL_GlobalOrientationSperical.Theta), Sagnac); calcsSagnac.Add(alpha, Sagnac); calcsCoords.Add(RingLaserPrediction.DEG(RL_GlobalOrientationSperical.Phi), RingLaserPrediction.DEG(RL_GlobalOrientationSperical.Theta)); } ZedGraph.LineItem myCurve1 = myPane1.AddCurve(null, calcsSagnac, Color.Red, ZedGraph.SymbolType.None); ZedGraph.LineItem myCurve2 = myPane2.AddCurve("Coordinate path of normal vector", calcsCoords, Color.Red, ZedGraph.SymbolType.Diamond); myCurve2.Line.IsVisible = false; calcsCoords = new ZedGraph.PointPairList(); if (rlg.SiteLocation.Longitude > 0) { calcsCoords.Add(rlg.SiteLocation.Longitude, rlg.SiteLocation.Latitude); } else { calcsCoords.Add(360 + rlg.SiteLocation.Longitude, rlg.SiteLocation.Latitude); } myCurve2 = myPane2.AddCurve("Site location", calcsCoords, Color.Blue, ZedGraph.SymbolType.XCross); myCurve2.Line.IsVisible = false; richTextBox1.Text += tmp; } else { // Rotation around co-latitude RingLaserPrediction.Coordinate_Cartesian RL_GlobalOrientationCartesien = rlg.CoordinateRotation(RL_LocalOrientationCartesien, RingLaserPrediction.RAD(90.0 - rlg.SiteLocation.Latitude), RingLaserPrediction.RotationAround.Y); // Rotation around longitude - Not nesseccary, but well for proofing RL_GlobalOrientationCartesien = rlg.CoordinateRotation(RL_GlobalOrientationCartesien, RingLaserPrediction.RAD(-rlg.SiteLocation.Longitude), RingLaserPrediction.RotationAround.Z); // Conversion from cartesien to sperical coordinates RingLaserPrediction.Coordinate_Sperical RL_GlobalOrientationSperical = rlg.CoordinateTransformation_CartesionToSpherical(RL_GlobalOrientationCartesien); // Calculation of Sagnac-frewquency of "G": 'Scale factor' * 'Earth rotation' * Cos('co-latitude of normal vector within the global coordinate system') double Sagnac = (rlg.ScaleFactor * RingLaserPrediction.EarthRotationIERS * Math.Abs(Math.Cos(RingLaserPrediction.RAD(90.0) - RL_GlobalOrientationSperical.Theta))); // Output richTextBox1.Text += String.Format(PreAnalyseExtended.Constants.NumberFormatEN, " Global orientation of ring laser normal: " + Environment.NewLine + " Longitude: {1,7:0.0000}" + Environment.NewLine + " Latitude : {0,7:0.0000}" + Environment.NewLine, RingLaserPrediction.DEG(RL_GlobalOrientationSperical.Theta), RingLaserPrediction.DEG(RL_GlobalOrientationSperical.Phi)); richTextBox1.Text += String.Format(PreAnalyseExtended.Constants.NumberFormatEN, "Nominal Sagnac-frequency [Hz]: {0,10:0.000}", Sagnac) + Environment.NewLine; ZedGraph.LineItem myCurve2 = myPane2.AddCurve("Coordinate path of normal vector", null, Color.Red, ZedGraph.SymbolType.Diamond); myCurve2.Line.IsVisible = false; ZedGraph.PointPairList calcsCoords = new ZedGraph.PointPairList(); if (rlg.SiteLocation.Longitude > 0) { calcsCoords.Add(rlg.SiteLocation.Longitude, rlg.SiteLocation.Latitude); } else { calcsCoords.Add(360 + rlg.SiteLocation.Longitude, rlg.SiteLocation.Latitude); } myCurve2 = myPane2.AddCurve("Site location", calcsCoords, Color.Blue, ZedGraph.SymbolType.XCross); myCurve2.Line.IsVisible = false; } // Calculate the Axis Scale Ranges zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); zedGraphControl2.AxisChange(); zedGraphControl2.Invalidate(); }