本文整理汇总了C#中NPlot.Axis类的典型用法代码示例。如果您正苦于以下问题:C# Axis类的具体用法?C# Axis怎么用?C# Axis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Axis类属于NPlot命名空间,在下文中一共展示了Axis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TradingDateTimeAxis
/// <summary>
/// Copy Constructor
/// </summary>
/// <param name="a">construct a TradingDateTimeAxis based on this provided axis.</param>
public TradingDateTimeAxis(Axis a)
: base(a)
{
Init();
if (a is TradingDateTimeAxis)
DoClone ((TradingDateTimeAxis)a, this);
else if (a is DateTimeAxis)
DoClone ((DateTimeAxis)a, this);
else {
DoClone (a, this);
this.NumberFormat = null;
}
}
示例2: DoMouseDown
/// <summary>
/// MouseDown method for AxisDrag interaction
/// </summary>
/// <param name="X">mouse X position</param>
/// <param name="Y">mouse Y position</param>
/// <param name="keys">mouse and keyboard modifiers</param>
/// <param name="ps">the InteractivePlotSurface2D</param>
public override bool DoMouseDown(int X, int Y, Modifier keys, InteractivePlotSurface2D ps)
{
// if the mouse is inside the plot area [the tick marks may be here,
// and are counted as part of the axis], then don't invoke drag.
if (ps.PlotAreaBoundingBoxCache.Contains(X,Y)) {
return false;
}
if ((keys & Modifier.Button1) != 0) {
// see if hit with axis. NB Only one axis object will be returned
ArrayList objects = ps.HitTest(new Point(X, Y));
foreach (object o in objects) {
if (o is NPlot.Axis) {
dragging_ = true;
axis_ = (Axis)o;
if (ps.PhysicalXAxis1Cache.Axis == axis_) {
physicalAxis_ = ps.PhysicalXAxis1Cache;
ps.plotCursor = CursorType.LeftRight;
}
else if (ps.PhysicalXAxis2Cache.Axis == axis_) {
physicalAxis_ = ps.PhysicalXAxis2Cache;
ps.plotCursor = CursorType.LeftRight;
}
else if (ps.PhysicalYAxis1Cache.Axis == axis_) {
physicalAxis_ = ps.PhysicalYAxis1Cache;
ps.plotCursor = CursorType.UpDown;
}
else if (ps.PhysicalYAxis2Cache.Axis == axis_) {
physicalAxis_ = ps.PhysicalYAxis2Cache;
ps.plotCursor = CursorType.UpDown;
}
startPoint_ = new Point(X, Y); // don't combine these - Mono
lastPoint_ = startPoint_; // bug #475205 prior to 2.4
// evaluate focusRatio about which axis is expanded
float x = startPoint_.X - physicalAxis_.PhysicalMin.X;
float y = startPoint_.Y - physicalAxis_.PhysicalMin.Y;
double r = Math.Sqrt(x*x + y*y);
focusRatio_ = r/physicalAxis_.PhysicalLength;
return false;
}
}
}
return false;
}
示例3: Clear
/// <summary>
/// Clears the plot and resets to default values.
/// </summary>
public void Clear()
{
xAxis1ZoomCache_ = null;
yAxis1ZoomCache_ = null;
xAxis2ZoomCache_ = null;
yAxis2ZoomCache_ = null;
ps_.Clear();
interactions_.Clear();
}
示例4: DoMouseUp
/// <summary>
///
/// </summary>
/// <param name="e"></param>
/// <param name="ctr"></param>
public override bool DoMouseUp(MouseEventArgs e, Control ctr)
{
if (doing_)
{
doing_ = false;
axis_ = null;
physicalAxis_ = null;
lastPoint_ = new Point();
}
return false;
}
示例5: LogAxis
/// <summary>
/// Copy Constructor
/// </summary>
/// <param name="a">The Axis to clone.</param>
public LogAxis(Axis a)
: base(a)
{
Init();
}
示例6: PhysicalAxis
/// <summary>
/// Construct
/// </summary>
/// <param name="a">The axis this is a physical representation of.</param>
/// <param name="physicalMin">the physical position of the world minimum axis value.</param>
/// <param name="physicalMax">the physical position of the world maximum axis value.</param>
public PhysicalAxis(Axis a, Point physicalMin, Point physicalMax)
{
Axis = a;
PhysicalMin = physicalMin;
PhysicalMax = physicalMax;
}
示例7: DateTimeAxis
/// <summary>
/// Constructor
/// </summary>
/// <param name="a">Axis to construct from</param>
public DateTimeAxis(Axis a)
: base(a)
{
Init ();
NumberFormat = null;
}
示例8: DetermineAxesToDraw
private void DetermineAxesToDraw( out Axis xAxis1, out Axis xAxis2, out Axis yAxis1, out Axis yAxis2 )
{
xAxis1 = this.xAxis1_;
xAxis2 = this.xAxis2_;
yAxis1 = this.yAxis1_;
yAxis2 = this.yAxis2_;
if (this.xAxis1_ == null)
{
if (this.xAxis2_ == null)
{
throw new NPlotException( "Error: No X-Axis specified" );
}
xAxis1 = (Axis)this.xAxis2_.Clone();
xAxis1.HideTickText = true;
xAxis1.TicksAngle = -(float)Math.PI / 2.0f;
}
if (this.xAxis2_ == null)
{
// don't need to check if xAxis1_ == null, as case already handled above.
xAxis2 = (Axis)this.xAxis1_.Clone();
xAxis2.HideTickText = true;
xAxis2.TicksAngle = (float)Math.PI / 2.0f;
}
if (this.yAxis1_ == null)
{
if (this.yAxis2_ == null)
{
throw new NPlotException( "Error: No Y-Axis specified" );
}
yAxis1 = (Axis)this.yAxis2_.Clone();
yAxis1.HideTickText = true;
yAxis1.TicksAngle = (float)Math.PI / 2.0f;
}
if (this.yAxis2_ == null)
{
// don't need to check if yAxis1_ == null, as case already handled above.
yAxis2 = (Axis)this.yAxis1_.Clone();
yAxis2.HideTickText = true;
yAxis2.TicksAngle = -(float)Math.PI / 2.0f;
}
}
示例9: DoClone
/// <summary>
/// Helper method for Clone. Does all the copying - can be called by derived
/// types so they don't need to implement this part of the copying themselves.
/// also useful in constructor of derived types that takes Axis class.
/// </summary>
protected static void DoClone(Axis src, Axis dest)
{
// value items
dest.autoScaleText_ = src.autoScaleText_;
dest.autoScaleTicks_ = src.autoScaleTicks_;
dest.worldMax_ = src.worldMax_;
dest.worldMin_ = src.worldMin_;
dest.tickTextNextToAxis_ = src.tickTextNextToAxis_;
dest.hidden_ = src.hidden_;
dest.hideTickText_ = src.hideTickText_;
dest.reversed_ = src.reversed_;
dest.ticksAngle_ = src.ticksAngle_;
dest.ticksLabelAngle_ = src.ticksLabelAngle_;
dest.minPhysicalLargeTickStep_ = src.minPhysicalLargeTickStep_;
dest.ticksIndependentOfPhysicalExtent_ = src.ticksIndependentOfPhysicalExtent_;
dest.largeTickSize_ = src.largeTickSize_;
dest.smallTickSize_ = src.smallTickSize_;
dest.ticksCrossAxis_ = src.ticksCrossAxis_;
dest.labelOffset_ = src.labelOffset_;
dest.labelOffsetAbsolute_ = src.labelOffsetAbsolute_;
dest.labelOffsetScaled_ = src.labelOffsetScaled_;
dest.lineColor_ = src.lineColor_;
dest.tickTextColor_ = src.tickTextColor_;
dest.labelColor_ = src.labelColor_;
dest.fontScale_ = src.fontScale_;
dest.tickScale_ = src.tickScale_;
// reference items.
dest.tickTextFont_ = src.tickTextFont_.WithScaledSize (1.0);
dest.labelFont_ = src.labelFont_.WithScaledSize (1.0);
dest.label_ = (string)src.label_.Clone();
}
示例10: Axis
/// <summary>
/// Copy constructor.
/// </summary>
/// <param name="src">The Axis to clone.</param>
public Axis(Axis src )
{
Axis.DoClone (src, this);
}
示例11: Init
private void Init()
{
drawables_ = new ArrayList();
xAxisPositions_ = new ArrayList();
yAxisPositions_ = new ArrayList();
zPositions_ = new ArrayList();
ordering_ = new SortedList();
FontFamily fontFamily = FontFamily.GenericSansSerif;
TitleFont = new Font(fontFamily, 14, FontStyle.Regular);
padding_ = 10;
title_ = "";
autoScaleTitle_ = false;
autoScaleAutoGeneratedAxes_ = false;
xAxis1_ = null;
xAxis2_ = null;
yAxis1_ = null;
yAxis2_ = null;
pXAxis1Cache_ = null;
pYAxis1Cache_ = null;
pXAxis2Cache_ = null;
pYAxis2Cache_ = null;
titleBrush_ = new SolidBrush( Color.Black );
plotBackColor_ = Color.White;
this.legend_ = null;
axesConstraints_ = new ArrayList();
}
示例12: DateTimeAxis
/// <summary>
/// Constructor
/// </summary>
/// <param name="a">Axis to construct from</param>
public DateTimeAxis( Axis a )
: base(a)
{
this.Init();
this.NumberFormat = null;
}
示例13: Init
private void Init()
{
drawables = new ArrayList ();
xAxisPositions = new ArrayList ();
yAxisPositions = new ArrayList ();
zPositions = new ArrayList ();
ordering = new SortedList ();
try {
TitleFont = Font.FromName ("Tahoma 14");
}
catch (System.ArgumentException) {
throw new NPlotException("Error: Tahoma font is not installed on this system");
}
padding = 10;
title = "";
autoScaletitle = false;
autoScaleAutoGeneratedAxes = false;
xAxis1 = null;
xAxis2 = null;
yAxis1 = null;
yAxis2 = null;
pXAxis1Cache = null;
pYAxis1Cache = null;
pXAxis2Cache = null;
pYAxis2Cache = null;
titleColor = Colors.Black;
plotBackColor = Colors.White;
legend = null;
axesConstraints = new ArrayList ();
}
示例14: 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 );
}
示例15: DetermineAxesToDraw
private void DetermineAxesToDraw(out Axis xAxis_1, out Axis xAxis_2, out Axis yAxis_1, out Axis yAxis_2)
{
xAxis_1 = xAxis1;
xAxis_2 = xAxis2;
yAxis_1 = yAxis1;
yAxis_2 = yAxis2;
if (xAxis1 == null) {
if (xAxis2 == null) {
throw new NPlotException ("Error: No X-Axis specified");
}
xAxis_1 = (Axis)xAxis2.Clone ();
xAxis_1.HideTickText = true;
xAxis_1.TicksAngle = -Math.PI / 2;
}
if (xAxis2 == null) {
// don't need to check if xAxis1 == null, as case already handled above.
xAxis_2 = (Axis)xAxis1.Clone ();
xAxis_2.HideTickText = true;
xAxis_2.TicksAngle = Math.PI / 2.0;
}
if (yAxis1 == null) {
if (yAxis2 == null) {
throw new NPlotException ("Error: No Y-Axis specified");
}
yAxis_1 = (Axis)yAxis2.Clone();
yAxis_1.HideTickText = true;
yAxis_1.TicksAngle = Math.PI / 2.0;
}
if (yAxis2 == null) {
// don't need to check if yAxis1 == null, as case already handled above.
yAxis_2 = (Axis)yAxis1.Clone();
yAxis_2.HideTickText = true;
yAxis_2.TicksAngle = -Math.PI / 2.0;
}
}