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 |
|
|
Determines data mapping (category axis) and formatting (all axis) of labels
|
|
|
|
|
|
Determines angle rotation of axis labels
|
|
|
Determines empty space that extents between axis labels and the axis main line
|
|
|
Determines font of axis labels
|
|
|
Determines horizontal alignment of labels on CategoryYAxis and NumericYAxis only
|
|
|
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
|
|
|
Determines whether or not axis labels are visible
|
|
|
Determines text color of axis labels
|
<ig:XamDataChart x:Name="DataChart" >
<ig:XamDataChart.Axes>
<ig:CategoryXAxis x:Name="xAxis"
Label="{}{Date:MM/dd}"
ItemsSource="{Binding}" >
<ig:CategoryXAxis.LabelSettings>
<ig:AxisLabelSettings Foreground="Green"
Location="OutsideBottom"
Extent="40"
Angle="45" />
</ig:CategoryXAxis.LabelSettings>
</ig:CategoryXAxis>
<ig:NumericYAxis x:Name="yAxis" >
<ig:NumericYAxis.LabelSettings>
<ig:AxisLabelSettings Foreground="Red"
Location="OutsideRight"
Extent="40"
Angle="-30" />
</ig:NumericYAxis.LabelSettings>
</ig:NumericYAxis>
</ig:XamDataChart.Axes>
</ig:XamDataChart>
var yAxis = new NumericYAxis();
var xAxis = new CategoryXAxis();
xAxis.Label = "Date";
xAxis.LabelSettings = new AxisLabelSettings();
xAxis.LabelSettings.Foreground = new SolidColorBrush(Colors.Green);
xAxis.LabelSettings.Location = AxisLabelsLocation.OutsideBottom;
xAxis.LabelSettings.Extent = 40;
xAxis.LabelSettings.Angle = 45;
yAxis.LabelSettings = new AxisLabelSettings();
yAxis.LabelSettings.Foreground = new SolidColorBrush(Colors.Red);
yAxis.LabelSettings.Location = AxisLabelsLocation.OutsideRight;
yAxis.LabelSettings.Extent = 40;
yAxis.LabelSettings.Angle = -30;
Dim yAxis As New NumericYAxis()
Dim xAxis As New CategoryXAxis()
xAxis.Label = "Date"
xAxis.LabelSettings As New AxisLabelSettings()
xAxis.LabelSettings.Foreground = New SolidColorBrush(Colors.Green)
xAxis.LabelSettings.Location = AxisLabelsLocation.OutsideBottom
xAxis.LabelSettings.Extent = 40
xAxis.LabelSettings.Angle = 45
yAxis.LabelSettings As New AxisLabelSettings()
yAxis.LabelSettings.Foreground = New SolidColorBrush(Colors.Red)
yAxis.LabelSettings.Location = AxisLabelsLocation.OutsideRight
yAxis.LabelSettings.Extent = 40
yAxis.LabelSettings.Angle = -30
The following image shows how the XamDataChart control might look with custom label settings for CategoryXAxis and NumericYAxis.
In order to remove a previous AxisLabelSettings, a new AxisLabelSettings must be added even if the Axis was previously cleared and re-added.