本文整理汇总了C#中NPlot.PhysicalAxis.GetBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# PhysicalAxis.GetBoundingBox方法的具体用法?C# PhysicalAxis.GetBoundingBox怎么用?C# PhysicalAxis.GetBoundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPlot.PhysicalAxis
的用法示例。
在下文中一共展示了PhysicalAxis.GetBoundingBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeterminePhysicalAxesToDraw
private void DeterminePhysicalAxesToDraw( Rectangle bounds,
Axis xAxis1, Axis xAxis2, Axis yAxis1, Axis yAxis2,
out PhysicalAxis pXAxis1, out PhysicalAxis pXAxis2,
out PhysicalAxis pYAxis1, out PhysicalAxis pYAxis2 )
{
System.Drawing.Rectangle cb = bounds;
pXAxis1 = new PhysicalAxis( xAxis1,
new Point( cb.Left, cb.Bottom ), new Point( cb.Right, cb.Bottom ) );
pYAxis1 = new PhysicalAxis( yAxis1,
new Point( cb.Left, cb.Bottom ), new Point( cb.Left, cb.Top ) );
pXAxis2 = new PhysicalAxis( xAxis2,
new Point( cb.Left, cb.Top), new Point( cb.Right, cb.Top) );
pYAxis2 = new PhysicalAxis( yAxis2,
new Point( cb.Right, cb.Bottom ), new Point( cb.Right, cb.Top ) );
int bottomIndent = padding_;
if (!pXAxis1.Axis.Hidden)
{
// evaluate its bounding box
Rectangle bb = pXAxis1.GetBoundingBox();
// finally determine its indentation from the bottom
bottomIndent = bottomIndent + bb.Bottom - cb.Bottom;
}
int leftIndent = padding_;
if (!pYAxis1.Axis.Hidden)
{
// evaluate its bounding box
Rectangle bb = pYAxis1.GetBoundingBox();
// finally determine its indentation from the left
leftIndent = leftIndent - bb.Left + cb.Left;
}
int topIndent = padding_;
float scale = this.DetermineScaleFactor( bounds.Width, bounds.Height );
int titleHeight;
if (this.AutoScaleTitle)
{
titleHeight = Utils.ScaleFont(titleFont_, scale).Height;
}
else
{
titleHeight = titleFont_.Height;
}
//count number of new lines in title.
int nlCount = 0;
for (int i=0; i<title_.Length; ++i)
{
if (title_[i] == '\n')
nlCount += 1;
}
titleHeight = (int)( ((float)nlCount*0.75 + 1.0f) * (float)titleHeight);
if (!pXAxis2.Axis.Hidden)
{
// evaluate its bounding box
Rectangle bb = pXAxis2.GetBoundingBox();
topIndent = topIndent - bb.Top + cb.Top;
// finally determine its indentation from the top
// correct top indendation to take into account plot title
if (title_ != "" )
{
topIndent += (int)(titleHeight * 1.3f);
}
}
int rightIndent = padding_;
if (!pYAxis2.Axis.Hidden)
{
// evaluate its bounding box
Rectangle bb = pYAxis2.GetBoundingBox();
// finally determine its indentation from the right
rightIndent = (int)(rightIndent + bb.Right-cb.Right);
}
// now we have all the default calculated positions and we can proceed to
// "move" the axes to their right places
// primary axes (bottom, left)
pXAxis1.PhysicalMin = new Point( cb.Left+leftIndent, cb.Bottom-bottomIndent );
pXAxis1.PhysicalMax = new Point( cb.Right-rightIndent, cb.Bottom-bottomIndent );
pYAxis1.PhysicalMin = new Point( cb.Left+leftIndent, cb.Bottom-bottomIndent );
pYAxis1.PhysicalMax = new Point( cb.Left+leftIndent, cb.Top+topIndent );
// secondary axes (top, right)
pXAxis2.PhysicalMin = new Point( cb.Left+leftIndent, cb.Top+topIndent );
pXAxis2.PhysicalMax = new Point( cb.Right-rightIndent, cb.Top+topIndent );
pYAxis2.PhysicalMin = new Point( cb.Right-rightIndent, cb.Bottom-bottomIndent );
pYAxis2.PhysicalMax = new Point( cb.Right-rightIndent, cb.Top+topIndent );
}
示例2: DeterminePhysicalAxesToDraw
private void DeterminePhysicalAxesToDraw(Rectangle bounds,
Axis xAxis1, Axis xAxis2, Axis yAxis1, Axis yAxis2,
out PhysicalAxis pXAxis1, out PhysicalAxis pXAxis2,
out PhysicalAxis pYAxis1, out PhysicalAxis pYAxis2 )
{
Rectangle cb = bounds;
pXAxis1 = new PhysicalAxis (xAxis1,
new Point (cb.Left, cb.Bottom), new Point (cb.Right, cb.Bottom) );
pYAxis1 = new PhysicalAxis (yAxis1,
new Point (cb.Left, cb.Bottom), new Point (cb.Left, cb.Top) );
pXAxis2 = new PhysicalAxis (xAxis2,
new Point (cb.Left, cb.Top), new Point (cb.Right, cb.Top) );
pYAxis2 = new PhysicalAxis (yAxis2,
new Point (cb.Right, cb.Bottom), new Point (cb.Right, cb.Top) );
double bottomIndent = padding;
if (!pXAxis1.Axis.Hidden) {
// evaluate its bounding box
Rectangle bb = pXAxis1.GetBoundingBox ();
// finally determine its indentation from the bottom
bottomIndent = bottomIndent + bb.Bottom - cb.Bottom;
}
double leftIndent = padding;
if (!pYAxis1.Axis.Hidden) {
// evaluate its bounding box
Rectangle bb = pYAxis1.GetBoundingBox();
// finally determine its indentation from the left
leftIndent = leftIndent - bb.Left + cb.Left;
}
// determine title size
double scale = DetermineScaleFactor (bounds.Width, bounds.Height);
Font scaled_font;
if (AutoScaleTitle) {
scaled_font = titleFont.WithScaledSize (scale);
}
else {
scaled_font = titleFont;
}
Size titleSize;
using (TextLayout layout = new TextLayout ()) {
layout.Font = scaled_font;
layout.Text = Title;
titleSize = layout.GetSize ();
};
double topIndent = padding;
if (!pXAxis2.Axis.Hidden) {
// evaluate its bounding box
Rectangle bb = pXAxis2.GetBoundingBox();
topIndent = topIndent - bb.Top + cb.Top;
// finally determine its indentation from the top
// correct top indendation to take into account plot title
if (title != "" ) {
topIndent += titleSize.Height * 1.3;
}
}
double rightIndent = padding;
if (!pYAxis2.Axis.Hidden) {
// evaluate its bounding box
Rectangle bb = pYAxis2.GetBoundingBox();
// finally determine its indentation from the right
rightIndent += (bb.Right-cb.Right);
}
// now we have all the default calculated positions and we can proceed to
// "move" the axes to their right places
// primary axes (bottom, left)
pXAxis1.PhysicalMin = new Point( cb.Left+leftIndent, cb.Bottom-bottomIndent );
pXAxis1.PhysicalMax = new Point( cb.Right-rightIndent, cb.Bottom-bottomIndent );
pYAxis1.PhysicalMin = new Point( cb.Left+leftIndent, cb.Bottom-bottomIndent );
pYAxis1.PhysicalMax = new Point( cb.Left+leftIndent, cb.Top+topIndent );
// secondary axes (top, right)
pXAxis2.PhysicalMin = new Point( cb.Left+leftIndent, cb.Top+topIndent );
pXAxis2.PhysicalMax = new Point( cb.Right-rightIndent, cb.Top+topIndent );
pYAxis2.PhysicalMin = new Point( cb.Right-rightIndent, cb.Bottom-bottomIndent );
pYAxis2.PhysicalMax = new Point( cb.Right-rightIndent, cb.Top+topIndent );
}