Q: WPF Charting toolkit change axis interval labels programatically I'd like to programatically change the interval of labels on X axis of my Line chart. 
The only thing I've found was how to do it in xaml file: https://stackoverflow.com/a/8944925/2302510 and it works fine. I can do it for hours/days/months etc.
However I need to change it according to what interval I'm displaying. User can choose to display one week, one month, one year or other given interval and when leaving it to default it just overcrowds the X axis with dates which makes it quite confusing. 
Thanks for any advice.

A: You can assign a name to the axis and call it from the code-behind.
XAML:
<chartingToolkit:DateTimeAxis x:Name="xAxis" Orientation="X" IntervalType ="Hours" Interval="1">

C#
xAxis.IntervalType = DateTimeIntervalType.Days; // Month, Hours
xAxis.Interval = 1

