C# Class Smrf.WpfGraphicsLib.Axis

Draws a linear axis with major and minor gridlines, major gridline values, and an axis label.
This can be used as either a horizontal x-axis (the default) or a vertical y-axis. For the latter, set IsXAxis to false.

The axis is meant to be docked below or to the left of the control to which the axis applies. If you set the to the render transform of the docked control, the axis will adjust itself as the docked control is zoomed or translated.

Call SetRange to set the range of values in the axis.

Inheritance: System.Windows.FrameworkElement
Show file Open project: 2014-sed-team3/term-project Class Usage Examples

Protected Properties

Property Type Description
m_bIsXAxis System.Boolean
m_bValuesAreLogarithmic System.Boolean
m_dFarOffset Double
m_dFarValue Double
m_dLabelFontSizeEm Double
m_dNearOffset Double
m_dNearValue Double
m_oDockedControlRenderTransform System.Windows.Media.Transform
m_oTypeface System.Windows.Media.Typeface
m_sLabel String

Public Methods

Method Description
Axis ( ) : System

Initializes a new instance of the Axis class.

SetFont ( System.Windows.Media.Typeface typeface, Double labelEmSize ) : void
SetRange ( Double nearValue, Double nearOffset, Double farValue, Double farOffset, System.Boolean valuesAreLogarithmic ) : void

Protected Methods

Method Description
DrawAxisLine ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen ) : void
DrawBackground ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, Double dAdjustedNearOffset, Double dAdjustedFarOffset ) : void
DrawGridline ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen, Double dGridlineOffset, Double dGridlineLength ) : void
DrawLabel ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle ) : void
DrawMajorGridlineAndValue ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen, Double dMajorGridlineValue, Double dMajorGridlineOffset, String sFormatSpecifier ) : void
DrawMajorGridlineValue ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, Double dMajorGridlineValue, Double dMajorGridlineOffset, String sFormatSpecifier ) : void
DrawMinorGridlines ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen, Double dMajorGridline2Offset, Double dMajorGridline1Offset ) : void
DrawOffsetBackground ( System.Windows.Media.DrawingContext oDrawingContext, Rect oOffsetRectangle ) : void
DrawRotatedText ( System.Windows.Media.DrawingContext oDrawingContext, System.Windows.Media.FormattedText oFormattedText, Double dCenterX, Double dCenterY ) : void
GetCenteredFormattedText ( String sText, System.Windows.Media.Typeface oTypeface, Double dFontSizeEm ) : System.Windows.Media.FormattedText
GetFormatSpecifier ( Double adMajorGridlineValues, Int32 iDecimalPlacesToShow ) : String
GetLogIfRequired ( Double dNumber ) : Double
GetPowIfRequired ( Double dNumber ) : Double
GetRotatedTextTransform ( Double dCenterX, Double dCenterY ) : Transform
MeasureOverride ( Size availableSize ) : Size
OnRender ( System.Windows.Media.DrawingContext drawingContext ) : void
OnRender ( System.Windows.Media.DrawingContext oDrawingContext, Double dAdjustedNearValue, Double dAdjustedNearOffset, Double dAdjustedFarValue, Double dAdjustedFarOffset ) : void

Private Methods

Method Description
AssertValid ( ) : void

Method Details

Axis() public method

Initializes a new instance of the Axis class.
public Axis ( ) : System
return System

DrawAxisLine() protected method

protected DrawAxisLine ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
oPen System.Windows.Media.Pen
return void

DrawBackground() protected method

protected DrawBackground ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, Double dAdjustedNearOffset, Double dAdjustedFarOffset ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
dAdjustedNearOffset Double
dAdjustedFarOffset Double
return void

DrawGridline() protected method

protected DrawGridline ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen, Double dGridlineOffset, Double dGridlineLength ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
oPen System.Windows.Media.Pen
dGridlineOffset Double
dGridlineLength Double
return void

DrawLabel() protected method

protected DrawLabel ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
return void

DrawMajorGridlineAndValue() protected method

protected DrawMajorGridlineAndValue ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen, Double dMajorGridlineValue, Double dMajorGridlineOffset, String sFormatSpecifier ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
oPen System.Windows.Media.Pen
dMajorGridlineValue Double
dMajorGridlineOffset Double
sFormatSpecifier String
return void

DrawMajorGridlineValue() protected method

protected DrawMajorGridlineValue ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, Double dMajorGridlineValue, Double dMajorGridlineOffset, String sFormatSpecifier ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
dMajorGridlineValue Double
dMajorGridlineOffset Double
sFormatSpecifier String
return void

