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

Gets or sets the bar group spacing.

public Unit BarGroupSpacing { get; set; }

Property Value

Unit:

The bar group spacing.

BarSpacing

Gets or sets the amount of spacing applied to either side of the individual bar shapes. This is a dependency property.

public Unit BarSpacing { get; set; }

Property Value

Unit:

The amount of spacing applied to either side of the individual bar shapes. The default value is 1px.

LabelAngle

The angle at which to draw the axis labels.

public double LabelAngle { get; set; }

Property Value

double

LabelFormat

Gets or sets the string format used when presenting a label on an axis tick. This is a dependency property.

public string LabelFormat { get; set; }

Property Value

string:

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

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

Gets or sets the axis position.

public AxisPosition Position { get; set; }

Property Value

AxisPosition:

The axis position.

Ranges

Gets the collection of ranges displayed by this chart.

public XYRangeCollection Ranges { get; }

Property Value

XYRangeCollection:

The collection of ranges displayed by this chart.

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

Gets or sets the axis title.

public object Title { get; set; }

Property Value

object:

The title displayed on the axis.

TitleStyle

Gets or sets the style to apply to the axis title. TargetType of the Style must be a ContentPresenter.

public Style TitleStyle { get; set; }

Property Value

Style:

The style to apply to the axis title.

UseDisplayOptimizations

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

public bool UseDisplayOptimizations { get; set; }

Property Value

bool:

true if data point values are rounded to better appear on display pixels; otherwise, false. 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 property changed.

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

The sender.

args DependencyPropertyChangedEventArgs

The System.Windows.DependencyPropertyChangedEventArgs instance containing the event data.

Events

Refreshed

Occurs when XYAxisBase is refreshed.

public event EventHandler Refreshed

Event Type

EventHandler

Fields

AreLabelsVisibleProperty

Identifies the AreLabelsVisible dependency property. This field is read-only.

public static readonly DependencyProperty AreLabelsVisibleProperty

AreMajorTicksVisibleProperty

Identifies the AreMajorTicksVisible dependency property. This field is read-only.

public static readonly DependencyProperty AreMajorTicksVisibleProperty

AreMinorTicksVisibleProperty

Identifies the AreMinorTicksVisible dependency property. This field is read-only.

public static readonly DependencyProperty AreMinorTicksVisibleProperty

BarGroupSpacingProperty

Identifies the BarGroupSpacing dependency property. This field is read-only.

public static readonly DependencyProperty BarGroupSpacingProperty

BarSpacingProperty

Identifies the BarSpacing dependency property. This field is read-only.

public static readonly DependencyProperty BarSpacingProperty

LabelAngleProperty

Identifies the LabelAngle dependency property. This field is read-only.

public static readonly DependencyProperty LabelAngleProperty

LabelFormatProperty

Identifies the LabelFormat dependency property. This field is read-only.

public static readonly DependencyProperty LabelFormatProperty

LabelStyleProperty

Identifies the LabelStyle dependency property. This field is read-only.

public static readonly DependencyProperty LabelStyleProperty

PositionProperty

Identifies the Position dependency property. This field is read-only.

public static readonly DependencyProperty PositionProperty

TickMajorStyleProperty

Identifies the TickMajorStyle dependency property. This field is read-only.

public static readonly DependencyProperty TickMajorStyleProperty

TickMinorStyleProperty

Identifies the TickMinorStyle dependency property. This field is read-only.

public static readonly DependencyProperty TickMinorStyleProperty

TitleProperty

Identifies the Title dependency property. This field is read-only.

public static readonly DependencyProperty TitleProperty

TitleStyleProperty

Identifies the TitleStyle dependency property. This field is read-only.

public static readonly DependencyProperty TitleStyleProperty

UseDisplayOptimizationsProperty

Identifies the UseDisplayOptimizations dependency property. This field is read-only.

public static readonly DependencyProperty UseDisplayOptimizationsProperty