You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In bar charts, data label rotation does not seem to work well. #20307
Rotated data labels works as expected in column charts. However, in a bar chart, it doesn't work. The align option aligns the text in the label (I assume), not the label in the bar (as works for column with verticalAlign).
When I test that the align property works for the bar. The verticalAlign works but I agree it might be counterintuitive. When you set the rotation it also affects the labels.
Could you please explain what doesn't work here?
In the attached demo you can see, that rotation: 1 is not taking verticalAlignment into account, also align to right is badly positioned (more to the center than right).
It seems that how this works in stack labels is there are three properties, not two: align, verticalAlign, and textAlign.
I think (for bar, didn't look at line) when rotation == 0, dataLabel.align is controlling stackLabel.align and stackLabel.textAlign. However, with rotation != 0, it stops controlling stackLabel.align.
EDIT: this comment was made assuming that these properties work well with stacked charts. While I think they are the correct 3 logical values, I'm unsure they work well in stacked labels either
Activity
karolkolodziej commentedon Dec 15, 2023
Hi @magnusanderson-wk!
When I test that the
alignproperty works for the bar. TheverticalAlignworks but I agree it might be counterintuitive. When you set therotationit also affects the labels.Could you please explain what doesn't work here?
TorsteinHonsi commentedon Dec 15, 2023
One observation is that on the second chart, as long as
rotationis anything other than 0, thealigndoesn't work.rotation: 0=> We can set the alignment to left, center or right.rotation: 1=> Always aligns to center.hubertkozik commentedon Dec 20, 2023
This bug is not only present in column/bar series, but also in Line: https://jsfiddle.net/BlackLabel/gs9t0wf5/
In the attached demo you can see, that
rotation: 1is not takingverticalAlignmentinto account, alsoaligntorightis badly positioned (more to the center than right).magnusanderson-wk commentedon Dec 22, 2023
It seems that how this works in stack labels is there are three properties, not two:
align,verticalAlign, andtextAlign.I think (for bar, didn't look at line) when
rotation == 0,dataLabel.alignis controllingstackLabel.alignandstackLabel.textAlign. However, withrotation != 0, it stops controllingstackLabel.align.EDIT: this comment was made assuming that these properties work well with stacked charts. While I think they are the correct 3 logical values, I'm unsure they work well in stacked labels either
magnusanderson-wk commentedon Dec 22, 2023
Opened this ticket for stack labels also.