Page 1 of 1

XY Axis labeling, offset on individual labels for space?

Posted: Fri Apr 25, 2014 2:18 pm
by greggorob64
I have to graphs in close proximity to each other (displaying a cross section). If you look in the bottom right, the last value (200) is jammed right up against the edge of the graph.

Are any of these options possible? I only need one (in order of preference). My goal is to have the spacing between the two charts only be 1px. Its currently more than 1px on account of the label spacing.

[*]Is there a way for me to offset the last label by a number of pixels?
[*]Is there a way for me to hide the last label completely?
[*]Is there a way for me to hide the first label of the second chart?

Image
I currently have that X axis with all auto-generated labels. I'm not using any custom ticks on that axis currently.

Thanks in advance!

Re: XY Axis labeling, offset on individual labels for space?

Posted: Fri Apr 25, 2014 2:34 pm
by ArctionPasi
Using xAxis.FormatValueLabel event handler is one possiblity. You can return empty string if near chart border. Pass FormatValueLabel handler's value to xAxis.ValueToCoord method, and you'll get the center coordinate of string. To find out the total string length in pixels, you call chart.MeasureText method.

Something like that :P

Re: XY Axis labeling, offset on individual labels for space?

Posted: Thu May 08, 2014 2:18 pm
by greggorob64
This method worked great. I added some padding to the farthest over label (by drawing "200 .") as the string.

Thanks!

Image