Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
620
Auto format CategoryDateTimeXAxis labels
posted

Hi

I have this chart with some data in it ranging for a few days. I need to have the XAxisLabel format  set to something like this when zoomed out:


    Label="{}{TimeStamp:dddd MMMM dd}"


But when I zoom in I want the time only


    Label="{}{TimeStamp:T}"

Is this possible without too much code behind? I hope for a simple property I have overlooked :-)

 

 

Parents
No Data
Reply
  • 30945
    Offline posted

    Hello Genvej,

     

    Thank you for your post. I have been looking into the functionality that you are trying to achieve and in order to avoid writing code in the code behind, I can suggest binding the Label property of the CategoryDateTimeXAxis to the WindowRect.Width property of the XamDataChart. The WindowRect property is representation of the visible part of the XamDataChart and the Width property of the WindowRect corresponds to the horizontal zoom, so binding the label to it will allows you to change the Label when the user is zooming the chart. In the binding you can use a converter in order to change the double value of the Width property to the appropriate format for the label. I have created a sample application for you that demonstrates how you can implement this approach.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    DifferentLabelBasedOnZoomLevel.zip
Children