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

Vertical datalabel suppressed for last column #9687

Closed
kzoon opened this issue Dec 17, 2018 · 19 comments · Fixed by #17087
Closed

Vertical datalabel suppressed for last column #9687

kzoon opened this issue Dec 17, 2018 · 19 comments · Fixed by #17087

Comments

@kzoon
Copy link

kzoon commented Dec 17, 2018

Expected behaviour

All categories in a column chart should have data labels when there is enough space to render them.

Actual behaviour

The last data label in a column chart gets suppressed when data labels are rotated. This happens when you limit the width of the chart. The new chart width leaves enough space to render the data label.

Live demo with steps to reproduce

http://jsfiddle.net/kzoon/2bd8vomc/1/

Product version

Highcharts v6, v7

Affected browser(s)

All

@sebastianbochan
Copy link
Contributor

Hi @kzoon,
Thank you for reporting. The space for labels is calculated before rotating, by default. If you disable the series.dataLabels.crop option, then datalabel will be visible.

Demo:

Docs:

@TorsteinHonsi Should we consider it as a bug ?

@kzoon
Copy link
Author

kzoon commented Dec 19, 2018

Thanks for your quick response. I can work with the datalabels.crop option for now.

But I still consider this a bug, because I can't have cropped vertical data labels.
See http://jsfiddle.net/kzoon/2bd8vomc/4/

By the way: vertical labels are cropped, even when the horizontal label would fit. So you must be doing some cropping after rotation... See http://jsfiddle.net/kzoon/2bd8vomc/7/

@kzoon kzoon closed this as completed Dec 19, 2018
@KacperMadej
Copy link
Contributor

Let's keep this issue open until we'll decide if this is a bug or not.

@KacperMadej KacperMadej reopened this Dec 19, 2018
@TorsteinHonsi
Copy link
Collaborator

Yes it's a bug. I thought we had is covered, see #4779 and the test at https://jsfiddle.net/highcharts/fLcjuspq/. But the problem in #4779 was the opposite, we had rotated labels displayed outside when they should have been cropped.

@kzoon
Copy link
Author

kzoon commented Jan 16, 2019

I have a new version release in three weeks time.
Any change of fixing this soon?
Obviously, I like a fix better than having to implement a workaround...

@KacperMadej
Copy link
Contributor

There's no ETA for the fix at this moment. It's doubtful that the fix will make it to 7.0.2 (planned to be released within next few days).
I know that you prefer a fix, but if a workaround will be of any use for you please let me know and I'll prepare a demo.

@kzoon
Copy link
Author

kzoon commented Jan 18, 2019

I was planning to disable series.dataLabels.crop as a workaround. But if you have a more elegant workaround, I'm certainly interested!

@KacperMadej
Copy link
Contributor

@kzoon
Here's a workaround that is not fully tested, but works in case of your original demo. Additional adjustment is at JS line number 106. Demo: http://jsfiddle.net/BlackLabel/rzL8buh7/

Internal note:
The change affects the related issue #4779 demo by keeping and cropping away different labels, but the general rule of cropping what's outside is kept. Demo: https://jsfiddle.net/BlackLabel/hn8xtebu/

@kzoon
Copy link
Author

kzoon commented Jan 29, 2019

The workaround very soon suppresses the first label in my charts. See example http://jsfiddle.net/kzoon/xtwyqrm3/18/

Somehow this is caused by my use of Min and Max on the x-axis.

I started doing this as a suggested workaround for tick marks and labels not being rendered when there was no data in the chart. The link to the Highchart issue no longer works (http://forum.highcharts.com/highcharts-usage/show-category-labels-when-there-is-no-data-t32428/), so I can't check if using Min/Max is still needed.

Is there a way to make the current workaround work with Min and Max on the x-axis?

@KacperMadej
Copy link
Contributor

Working forum link: https://www.highcharts.com/forum/viewtopic.php?f=9&t=32428
Adjusted the workaround for your last demo: https://jsfiddle.net/BlackLabel/j9xvwefh/1/

@kzoon
Copy link
Author

kzoon commented Jan 30, 2019

Thanks very much! Now I can implement a workaround in my next version.

I improved the workaround slightly:
With alignAttr.x -= negRotation ? bBox.height * 0.2 : 0; the right hand data label disappears when I lower the chart container width to 450px: https://jsfiddle.net/kzoon/afcu2908/
When I use 0.3 instead of 0.2, I can go down as low as to chart container width 350px: https://jsfiddle.net/kzoon/afcu2908/2/

@KacperMadej
Copy link
Contributor

Workaround idea for now is to adjust the value until the chart is rendered correctly. Currently there's no better logic to decide when the labels should be hidden, but this issue is still open, so we'll be looking for a proper fix.

@kzoon
Copy link
Author

kzoon commented Jan 30, 2019

Actually,
This is the better workaround: alignAttr.x -= negRotation ? (bBox.width / 2) : 0;

It works on the narrowest of charts:
https://jsfiddle.net/kzoon/afcu2908/68/

Thanks again. I have enough to go ahead

@kzoon
Copy link
Author

kzoon commented Nov 18, 2019

Still an issue in 7.2.1

@kzoon
Copy link
Author

kzoon commented Apr 6, 2021

Still an issue in v9.0.1.
Still using a work around (https://jsfiddle.net/kzoon/afcu2908/68/)
I don't understand why these kind of bugs are allowed to linger on an on....

@kzoon
Copy link
Author

kzoon commented Mar 10, 2022

I am sorry to see this issue still open in V10.0. How can issues stay open for 3+ years???

For anyone having the same issue: this rough workaround works on V10.0: https://jsfiddle.net/kzoon/afcu2908/70/

@raf18seb
Copy link
Contributor

Hi @kzoon,

Thank you for updating a workaround and sorry it's been hanging for so long. We'll try to prioritize and we'll provide more info soon. Thank you for bumping this up.

@KacperMadej
Copy link
Contributor

In case overlapping is not an issue, crop: false gives the same results as the workaround (at least in the last shared demo): https://jsfiddle.net/BlackLabel/yktLnvga/

@kzoon
Copy link
Author

kzoon commented Mar 11, 2022

Cropping has been discussed above: #9687 (comment)

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

Successfully merging a pull request may close this issue.

6 participants