本文整理汇总了C#中ZedGraph.MasterPane.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MasterPane.Add方法的具体用法?C# MasterPane.Add怎么用?C# MasterPane.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.MasterPane
的用法示例。
在下文中一共展示了MasterPane.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZedGraphProxy
public ZedGraphProxy(ZedGraphControl chart)
{
Chart = chart;
master = chart.MasterPane;
master.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0f);
master.PaneList.Clear();
master.Title.IsVisible = true;
//master.Title.Text = "";
master.Margin.All = 10;
master.InnerPaneGap = 0;
myPane = new GraphPane(new Rectangle(25, 25, chart.Width - 50, chart.Height - 50), "", "", "");
// myPane.Title.Text = "";
myPane.XAxis.Title.Text = "Time, s";
myPane.Y2Axis.IsVisible = true;
myPane.Fill.IsVisible = false;
myPane.Chart.Fill = new Fill(Color.White, Color.LightYellow, 45.0F);
myPane.Margin.All = 0;
myPane.Margin.Top = 20;
master.Add(myPane);
y1List = new PointPairList();
y2List = new PointPairList();
var myCurve = myPane.AddCurve("", y1List, Color.Red, SymbolType.Circle);
myCurve.IsVisible = false;
myCurve = myPane.AddCurve("", y2List, Color.Green, SymbolType.Circle);
myCurve.IsVisible = false;
myCurve.IsY2Axis = true;
chart.IsSynchronizeYAxes = true;
chart.Invalidate();
}
示例2: CreateGraph
/// <summary>
///
/// </summary>
/// <param name="OutputStream"></param>
/// <param name="Format"></param>
/// <param name="bShowTransparency">if true, draw squares instead of leaving the
/// background transparent</param>
/// <remarks>
/// bShowTransparency is set to true in design mode, to false otherwise.
/// </remarks>
protected MasterPane CreateGraph( System.IO.Stream OutputStream, ImageFormat Format,
bool bShowTransparency )
{
RectangleF rect = new RectangleF( 0, 0, this.Width, this.Height );
MasterPane mp = new MasterPane( string.Empty, rect );
mp.Margin.All = 0;
mp.Fill.IsVisible = false;
mp.Border.IsVisible = false;
// create all required panes
//for ( int i = 0; i < this.PaneCount; i++ )
//{
mp.Add( new GraphPane( rect, Title, string.Empty, string.Empty ) );
//}
// create output bitmap container
Bitmap image = new Bitmap( this.Width, this.Height );
using ( Graphics g = Graphics.FromImage( image ) )
{
// Apply layout plan
//mp.SetLayout( this.PaneLayout );
mp.ReSize( g, rect );
// Use callback to gather more settings and data values
OnDrawPane( g, mp );
// Allow designer control of axischange
if ( this.AxisChanged ) mp.AxisChange( g );
// Render the graph to a bitmap
if ( bShowTransparency && mp.Fill.Color.A != 255 )
{
//Show the transparency as white/gray filled squares
// We need to add the resource namespace to its name
//string resourceName = string.Format( "{0}.transparency.png", GetType().Namespace );
string resourceName = "ZedGraph.ZedGraph.transparency.png";
Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( resourceName );
if ( stream == null )
throw new Exception( "Does the Build Action of the resource " + resourceName + " is set to Embedded Resource ?" );
using ( System.Drawing.Image brushImage = new Bitmap( stream ) )
using ( TextureBrush brush = new TextureBrush( brushImage, WrapMode.Tile ) )
{
g.FillRectangle( brush, 0, 0, this.Width, this.Height );
}
stream.Close();
}
mp.Draw( g );
}
// Stream the graph out
MemoryStream ms = new MemoryStream();
image.Save( ms, Format );
//TODO: provide caching options
ms.WriteTo( OutputStream );
return mp;
}
示例3: ZedGraphControl
/// <summary>
/// Default Constructor
/// </summary>
public ZedGraphControl()
{
InitializeComponent();
// These commands do nothing, but they get rid of the compiler warnings for
// unused events
bool b = MouseDown == null || MouseUp == null || MouseMove == null;
// Link in these events from the base class, since we disable them from this class.
base.MouseDown += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseDown );
base.MouseUp += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseUp );
base.MouseMove += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseMove );
//this.MouseWheel += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseWheel );
// Use double-buffering for flicker-free updating:
SetStyle( ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint
| ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true );
//isTransparentBackground = false;
//SetStyle( ControlStyles.Opaque, false );
SetStyle( ControlStyles.SupportsTransparentBackColor, true );
//this.BackColor = Color.Transparent;
_resourceManager = new ResourceManager( "VixenModules.App.Curves.ZedGraph.ZedGraphLocale",
Assembly.GetExecutingAssembly());
Rectangle rect = new Rectangle( 0, 0, this.Size.Width, this.Size.Height );
_masterPane = new MasterPane( "", rect );
_masterPane.Margin.All = 0;
_masterPane.Title.IsVisible = false;
string titleStr = _resourceManager.GetString( "title_def" );
string xStr = _resourceManager.GetString( "x_title_def" );
string yStr = _resourceManager.GetString( "y_title_def" );
//GraphPane graphPane = new GraphPane( rect, "Title", "X Axis", "Y Axis" );
GraphPane graphPane = new GraphPane( rect, titleStr, xStr, yStr );
using ( Graphics g = this.CreateGraphics() )
{
graphPane.AxisChange( g );
//g.Dispose();
}
_masterPane.Add( graphPane );
this.hScrollBar1.Minimum = 0;
this.hScrollBar1.Maximum = 100;
this.hScrollBar1.Value = 0;
this.vScrollBar1.Minimum = 0;
this.vScrollBar1.Maximum = 100;
this.vScrollBar1.Value = 0;
_xScrollRange = new ScrollRange( true );
_yScrollRangeList = new ScrollRangeList();
_y2ScrollRangeList = new ScrollRangeList();
_yScrollRangeList.Add( new ScrollRange( true ) );
_y2ScrollRangeList.Add( new ScrollRange( false ) );
_zoomState = null;
_zoomStateStack = new ZoomStateStack();
}
示例4: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
CreateGraph_BasicDate();
Trace.Listeners.Add(new TextWriterTraceListener( @"myTrace.txt" ) );
Trace.AutoFlush = true;
memGraphics.CreateDoubleBuffer(this.CreateGraphics(),
this.ClientRectangle.Width, this.ClientRectangle.Height);
#if false // Multi Y Axis demo
myPane = new GraphPane( new Rectangle( 10, 10, 10, 10 ),
"Demonstration of Multi Y Graph",
"Time, s",
"Velocity, m/s" );
// Set the titles and axis labels
myPane.Y2Axis.Title.Text = "Acceleration, m/s2";
// Make up some data _points based on the Sine function
PointPairList vList = new PointPairList();
PointPairList aList = new PointPairList();
PointPairList dList = new PointPairList();
PointPairList eList = new PointPairList();
for ( int i=0; i<30; i++ )
{
double time = (double) i;
double acceleration = 2.0;
double velocity = acceleration * time;
double distance = acceleration * time * time / 2.0;
double energy = 100.0 * velocity * velocity / 2.0;
aList.Add( time, acceleration );
vList.Add( time, velocity );
eList.Add( time, energy );
dList.Add( time, distance );
}
// Generate a red curve with diamond symbols, and "Velocity" in the _legend
LineItem myCurve = myPane.AddCurve( "Velocity",
vList, Color.Red, SymbolType.Diamond );
// Fill the symbols with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Generate a blue curve with circle symbols, and "Acceleration" in the _legend
myCurve = myPane.AddCurve( "Acceleration",
aList, Color.Blue, SymbolType.Circle );
// Fill the symbols with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Associate this curve with the Y2 axis
myCurve.IsY2Axis = true;
// Generate a green curve with square symbols, and "Distance" in the _legend
myCurve = myPane.AddCurve( "Distance",
dList, Color.Green, SymbolType.Square );
// Fill the symbols with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Associate this curve with the second Y axis
myCurve.YAxisIndex = 1;
// Generate a Black curve with triangle symbols, and "Energy" in the _legend
myCurve = myPane.AddCurve( "Energy",
eList, Color.Black, SymbolType.Triangle );
// Fill the symbols with white
myCurve.Symbol.Fill = new Fill( Color.White );
// Associate this curve with the Y2 axis
myCurve.IsY2Axis = true;
// Associate this curve with the second Y2 axis
myCurve.YAxisIndex = 1;
// Show the x axis grid
myPane.XAxis.MajorGrid.IsVisible = true;
// 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 = false;
// Align the Y axis labels so they are flush to the axis
myPane.YAxis.Scale.Align = AlignP.Inside;
myPane.YAxis.Scale.Max = 100;
// Enable the Y2 axis display
myPane.Y2Axis.IsVisible = true;
// Make the Y2 axis scale blue
myPane.Y2Axis.Scale.FontSpec.FontColor = Color.Blue;
myPane.Y2Axis.Title.FontSpec.FontColor = Color.Blue;
// turn off the opposite tics so the Y2 tics don't show up on the Y axis
myPane.Y2Axis.MajorTic.IsOpposite = false;
myPane.Y2Axis.MinorTic.IsOpposite = false;
// Display the Y2 axis grid lines
myPane.Y2Axis.MajorGrid.IsVisible = true;
// Align the Y2 axis labels so they are flush to the axis
myPane.Y2Axis.Scale.Align = AlignP.Inside;
myPane.Y2Axis.Scale.Min = 1.5;
myPane.Y2Axis.Scale.Max = 3;
//.........这里部分代码省略.........