Version

Configuring Axis Label Settings

In the XamDataChart™ control, you can change the location, rotation angle, margin, horizontal/vertical alignment, visibility, and appearance of the axis label using the following properties of an Axis objects.

Property Name Property Type Description

String

Determines data mapping (category axis) and formatting (all axis) of labels

double

Determines angle rotation of axis labels

double

Determines empty space that extents between axis labels and the axis main line

FontFamily

Determines font of axis labels

HorizontalAlignment

Determines horizontal alignment of labels on CategoryYAxis and NumericYAxis only

VerticalAlignment

Determines vertical alignment of labels on CategoryXAxis and NumericXAxis only

Determines location of axis labels in relation to axis main line and chart plot area

Visibility

Determines whether or not axis labels are visible

Brush

Determines text color of axis labels

The following sample code shows how to change the location, orientation angle, and appearance of the axis label on CategoryXAxis and NumericYAxis in the XamDataChart control.

In XAML:

<ig:CategoryXAxis x:Name="xAxis"
                  Label="Date"
                  LabelTextColor="Green"
                  LabelLocation="OutsideBottom"
                  LabelExtent="40"
                  LabelAngle="45"
                  ItemsSource="{Binding}" />
<ig:NumericYAxis x:Name="yAxis"
                 LabelTextColor="Red"
                 LabelLocation="OutsideRight"
                 LabelExtent="40"
                 LabelAngle="-30" />

In C#:

var xAxis = new CategoryXAxis()
{
    Label = "Date",
    LabelTextColor = new SolidColorBrush(Color.Green),
    LabelLocation = AxisLabelsLocation.OutsideBottom,
    LabelExtent = 40,
    LabelAngle = 45
};

var yAxis = new NumericYAxis()
{
    LabelTextColor= new SolidColorBrush(Color.Red),
    LabelLocation = AxisLabelsLocation.OutsideRight,
    LabelExtent = 40,
    LabelAngle = -30
};

The following image shows how the XamDataChart control might look with custom label settings for CategoryXAxis and NumericYAxis.

xamDataChart Axis Label Settings 01.png