本文整理汇总了C#中ZedGraph.MasterPane.CalcScaleFactor方法的典型用法代码示例。如果您正苦于以下问题:C# MasterPane.CalcScaleFactor方法的具体用法?C# MasterPane.CalcScaleFactor怎么用?C# MasterPane.CalcScaleFactor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.MasterPane
的用法示例。
在下文中一共展示了MasterPane.CalcScaleFactor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeImageMap
/// <summary>
/// Generate an ImageMap as Html tags
/// </summary>
/// <param name="masterPane">The source <see cref="MasterPane" /> to be
/// image mapped.</param>
/// <param name="output">An <see cref="HtmlTextWriter" /> instance in which
/// the html tags will be written for the image map.</param>
public void MakeImageMap( MasterPane masterPane, HtmlTextWriter output )
{
string shape;
string coords;
Bitmap image = new Bitmap( 1, 1 );
using ( Graphics g = Graphics.FromImage( image ) )
{
float masterScale = masterPane.CalcScaleFactor();
// Frontmost objects are MasterPane objects with A_InFront
foreach ( GraphObj obj in masterPane.GraphObjList )
{
if ( obj.Link.IsActive && obj.ZOrder == ZOrder.A_InFront )
{
obj.GetCoords( masterPane, g, masterScale, out shape, out coords );
MakeAreaTag( shape, coords, obj.Link.Url, obj.Link.Target,
obj.Link.Title, obj.Link.Tag, output );
}
}
// Now loop over each GraphPane
foreach ( GraphPane pane in masterPane.PaneList )
{
float scaleFactor = pane.CalcScaleFactor();
// Next comes GraphPane GraphObjs in front of data points
foreach ( GraphObj obj in pane.GraphObjList )
{
if ( obj.Link.IsActive && obj.IsInFrontOfData )
{
obj.GetCoords( pane, g, scaleFactor, out shape, out coords );
MakeAreaTag( shape, coords, obj.Link.Url, obj.Link.Target,
obj.Link.Title, obj.Link.Tag, output );
}
}
// Then come the data points (CurveItems)
foreach ( CurveItem curve in pane.CurveList )
{
if ( curve.Link.IsActive && curve.IsVisible )
{
for ( int i=0; i < (curve is PieItem ? 1 : curve.Points.Count); i++ )
{
//if ( curve.GetCoords( pane, i, pane.Rect.Left, pane.Rect.Top, out coords ) )
if ( curve.GetCoords( pane, i, out coords ) )
{
if ( curve is PieItem )
{
MakeAreaTag( "poly", coords, curve.Link.Url,
curve.Link.Target, curve.Link.Title, curve.Link.Tag, output );
// only one point for PieItems
break;
}
else
{
// Add an "?index=4" type tag to the url to indicate which
// point was selected
string url;
if ( curve.Link.Url != string.Empty )
url = curve.Link.MakeCurveItemUrl( pane, curve, i );
else
url = "";
string title = curve.Link.Title;
if ( curve.Points[i].Tag is string )
title = curve.Points[i].Tag as string;
MakeAreaTag( "rect", coords, url,
curve.Link.Target, title, curve.Points[i].Tag, output );
}
}
}
}
}
// Then comes the GraphObjs behind the data points
foreach ( GraphObj obj in pane.GraphObjList )
{
if ( obj.Link.IsActive && !obj.IsInFrontOfData )
{
obj.GetCoords( pane, g, scaleFactor, out shape, out coords );
MakeAreaTag( shape, coords, obj.Link.Url, obj.Link.Target,
obj.Link.Title, obj.Link.Tag, output );
}
}
}
// Hindmost objects are MasterPane objects with !A_InFront
foreach ( GraphObj obj in masterPane.GraphObjList )
{
if ( obj.Link.IsActive && obj.ZOrder != ZOrder.A_InFront )
{
obj.GetCoords( masterPane, g, masterScale, out shape, out coords );
MakeAreaTag( shape, coords, obj.Link.Url, obj.Link.Target,
//.........这里部分代码省略.........
示例2: 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;
}
}
}