I am able to set the axes as logarithmic but would like to display the axis numbers in scientific notation. Could anyone please advice on how to do the same?
Hello Marc,
I have been investigating into the behavior you are seeing where the solution I provided above is not working, but at this time I am unable to reproduce an error where a message “Resource is never used” appears.
I have updated the sample project I provided above to version 2021.1 (specific version 21.1.20211.27) and I am attaching it here. If you are using a different version, please let me know what version you are using so I may test against it, but it appears that the code I provided in 2016 is still valid for showing superscript labels with the XamDataChart with the latest version of Infragistics for WPF at the time of writing this.
Please let me know if you have any other questions or concerns on this matter.
XamDataChartSuperScriptLabelsCase.zip
Hello I want to do the same thing but when I try this solution it is not working. In visual studio
<ig:NumericXAxis.Label> <DataTemplate>
</DataTemplate>
I have the message "Resource is never used" and it does not work.
Not sure why.
Thanks! I can make it work!
Hello P D,
Thank you for your post.
To set the labels of a numeric axis to be in exponential format or scientific notation, I would recommend writing a new DataTemplate for the numeric axis' Label property. In this DataTemplate, I would recommend placing a TextBlock with a pair of Run objects for its Text. The first Run can have its Text property set to "10" or whichever base you choose to use with your logarithmic axis. By default, this value is 10 when you set the IsLogarithmic property of your axis to "true."
For the second Run element, I would recommend setting the BaselineAlignment property to "Superscript" and bind the Text property to Item with an IValueConverter. This "Item" binding will bind to the Item property of the AxisItemDataContex object that makes up the data context of the items you are using for your Label. In the case of the numeric axes in the XamDataChart, this will pass the number that would've been shown by the label by default to your converter. In your converter, you can take the string representation of this number, parse it, and return a number that represents the power that your base 10 is raised to in order to create that number.
I have attached a sample project to demonstrate the above. I hope this helps you.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support