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
|
Here I have two types for X axis binding, one is number with integer type, another is time with DateTime type. And I have property XLabelFormat in ViewModel bound to "LabelFormat" property of X axis. Like below code in XAML file:
And when I swith to number type for X axis, I do below in ViewModel:
3 .Create new line and do the XBinding to number data path.
When I switch to time type for X axis, I do below in ViewModel:
3 .Create new line and do the XBinding to timestamp data path.
But the X axis label does not change correctly. Please see the screen shoots: Below is the graph with Number type for X axis. And then I swith the type from number to timestamp, the graph change to below: At last, I switched the type back to number again, the weird thing happened, it changed to below:
It seems the part of the x axis which has data cannot be changed back to number value and kept being timestamp value. Although the "XLableFormat" does work to make the rotation changed. But the axis value does not changed back to number. Is there anything that I missed to do and caused this weird phenomenon? Any help will do me a great favor, Thanks a lot. |
|
|
Hello Yaron I think you may have missed setting the ValueConverter of the X axis to be a DateTimeAxisValueConverter when plotting DateTime values. Then you can set this back to null when switching back to plotting numbers. Without the value converter, the axis will use the default behaviour which is to map objects (such as DateTime values) to consecutive integer axis plot positions. So when you were switching to plot DateTime values, the axis was creating a map of each DateTime in your data to the values from 0 to 9. As you are forcing the axis to render up to 20, the remaining labels run out of mapped objects. Switching back to plotting numbers does not clear this mapping. Using the DateTimeAxisValueConverter will cause the X axis to use proper DateTime axis plotting. You may also need to adjust the way you are setting the minimum and maximum values (if you are setting them). You can set the Minimum and Maximum properties as the DateTime values that you want them to be. Let me know if you have further questions. -Jason Fauchelle |
|