本文整理汇总了C#中ZedGraph.GraphPane.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# GraphPane.Draw方法的具体用法?C# GraphPane.Draw怎么用?C# GraphPane.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.GraphPane
的用法示例。
在下文中一共展示了GraphPane.Draw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGraph
/// <summary>
/// Method to create a <see cref="ZedGraph.GraphPane"/> class for the control.
/// </summary>
/// <param name="OutputStream">A <see cref="Stream"/> in which to output the ZedGraph
/// <see cref="System.Drawing.Image"/>.</param>
protected void CreateGraph( System.IO.Stream OutputStream )
{
//TODO: fix/verify the height/width values are okay like this
RectangleF rect = new RectangleF( 0, 0, this.Width-1, this.Height-1 );
GraphPane pane = new GraphPane( rect, title, xlabel, ylabel );
//TODO: add all the goodies from visual mode
pane.IsShowTitle = this.IsShowTitle;
Bitmap image = new Bitmap( this.Width, this.Height );
Graphics g = Graphics.FromImage( image );
// Use callback to gather more settings
OnDrawPane( g, pane );
// Render the graph to a bitmap
g.Clear(Color.FromArgb(255, 255, 255, 255));
pane.Draw( g );
// Stream the graph out
MemoryStream ms = new MemoryStream();
image.Save( ms, this.ImageFormat );
//TODO: provide caching options
ms.WriteTo(OutputStream);
}
示例2: AxisChangeAndDraw
private static void AxisChangeAndDraw(GraphPane myPane)
{
using (Bitmap b = new Bitmap(640, 480))
{
using (Graphics g = Graphics.FromImage(b))
{
myPane.AxisChange(g);
myPane.Draw(g);
}
}
}
示例3: CopyToClip
private void CopyToClip( GraphPane thePane )
{
Graphics g = this.CreateGraphics();
IntPtr hdc = g.GetHdc();
//metaFile = new Metafile( hdc, EmfType.EmfPlusDual, "ZedGraph" );
Metafile metaFile = new Metafile(hdc, EmfType.EmfPlusOnly);
g.ReleaseHdc(hdc);
g.Dispose();
Graphics gMeta = Graphics.FromImage( metaFile );
thePane.Draw( gMeta );
gMeta.Dispose();
//You can call this function with code that is similar to the following code:
//ClipboardMetafileHelper.PutEnhMetafileOnClipboard( this.Handle, metaFile );
IntPtr hMeta = metaFile.GetHenhmetafile();
System.Windows.Forms.Clipboard.SetDataObject( hMeta, true );
MessageBox.Show( "Copied to ClipBoard" );
}
示例4: Form1_Load
//.........这里部分代码省略.........
myPane.AxisChange( this.CreateGraphics() );
#endif
#if false // Basic curve test - Linear Axis with Many Points
myPane = new GraphPane( new RectangleF( 0, 0, 640, 480 ), "Title", "XAxis", "YAxis" );
PointPairList list = new PointPairList();
for ( int i=0; i<100000; i++ )
{
double x = (double) i;
double y = Math.Sin( x / 8.0 );
double z = Math.Abs(Math.Cos( i / 8.0 )) * y;
list.Add( x, y, z );
}
LineItem myCurve = myPane.AddCurve( "curve", list, Color.Blue, SymbolType.HDash );
myCurve.Symbol.IsVisible = false;
//myPane.XAxis.Min = 1;
//myPane.XAxis.Max = 100;
//myPane.XAxis.IsReverse = true;
//myPane.XAxis.Type = AxisType.Log;
//RectangleF rect = new RectangleF( 3, 0.7, 8, 0.2 );
Graphics g = this.CreateGraphics();
myPane.AxisChange( g );
SetSize();
int startTick = Environment.TickCount;
myPane.Draw( g );
int endTick = Environment.TickCount;
MessageBox.Show( "ticks = " + ( endTick - startTick ).ToString() );
#endif
#if false // Gantt Chart
myPane = new GraphPane();
myPane.Title.Text = "Gantt Chart";
myPane.XAxis.Title.Text = "Date";
myPane.YAxis.Title.Text = "Project";
myPane.XAxis.Type = AxisType.Date;
myPane.YAxis.Type = AxisType.Text;
myPane.BarBase = BarBase.Y;
string[] labels = { "Project 1", "Project 2" };
myPane.YAxis.TextLabels = labels;
myPane.YAxis.IsTicsBetweenLabels = true;
// First, define all the bars that you want to be red
PointPairList ppl = new PointPairList();
XDate start = new XDate( 2005, 10, 31 );
XDate end = new XDate( 2005, 11, 15 );
// x is start of bar, y is project number, z is end of bar
// Define this first one using start/end variables for illustration
ppl.Add( start, 1.0, end );
// add another red bar, assigned to project 2
// Didn't use start/end variables here, but it's the same concept
ppl.Add( new XDate( 2005, 12, 16 ), 2.0, new XDate( 2005, 12, 31 ) );
HiLowBarItem myBar = myPane.AddHiLowBar( "job 1", ppl, Color.Red );
示例5: DoCreateChartImage
protected override Image DoCreateChartImage()
{
var pg = new GraphPane();
var seria = new PointPairList();
foreach (var pointPair in Parameters.SeriaData.Select(p => new PointPair(p.Key, p.Value)))
{
seria.Add(pointPair);
}
pg.AddCurve("Test", seria, Color.DeepSkyBlue);
pg.AxisChange();
Image tmpImage = new Bitmap(Parameters.ChartWidth, Parameters.ChartHeight);
var g = Graphics.FromImage(tmpImage);
pg.ReSize(g, new RectangleF(0, 0, Parameters.ChartWidth, Parameters.ChartHeight));
pg.Draw(g);
return tmpImage;
}