In This Article

XYAxisBase Class

Represents the base functionality of a chart axis.

[StyleTypedProperty(Property = "LabelStyle", StyleTargetType = typeof(TextBlock))]
[StyleTypedProperty(Property = "TitleStyle", StyleTargetType = typeof(ContentControl))]
[StyleTypedProperty(Property = "TickMajorStyle", StyleTargetType = typeof(Path))]
[StyleTypedProperty(Property = "TickMinorStyle", StyleTargetType = typeof(Path))]
[TemplatePart(Name = "PART_LogicalGrid", Type = typeof(Grid))]
public abstract class XYAxisBase : Control
Inheritance:
object Visual UIElement FrameworkElement Control object
Derived:
XYDateTimeAxis XYDecimalAxisBase<T> XYDoubleAxis XYGroupedAxis XYPercentageAxis

Properties

AreLabelsVisible

Whether or not axis labels are visible.

public bool AreLabelsVisible { get; set; }

Property Value

bool

AreMajorTicksVisible

Whether or not major ticks are visible.

public bool AreMajorTicksVisible { get; set; }

Property Value

bool

AreMinorTicksVisible

Whether or not minor ticks are visible.

public bool AreMinorTicksVisible { get; set; }

Property Value

bool

AxisType

The type of data on the axis.

public Type? AxisType { get; }

Property Value

Type

BarGroupSpacing

The bar group spacing.

public Unit BarGroupSpacing { get; set; }

Property Value

Unit

BarSpacing

The amount of spacing applied to either side of the individual bar shapes.

public Unit BarSpacing { get; set; }

Property Value

Unit:

The default value is 1px.

LabelAngle

The angle at which to draw the axis labels.

public double LabelAngle { get; set; }

Property Value

double

LabelFormat

The string format used when presenting a label on an axis tick.

public string LabelFormat { get; set; }

Property Value

string

Remarks

The format string will be passed the following parameters:

  • {0} - The value of the axis tick, or null when the axis is slotted, such as on a bar chart.
  • {1} - The starting value of the current slot when the axis is slotted, such as on a bar chart. Otherwise, null.
  • {2} - The ending value of the current slot when the axis is slotted, such as on a bar chart. Otherwise, null.

LabelStyle

The style to apply to axis labels. TargetType of the Style must be a TextBlock.

public Style LabelStyle { get; set; }

Property Value

Style

Position

The axis position.

public AxisPosition Position { get; set; }

Property Value

AxisPosition

Ranges

The collection of ranges displayed by this chart.

public XYRangeCollection Ranges { get; }

Property Value

XYRangeCollection

TickMajorStyle

The style to apply to major ticks. TargetType of the Style must be a Path.

public Style TickMajorStyle { get; set; }

Property Value

Style

TickMinorStyle

The style to apply to minor ticks. TargetType of the Style must be a Path.

public Style TickMinorStyle { get; set; }

Property Value

Style

Title

The axis title.

public object Title { get; set; }

Property Value

object

TitleStyle

The style to apply to the axis title. TargetType of the Style must be a ContentPresenter.

public Style TitleStyle { get; set; }

Property Value

Style

UseDisplayOptimizations

Whether data point values are rounded to better appear on display pixels.

public bool UseDisplayOptimizations { get; set; }

Property Value

bool:

The default value is true.

Remarks

This property is usually good to leave as its default value of true because it will ensure that lines render with minimal anti-aliasing. It accomplishes this by slightly rounding data point values as needed. However, if precise data point locations are required, such as when rendering a smooth curved line graph, set this to false to remove line jaggedness.

Methods

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnPropertyChanged(DependencyObject, DependencyPropertyChangedEventArgs)

Called when the value of a property has changed that requires the control to be refreshed.

protected static void OnPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
Parameter Type Description
sender DependencyObject

The control whose property changed.

args DependencyPropertyChangedEventArgs

The event data.

Events

Refreshed

Occurs when XYAxisBase is refreshed.

public event EventHandler? Refreshed

Event Type

EventHandler

Fields

AreLabelsVisibleProperty

Defines the AreLabelsVisible property.

public static readonly DependencyProperty AreLabelsVisibleProperty

AreMajorTicksVisibleProperty

Defines the AreMajorTicksVisible property.

public static readonly DependencyProperty AreMajorTicksVisibleProperty

AreMinorTicksVisibleProperty

Defines the AreMinorTicksVisible property.

public static readonly DependencyProperty AreMinorTicksVisibleProperty

BarGroupSpacingProperty

Defines the BarGroupSpacing property.

public static readonly DependencyProperty BarGroupSpacingProperty

BarSpacingProperty

Defines the BarSpacing property.

public static readonly DependencyProperty BarSpacingProperty

LabelAngleProperty

Defines the LabelAngle property.

public static readonly DependencyProperty LabelAngleProperty

LabelFormatProperty

Defines the LabelFormat property.

public static readonly DependencyProperty LabelFormatProperty

LabelStyleProperty

Defines the LabelStyle property.

public static readonly DependencyProperty LabelStyleProperty

PositionProperty

Defines the Position property.

public static readonly DependencyProperty PositionProperty

TickMajorStyleProperty

Defines the TickMajorStyle property.

public static readonly DependencyProperty TickMajorStyleProperty

TickMinorStyleProperty

Defines the TickMinorStyle property.

public static readonly DependencyProperty TickMinorStyleProperty

TitleProperty

Defines the Title property.

public static readonly DependencyProperty TitleProperty

TitleStyleProperty

Defines the TitleStyle property.

public static readonly DependencyProperty TitleStyleProperty

UseDisplayOptimizationsProperty

Defines the UseDisplayOptimizations property.

public static readonly DependencyProperty UseDisplayOptimizationsProperty

Extension Methods