当前位置: 首页>>代码示例>>C#>>正文


C# ZedGraph.ZedGraphControl类代码示例

本文整理汇总了C#中ZedGraph.ZedGraphControl的典型用法代码示例。如果您正苦于以下问题:C# ZedGraphControl类的具体用法?C# ZedGraphControl怎么用?C# ZedGraphControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ZedGraphControl类属于ZedGraph命名空间,在下文中一共展示了ZedGraphControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowHistorgam

        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();
        }
开发者ID:elilise,项目名称:ulearn,代码行数:25,代码来源:Charts.cs

示例2: ZedGraphStyle_ZedGraphDrawing

        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();
        }
开发者ID:MapSuiteSamples,项目名称:MapSuiteSamples,代码行数:32,代码来源:PieChartDemographicStyleBuilder.cs

示例3: AddGraph

        /// <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();
            }
        }
开发者ID:Kushagratrivedi,项目名称:GitHub,代码行数:69,代码来源:OHLCGraph.cs

示例4: InitializeComponent

        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);

        }
开发者ID:matalangilbert,项目名称:stromohab-2008,代码行数:32,代码来源:ZedGraphPlotForm.cs

示例5: CreatGraph_all

        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();
        }
开发者ID:pandaDrunk,项目名称:CreativeABC,代码行数:28,代码来源:uiEGLPABC_ScoreShow1.cs

示例6: ConfigureEqGraph

        /// <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;
        }
开发者ID:hedoluna,项目名称:midi-shape-shifter,代码行数:36,代码来源:EqGraphConfig.cs

示例7: CreateGraph

    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();
    }
开发者ID:msphair,项目名称:MonoTesting,代码行数:28,代码来源:charting.cs

示例8: CreateChart

 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);
 }
开发者ID:facchinm,项目名称:SiRFLive,代码行数:27,代码来源:frmMPMStatsPlots.cs

示例9: ZedRepeater

        public ZedRepeater(ZedGraphControl zg, string curveName)
        {
            _zg = zg;
            CurveName = curveName;

            InitializeZedGraph();
        }
开发者ID:m000z0rz,项目名称:TuneRecognizer,代码行数:7,代码来源:ZedRepeater.cs

示例10: CreateBufferSizeChart

        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();
        }
开发者ID:cs143,项目名称:simulator,代码行数:35,代码来源:GraphWindow.cs

示例11: InitializeComponent

        /// <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);

        }
开发者ID:Rossano,项目名称:Peltier_Project_PC_GUI,代码行数:34,代码来源:zedGraphUserControl.Designer.cs

示例12: CreateGraph

        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();
        }
开发者ID:Mabloza,项目名称:GPS-Vehicle-Tracking,代码行数:30,代码来源:frmKmAnno.cs

示例13: PlotterWindow

        /// <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;
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:36,代码来源:PlotterWindow.cs

示例14: ShowHeatmap

 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();
 }
开发者ID:elilise,项目名称:ulearn,代码行数:30,代码来源:Charts.cs

示例15: CreateErrorChart

        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");
        }
开发者ID:rZeton,项目名称:plot-inet-x,代码行数:32,代码来源:ErrorSummaryWindow.cs


注:本文中的ZedGraph.ZedGraphControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。