ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  x-Axis Labels displaced from the tick marks.
Posted by Jaideep on Dec-15-2011 03:16
Attachments:
Hi,
When using XY charts like line etc, i noticed that if the x-axis label angle is more than 75 or less than 15, the labels seem to be displaced from their respective tick marks.
With every other parameter being the same if the angle is between 15 and 75 degrees, the labels render just fine.
To generate the simple example in the attached snapshot, we use the axis.setLabels(LabelArray) method call to assign labels to the x axis. The one on the left is using an angle of 70 and the one on the right has an angle of 75 (Note that in the right one, the x-axis labels are displaced to the right of their tick mark positions).
xAxisLabels.PNG

  Re: x-Axis Labels displaced from the tick marks.
Posted by Peter Kwan on Dec-16-2011 06:11
Attachments:
Hi Jaideep,

Actually, exactly the reverse happen, the label is shifted when 15 < angle < 75.

I have attached 3 charts at angle = 0, 15 and 16 for your reference.

At angle = 0, the label is center aligned on the tick, with the top-center of the label bounding box aligned with the tick.

At angle =15, the label is still center aligned to the tick, with the top-center of the label bounding box aligned with the tick.

At angle = 16, the alignment changes. Now top-right corner of the label bounding box is aligned to the tick. Comparing angle = 15 to angle = 16, you will notice a shift.

The alignment changes because in general, the top-center alignment is more natural for horizontal labels, while the top-right alignment is more natural for labels with sufficient rotation. Currently, we just hard coded the threshold for switching the alignment at angle = 15.

Similar alignment changes occur at angle = 75.

The angles 15 and 75 seems to work well for shorter labels that are most often used. For your case, the labels are very long, and angle = 75 does not look natural. Unluckily, the threshold angle = 75 is hard coded and cannot be changed.

May be you can consider not to allow 75 <= angle <= 105 except angle = 90. So any angle that is close to vertical will be modified to exactly vertical (angle = 90). Personally, I think instead of rotating by a small angle from vertical or horizontal, it may be better not to rotate at all.

Regards
Peter Kwan
angle0.png
angle15.png
angle16.png