Is there a way to pad the min/max x or y axis values? For instance, if my dataset has a min y-value of -10 and a max y-value of 10, the chart will automatically set the y-axis to range from -10 to 10. The problem is that I can get points along the top or bottom edges of the chart which can make them difficult to see. What I’d like to do is pad the range by some percentage, say 110%, such that the y-axis will range from -11 to 11.
Thanks, Steve
Hello Steve,
I have been looking into your issue and what I can suggest you is using MaximumValue and MinimumValue properties of the NumericXAxis and NumericYAxis so that you can set minimum and maximum values of the x and y axis. You can find more information about axis range here.
Please let me know if you have any other questions on the matter.
Thanks, Maria. I think that will work, but I was hoping there was some way to just set a padding parameter and allow the xamDataChart to continue automatically determining min/max values for the axis. Setting the values manually means I'll have to compute them at run-time when I load the chart.
I can suggest you handle the Loaded event of the XamDataChart in order to calculate MaximumValue and MinimumValue for the X and Y axes. I made a sample project where I sorted the DataPoints by x coordinate, calculated minimum and maximum values for numericXAxis. I used the same logic for the y coordinate.
Please have a look at the attached project and let me know if it helps you.
Thank you for your response. I am glad that you resolved your issue.
Thanks, Maria. Your sample helped. As I said, I was just hoping there was a property I could set rather than manually calculating. My application is very interactive in that the user can pick among many different series to plot which makes it somewhat cumbersome to manually calculate the min/max values. I have it working fine now.
Thanks, Steve.
Hello,
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.