Version

Configuring Axis Title

Purpose

This topic provides information on setting an axis title on the XamDataChart™ control.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

The XamDataChart requires a data object model to be mapped to control’s DataContext property. This article will provide a simple data object model but you can create your own and use it with this sample code instead.

This topic provides information on setting appearance properties of axis labels.

In this topic

This topic contains the following sections:

Axis Title

Overview

The axis title feature of the XamDataChart control allows you to add contextual information to the x and y axes of the XamDataChart control.

Preview

The following screenshot is a preview of the XamDataChart control with a title set on the y-axis.

xamDataChart Axis Title 01.png

Properties

The Title property sets the value of the information areas of the axis.

Property Name Property Type * Description*

String

Defines the title of the axis.

The following table summarizes the properties .

Property Name Property Type * Description*

AxisTitlePosition

Defines the position of the title according to the position of the labels.

By default this property is set to Auto, meaning that the axis title will always be on opposite sides of the axis stroke and the axis labels. In other words, axis labels will be always between axis title and axis stroke even if you change the location of axis labels. For example, changing location of an axis label to OutsideRight automatically position the axis title to the right side of the axis labels.

double

Defines the rotation of the title around the center of axis title in degrees. For example, value of -90 rotates the title vertically and value of zero will render the title horizontally.

Brush

Defines the color applied to the foreground of the axis title.

string

Defines the font applied to the text of the axis title.

double

Defines the font size used rendering text of the axis title.

FontAttributes

Defines the font attributes used rendering text of the axis title, for example Regular, Bold, Italic, etc.

HorizontalAlignment

Defines the horizontal alignment of the axis title in the axis info panel. This property only applies to a title on x-axis.

VerticalAlignment

Defines the vertical alignment of the axis title in the axis info panel. This property only applies to a title on y-axis.

double

Defines the size of the margin set around the axis title.

Example

The screenshot, following the table, demonstrates how the XamDataChart control with axis Title and title settings looks as a result of the following settings:

Property Value

Terawatt Hours (TWh)

Bottom

270

15

xamDataChart Axis Title 02.png

Following is the code that implements this example:

In XAML:

<ig:NumericYAxis x:Name="yAxis"
                 TitleFontSize="15"
                 TitleAngle="270"
                 TitlePosition="Bottom"
                 Title="Terawatt Hours (TWh)" />

In C#:

var yAxis = new NumericYAxis();
yAxis.Title = "Terawatt Hours (TWh)";
yAxis.TitlePosition = AxisTitlePosition.Bottom;
yAxis.TitleAngle = 270;
yAxis.TitleFontSize = 15;

Related Content

The following topics provide additional information related to this topic:

Topic Purpose

The XamDataChart requires a data object model to be mapped to control’s DataContext property. This article will provide a simple data object model but you can create your own and use it with this sample code instead.

This topic provides information on setting appearance properties of axis labels.