Version

Configuring Axis Ranges in XamFinancialChart

In the XamFinancialChart control, the range on the axes is calculated from your datasource by default and can be configured as described below. The range minimum is the lowest value of the axis. The range maximum is the highest value of the axis.

Overview

By default, the XamFinancialChart control will calculate the minimum and maximum values for the X and Y axis range based on the lowest and highest data points in the underlying data source in order to maximize the chart plot area. This automatic calculation of an axis' minimum and maximum values may not be appropriate for your set of data points. For example, if you wanted to show some extra space between the edge of the chart and your plotted series, you would need to format the axis range in the XamFinancialChart.

You can configure the ranges of the Y-axis by setting the following properties of the XamFinancialChart control:

Property Name Property Type Description

double

Get or sets minimum value on the y-axis

double

Get or sets maximum value on the y-axis

Code Snippet

The following sample code demonstrates how to change the axis range on the Y-axis of the XamFinancialChart control.

In XAML:

<ig:XamFinancialChart ItemsSource="{Binding}"
    XAxisMinimumValue="4/1/2016"
    XAxisMaximumValue="11/1/2017"
    YAxisMinimumValue="600"
    YAxisMaximumValue="1000" />

In C#:

var chart = new XamFinancialChart();
chart.XAxisMinimumValue = new DateTime(2016, 4, 1);
chart.XAxisMaximumValue = new DateTime(2017, 11, 1);
chart.YAxisMinimumValue = 600;
chart.YAxisMaximumValue = 1000;

In VB:

Dim chart = New XamFinancialChart()
chart.XAxisMinimumValue = New DateTime(2016, 4, 1)
chart.XAxisMaximumValue = New DateTime(2017, 11, 1)
chart.YAxisMinimumValue = 600
chart.YAxisMaximumValue = 1000

The above code will result in a XamFinancialChart that looks like the following:

financialchart wpf axis ranges.png