I have a data series that starts at 100 and is exponential in nature, so I am displaying it on a chart with a logarithmic scale and a log base of 2. The minimum value of this scale is calculated in code behind and bound. For example the minimum value might be 100, 50, 25 etc. However when I display the chart the labels are always powers of 2. For example if I set the minimum value to 50, then there is no label at 50, the first label is 64 and then 128, 256 etc.
Is there any way I can control these labels so that the labels would appear at 25, 50, 100, 200, 400 etc. ?
Hello,
Thank you for your post. I have been looking into and I created a sample project for you with the functionality you want. Basically I added an additional Axis which Minimum and Interval Properties are the same as the main one’s MinimumValue. Also I handled the XamDataChart event, so I can change the Margin of the fake Axis, so it looks like they are the same. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hi,
Thanks for the response. Unfortunately it doesn't really solve the problem for me, although it helps. It gives me the minimum value for the cross-over, ie 50, but not the multiples of 50, eg 100, 200, 400 etc. Is there any way, perhaps in the code-behind, that I could manually override the placement of the axis labels, or any other work-around you can think of that would also produce the 100, 200 etc.
One variation I could think of using your solution as a base would be to set the minimum and maximum of the false axis in the code behind to be log2 of the actual minimum and maximum, and it's interval to log(2). Then it would just be a case of over-riding the label display format to display 2^{label value}, although I'm not sure how I could override the displayed label?
Thanks,
Graeme
I can say that the Labels are calculated internally and you can onlu set the Axis' Minimum, Maximum and Interval Properties based on which the Labels are calculated, so I believ that the approach your are using is the best one to achiev the functionality you want. If I think of another possible approach for this I will let you know.
The only issue with the solution I mentioned is that I don't know any way to change the label display. I would somehow need to introduce a value converter or something. My solution would correctly place a label at the values 50, 100, 200 etc, but these values would be the logs of those values 5.64, 6.34, 7.03 etc. Is there anyway that the template used to display the label could be modified to add a value converter, or any other way, so that I could display 2 ^ value instead of the values?
Here you can read how to format the labels using Converter:
http://es.infragistics.com/community/forums/t/45888.aspx
Hope this helps you.