本文整理汇总了C#中ZedGraph.MasterPane类的典型用法代码示例。如果您正苦于以下问题:C# MasterPane类的具体用法?C# MasterPane怎么用?C# MasterPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MasterPane类属于ZedGraph命名空间,在下文中一共展示了MasterPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Select
//public static Color SelectedSymbolColor = Color.Gray;
#endregion
#region Methods
/// <summary>
/// Place a <see cref="CurveItem" /> in the selection list, removing all other
/// items.
/// </summary>
/// <param name="master">The <see cref="MasterPane" /> that is the "owner"
/// of the <see cref="CurveItem" />'s.</param>
/// <param name="ci">The <see cref="CurveItem" /> to be added to the list.</param>
public void Select( MasterPane master, CurveItem ci )
{
//Clear the selection, but don't send the event,
//the event will be sent in "AddToSelection" by calling "UpdateSelection"
ClearSelection( master, false );
AddToSelection( master, ci );
}
示例2: ZoomStateGroup
/// <summary>
/// Construct a <see cref="ZoomStateGroup"/> object from the scale ranges settings contained
/// in each <see cref="GraphPane" /> for the specified <see cref="MasterPane"/>.
/// </summary>
/// <param name="masterPane">The <see cref="MasterPane"/> from which to obtain the scale
/// range values.
/// </param>
/// <param name="type">A <see cref="ZoomState.StateType"/> enumeration that indicates whether
/// this saved state is from a pan, zoom, or scroll.</param>
public ZoomStateGroup( MasterPane masterPane, StateType type )
: base(type)
{
_stack = new ZoomStateStack();
foreach ( GraphPane pane in masterPane._paneList )
_stack.Add( new ZoomState( pane, type ) );
}
示例3: MainWindow
public MainWindow()
{
//hp8753 = new HP8753DotNet();
isConnected = false;
InitializeComponent();
connect_button.Content = "Local -> Remote";
// Link to the XAML plot graph
plotGraphPane = dataGraph.MasterPane;
}
示例4: OnRenderGraphVillagePie
/// <summary>
/// This method is where you generate your graph.
/// </summary>
/// <param name="masterPane">You are provided with a MasterPane instance that
/// contains one GraphPane by default (accessible via masterPane[0]).</param>
/// <param name="g">A graphics instance so you can easily make the call to AxisChange()</param>
/// <param name="z">And a ZedGraphWeb instance because the event handler requires it</param>
/// <param name="row">Selected row n gridview.</param>
private static void OnRenderGraphVillagePie(ZedGraphWeb z,
Graphics g,
MasterPane masterPane,
TableRow row)
{
// Get the GraphPane so we can work with it
GraphPane myPane = masterPane[0];
// Fill the pane background with a color gradient
myPane.Fill = new Fill(Color.White, Color.White, 45.0f);
// No fill for the chart background
myPane.Chart.Fill.Type = FillType.None;
myPane.Legend.IsVisible = false;
myPane.Legend.IsShowLegendSymbols = true;
myPane.Legend.IsHStack = false;
// Add some pie slices
const string srcTable = "Goods";
DataBase dataBase = new DataBase();
DataSet dataSet = dataBase.GetGoods(srcTable, Misc.String2Number(row.Cells[0].Text.Trim()));
DataRow dataRow = dataSet.Tables[srcTable].Rows[0];
int wood = Misc.String2Number(dataRow.ItemArray[0].ToString());
int clay = Misc.String2Number(dataRow.ItemArray[1].ToString());
int iron = Misc.String2Number(dataRow.ItemArray[2].ToString());
int crop = Misc.String2Number(dataRow.ItemArray[3].ToString());
PieItem segmentWood = myPane.AddPieSlice(wood, Color.Green, Color.Green, 45f, 0, wood.ToString());
PieItem segmentClay = myPane.AddPieSlice(clay, Color.OrangeRed, Color.OrangeRed, 45f, .0, clay.ToString());
PieItem segmentIron = myPane.AddPieSlice(iron, Color.Blue, Color.Blue, 45f, 0, iron.ToString());
PieItem segmentCrop = myPane.AddPieSlice(crop, Color.Yellow, Color.Yellow, 45f, 0.2, crop.ToString());
segmentWood.LabelDetail.FontSpec.Size = 20f;
segmentClay.LabelDetail.FontSpec.Size = 20f;
segmentIron.LabelDetail.FontSpec.Size = 20f;
segmentCrop.LabelDetail.FontSpec.Size = 20f;
// Sum up the pie values
CurveList curves = myPane.CurveList;
double total = 0;
for (int x = 0; x < curves.Count; x++)
{
total += ((PieItem) curves[x]).Value;
}
// Set the GraphPane title
//myPane.Title.Text = String.Format("Total Goods : {0}\nWood : {1}\nClay : {2}\nIron : {3}\nCrop : {4}", total,
// wood, clay, iron, crop);
myPane.Title.Text = String.Format("Total Goods : {0}", total);
myPane.Title.FontSpec.IsItalic = true;
myPane.Title.FontSpec.Size = 24f;
myPane.Title.FontSpec.Family = "Times New Roman";
masterPane.AxisChange(g);
}
示例5: GetGraphData
public static GraphData GetGraphData(MasterPane masterPane)
{
var paneDatas = new List<GraphPaneData>();
foreach (var graphPane in masterPane.PaneList)
{
var graphPaneData = GraphPaneData.GetGraphPaneData(graphPane);
if (graphPaneData != null)
{
paneDatas.Add(graphPaneData);
}
}
return new GraphData(null, paneDatas);
}
示例6: 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();
}
示例7: UpdateSelection
/// <summary>
/// Mark the <see cref="CurveItem" />'s that are included in the selection list
/// by setting the <see cref="CurveItem.IsSelected" /> property to true.
/// </summary>
/// <param name="master">The <see cref="MasterPane" /> that "owns" the selection list.</param>
public void UpdateSelection( MasterPane master )
{
if ( Count <= 0 )
{
ClearSelection( master );
return;
}
foreach ( GraphPane pane in master.PaneList )
{
foreach ( CurveItem ci in pane.CurveList )
{
//Make it Inactive
ci.IsSelected = false;
}
}
foreach ( CurveItem ci in this )
{
//Make Active
ci.IsSelected = true;
//If it is a line / scatterplot, the selected Curve may be occluded by an unselected Curve
//So, move it to the top of the ZOrder by removing it, and re-adding it.
//Why only do this for Lines? ...Bar and Pie Curves are less likely to overlap,
//and adding and removing Pie elements changes thier display order
if ( ci.IsLine )
{
//I don't know how to get a Pane, from a CurveItem, so I can only do it
//if there is one and only one Pane, based on the assumption that the
//Curve's Pane is MasterPane[0]
//If there is only one Pane
if ( master.PaneList.Count == 1 )
{
GraphPane pane = master.PaneList[0];
pane.CurveList.Remove( ci );
pane.CurveList.Insert( 0, ci );
}
}
}
//Send Selection Changed Event
if ( SelectionChangedEvent != null )
SelectionChangedEvent( this, new EventArgs() );
}
示例8: ClearSelection
/// <summary>
/// Clear the selection list and optionally trigger a <see cref="SelectionChangedEvent" />.
/// </summary>
/// <param name="master">The <see cref="MasterPane" /> that "owns" the selection list.</param>
/// <param name="sendEvent">true to trigger a <see cref="SelectionChangedEvent" />,
/// false otherwise.</param>
public void ClearSelection( MasterPane master, bool sendEvent )
{
this.Clear();
foreach ( GraphPane pane in master.PaneList )
{
foreach ( CurveItem ci in pane.CurveList )
{
ci.IsSelected = false;
}
}
if ( sendEvent )
{
if ( SelectionChangedEvent != null )
SelectionChangedEvent( this, new EventArgs() );
}
}
示例9: OnRenderUserChart
private void OnRenderUserChart(ZedGraphWeb z, Graphics g, MasterPane masterPane)
{
GraphPane graphPane = masterPane[0];
graphPane.Title.Text = Resource.SalesByMonthChartLabel;
graphPane.XAxis.Title.Text = Resource.SalesByMonthChartMonthLabel;
graphPane.YAxis.Title.Text = Resource.SalesByMonthChartSalesLabel;
PointPairList pointList = new PointPairList();
if (salesByMonthData == null) { salesByMonthData = CommerceReport.GetSalesByYearMonthBySite(siteSettings.SiteGuid); }
foreach (DataRow row in salesByMonthData.Rows)
{
double x = new XDate(Convert.ToInt32(row["Y"]), Convert.ToInt32(row["M"]), 1);
double y = Convert.ToDouble(row["Sales"]);
pointList.Add(x, y);
}
LineItem myCurve2 = graphPane.AddCurve(Resource.SalesByMonthChartLabel, pointList, Color.Blue, SymbolType.Circle);
// Fill the area under the curve with a white-red gradient at 45 degrees
myCurve2.Line.Fill = new Fill(Color.White, Color.Green, 45F);
// Make the symbols opaque by filling them with white
myCurve2.Symbol.Fill = new Fill(Color.White);
// Set the XAxis to date type
graphPane.XAxis.Type = AxisType.Date;
graphPane.XAxis.CrossAuto = true;
// Fill the axis background with a color gradient
graphPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F);
masterPane.AxisChange(g);
}
示例10: MasterPaneInit
public void MasterPaneInit()
{
masterPane = graph.MasterPane;
masterPane.PaneList.Clear();
masterPane.Title.Text = "Spectrum Analyser";
masterPane.Title.IsVisible = false;
masterPane.Title.FontSpec.Size = 14f;
masterPane.Title.FontSpec.FontColor = Color.Gray;
masterPane.Title.FontSpec.IsBold = true;
masterPane.Fill = new Fill(Color.Black);
masterPane.Margin.All = 0f;
masterPane.InnerPaneGap = 0f;
masterPane.Legend.IsVisible = false;
masterPane.Legend.Position = LegendPos.TopCenter;
masterPane.Legend.Fill = new Fill(Color.Black);
masterPane.Legend.FontSpec.FontColor = Color.Gray;
masterPane.Legend.FontSpec.Size = 12f;
masterPane.Legend.Border.Color = Color.Gray;
masterPane.BaseDimension = 10f;
}
示例11: 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;
}
示例12: ApplyState
/// <summary>
/// Copy the properties from this <see cref="ZoomStateGroup"/> out to the specified
/// <see cref="MasterPane"/>.
/// </summary>
/// <param name="masterPane">The <see cref="MasterPane"/> to which the scale range
/// properties should be copied.
/// </param>
public void ApplyState( MasterPane masterPane )
{
for ( int i = 0; i < _stack.Count; i++ )
{
if ( masterPane._paneList.Count > i )
_stack[i].ApplyState( masterPane._paneList[i] );
}
}
示例13: ZedGraphWebStatistic_RenderGraph
//private bool CreateStatisticTable(StatisticInfo[] infos, int statisticTypeIndex, object[] statistic)
//{
// string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map };
// TableHeaderRow headerRow = new TableHeaderRow();
// TableHeaderCell headerCell = new TableHeaderCell();
// headerCell.Text = StatisticTypeNames[statisticTypeIndex];
// headerRow.Cells.Add(headerCell);
// headerCell = new TableHeaderCell();
// headerCell.Text = StringDef.Count;
// headerRow.Cells.Add(headerCell);
// TableStatistic.Rows.Add(headerRow);
// for (int i = 0; i < infos.Length; i++)
// {
// StatisticInfo info = infos[i];
// TableRow row = new TableRow();
// TableCell cell = new TableCell();
// for (int j = 0; j < statistic.Length; j++)
// {
// if (statistic[j].Id == info.Type)
// {
// cell.Text = statistic[j].Name;
// row.Cells.Add(cell);
// break;
// }
// }
// cell = new TableCell();
// cell.Text = info.Count.ToString();
// row.Cells.Add(cell);
// TableStatistic.Rows.Add(row);
// }
// return true;
//}
protected void ZedGraphWebStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
{
if (_server != null)
{
GraphPane graphPane = masterPane[0];
string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map };
string staticType = StatisticTypes[_statisticType];
string staticTypeName = StatisticTypeNames[_statisticType];
SqlCommand cmd = new SqlCommand("SELECT " + staticType + ",COUNT(*) FROM rolesfirst " + _whereStatement + " GROUP BY " + staticType);
if (!_server.IsConnected)
{
//LabelMessage.Visible = true;
//LabelMessage.Text = StringDef.NoConnectionAlert;
return;
}
SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id,_server, cmd);
if (result != null && result.Success)
{
//整理数据
SqlDataType[] dataTypes = new SqlDataType[] { SqlDataType.Int32, SqlDataType.Int32 };
result.SetFieldType(dataTypes);
object[] statistic = null;
switch (_statisticType)
{
case 0:
{
statistic = new object[FS2GameDataManager.MaxLevel];
for (int level = 1; level <= FS2GameDataManager.MaxLevel; level++)
{
statistic[level - 1] = level;
}
}
break;
case 1:
{
statistic = new object[FS2GameDataManager.RoleClasses.Length];
for (int i = 0; i < FS2GameDataManager.RoleClasses.Length; i++)
{
statistic[i] = FS2GameDataManager.RoleClasses[i];
}
}
break;
case 2:
{
statistic = new object[FS2GameDataManager.RoleSexes.Length];
for (int i = 0; i < FS2GameDataManager.RoleSexes.Length; i++)
{
statistic[i] = FS2GameDataManager.RoleSexes[i];
}
}
break;
case 3:
statistic = new object[] { 0, 1, 2, 3, 4 };
break;
}
//.........这里部分代码省略.........
示例14: ZedGraphWebExpStatistic_RenderGraph
protected void ZedGraphWebExpStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
{
Color statColor = Color.Blue;
string statTitle = string.Empty;
string statXAxisTitle = string.Empty;
switch (ListBoxViewContent.SelectedValue)
{
case "NpcBeKilled":
statColor = Color.Orange;
statTitle = StringDef.NpcBeKilledStatistic;
statXAxisTitle = StringDef.NpcBeKilledCount;
break;
case "NpcKill":
statColor = Color.Red;
statTitle = StringDef.NpcKillPlayerStatistic;
statXAxisTitle = StringDef.NpcKillPlayerCount;
break;
}
GraphPane graphPane = masterPane[0];
graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);
graphPane.Title.Text = statTitle;
graphPane.Title.FontSpec.Family = StringDef.DefaultFontFamily;
graphPane.Title.FontSpec.Size = 10;
graphPane.Legend.IsVisible = false;
graphPane.BarSettings.Base = BarBase.Y;
graphPane.XAxis.Title.Text = statXAxisTitle;
graphPane.XAxis.Title.FontSpec.Family = StringDef.DefaultFontFamily;
graphPane.XAxis.Title.FontSpec.Size = 6.2f;
graphPane.XAxis.MajorGrid.IsVisible = true;
graphPane.XAxis.MajorGrid.DashOff = 0;
graphPane.XAxis.MajorGrid.Color = Color.Gray;
graphPane.XAxis.MinorGrid.IsVisible = true;
graphPane.XAxis.MinorGrid.Color = Color.LightGray;
graphPane.XAxis.MinorGrid.DashOff = 0;
graphPane.XAxis.Scale.FontSpec.Size = 5.6f;
graphPane.XAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;
//graphPane.YAxis.Title.Text = StringDef.NpcTemplate;
graphPane.YAxis.Title.FontSpec.Family = StringDef.DefaultFontFamily;
graphPane.YAxis.MajorTic.IsBetweenLabels = true;
graphPane.YAxis.Scale.IsPreventLabelOverlap = false;
graphPane.YAxis.Scale.AlignH = AlignH.Center;
graphPane.YAxis.Scale.FontSpec.Size = 5.6f;
graphPane.YAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;
graphPane.YAxis.Scale.IsReverse = true;
graphPane.YAxis.Type = AxisType.Text;
double[] countList = new double[_recordList.Count];
string[] templateList = new string[_recordList.Count];
for (int i = 0; i < _recordList.Count; i++)
{
NpcStatisticInfo info = _recordList[i];
countList[i] = info.Count;
FS2NpcData npcData = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(info.TemaplteId));
if (npcData != null)
{
templateList[i] = npcData.ToString();
}
else
{
templateList[i] = info.TemaplteId;
}
}
BarItem barItem = graphPane.AddBar(StringDef.NpcBeKilledCount, countList, null, Color.Blue);
barItem.Bar.Fill = new Fill(statColor);
graphPane.YAxis.Scale.TextLabels = templateList;
masterPane.AxisChange();
BarItem.CreateBarLabels(graphPane, false, string.Empty, StringDef.DefaultFontFamily, 5.6f, TextObj.Default.FontColor, false, false, false);
}
示例15: DoLayout
/// <summary>
/// Internal method that applies a previously set layout with a rows per column or
/// columns per row configuration. This method is only called by
/// <see cref="DoLayout(Graphics,MasterPane)" />.
/// </summary>
internal void DoLayout( Graphics g, MasterPane master, bool isColumnSpecified, int[] countList,
float[] proportion)
{
// calculate scaleFactor on "normal" pane size (BaseDimension)
float scaleFactor = master.CalcScaleFactor();
// innerRect is the area for the GraphPane's
RectangleF innerRect = master.CalcClientRect( g, scaleFactor );
master.Legend.CalcRect( g, master, scaleFactor, ref innerRect );
// scaled InnerGap is the area between the GraphPane.Rect's
float scaledInnerGap = (float)( master._innerPaneGap * scaleFactor );
int iPane = 0;
if ( isColumnSpecified )
{
int rows = countList.Length;
float y = 0.0f;
for ( int rowNum = 0; rowNum < rows; rowNum++ )
{
float propFactor = _prop == null ? 1.0f / rows : _prop[rowNum];
float height = ( innerRect.Height - (float)( rows - 1 ) * scaledInnerGap ) *
propFactor;
int columns = countList[rowNum];
if ( columns <= 0 )
columns = 1;
float width = ( innerRect.Width - (float)( columns - 1 ) * scaledInnerGap ) /
(float)columns;
if ( iPane >= master._paneList.Count )
return;
for ( int colNum = 0; colNum < columns; colNum++ )
{
master[iPane].Rect = new RectangleF(
innerRect.X + colNum * ( width + scaledInnerGap ),
innerRect.Y + y,
width,
height );
iPane++;
}
y += height + scaledInnerGap;
}
}
else
{
int columns = countList.Length;
float x = 0.0f;
for ( int colNum = 0; colNum < columns; colNum++ )
{
float propFactor = _prop == null ? 1.0f / columns : _prop[colNum];
float width = ( innerRect.Width - (float)( columns - 1 ) * scaledInnerGap ) *
propFactor;
int rows = countList[colNum];
if ( rows <= 0 )
rows = 1;
float height = ( innerRect.Height - (float)( rows - 1 ) * scaledInnerGap ) / (float)rows;
for ( int rowNum = 0; rowNum < rows; rowNum++ )
{
if ( iPane >= master._paneList.Count )
return;
master[iPane].Rect = new RectangleF(
innerRect.X + x,
innerRect.Y + rowNum * ( height + scaledInnerGap ),
width,
height );
iPane++;
}
x += width + scaledInnerGap;
}
}
}