In This Article

AxisVisual Class

Visualizes a given axis.

[TemplatePart(Name = "PART_DrawingSurface", Type = typeof(Canvas))]
public abstract class AxisVisual : Control
Inheritance:
object Visual UIElement FrameworkElement Control object
Derived:
XAxisVisual YAxisVisual

Properties

TickMajorMidPixel

Gets the major tick position snapped to mid-pixel, if necessary.

protected double TickMajorMidPixel { get; }

Property Value

double:

The major tick position snapped to mid-pixel, if necessary.

TickMinorMidPixel

Gets the minor tick position snapped to mid-pixel, if necessary.

protected double TickMinorMidPixel { get; }

Property Value

double:

The minor tick position snapped to mid-pixel, if necessary.

Methods

AreAnyTicksVisible(Size)

Determines if any ticks are visible.

protected bool AreAnyTicksVisible(Size plotSize)
Parameter Type Description
plotSize Size

The plot size.

Returns

bool:

True if any ticks are visible, otherwise false.

DrawLineOnGeometry(PathGeometry, double, double, double, double)

Draws a line on a given geometry.

protected static void DrawLineOnGeometry(PathGeometry geometry, double x1, double y1, double x2, double y2)
Parameter Type Description
geometry PathGeometry

The PathGeometry to draw the line on.

x1 double

The starting X point of the line.

y1 double

The starting Y point of the line.

x2 double

The ending X point of the line.

y2 double

The ending Y point of the line.

DrawMajorTickAtPosition(double, Size)

Draws a major tick at a given position on the axis.

protected abstract void DrawMajorTickAtPosition(double position, Size plotSize)
Parameter Type Description
position double

The position to draw the tick at.

plotSize Size

Size of the plot.

DrawMinorTickAtPosition(double, Size)

Draws a minor tick at a given position on the axis.

protected abstract void DrawMinorTickAtPosition(double position, Size plotSize)
Parameter Type Description
position double

The position to draw the tick at.

plotSize Size

Size of the plot.

DrawSpine(Size)

Draws an axis spine.

protected abstract void DrawSpine(Size plotSize)
Parameter Type Description
plotSize Size

GetRealNumberOrDefault(double, double)

Provides the given argumentValue if it is not infinity, otherwise provides the given default argumentValue.

protected static double GetRealNumberOrDefault(double value, double defaultValue)
Parameter Type Description
value double

The argumentValue to be returned if real.

defaultValue double

The default argumentValue to be returned if the primary argumentValue is infinity.

Returns

double:

The argumentValue if it is not infinity, otherwise the default argumentValue.

GetTextBlockMeasuredSize(TextBlock)

Gets the measured size of the text block.

protected static Size GetTextBlockMeasuredSize(TextBlock textBlock)
Parameter Type Description
textBlock TextBlock

The text block.

Returns

Size:

The measured size of the text block.

GetTitleTemplateFromResources(ResourceDictionary)

Retrieves the appropriate DataTemplate for the axis title from the given ResourceDictionary.

protected abstract DataTemplate GetTitleTemplateFromResources(ResourceDictionary resources)
Parameter Type Description
resources ResourceDictionary

The ResourceDictionary to retrieve the title template from.

Returns

DataTemplate:

The template for the axis title.

IsSpineVisible()

Determines whether or not the spine is visible.

public bool IsSpineVisible()

Returns

bool:

true if the spine is visible; otherwise, false.

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate.

public override void OnApplyTemplate()

PlaceLabelAtPosition(TextBlock, double, double, Size)

Place the axis label at the given position.

protected abstract void PlaceLabelAtPosition(TextBlock label, double position, double angle, Size plotSize)
Parameter Type Description
label TextBlock

The axis label to lay out.

position double

The position to draw the axis label at.

angle double

The angle to draw the axis label at.

plotSize Size

Size of the plot.

Refresh(Size)

Redraws the axis.

public virtual void Refresh(Size plotSize)
Parameter Type Description
plotSize Size

UpdateTitlePosition(Size)

Updates the title position.

protected abstract void UpdateTitlePosition(Size plotSize)
Parameter Type Description
plotSize Size

Fields

Infinity

Size with width and height of infinity.

protected static readonly Size Infinity