Version

Configuring Axis Tick Marks

Topic Overview

Purpose

This topic explains, with code examples, how to configure the tick marks for a chart axis of the XamDataChart™ control.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

The XamDataChart control requires a Data set and data binding. This topic demonstrates how to provide a simple Data Object Model.

This topic introduces the types of axes supported by the XamDataChart control.

Configuring Axis Tick Marks

Overview

Axis tick marks can be displayed along all horizontal and vertical axes of the XamDataChart control. When axis tick marks are enabled, a tick mark is displayed for every label (at all major line positions).

xamDataChart Axis Ticks 1.png

Axis tick marks are enabled by setting the TickLength property of an axis to a value greater than 0. (This property specifies the length of the line segments forming the tick marks.)

Tick marks are always displayed at the axis stroke line and point to the direction of the labels. Labels are offset by the value of the TickLength property to avoid overlapping. For example, for a horizontal axis where the label location is AxisLabelsLocation.OutsideBottom, if the TickLength is set to 5, labels will be shifted down by that amount.

Note
Note:

Tick marks will not be displayed (even if they have valid properties) when the LabelSettings property is collapsed

Property settings

The following table maps the desired configuration to its respective property settings.

In order to configure: Use this property: And set it to:

The length of the axis tick marks

The desired length of the axis tick marks

The thickness of the axis tick marks

The desired thickness of the axis tick marks set as a double value

The color of the axis tick marks

The desired color

The line style for the tick marks (dashed/continuous).

A collection of even number of double values in which the odd-position numbers represent the length of the dashes and the even-position numbers represent the gap sizes between the dashes, both in pixels.

For instance, if values of "2 ,1 " are specified, tick marks will be rendered as dashed lines with a repeating pattern of 2-px long dash followed by an 1-px gap.

If TickStrokeDashArray is not set (default), the line style for the tick marks will be continuous.

Example

The screenshot below demonstrates how the category x-axis in a XamDataChart control looks as a result of the following tick-marks-related settings:

Property Value

"7"

"Red"

"2"

xamDataChart Axis Ticks 2.png

Following is the code snippet for the chart’s x-axis:

In XAML:

<ig:CategoryXAxis x:Name="XAxis"
    TickLength="7"
    TickStroke="Red"
    TickStrokeThickness="2" />

In C#:

var xAxis = new CategoryXAxis()
{
    TickLength = 7,
    TickStroke = new SolidColorBrush(Color.Red),
    TickStrokeThickness = 2
};

In Visual Basic:

Dim xAxis As New CategoryXAxis()
xAxis.TickLength = 7
xAxis.TickStrokeThickness = 2

Related Content

Topics

The following topic provides additional information related to this topic.

Topic Purpose

In the XamDataChart control, you can change the location, orientation angle, visibility and appearance of the axis label using the AxisLabelSettings object’s properties on any axis.