public static void ShowHistorgam(string title, string[] xLabels, double[] yValues) { // Графики строятся сторонней библиотекой ZedGraph. Документацию можно найти тут http://zedgraph.sourceforge.net/samples.html // Не бойтесь экспериментировать с кодом самостоятельно! var chart = new ZedGraphControl() { Dock = DockStyle.Fill }; chart.GraphPane.Title.Text = title; chart.GraphPane.YAxis.Title.Text = "Y"; chart.GraphPane.AddBar("", Enumerable.Range(0, yValues.Length).Select(i => (double)i).ToArray(), yValues, Color.Blue); chart.GraphPane.YAxis.Scale.MaxAuto = true; chart.GraphPane.YAxis.Scale.MinAuto = true; chart.GraphPane.XAxis.Type = AxisType.Text; chart.GraphPane.XAxis.Scale.TextLabels = xLabels; chart.AxisChange(); // Form — это привычное нам окно программы. Это одна из главных частей подсистемы под названием Windows Forms http://msdn.microsoft.com/ru-ru/library/ms229601.aspx var form = new Form(); form.Text = title; form.Size = new Size(800, 600); form.Controls.Add(chart); form.ShowDialog(); }
//Настройки графика void setup_graph(ZedGraph.ZedGraphControl graph) { var pane = graphTheor.GraphPane; pane.YAxis.Title.Text = "y"; pane.X2Axis.Title.Text = "x"; //Настраиваем пересечение осей pane.XAxis.Cross = 0.0; pane.YAxis.Cross = 0.0; pane.XAxis.Scale.IsSkipFirstLabel = true; pane.XAxis.Scale.IsSkipLastLabel = true; pane.XAxis.Scale.IsSkipCrossLabel = true; pane.YAxis.Scale.IsSkipFirstLabel = true; pane.YAxis.Scale.IsSkipLastLabel = true; pane.YAxis.Scale.IsSkipCrossLabel = true; //Убираем засечки сверху и снизу pane.XAxis.MinorTic.IsOpposite = false; pane.XAxis.MajorTic.IsOpposite = false; pane.YAxis.MinorTic.IsOpposite = false; pane.YAxis.MajorTic.IsOpposite = false; graph.AxisChange(); graph.Invalidate(); }
public GraphController(Model model, ZedGraphControl graphControl) { this.model = model; this.graphControl = graphControl; this.graphPane = graphControl.GraphPane; // Initialize lines this.lineItemA = this.graphPane.AddCurve("Person A", new PointPairList(), Color.Red, SymbolType.Diamond); this.lineItemB = this.graphPane.AddCurve("Person B", new PointPairList(), Color.Blue, SymbolType.Circle); this.lineItemAgent = this.graphPane.AddCurve("Agent", new PointPairList(), Color.Green, SymbolType.Star); this.lineItemAgent.IsY2Axis = true; // Set the Titles this.graphPane.Title.Text = "Graph of persons' data and the agent's state"; this.graphPane.XAxis.Title.Text = "Time"; this.graphPane.XAxis.Type = AxisType.Date; this.graphPane.Y2Axis.Title.Text = "Agent's state"; this.graphPane.YAxis.Scale.Min = -4; this.graphPane.YAxis.Scale.Max = 4; this.graphPane.Y2Axis.Scale.Min = -4; this.graphPane.Y2Axis.Scale.Max = 4; this.graphPane.Y2Axis.IsVisible = true; // Update threshold lines UpdateThresholdLines(); }
private void InitializeRFGenTab() { this.m_tabRFGen = new System.Windows.Forms.TabPage(); this.m_tabRFGen.SuspendLayout(); this.m_MainTab.Controls.Add(this.m_tabRFGen); // // m_tabRFGen // //this.m_tabRFGen.Controls.Add(this.m_groupControl_Commands); //this.m_tabRFGen.Controls.Add(this.m_ReportTextBox); this.m_tabRFGen.Location = new System.Drawing.Point(4, 26); this.m_tabRFGen.Name = "m_tabRFGen"; this.m_tabRFGen.Padding = new System.Windows.Forms.Padding(3); this.m_tabRFGen.Size = new System.Drawing.Size(1084, 510); this.m_tabRFGen.TabIndex = 1; this.m_tabRFGen.Text = "Signal Generator [BETA]"; this.m_tabRFGen.UseVisualStyleBackColor = true; this.m_tabRFGen.Enter += new System.EventHandler(this.OnTabRFGen_Enter); m_GraphTrackingGenerator = new ZedGraph.ZedGraphControl(); m_tabRFGen.Controls.Add(m_GraphTrackingGenerator); InitializeTrackingGeneratorGraph(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.zg1 = new ZedGraph.ZedGraphControl(); this.SuspendLayout(); // // zg1 // this.zg1.Location = new System.Drawing.Point(8, 8); this.zg1.Name = "zg1"; this.zg1.ScrollGrace = 0; this.zg1.ScrollMaxX = 0; this.zg1.ScrollMaxY = 0; this.zg1.ScrollMaxY2 = 0; this.zg1.ScrollMinX = 0; this.zg1.ScrollMinY = 0; this.zg1.ScrollMinY2 = 0; this.zg1.Size = new System.Drawing.Size(352, 248); this.zg1.TabIndex = 0; this.zg1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.plot_enter); this.zg1.Load += new System.EventHandler(this.zg1_Load); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(368, 262); this.Controls.Add(this.zg1); this.Name = "Form1"; this.Text = "Form1"; this.Resize += new System.EventHandler(this.Form1_Resize); this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); }
/// <summary> /// /// </summary> /// <param name="control"></param> public PlotterWindow(Plotter control) { m_owner = control; m_isSavable = false; InitializeComponent(); m_zCnt = new ZedGraphControl(); m_zCnt.Dock = DockStyle.Fill; m_zCnt.GraphPane.Title.Text = ""; m_zCnt.GraphPane.XAxis.Title.IsVisible = false; m_zCnt.GraphPane.YAxis.Title.IsVisible = false; m_zCnt.GraphPane.Legend.IsVisible = false; m_zCnt.GraphPane.XAxis.Scale.Max = 100; m_zCnt.GraphPane.XAxis.Scale.MaxAuto = true; m_zCnt.GraphPane.YAxis.Scale.MaxAuto = true; m_zCnt.GraphPane.XAxis.Scale.Min = 0; m_zCnt.GraphPane.Margin.Top = 35.0f; m_zCnt.GraphPane.YAxis.MajorGrid.IsVisible = true; m_zCnt.GraphPane.XAxis.MinorTic.Color = Color.FromArgb(200, 200, 200); m_zCnt.GraphPane.XAxis.MajorTic.Color = Color.FromArgb(200, 200, 200); m_zCnt.GraphPane.YAxis.MinorTic.Color = Color.FromArgb(200, 200, 200); m_zCnt.GraphPane.YAxis.MajorTic.Color = Color.FromArgb(200, 200, 200); m_zCnt.GraphPane.Chart.Border.Color = Color.FromArgb(200, 200, 200); m_zCnt.GraphPane.YAxis.MajorGrid.Color = Color.FromArgb(200, 200, 200); m_zCnt.GraphPane.Fill = new Fill(Color.White, Color.LightGray, 90.0f); plotTableLayoutPanel.Controls.Add(m_zCnt, 0, 0); m_zCnt.AxisChange(); m_zCnt.Refresh(); displaySettingDataGrid.ContextMenuStrip = gridContextMenuStrip; }
private void DrawLSB(double[] B, ZedGraphControl zgc, string filename) { GraphPane pane = zgc.GraphPane; pane.CurveList.Clear(); PointPairList list = new PointPairList(); int x = 0; for (long j = 0; j < B.Length; j++) { //if (x[j] != 0) { list.Add(x, B[j]); x++; } } //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("B = (m00 - m01)/2 + (m11 - m10)/2", list, Color.Crimson, SymbolType.None); //pane.AddBar("Ожидаемый результат", list2, Color.CadetBlue); pane.YAxis.Scale.Min = 0; pane.YAxis.Scale.Max = 1.1 * B.Max(); pane.XAxis.Scale.Min = 0; pane.XAxis.Scale.Max = x; pane.Title.Text = filename; zgc.AxisChange(); zgc.Invalidate(); }
private void button5_Click(object sender, EventArgs e) { double Ie, Ic, Rc, Re, Rb, Vcc, Vce, Vbe, Imax, Vee, vc, vmax; Rc = Convert.ToDouble(txtemiterpolarmarc.Text) * 1000; Rb = Convert.ToDouble(txtemiterpolarmarb.Text) * 1000; Re = Convert.ToDouble(txtemiterpolarmare.Text) * 1000; Vcc = Convert.ToDouble(txtemiterpolarmavcc.Text); Imax = (1000 * Vcc) / Rc; Vee = Convert.ToDouble(txtemiterpolarmavee.Text); Vbe = Convert.ToDouble(txtemiterpolarmavbe.Text); Ie = -1000 * (Vee + Vbe) / Re; vc = Vcc - (Math.Pow(10, -3) * Ie * Rc); Vce = vc + Vbe; Imax = 1000 * (Vcc - Vee) / (Rc + Re); vmax = Vcc - Vee; ZedGraph.ZedGraphControl g = new ZedGraph.ZedGraphControl(); g.Size = new Size(panel3.Width - 2, panel3.Height - 2); ZedGraph.GraphPane myGraphPane = g.GraphPane; myGraphPane.Title.Text = "Dc yük eğrisi "; myGraphPane.XAxis.Title.Text = "Volt (V)"; myGraphPane.YAxis.Title.Text = "Akım(ma)"; PointPairList list1 = new PointPairList(); myGraphPane.AddCurve("", new double[] { 0, vmax }, new double[] { Imax, 0 }, Color.Blue, ZedGraph.SymbolType.None); myGraphPane.AddCurve("", new double[] { 0, Vce }, new double[] { Ie, Ie }, Color.Blue, ZedGraph.SymbolType.None); myGraphPane.AddCurve("", new double[] { Vce, Vce }, new double[] { Ie, 0 }, Color.Blue, ZedGraph.SymbolType.None); myGraphPane.Chart.Fill = new ZedGraph.Fill(Color.White, Color.Red, 3.0f); g.AxisChange(); panel3.Controls.Add(g); }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.zedGraphControl1 = new ZedGraph.ZedGraphControl(); this.SuspendLayout(); // // zedGraphControl1 // this.zedGraphControl1.BackColor = System.Drawing.SystemColors.Control; this.zedGraphControl1.Location = new System.Drawing.Point(5, 8); this.zedGraphControl1.Name = "zedGraphControl1"; this.zedGraphControl1.ScrollGrace = 0; this.zedGraphControl1.ScrollMaxX = 0; this.zedGraphControl1.ScrollMaxY = 0; this.zedGraphControl1.ScrollMaxY2 = 0; this.zedGraphControl1.ScrollMinX = 0; this.zedGraphControl1.ScrollMinY = 0; this.zedGraphControl1.ScrollMinY2 = 0; this.zedGraphControl1.Size = new System.Drawing.Size(255, 219); this.zedGraphControl1.TabIndex = 0; // // ZedGraphPlotForm // this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.zedGraphControl1); this.Name = "ZedGraphPlotForm"; this.Load += new System.EventHandler(this.ZedGraphPlotForm_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ZedGraphPlotForm_FormClosing); this.Resize += new System.EventHandler(this.ZedGraphPlotForm_Resize); this.ResumeLayout(false); }
// Build the Chart private void CreateGraph(ZedGraphControl zgc) { // get a reference to the GraphPane GraphPane myPane = zgc.GraphPane; // Set the Titles myPane.Title.Text = "Temperature Graph"; myPane.YAxis.Title.Text = "Temperature"; myPane.XAxis.Title.Text = "Time"; myPane.XAxis.Type = AxisType.Date; //myPane.XAxis.Scale.Format // Generate a red curve with diamond // symbols, and "Porsche" in the legend LineItem myCurve = myPane.AddCurve("Ambient", list1, Color.Red, SymbolType.None); // Generate a blue curve with circle // symbols, and "Piper" in the legend LineItem myCurve2 = myPane.AddCurve("Thermocouple", list2, Color.Blue, SymbolType.None); // Tell ZedGraph to refigure the // axes since the data have changed zgc.AxisChange(); }
public ZedRepeater(ZedGraphControl zg, string curveName) { _zg = zg; CurveName = curveName; InitializeZedGraph(); }
/// <summary> /// Copy the data from the curves in the ZedGraphControl to the clipboard. /// </summary> public static void CopyGraphData(ZedGraphControl zedGraphControl) { var graphData = GraphData.GetGraphData(zedGraphControl.MasterPane); if (graphData.Panes.Count == 0) { return; } var allText = graphData.ToString(); bool success = false; try { Clipboard.Clear(); Clipboard.SetText(allText); success = true; } catch (Exception e) { ErrorHandler.LogException("Copy Data", "Error copying data to clipboard", e); } if (zedGraphControl.IsShowCopyMessage) { if (success) { MessageBox.Show(zedGraphControl, "Data copied to clipboard"); } else { MessageBox.Show(zedGraphControl, "Unable to copy data to the clipboard."); } } }
public void ShowLine(double[,] mImageArray, int point_now_y, ZedGraph.ZedGraphControl zg, bool clear, Color in_color) { double[,] line_show = Calculate_Line(mImageArray, point_now_y); line_show[1, line_show.Length] = line_show[1, line_show.Length - 1]; // delete last point line_show[1, 1] = line_show[1, 2]; // delete last point double[] line_x = new double[line_show.GetLength(1)]; double[] line_y = new double[line_show.GetLength(1)]; for (int k = 0; k < line_show.GetLength(1); k++) { line_x[k] = k; line_y[k] = line_show[1, k + 1]; } if (clear == true) { zg.GraphPane.CurveList.Clear(); } zg.GraphPane.AddCurve("", line_x, line_y, in_color, SymbolType.Star); //((LineItem)zg.GraphPane.CurveList[0]).Line.Width = 3.0F; // zg..AddCurve("", time, data, Color.Red, SymbolType.Plus); zg.AxisChange(); zg.IsShowPointValues = true; //zg.GraphPane.Title = "Nano Force Sensor Readout"; zg.GraphPane.XAxis.Title = ""; zg.GraphPane.YAxis.Title = "nm"; zg.Invalidate(); }
public ExtendedGraphic(StAnalyzeResult stAnalyzeResult, Color color, bool pointView, ExtendedGraphicCondition graphicCondition) { InitializeComponent(); this.resultsList = new List<StAnalyzeResult>(); this.resultsList.Add(stAnalyzeResult); this.currentColor = color; this.currentPointView = pointView; this.parent = graphicCondition; avgsGraphic = new ZedGraphControl(); avgsGraphic.Dock = DockStyle.Fill; this.resultsTab.TabPages[0].Controls.Add(avgsGraphic); avgsGraphic.GraphPane.Title.Text = "Avgs"; avgsGraphic.GraphPane.XAxis.Title.Text = "Mu"; avgsGraphic.GraphPane.YAxis.Title.Text = "Avgs"; sigmasGraphic = new ZedGraphControl(); sigmasGraphic.Dock = DockStyle.Fill; this.resultsTab.TabPages[1].Controls.Add(sigmasGraphic); sigmasGraphic.GraphPane.Title.Text = "Sigmas"; sigmasGraphic.GraphPane.XAxis.Title.Text = "Mu"; sigmasGraphic.GraphPane.YAxis.Title.Text = "Sigmas"; }
private void ZedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e) { ZedGraphControl zedGraph = new ZedGraphControl(); zedGraph.Size = new Size(100, 100); zedGraph.GraphPane.Fill.Type = FillType.None; zedGraph.GraphPane.Chart.Fill.Type = FillType.None; zedGraph.GraphPane.Border.IsVisible = false; zedGraph.GraphPane.Chart.Border.IsVisible = false; zedGraph.GraphPane.XAxis.IsVisible = false; zedGraph.GraphPane.YAxis.IsVisible = false; zedGraph.GraphPane.Legend.IsVisible = false; zedGraph.GraphPane.Title.IsVisible = false; for (int i = 0; i < SelectedColumns.Count; i++) { double value = 0; if (!double.TryParse(e.Feature.ColumnValues[SelectedColumns[i]], out value)) { zedGraph.Dispose(); return; } Color color = System.Drawing.Color.FromArgb(pieColors[i].AlphaComponent, pieColors[i].RedComponent, pieColors[i].GreenComponent, pieColors[i].BlueComponent); PieItem pieItem = zedGraph.GraphPane.AddPieSlice(value, color, 0.08, ""); pieItem.LabelDetail.IsVisible = false; } zedGraph.AxisChange(); e.Bitmap = zedGraph.GraphPane.GetImage(); zedGraph.Dispose(); }
/// <summary> /// Add a new graph to the control. /// </summary> /// <param name="data">The points to plot.</param> /// <param name="key">Name of the set to put in the graph key</param> /// <param name="control">The control to plot on.</param> /// <param name="color">The color for this key.</param> /// <param name="offset">The starting point for this plot.</param> /// <param name="lineStyle">The style of line to plot.</param> public void AddGraph( Dictionary<DateTime, Dictionary<string, double>> data, string key, ZedGraphControl control, Color color, int offset, System.Drawing.Drawing2D.DashStyle lineStyle) { GraphPane pane; int num_panels = control.MasterPane.PaneList.Count; if (num_panels == 2) { pane = control.MasterPane.PaneList[1]; } else { pane = new GraphPane(); control.MasterPane.PaneList.Add(pane); } pane.XAxis.Scale.Max = data.Count; if (data.Count >= 99) { pane.XAxis.Scale.Min = data.Count - 99; } else { pane.XAxis.Scale.Min = 0; } PointPairList list = ExtractPointPair(data, key, offset); LineItem line = pane.AddCurve(key, list, color, SymbolType.None); line.Line.Style = lineStyle; line.IsOverrideOrdinal = true; pane.IsBoundedRanges = true; pane.Title.Text = "OHLC Graph"; pane.XAxis.Type = AxisType.Ordinal; pane.XAxis.Title.Text = "Date"; pane.YAxis.Title.Text = "KEY"; pane.Margin.All = 0; pane.Margin.Bottom = 10; pane.YAxis.MinSpace = 80; pane.Y2Axis.MinSpace = 20; pane.AxisChange(); control.MasterPane.AxisChange(); using (Graphics g = control.CreateGraphics()) { control.MasterPane.SetLayout(g, PaneLayout.SingleColumn); control.MasterPane.AxisChange(g); // Synchronize the Axes ////control.IsAutoScrollRange = true; control.IsShowHScrollBar = true; ////control.IsShowVScrollBar = true; control.IsSynchronizeXAxes = true; ////g.Dispose(); } }
/// <summary> /// Configures the appearance of an existing ZedGraphControl to be used as an equation /// graph. /// </summary> public static void ConfigureEqGraph(ZedGraphControl eqGraph) { // get a reference to the GraphPane GraphPane pane = eqGraph.GraphPane; //Specifies how far away (in pixels) a click must be from an exsisting point to create a //new point instead of dragging the exsisting point. ZedGraph.GraphPane.Default.NearestTol = 7; pane.Border.IsVisible = false; pane.Legend.IsVisible = false; pane.Title.IsVisible = false; pane.Margin.Bottom = 60; pane.Margin.Left = 30; pane.XAxis.Title.IsVisible = false; pane.XAxis.Scale.FontSpec.Size = 18; pane.XAxis.Scale.Min = 0; pane.XAxis.Scale.Max = 1; pane.XAxis.Scale.MinorStep = 1; pane.XAxis.Scale.MajorStep = 1; pane.YAxis.Title.IsVisible = false; pane.YAxis.Scale.FontSpec.Size = 18; //The min and max values in the Y axis must be slightly outside of the range 0 to 1 so //that lines at 0 and 1 are visible. pane.YAxis.Scale.Min = -0.005; pane.YAxis.Scale.Max = 1.01; pane.YAxis.Scale.MinorStep = 1; pane.YAxis.Scale.MajorStep = 1; pane.YAxis.MajorGrid.IsZeroLine = false; }
private void CreatGraph_all(ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; myPane.XAxis.Scale.MaxAuto = true; myPane.XAxis.Scale.MinAuto = true; myPane.YAxis.Scale.MaxAuto = true; myPane.YAxis.Scale.MinAuto = true; myPane.XAxis.MinSpace = 1; myPane.YAxis.MinSpace = 20; DataSet ds = new DataSet(); myPane.Title.Text = "个人全部数据"; myPane.XAxis.Title.Text = "训练进度"; myPane.YAxis.Title.Text = "训练分数"; ds = btUS.GetSQL("select CorrectRate from R_SHFUnitScores where ProgramID=1030301 and StudentID=" + StudentID); double x, y1; PointPairList list = new PointPairList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { x = i; y1 = double.Parse(ds.Tables[0].Rows[i][0].ToString()); list.Add(x, y1); } LineItem mycurve = myPane.AddCurve("全部数据", list, Color.Red, SymbolType.Diamond); zgc.AxisChange(); zgc.Refresh(); }
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"; var list = _GetData(); // 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 void CreateChart(ZedGraphControl zgc) { EventHandler method = null; this._myMainPane.Title.Text = this._reportTitle; this._myMainPane.XAxis.Title.Text = "TOW"; this._myMainPane.YAxis.Title.Text = "Data"; this._myMainPane.XAxis.IsVisible = true; this._myMainPane.XAxis.Type = AxisType.Linear; this._myMainPane.YAxis.MajorGrid.IsVisible = true; this._myMainPane.YAxis.MinorGrid.IsVisible = true; this._myMainPane.CurveList.Clear(); this._myMainPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45f); if ((this._myMainXaxisData != null) && (this._myMainXaxisData.Length > 0)) { this._myMainPane.AddCurve(this._curveLabel, this._myMainXaxisData, this._myMainYaxisData, this._curveColor, SymbolType.Diamond); this._myMainPane.AxisChange(); if (method == null) { method = delegate { zgc.Update(); zgc.Refresh(); }; } base.Invoke(method); } zgc.Size = new Size(base.ClientRectangle.Width - 0x19, base.ClientRectangle.Height - 40); }
public void CreateChart(ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; // Set the titles and axis labels myPane.Title.Text = "Elevation above ground"; myPane.XAxis.Title.Text = "Distance (m)"; myPane.YAxis.Title.Text = "Elevation (m)"; LineItem myCurve; myCurve = myPane.AddCurve("Planner", list1, Color.Red, SymbolType.None); myCurve = myPane.AddCurve("GE", list2, Color.Green, SymbolType.None); foreach (PointPair pp in list1) { // Add a another text item to to point out a graph feature TextObj text = new TextObj((string)pp.Tag, pp.X, pp.Y); // rotate the text 90 degrees text.FontSpec.Angle = 90; text.FontSpec.FontColor = Color.White; // Align the text such that the Right-Center is at (700, 50) in user scale coordinates text.Location.AlignH = AlignH.Right; text.Location.AlignV = AlignV.Center; // Disable the border and background fill options for the text text.FontSpec.Fill.IsVisible = false; text.FontSpec.Border.IsVisible = false; myPane.GraphObjList.Add(text); } // Show the x axis grid myPane.XAxis.MajorGrid.IsVisible = true; myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = distance; // Make the Y axis scale red myPane.YAxis.Scale.FontSpec.FontColor = Color.Red; myPane.YAxis.Title.FontSpec.FontColor = Color.Red; // turn off the opposite tics so the Y tics don't show up on the Y2 axis myPane.YAxis.MajorTic.IsOpposite = false; myPane.YAxis.MinorTic.IsOpposite = false; // Don't display the Y zero line myPane.YAxis.MajorGrid.IsZeroLine = true; // Align the Y axis labels so they are flush to the axis myPane.YAxis.Scale.Align = AlignP.Inside; // Manually set the axis range //myPane.YAxis.Scale.Min = -1; //myPane.YAxis.Scale.Max = 1; // Fill the axis background with a gradient //myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f); // Calculate the Axis Scale Ranges try { zg1.AxisChange(); } catch { } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Graph = new ZedGraph.ZedGraphControl(); this.SuspendLayout(); // // Graph // this.Graph.Location = new System.Drawing.Point(0, 3); this.Graph.Name = "Graph"; this.Graph.ScrollGrace = 0D; this.Graph.ScrollMaxX = 0D; this.Graph.ScrollMaxY = 0D; this.Graph.ScrollMaxY2 = 0D; this.Graph.ScrollMinX = 0D; this.Graph.ScrollMinY = 0D; this.Graph.ScrollMinY2 = 0D; //this.Graph.Size = new System.Drawing.Size(297, 266); this.Graph.Size = new System.Drawing.Size(450, 350); this.Graph.TabIndex = 0; // // zedGraphUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.Graph); this.Name = "zedGraphUserControl"; this.Size = new System.Drawing.Size(300, 269); this.ResumeLayout(false); }
public void CreateErrorChart(ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; // Set the title and axis labels myPane.Title.Text = "Errors Found In the PCAP"; myPane.XAxis.Title.Text = "Stream ID"; myPane.YAxis.Title.Text = "Error Count"; // create the curves BarItem[] bars = new BarItem[_errorTotals.Length]; for(int i=0;i!=_errorTotals.Length;i++) { bars[i] = myPane.AddBar(i.ToString(), _errorTotals[i], Color.Bisque); } //BarItem myCurve = myPane.AddBar("curve 1", list, Color.Blue); //BarItem myCurve2 = myPane.AddBar("curve 2", list2, Color.Red); //BarItem myCurve3 = myPane.AddBar("curve 3", list3, Color.Green); // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 45.0F); zgc.AxisChange(); // expand the range of the Y axis slightly to accommodate the labels myPane.YAxis.Scale.Max += myPane.YAxis.Scale.MajorStep; // Create TextObj's to provide labels for each bar BarItem.CreateBarLabels(myPane, false, "f0"); }
public ZedGraphDataLoader(ZedGraphControl chart) { chart1 = chart; pane = chart1.GraphPane; pane.Chart.Border.IsVisible = false; // set scale pane.YAxis.Scale.MinGrace = 0; pane.YAxis.Scale.MaxGrace = 0; pane.XAxis.Scale.MinGrace = 0; pane.XAxis.Scale.MaxGrace = 0; pane.XAxis.Scale.MagAuto = false; pane.YAxis.Scale.MagAuto = false; SetPaneVisible(false); chart1.ZoomEvent += chart1_ZoomEvent; chart1.MouseDownEvent += chart1_MouseDownEvent; chart1.MouseUpEvent += chart1_MouseUpEvent; using (Graphics g = chart1.CreateGraphics()) { _dpiFactor = Convert.ToSingle(g.DpiX / 96.0); } // set fonts ApplyFontDefaults(); }
private void InitGragh(ZedGraph.ZedGraphControl zg) { GraphPane myPane = zg.GraphPane; myPane.CurveList.Clear(); myPane.GraphObjList.Clear(); //Set labels myPane.Title.Text = "煤气实绩"; // 表头 myPane.XAxis.Title.Text = "时间"; // 横坐标lable myPane.YAxis.Title.Text = "煤气量"; // 纵坐标label //Set list PointPairList list = new PointPairList(); // Generate a blue curve with circle symbols, and "My Curve 2" in the legend LineItem myCurve = myPane.AddCurve("煤气量", 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 myPane.XAxis.Type = AxisType.Date; myPane.AxisChange(); SetSize(); }
public static void CopyEmf(ZedGraphControl zedGraphControl) { Metafile mf = zedGraphControl.MasterPane.GetMetafile(); bool success = false; if (OpenClipboard(zedGraphControl.Handle)) { if (EmptyClipboard()) { success = true; SetClipboardData(14 /*CF_ENHMETAFILE*/, mf.GetHenhmetafile()); // TODO (nicksh): It would be nice if we also set the CF_BITMAP CloseClipboard(); } } if (zedGraphControl.IsShowCopyMessage) { if (success) { MessageBox.Show(zedGraphControl, "Metafile image copied to clipboard"); } else { MessageBox.Show(zedGraphControl, "Unable to copy metafile image to the clipboard."); } } }
private void formatoZed(ZedGraphControl zedC, int nro) { zedC.IsShowPointValues = true; zedC.GraphPane.XAxis.Scale.MinGrace = 0; zedC.GraphPane.XAxis.Scale.MaxGrace = 0; zedC.GraphPane.XAxis.Scale.Min = h.inicioX[nro]; zedC.GraphPane.XAxis.Scale.Max = h.finX[nro]; zedC.GraphPane.YAxis.Scale.Min = h.inicioY[nro]; zedC.GraphPane.YAxis.Scale.Max = h.finY[nro]; zedC.GraphPane.XAxis.IsVisible = true; zedC.GraphPane.XAxis.MajorGrid.IsVisible = true; zedC.GraphPane.XAxis.MajorGrid.IsZeroLine = false; zedC.GraphPane.YAxis.IsVisible = true; zedC.GraphPane.YAxis.MajorGrid.IsVisible = true; zedC.GraphPane.YAxis.MajorGrid.IsZeroLine = false; zedC.GraphPane.XAxis.Title.IsVisible = false; zedC.GraphPane.YAxis.Title.IsVisible = false; zedC.GraphPane.Chart.Border.IsVisible = false; zedC.GraphPane.Title.IsVisible = true; zedC.GraphPane.Title.Text = "Gráfica " + (nro + 1); zedC.GraphPane.Title.FontSpec.Size = 12F; zedC.GraphPane.Border.IsVisible = false; zedC.GraphPane.Legend.IsVisible = false; }
public void CreateBufferSizeChart(ZedGraphControl zgc, Link[] list) { GraphPane myPane = zgc.GraphPane; System.Drawing.Color[] GraphColors = { Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Purple, Color.Brown }; // Set the titles and axis labels myPane.Title.Text = ""; myPane.XAxis.Title.Text = "Time, ms"; myPane.YAxis.Title.Text = "Buffer size (packets)"; /*myPane.Legend.Position = LegendPos.Float; myPane.Legend.Location = new Location(0.95, 0.15, CoordType.PaneFraction, AlignH.Right, AlignV.Top); myPane.Legend.FontSpec.Size = 10;*/ myPane.Legend.Position = LegendPos.InsideTopLeft; // Add a curve for (int k = 0; k < list.Length; k++) { LineItem curve = myPane.AddCurve(list[k].name, list[k].buffer_size_list, GraphColors[k % 6], SymbolType.None); curve.Line.Width = 2.0F; curve.Line.IsAntiAlias = true; curve.Symbol.Fill = new Fill(Color.White); curve.Symbol.Size = 7; } // Fill the axis background with a gradient //myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.ForestGreen), 45.0F); // Offset Y space between point and label // NOTE: This offset is in Y scale units, so it depends on your actual data //const double offset = 1.0; // Leave some extra space on top for the labels to fit within the chart rect myPane.YAxis.Scale.MaxGrace = 0.2; // Calculate the Axis Scale Ranges zgc.AxisChange(); }
public static void ShowHeatmap(string title, double[,] heat, int xMin, int yMin) { var chart = new ZedGraphControl() { Dock = DockStyle.Fill }; var maxHeat = heat.Cast<double>().Max(); chart.GraphPane.Title.Text = title; chart.GraphPane.YAxis.Title.Text = ""; var maxSize = Math.Max(heat.GetLength(0), heat.GetLength(1)); for (int x = 0; x < heat.GetLength(0); x++) for (int y = 0; y < heat.GetLength(1); y++) { var value = heat[x, y]; if (value > 1000) throw new ArgumentException("too large heat value " + value); var color = Color.FromArgb(255, 50, (int)(255 * value / maxHeat), 0); var lineItem = chart.GraphPane.AddCurve("", new double[] { x + xMin }, new double[] { y + yMin }, color); lineItem.Symbol.Type = SymbolType.Circle; lineItem.Symbol.Fill = new Fill(color); lineItem.Symbol.Size = (float)(600 * value / maxHeat / maxSize); } chart.GraphPane.YAxis.Scale.MaxAuto = true; chart.GraphPane.YAxis.Scale.MinAuto = true; chart.AxisChange(); var form = new Form(); form.Text = title; form.Size = new Size(800, 600); form.Controls.Add(chart); form.ShowDialog(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.z1 = new ZedGraph.ZedGraphControl(); this.SuspendLayout(); // // z1 // this.z1.IsShowPointValues = false; this.z1.Location = new System.Drawing.Point(0, 0); this.z1.Name = "z1"; this.z1.PointValueFormat = "G"; this.z1.Size = new System.Drawing.Size(816, 446); this.z1.TabIndex = 0; this.z1.Load += new System.EventHandler(this.z1_Load); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(680, 414); this.Controls.Add(this.z1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); }
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(); }
private void CreateGraph(ZedGraphControl zgc) { string[] mesi = { "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" }; GraphPane myPane = zgc.GraphPane; // Set the titles and axis labels myPane.Title.Text = "Km percorsi per anno"; myPane.XAxis.Title.Text = "Mese"; myPane.XAxis.Type = AxisType.Text; myPane.XAxis.Scale.TextLabels = mesi; myPane.YAxis.Title.Text = "Km percorsi"; PointPairList list = new PointPairList(); for (double x = 1; x < 13; x++) { double y = MesiKm[int.Parse(x.ToString())]; list.Add(x, y, mesi[int.Parse((x-1).ToString())].ToString() +" "+ textBox1.Text); } BarItem bar = myPane.AddBar(textBox1.Text, list, Color.Blue); // 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(); }
private void CreateGraph(ZedGraphControl zgc) { // // clear old coordinates // myPane.CurveList.Clear(); zgc.AxisChange(); // Generate a LightBlue curve with circle symbols, and "My Curve" in the legend LineItem CurveS = myPane.AddCurve("Series GA", PPlist[0], Color.LightBlue, SymbolType.Diamond); // Generate a PaleVioletRed curve with circle symbols, and "My Curve" in the legend LineItem CurveP = myPane.AddCurve("Parallel GA", PPlist[1], Color.PaleVioletRed, SymbolType.Circle); float allPointSize = 50F; // Fill the area under the curve with a white-red gradient at 45 degrees CurveS.Line.Fill = new Fill(Color.Transparent, Color.LightBlue, allPointSize); // Make the symbols opaque by filling them with white CurveS.Symbol.Fill = new Fill(Color.Transparent); // Fill the area under the curve with a white-red gradient at 45 degrees CurveP.Line.Fill = new Fill(Color.Transparent, Color.PaleVioletRed, allPointSize); // Make the symbols opaque by filling them with white CurveP.Symbol.Fill = new Fill(Color.Transparent); // Calculate the Axis Scale Ranges zgc.AxisChange(); zgc.Refresh(); }
//初始化曲线控件上的曲线数量及名称 private void InitCurve(ZedGraph.ZedGraphControl zgControl, string curveName, string path, string lineColor) { if (curveName != null) { //_RPPList_Read = new RollingPointPairList(100000); _ResultPanel = zgControl.GraphPane; zgControl.GraphPane.CurveList.RemoveRange(0, zgControl.GraphPane.CurveList.Count); if (_List_Data != null) { _List_Data = null; } //foreach (CurveItem ci in zgControl.GraphPane.CurveList) //{ // ci.Clear(); //} LineItem CurveList = _ResultPanel.AddCurve(curveName, _RPPList_Read, Color.FromName(lineColor), SymbolType.None);//Y1-X1 CurveList.Line.IsAntiAlias = true; readCurveName(curveName, path); } //MessageBox.Show(zgControl.GraphPane.CurveList.Count.ToString()); //初始化曲线名称即 试样编号的名称 zgControl.AxisChange(); zgControl.RestoreScale(this._ResultPanel); }
private void Initialize() { DS = new DarkSkyData(Key, textBoxLat.Text, textBoxLong.Text); bool run = true; DateTime now = DateTime.Now; DateTime current = dateTimePickerStart.Value; while (run) { if (current.Date.Equals(now.Date)) { run = false; continue; } DS.AddDay(current); current = current.Add(new TimeSpan(1, 0, 0, 0)); System.Threading.Thread.Sleep(100); } //mschart = DS.GetChart(mschart); zedGraph = DS.GetZedGraph(zedGraph); DS.Save(); timer = new Timer(); double minutes = .1; timer.Interval = (int)(minutes * 60 * 1000); timer.Tick += timer_Tick; timer.Enabled = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\GraphPanel.xaml" ((AlleleFrequencySim.GraphPanel)(target)).Initialized += new System.EventHandler(this.GraphPanelOnInitialized); #line default #line hidden return; case 2: this.fitnessAA = ((AlleleFrequencySim.SlideText)(target)); return; case 3: this.fitnessAa = ((AlleleFrequencySim.SlideText)(target)); return; case 4: this.fitnessaa = ((AlleleFrequencySim.SlideText)(target)); return; case 5: this.mutationRateFromA = ((AlleleFrequencySim.SlideText)(target)); return; case 6: this.mutationRateToA = ((AlleleFrequencySim.SlideText)(target)); return; case 7: this.initAlleleFrequency = ((AlleleFrequencySim.SlideText)(target)); return; case 8: this.popSize = ((AlleleFrequencySim.SlideText)(target)); return; case 9: this.generation = ((AlleleFrequencySim.SlideText)(target)); return; case 10: this.noMutationFromA = ((System.Windows.Controls.CheckBox)(target)); return; case 11: this.noMutationToA = ((System.Windows.Controls.CheckBox)(target)); return; case 12: this.graphControl = ((ZedGraph.ZedGraphControl)(target)); return; } this._contentLoaded = true; }
private void Init( string description, string title, ICollection types ) { this.description = description; this.title = title; this.types = types; control = new ZedGraphControl(); }
private void Form1_Load(object sender, EventArgs e) { m_graph = new ZedGraphControl(); m_graph.Location = new Point(0, 0); m_graph.Parent = this; m_graph.Dock = DockStyle.Fill; CreateChart(m_graph); }
public FormChangeBifurcationPlot(ZedGraphControl control) { InitializeComponent(); ZedControl = control; chkXAuto.CheckedChanged += chkXAuto_CheckedChanged; chkYAuto.CheckedChanged += chkYAuto_CheckedChanged; }
private bool MouseUpHandler(ZedGraph.ZedGraphControl sender, MouseEventArgs e) { if (e.Button == this.myPanButton) { this.myViewportState.state = ViewportState.StateType.None; } return(default(bool)); }
private void createGraph(ZedGraph.ZedGraphControl zedGraphControl, int drawX, int drawY, int sizeX, int sizeY, string titolo, string x, string y) { zedGraphControl.Location = new Point(drawX, drawY); zedGraphControl.Size = new Size(sizeX, sizeY); myPane = zedGraphControl.GraphPane; myPane.Title.Text = titolo; myPane.XAxis.Title.Text = x; myPane.YAxis.Title.Text = y; }
private void importToolStripMenuItem_Click(object sender, EventArgs e) { DS = new DarkSkyData(); DS.Load(); //mschart = DS.GetChart(mschart); zedGraph = DS.GetZedGraph(zedGraph); textBoxLat.Text = DS.Latitude; textBoxLong.Text = DS.Longitude; }
private bool MouseDownHandler(ZedGraph.ZedGraphControl sender, MouseEventArgs e) { if (e.Button == this.myPanButton) { this.myViewportState.state = ViewportState.StateType.Panning; this.lastMouseLocation = e.Location; this.mouseMoveCount = 0; } return(default(bool)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.GraphControl = ((ZedGraph.ZedGraphControl)(target)); return; } this._contentLoaded = true; }
private void ClearGauge(int idx) { if (lblGuage1.InvokeRequired) { ClearDataCallback d = new ClearDataCallback(ClearGauge); this.Invoke(d, new object[] { idx }); } else { ZedGraph.ZedGraphControl currZG = null; System.Windows.Forms.Label currLabel = null; System.Windows.Forms.AGauge currGauge = null; if (idx == 1) { currZG = zg1; currLabel = lblGuage1; currGauge = gauge1; } if (idx == 2) { currZG = zg2; currLabel = lblGuage2; currGauge = gauge2; } if (idx == 3) { currZG = zg3; currLabel = lblGuage3; currGauge = gauge3; } if (currZG != null) { GraphPane myPane = currZG.GraphPane; myPane.Title.Text = "No data."; myPane.CurveList.Clear();// clear the graph currZG.Invalidate(); currZG.Refresh(); } if (currLabel != null) { currLabel.Text = "No data"; } if (currGauge != null) { currGauge.Value = 0; } } }
/// <summary> /// /// </summary> /// <param name="myGraphControl"></param> /// <param name="coor_x"></param> /// <param name="coor_y"></param> /// <param name="title"></param> /// <param name="Xtitle"></param> /// <param name="Ytitle"></param> public void MyDrawPic1(ZedGraph.ZedGraphControl myGraphControl, double[] coor_x, double[] coor_y, string title, string Xtitle, string Ytitle) { GraphPane myPane = myGraphControl.GraphPane; myPane.Legend.IsVisible = false; // myPane.CurveList.Clear(); //myPane.Title.Text = title; //myPane.XAxis.Title.Text = Xtitle; //myPane.YAxis.Title.Text = Ytitle; PointPairList list = new PointPairList(); int N = coor_x.Length; for (int i = 0; i < N; i++) { double x = coor_x[i]; double y = coor_y[i]; list.Add(x, y);//�������� } LineItem myCurve = myPane.AddCurve(title, list, Color.Black, SymbolType.None); myCurve.Symbol.Fill = new Fill(Color.White); myCurve.Line.Width = 2; //myCurve.IsX2Axis = false; //myCurve.IsY2Axis = false; myPane.XAxis.MajorGrid.IsVisible = false; myPane.YAxis.Scale.FontSpec.FontColor = Color.Black; myPane.YAxis.Title.FontSpec.FontColor = Color.Black; myPane.YAxis.MajorTic.IsOpposite = false; myPane.YAxis.MinorTic.IsOpposite = false; myPane.YAxis.MajorGrid.IsZeroLine = false; myPane.YAxis.Scale.Align = AlignP.Inside; myPane.YAxis.Scale.Min = -30; myPane.YAxis.Scale.Max = 30; myPane.Y2Axis.IsVisible = false; myPane.Y2Axis.Scale.FontSpec.FontColor = Color.Black; myPane.Y2Axis.Title.FontSpec.FontColor = Color.Black; myPane.Y2Axis.MajorTic.IsOpposite = false; myPane.Y2Axis.MinorTic.IsOpposite = false; myPane.Y2Axis.MajorGrid.IsVisible = false; myPane.Y2Axis.Scale.Align = AlignP.Inside; myPane.Chart.Fill = new Fill(Color.White, Color.White, 45.0f); myGraphControl.IsShowPointValues = true; myGraphControl.PointValueEvent += new ZedGraph.ZedGraphControl.PointValueHandler(MyPointValueHandler); myGraphControl.ZoomEvent += new ZedGraph.ZedGraphControl.ZoomEventHandler(MyZoomEvent); myGraphControl.AxisChange(); myGraphControl.RestoreScale(myPane); myGraphControl.Invalidate(); }
public void m_mthInitalPrintInfo(clsLISQCChartPrintVO objChartVO) { if (objChartVO == null || objChartVO.objBatch == null || objChartVO.zedChart == null) { return; } m_zedGraph = objChartVO.zedChart; m_objQCCon = objChartVO.objSelectQCCon; m_lstQCDatas = objChartVO.objBatch.GetDatas(); if (m_lstQCDatas != null && m_lstQCDatas.Count > 0) { m_lstQCDatas.Sort(clsLisQCDataVO.CompareVO); } m_lstQCReports = objChartVO.objBatch.GetReports(); m_strBrokeRules = objChartVO.objBatch.BrokenRules; m_strQCStatus = "在控"; if (string.IsNullOrEmpty(m_strBrokeRules)) { if (m_lstQCReports != null || m_lstQCReports.Count > 0) { foreach (clsLisQCReportVO objQCReport in m_lstQCReports) { if (objQCReport.m_enmQCControlStatus == enmQCControlStatus.UnControl) { m_strQCStatus = "失控"; m_strBrokeRules = objQCReport.m_strUnmatchedRule; break; } } } } else { m_strQCStatus = "失控"; } m_dtStartDate = objChartVO.objBatch.DateBegin; m_dtEndDate = objChartVO.objBatch.DateEnd; clsLisQCBatchVO objTemp = objChartVO.objBatch[0]; m_strWorkGroup = objTemp.m_strWorkGroupName; m_strDevice = objTemp.m_strDeviceModel; m_strItem = objTemp.m_strCheckItemName; m_strQCSampleLotNO = objTemp.m_strSampleLotNo; m_strQCSampleVendor = objTemp.m_strSampleVendor; m_strReagentLotNO = objTemp.m_strReagentBatch; m_strReagentVendor = objTemp.m_strReagent; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.zedGraphControl1 = new ZedGraph.ZedGraphControl(); this.SuspendLayout(); // // zedGraphControl1 // this.zedGraphControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.zedGraphControl1.IsAutoScrollRange = false; this.zedGraphControl1.IsEnableHPan = true; this.zedGraphControl1.IsEnableHZoom = true; this.zedGraphControl1.IsEnableVPan = true; this.zedGraphControl1.IsEnableVZoom = true; this.zedGraphControl1.IsPrintFillPage = true; this.zedGraphControl1.IsPrintKeepAspectRatio = true; this.zedGraphControl1.IsScrollY2 = false; this.zedGraphControl1.IsShowContextMenu = true; this.zedGraphControl1.IsShowCopyMessage = true; this.zedGraphControl1.IsShowCursorValues = false; this.zedGraphControl1.IsShowHScrollBar = false; this.zedGraphControl1.IsShowPointValues = false; this.zedGraphControl1.IsShowVScrollBar = false; this.zedGraphControl1.IsZoomOnMouseCenter = false; this.zedGraphControl1.Location = new System.Drawing.Point(0, 0); this.zedGraphControl1.Name = "zedGraphControl1"; this.zedGraphControl1.PanButtons = System.Windows.Forms.MouseButtons.Left; this.zedGraphControl1.PanButtons2 = System.Windows.Forms.MouseButtons.Middle; this.zedGraphControl1.PanModifierKeys2 = System.Windows.Forms.Keys.None; this.zedGraphControl1.PointDateFormat = "g"; this.zedGraphControl1.PointValueFormat = "G"; this.zedGraphControl1.ScrollMaxX = 0; this.zedGraphControl1.ScrollMaxY = 0; this.zedGraphControl1.ScrollMaxY2 = 0; this.zedGraphControl1.ScrollMinX = 0; this.zedGraphControl1.ScrollMinY = 0; this.zedGraphControl1.ScrollMinY2 = 0; this.zedGraphControl1.Size = new System.Drawing.Size(104, 72); this.zedGraphControl1.TabIndex = 0; this.zedGraphControl1.ZoomButtons = System.Windows.Forms.MouseButtons.Left; this.zedGraphControl1.ZoomButtons2 = System.Windows.Forms.MouseButtons.None; this.zedGraphControl1.ZoomModifierKeys = System.Windows.Forms.Keys.None; this.zedGraphControl1.ZoomModifierKeys2 = System.Windows.Forms.Keys.None; this.zedGraphControl1.ZoomStepFraction = 0.1; this.zedGraphControl1.Load += new System.EventHandler(this.zedGraphControl1_Load); // // UCTeachPointHistoryChart // this.Controls.Add(this.zedGraphControl1); this.Name = "UCTeachPointHistoryChart"; this.Size = new System.Drawing.Size(104, 72); this.ResumeLayout(false); }
/// <summary> /// zedgragh作图 /// </summary> /// <param name="zg"></param> private void SetGragh(ZedGraph.ZedGraphControl zg) { GraphPane myPane = zg.GraphPane; //Set labels myPane.Title.Text = "煤气实绩"; // 表头 myPane.XAxis.Title.Text = "时间"; // 横坐标lable myPane.YAxis.Title.Text = "煤气量"; // 纵坐标label //Set list PointPairList list = new PointPairList(); /* List<HRGasReal> tempList = vList.ToList(); * * for (int i = 0; i < 100; i++) * { * double C = tempList[i].Consumption; * DateTime T = tempList[i].Time; * * double x = Convert.ToDouble(i); * double y = Convert.ToDouble(C); * list.Add(x, y); * } */ /*//DateTime m = Convert.ToDateTime(DG1.Columns[1]); * Double n = Convert.ToDouble( DG1.Columns[2]); * list.Add(m, n); * for (int i = 0; i < 100; i++) * { * double x = (double)new XDate(2013, 6,11,i,0,0); * * double y = Math.Sin((double)i * 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("煤气量", 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 //myPane.XAxis.Type = AxisType.Date; myPane.AxisChange(); }
public void initialDateAxis(ZedGraph.ZedGraphControl zedChart) { try { if (this.m_dtLine1 == null && this.m_dtLine2 == null) { return; } GraphPane myPane = zedChart.GraphPane; // Set the titles and axis labels myPane.Title = this.m_strTitle; //myPane. myPane.XAxis.Title = this.m_xAxisTitle; myPane.YAxis.Title = this.m_yAxisTitle; double[] dDatas = new double[this.m_dtLine1.Rows.Count]; for (int i = 0; i < this.m_dtLine1.Rows.Count; i++) { dDatas[i] = double.Parse(m_dtLine1.Rows[i]["y"].ToString().Trim()); } string[] strLabels = new string[this.m_dtLine1.Rows.Count]; for (int i = 0; i < this.m_dtLine1.Rows.Count; i++) { if (this.isO(i)) { strLabels[i] = m_dtLine1.Rows[i]["x"].ToString().Trim(); } } myPane.CurveList.Clear(); LineItem myCurve = myPane.AddCurve(this.m_strLine1Name, null, dDatas, Color.Black, SymbolType.Circle); myPane.XAxis.Type = AxisType.Text; // Set the XAxis labels myPane.XAxis.TextLabels = strLabels; //myPane.XAxis.ScaleFontSpec.Angle = 40; myPane.XAxis.ScaleFontSpec.Size = 10; myPane.YAxis.ScaleFontSpec.Size = 10; myCurve.Symbol.Size = 4; zedChart.AxisChange(); zedChart.Invalidate(); } catch (Exception ex) { cSaveErr.CSaveErr.msgboxErr(ex.ToString()); } }
private void InitGragh(ZedGraph.ZedGraphControl zg) { GraphPane myPane = zg.GraphPane; myPane.CurveList.Clear(); myPane.GraphObjList.Clear(); //Set labels myPane.Title.Text = "煤气实绩"; // 表头 myPane.XAxis.Title.Text = "时间"; // 横坐标lable myPane.YAxis.Title.Text = "煤气量"; // 纵坐标label //Set list PointPairList list = new PointPairList(); //DataView dvList = new DataView(dataset.Tables[0]); //foreach (DataRowView dv in dvList) //{ // //double x = Convert.ToDouble(dv["TIME"]); // //double x = (double)new XDate(2013, 6, 11, i, 0, 0); // DateTime xx = DateTime.Parse(dv["TIME"].ToString()); // double x = (double)new XDate(xx); // if (dv["FLOW"] is DBNull) // dv["FLOW"] = 500; // double y = Convert.ToDouble(dv["FLOW"]); // list.Add(x, y); //} // Generate a blue curve with circle symbols, and "My Curve 2" in the legend LineItem myCurve = myPane.AddCurve("煤气量", 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 myPane.XAxis.Type = AxisType.Date; myPane.AxisChange(); SetSize(); }
public void Generate(ref ZedGraph.ZedGraphControl graph) { GraphPane myPane = graph.GraphPane; myPane.Fill = new Fill(Color.FromArgb(210, 210, 210), Color.FromArgb(240, 250, 240)); myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 210), -45F); myPane.Legend.Position = ZedGraph.LegendPos.Right; myPane.Legend.FontSpec.Size = 7; myPane.Title.Text = "DB Size report"; myPane.XAxis.Title.Text = "Table"; myPane.YAxis.Title.Text = "Size in MB"; graph.AxisChange(); IList <E_Label_Value> List = E_Label_Value.LoadFromQuery("SELECT left([TableName],cast((CHARINDEX('_',[TableName],0)-1) as bigint)) as Label ,sum([TotalSpaceMB]) as Value FROM [SYNAPSE].[dbo].[V_Synapse_DB_USAGE] group by left([TableName],cast((CHARINDEX('_',[TableName],0)-1) as bigint)) order by Label"); double[] y = new double[List.Count]; string[] x = new string[List.Count]; int i = 0; foreach (E_Label_Value val in List) { x[i] = val.Label; y[i] = (double)val.Value; i++; } BarItem myCurve = myPane.AddBar("Curve 1", null, y, Color.White); myPane.XAxis.Scale.TextLabels = x; myPane.XAxis.Scale.FontSpec.Angle = 45; myPane.XAxis.Scale.FontSpec.Size = 6; myCurve.Bar.Fill = new Fill(Color.White, Color.SteelBlue, 45.0f); // Draw the X tics between the labels instead of at the labels myPane.XAxis.MajorTic.IsBetweenLabels = true; myPane.Legend.IsVisible = false; // Set the XAxis to Text type myPane.XAxis.Type = AxisType.Text; graph.AxisChange(); }
public virtual void Generate(ref ZedGraph.ZedGraphControl graph) { GraphPane myPane = graph.GraphPane; myPane.Fill = new Fill(Color.FromArgb(210, 210, 210), Color.FromArgb(240, 250, 240)); myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 210), -45F); myPane.Legend.Position = ZedGraph.LegendPos.Right; myPane.Legend.FontSpec.Size = 7; myPane.Title.Text = title; myPane.XAxis.Title.Text = xtitle; myPane.YAxis.Title.Text = ytitle; graph.AxisChange(); IList <E_Label_Value> List = E_Label_Value.LoadFromQuery(query); double[] y = new double[List.Count]; string[] x = new string[List.Count]; int i = 0; foreach (E_Label_Value val in List) { x[i] = val.Label; y[i] = (double)val.Value; i++; } BarItem myCurve = myPane.AddBar("Curve 1", null, y, Color.White); myPane.XAxis.Scale.TextLabels = x; myPane.XAxis.Scale.FontSpec.Angle = angle; myPane.XAxis.Scale.FontSpec.Size = fontsize; myCurve.Bar.Fill = new Fill(Color.Orange, Color.Red, 45.0f); // Draw the X tics between the labels instead of at the labels myPane.XAxis.MajorTic.IsBetweenLabels = true; myPane.Legend.IsVisible = false; // Set the XAxis to Text type myPane.XAxis.Type = AxisType.Text; graph.AxisChange(); }
public void Generate(ref ZedGraph.ZedGraphControl graph, String _query, Definition _report, List <Field> _fields) { GraphPane myPane = graph.GraphPane; myPane.Fill = new Fill(Color.FromArgb(210, 210, 210), Color.FromArgb(240, 250, 240)); myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 210), -45F); myPane.Legend.Position = ZedGraph.LegendPos.Right; myPane.Legend.FontSpec.Size = 7; myPane.Title.Text = _report.LABEL.ToString(); myPane.XAxis.Title.Text = ((Field)_fields[0]).ALIAS.ToString(); myPane.YAxis.Title.Text = ((Field)_fields[1]).ALIAS.ToString(); DataTable DT = new DataTable(); DT = SynapseCore.Database.DBFunction.GetTableFromQuery(_query); double[] y = new double[DT.Rows.Count]; string[] x = new string[DT.Rows.Count]; int i = 0; foreach (DataRow dr in DT.Rows) { x[i] = dr[0].ToString(); y[i] = double.Parse(dr[1].ToString()); i++; } BarItem myCurve = myPane.AddBar("Curve 1", null, y, Color.White); myPane.XAxis.Scale.TextLabels = x; myPane.XAxis.Scale.FontSpec.Angle = 90; myPane.XAxis.Scale.FontSpec.Size = 8; myCurve.Bar.Fill = new Fill(Color.White, Color.SteelBlue, 45.0f); // Draw the X tics between the labels instead of at the labels myPane.XAxis.MajorTic.IsBetweenLabels = true; myPane.Legend.IsVisible = false; // Set the XAxis to Text type myPane.XAxis.Type = AxisType.Text; graph.AxisChange(); }
public WeatherTracker() { InitializeComponent(); textBoxLat.Text = "37.997786"; textBoxLong.Text = "-89.513871"; dateTimePickerStart.Value = DateTime.Now.Date.Subtract(new TimeSpan(10, 0, 0, 0)); //mschart = new System.Windows.Forms.DataVisualization.Charting.Chart(); //mschart.Dock = DockStyle.Fill; //mschart.ChartAreas.Add("wind"); //splitContainer2.Panel1.Controls.Add(mschart); zedGraph = new ZedGraphControl(); zedGraph.Dock = DockStyle.Fill; splitContainer2.Panel1.Controls.Add(zedGraph); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.z1 = new ZedGraph.ZedGraphControl(); this.Stat = new System.Windows.Forms.Button(); this.SuspendLayout(); // // z1 // this.z1.Location = new System.Drawing.Point(-3, 0); this.z1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.z1.Name = "z1"; this.z1.ScrollGrace = 0D; this.z1.ScrollMaxX = 0D; this.z1.ScrollMaxY = 0D; this.z1.ScrollMaxY2 = 0D; this.z1.ScrollMinX = 0D; this.z1.ScrollMinY = 0D; this.z1.ScrollMinY2 = 0D; this.z1.Size = new System.Drawing.Size(1248, 742); this.z1.TabIndex = 0; // // Stat // this.Stat.BackColor = System.Drawing.Color.Teal; this.Stat.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Stat.ForeColor = System.Drawing.SystemColors.Control; this.Stat.Location = new System.Drawing.Point(917, 33); this.Stat.Name = "Stat"; this.Stat.Size = new System.Drawing.Size(286, 72); this.Stat.TabIndex = 1; this.Stat.Text = "Статистика по лінії регресії"; this.Stat.UseVisualStyleBackColor = false; this.Stat.Click += new System.EventHandler(this.Stat_Click); // // RegressionLine // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(1243, 735); this.Controls.Add(this.Stat); this.Controls.Add(this.z1); this.Name = "RegressionLine"; this.Text = "Лінія регресії"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); }
void timer_Tick(object sender, EventArgs e) { //Get last day in collected data DateTime last = DS.Data[DS.Data.Count - 1].Date; //Get 2.5 days forward DateTime noonNext = last.Add(new TimeSpan(2, 12, 0, 0)); if (DateTime.Now > noonNext) { DateTime newDay = last.Add(new TimeSpan(1, 0, 0, 0)); DS.AddDay(newDay); //mschart = DS.GetChart(mschart); zedGraph = DS.GetZedGraph(zedGraph); DS.Save(); richTextBox1.AppendText(DateTime.Now.ToString() + ", Added day, " + newDay.ToShortDateString()); } }
public void Generate(ref ZedGraph.ZedGraphControl graph, String _query, Definition _report, List <Field> _fields) { GraphPane myPane = graph.GraphPane; myPane.Fill = new Fill(Color.FromArgb(210, 210, 210), Color.FromArgb(240, 250, 240)); myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 210), -45F); myPane.Legend.Position = ZedGraph.LegendPos.Right; myPane.Legend.FontSpec.Size = 12; myPane.Title.Text = _report.LABEL.ToString(); myPane.XAxis.Title.Text = ((Field)_fields[0]).ALIAS.ToString(); DataTable DT = new DataTable(); DT = SynapseCore.Database.DBFunction.GetTableFromQuery(_query); List <PointPairList> allY = new List <PointPairList>(); for (int y = 1; y < DT.Rows[0].ItemArray.Count(); y++) { allY.Add(new PointPairList()); } foreach (DataRow dr in DT.Rows) { for (int y = 1; y < dr.ItemArray.Count(); y++) { ((PointPairList)allY[y - 1]).Add(double.Parse(dr[0].ToString()), double.Parse(dr[y].ToString())); } } Random random = new Random(); foreach (PointPairList ppl in allY) { int r = random.Next(0, 255); int g = random.Next(0, 255); int b = random.Next(0, 255); string curveTitle = ((Field)_fields[allY.IndexOf(ppl) + 1]).ALIAS.ToString(); myPane.AddCurve(curveTitle, ppl, Color.FromArgb(r, g, b), SymbolType.Diamond); } myPane.Legend.IsVisible = true; graph.AxisChange(); }