Version

Configuring Axis Labels

The XamFinancialChart control allows you full control over configuring, formatting and styling the labels displayed along the x-axis and y-axis on your chart. By default, you do not need to explicitly set the labels.

In this topic

This topic contains the following sections:

Label Settings

In the XamFinancialChart control, you can change the rotation angle, margin, horizontal/vertical alignment, opacity, padding and visibility, of the x-axis and y-axis labels using the following properties:

Property Name Property Type Description

double

Determines angle rotation of x-axis or y-axis labels

HorizontalAlignment

Determines horizontal alignment of the x-axis or y-axis labels

VerticalAlignment

Determines vertical alignment of the x-axis or y-axis labels

Visibility

Determines whether or not x-axis or y-axis labels are visible

Thickness

Determines the margin applied to each x-axis or y-axis label

double

Determines the opacity of the x-axis or y-axis labels

Thickness

Determines the padding applied to the x-axis or y-axis labels

Styling

The look and feel of the financial chart’s x-axis and y-axis labels can be styled in many aspects, the main of which are applying different font styles such as font type, font size, font weight, and colors to the labels. This can be achieved through the following properties:

Property Name Property Type Description

FontFamily

Determines the font family to be used for the x-axis or y-axis labels

double

Determines the size of the font for the x-axis or y-axis labels

FontStretch

Determines the font stretch to applied to the x-axis or y-axis labels

FontStyle

Determines the font style of the x-axis or y-axis labels

FontWeight

Determines the font weight of the x-axis or y-axis labels

Brush

Determines the text color of the x-axis or y-axis labels

Abbreviating Large Numbers

The XamFinancialChart control allows you to specify if the y-axis labels should display abbreviated numeric values on the y-axis. For label values that may appear too long, you can set YAxisAbbreviateLargeNumbers to true to enable this feature. This is set to true by default.

Code Snippet

The following code example shows how to style labels on the x-axis using date formatting and other style properties:

In XAML:

<ig:XamFinancialChart x:Name="chart1"
    XAxisLabelFontSize="16"
    XAxisLabelForeground="Blue"
    XAxisLabelFontWeight="Bold"
    YAxisLabelFontSize="16"
    YAxisLabelForeground="Green"
    YAxisLabelFontWeight="Bold">
</ig:XamFinancialChart>

In C#:

var chart1 = new XamFinancialChart()
chart1.XAxisLabelFontSize = 16;
chart1.XAxisLabelForeground = new SolidColorBrush(Colors.Blue);
chart1.XAxisLabelFontWeight = FontWeights.Bold;
chart1.YAxisLabelFontSize = 16;
chart1.YAxisLabelForeground = new SolidColorBrush(Colors.Green);
chart1.YAxisLabelFontWeight = FontWeights.Bold;

In Visual Basic:

Dim chart1 = New XamFinancialChart()
chart1.XAxisLabelFontSize = 16
chart1.XAxisLabelForeground = New SolidColorBrush(Colors.Blue)
chart1.XAxisLabelFontWeight = FontWeights.Bold
chart1.YAxisLabelFontSize = 16
chart1.YAxisLabelForeground = New SolidColorBrush(Colors.Green)
chart1.YAxisLabelFontWeight = FontWeights.Bold

The following screenshot demonstrates the XamFinancialChart control with the axis labels formatted and styled.

financialchart wpf axis labels.png