Skip to content

In bar charts, data label rotation does not seem to work well.  #20307

Closed

Description

@magnusanderson-wk

Description of the feature

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).

Library related to the feature

Highcharts

Proof of Concept/Live example for the feature

https://jsfiddle.net/magnusandersonwk/16ukthd2/
Shows bar charts with/without rotation (not working), then column charts with/without rotation (does work).


You can vote for this feature by adding a thumbs-up reaction to this post.

Activity

  1. karolkolodziej commented on Dec 15, 2023

    @karolkolodziej
    Member

    Hi @magnusanderson-wk!

    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?

  2. TorsteinHonsi commented on Dec 15, 2023

    @TorsteinHonsi
    Collaborator

    One observation is that on the second chart, as long as rotation is anything other than 0, the align doesn't work.

    • rotation: 0 => We can set the alignment to left, center or right.
    • rotation: 1 => Always aligns to center.
  3. self-assigned this
    on Dec 19, 2023
  4. hubertkozik commented on Dec 20, 2023

    @hubertkozik
    Member

    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: 1 is not taking verticalAlignment into account, also align to right is badly positioned (more to the center than right).

  5. magnusanderson-wk commented on Dec 22, 2023

    @magnusanderson-wk
    Author

    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

  6. magnusanderson-wk commented on Dec 22, 2023

    @magnusanderson-wk
    Author

    Opened this ticket for stack labels also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions