How can I set up a numeric X-Axis to look like this?
I already achieved it by using a converter. So my axis goes from -0.7 to 0.7 but I just use a converter to display a 0.2 instead of a 0.1 and 0.3 instead of 0.2, etc. But the problem with that is that XMemberPath of the data also needs to be manipulated before being passed to the chart, else the data appears to be plotted incorrectly because it is going by the original X-Axis points rather than the converted ones. So I have 2 questions actually:
Can the same converter be somehow applied to the XMemberPath. (Couldnt find a way to do this) OR
Is it possible to manipulate the min, max, interval values of the axis to get this look for the X-Axis.
Thanks.
Here is an attacment of the image (which is not showing up in the original post).
Hello sudnya_s,
In order to achieve a look for the NumericXAxis like is depicted in your attachment, I would recommend continuing by setting the Minimum and Maximum Value properties to -0.7 and 0.7, respectively. You can also set the Interval property to 0.1.
By default, this will show the labels for 0, -0.1, and 0.1, but if you handle the FormatLabel event of the NumericXAxis, you can prevent this. This event has a string return type, and the "item" event argument will return you the value of the label to be drawn. If you catch the -0.1, 0, and 0.1 labels as they are drawn, you can return string.Empty instead. The same goes for your negative values showing as absolute. You can use the FormatLabel event here to check if the item parsed to a double is negative and if so, return the absolute value of that parsed double as a string.
Note, this will keep the space where 0, -0.1, and 0.1 would have been. If this is acceptable for you, I would recommend that you take a look at the sample project that I have attached, as it demonstrates the procedures above. If not, then I would recommend continuing with your current method, but perhaps have a separate property on your underlying data item that you can convert your value into. You can then use your series' XMemberPath with that property instead, rather than the one that contains your "actual" value.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer