This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, (RE: WPF Element Version 6 - Chart Control) In a line chart we have the X-axis as DateTime. As we zoom in we are able to specify to the chart control when to switch between displaying years on the x-axis to displaying months, to displaying days, to displaying hours.... However how can we specify the interval to use when changing to these different levels. (i.e. the interval to use when displaying years, the interval to use when displaying months, the interval to use when displaying days, etc...) Thank you Oscar |
|
|
Hello Oscar When using DateTime along an axis, we recommend using our DateTimeAxisValueConverter. Start by creating a DateTimeAxisValueConverter in a xaml resource dictionary:
Then on your chart(s), set the ValueConverter property of the X-axis to be this converter:
Now when you run your application, the X axis will have improved handling of DateTime values. Zooming in will automatically change the string formatting of the labels based on Year, Month, Day etc ranges, and automatically pick an appropriate interval between the tick marks and labels. If the automatic handling of date time ranges is not quite what you want for your application, you can override our ranges with your own custom ones. On the DateTimeAxisValueConverter that you added to a xaml resource dictionary, you can add instances of DateTimeIntervalDefinition:
Here I am saying that if the current range of the X-axis is somewhere between 1 year and 3 years, then I want the X-axis to use months as the date/time unit, and I want the ticks/labels to be 1 month apart. If you set the IntervalMagnitude to 0, then the DateTimeAxisValueConverter will pick an appropriate number of units for you which can be convenient for different zoom levels within the same date/time unit range. In this example, I am only covering the range of 1 - 3 years, if the chart is at a zoom level outside this range, the DateTimeAxisValueConverter will fall-back to automatically picking units and magnitudes for you. You can add as many DateTimeIntervalDefinition objects to the converter that you need. Let me know if you have any questions or need assistance. -Jason Fauchelle |
|