Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The stackLabels are misplaced when rotation is set. #15129

Closed
raf18seb opened this issue Feb 14, 2021 · 9 comments · Fixed by #18207
Closed

The stackLabels are misplaced when rotation is set. #15129

raf18seb opened this issue Feb 14, 2021 · 9 comments · Fixed by #18207

Comments

@raf18seb
Copy link
Contributor

Actual behaviour

The longer text, the bigger is misplace of stackLabels.

Live demo with steps to reproduce

https://jsfiddle.net/BlackLabel/tnv25pzq/

Product version

Highcharts 9.0.0

@PaulDalek
Copy link
Contributor

It is a regression. The latest working version is 7.1.2.

Demo
https://jsfiddle.net/BlackLabel/mg3u54dv/

Bisected to commit ed7ea40.

@gustavoittner
Copy link

Meanwhile there is a workaround to this issue?

@PaulDalek
Copy link
Contributor

Hi @gustavoittner

You could try to make stack labels as HTML elements and rotate them through inline CSS with transform: rotate.

Demo
https://jsfiddle.net/BlackLabel/ym9gLr2z/

@gustavoittner
Copy link

Even in the HighCharts version 7.1.2, the stackLabels that are too large to fit the chart are not adjusted to fit. Another issue is that the stackLabels can overlap the series dataLabels. Is there any way that I could handle the collision between the stackLabels and the dataLabels giving stackLabels priority over dataLabels?

Current:
current

Expected (collision and fit handled):
expected

Is there any way that I can achieve this behavior?

@KacperMadej
Copy link
Contributor

@gustavoittner
This looks like a different problem and should be reported in a different issue - this one is about the misplaced position after rotation. It looks like the priority is already in favor of stackLabels - maybe you could add a live demo?

@gustavoittner
Copy link

gustavoittner commented Feb 17, 2021

@KacperMadej

In the fiddle I'm using version 7.1.2 which is supposed to have the expected behavior, but it still has some problems.

https://jsfiddle.net/3r8bp9dq/

In version 7.1.2 the result is not like image bellow (the behavior of the image below is not present in any version of Highcharts):
image

Differently from the fiddle, in the image above:

  1. The stackLabels are not over the column stacks, only when they are adjusted to fit into the chart
  2. When stackLabels are adjusted to fit into the chart, the possible collisions with series.dataLabels are resolved, giving priority to the stackLabel over the conflicted dataLabel

In the fiddle, for some reason, the second column stack has lost the dataLabel, even thought there is no collision happening. I don't know if it's gonna happen in current Highcharts version after the regression:
image

@KacperMadej
Copy link
Contributor

It's (hopefully) not going to happen because you have pointed this out, so thank you.
Demo of the second problem (wrong overlap detection): https://jsfiddle.net/BlackLabel/9nkbr7sf/

@isiemers
Copy link

The original issue (stack labels with set rotation being horizontally offset, proportionally to the length of the label) is still present in version 10.3.2

@pawellysy
Copy link
Member

Thanks for your input @isiemers! We are in process of refactoring this module. Any updates will be posted in the thread, or linked PR's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants