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 :-)
Great example. Adressed my question to perfection! Only problem is that I didnt explain it proper (sorry) Im interested in showing the label in days when the range is more than a day. And then when I zoom in and the scale is less than a day I want hours instead. The data are dynamic and some span several days others only for a few hours. The Window.Rectangle doesnt work for that I think. But we are close.
My original idea was to have an event on the chart which looks at the window max and min value and then do my formatting based on the result. I like your converters better and if you had an idea how to do it with that it would be much appreciated :-)
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