DrawMinorGridlines() protected method

protected DrawMinorGridlines ( System.Windows.Media.DrawingContext oDrawingContext, Rect oClientRectangle, System.Windows.Media.Pen oPen, Double dMajorGridline2Offset, Double dMajorGridline1Offset ) : void
oDrawingContext System.Windows.Media.DrawingContext
oClientRectangle System.Windows.Rect
oPen System.Windows.Media.Pen
dMajorGridline2Offset Double
dMajorGridline1Offset Double
return void

DrawOffsetBackground() protected method

protected DrawOffsetBackground ( System.Windows.Media.DrawingContext oDrawingContext, Rect oOffsetRectangle ) : void
oDrawingContext System.Windows.Media.DrawingContext
oOffsetRectangle System.Windows.Rect
return void

DrawRotatedText() protected method

protected DrawRotatedText ( System.Windows.Media.DrawingContext oDrawingContext, System.Windows.Media.FormattedText oFormattedText, Double dCenterX, Double dCenterY ) : void
oDrawingContext System.Windows.Media.DrawingContext
oFormattedText System.Windows.Media.FormattedText
dCenterX Double
dCenterY Double
return void

GetCenteredFormattedText() protected method

protected GetCenteredFormattedText ( String sText, System.Windows.Media.Typeface oTypeface, Double dFontSizeEm ) : System.Windows.Media.FormattedText
sText String
oTypeface System.Windows.Media.Typeface
dFontSizeEm Double
return System.Windows.Media.FormattedText

GetFormatSpecifier() protected method

protected GetFormatSpecifier ( Double adMajorGridlineValues, Int32 iDecimalPlacesToShow ) : String
adMajorGridlineValues Double
iDecimalPlacesToShow System.Int32
return String

GetLogIfRequired() protected method

protected GetLogIfRequired ( Double dNumber ) : Double
dNumber Double
return Double

GetPowIfRequired() protected method

protected GetPowIfRequired ( Double dNumber ) : Double
dNumber Double
return Double

GetRotatedTextTransform() protected method

protected GetRotatedTextTransform ( Double dCenterX, Double dCenterY ) : Transform
dCenterX Double
dCenterY Double
return System.Windows.Media.Transform

MeasureOverride() protected method

protected MeasureOverride ( Size availableSize ) : Size
availableSize System.Windows.Size
return System.Windows.Size

OnRender() protected method

protected OnRender ( System.Windows.Media.DrawingContext drawingContext ) : void
drawingContext System.Windows.Media.DrawingContext
return void

OnRender() protected method

protected OnRender ( System.Windows.Media.DrawingContext oDrawingContext, Double dAdjustedNearValue, Double dAdjustedNearOffset, Double dAdjustedFarValue, Double dAdjustedFarOffset ) : void
oDrawingContext System.Windows.Media.DrawingContext
dAdjustedNearValue Double
dAdjustedNearOffset Double
dAdjustedFarValue Double
dAdjustedFarOffset Double
return void

SetFont() public method

public SetFont ( System.Windows.Media.Typeface typeface, Double labelEmSize ) : void
typeface System.Windows.Media.Typeface
labelEmSize Double
return void

SetRange() public method

public SetRange ( Double nearValue, Double nearOffset, Double farValue, Double farOffset, System.Boolean valuesAreLogarithmic ) : void
nearValue Double
nearOffset Double
farValue Double
farOffset Double
valuesAreLogarithmic System.Boolean
return void

Property Details

m_bIsXAxis protected property

protected Boolean,System m_bIsXAxis
return System.Boolean

m_bValuesAreLogarithmic protected property

protected Boolean,System m_bValuesAreLogarithmic
return System.Boolean

m_dFarOffset protected property

protected Double m_dFarOffset
return Double

m_dFarValue protected property

protected Double m_dFarValue
return Double

m_dLabelFontSizeEm protected property

protected Double m_dLabelFontSizeEm
return Double

m_dNearOffset protected property

protected Double m_dNearOffset
return Double

m_dNearValue protected property

protected Double m_dNearValue
return Double

m_oDockedControlRenderTransform protected property

protected Transform,System.Windows.Media m_oDockedControlRenderTransform
return System.Windows.Media.Transform

m_oTypeface protected property

protected Typeface,System.Windows.Media m_oTypeface
return System.Windows.Media.Typeface

m_sLabel protected property

protected String m_sLabel
return String