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

Suggestion: Improving label handling for optimum dynamic PieChart label positioning. #655

Open
buggedcom opened this issue Oct 5, 2022 · 2 comments
Labels
enhancement Feature request

Comments

@buggedcom
Copy link

buggedcom commented Oct 5, 2022

Question

We have a chart generator allowing users to create highly custom, but specific, types of charts. This means it's very hard to get a one size fits all solution for pie chart labelling as the data can vary so much.

These charts enter a dashboard - at which point the charts can be resized. This leads to an incredibly complicated set of rules for label handling in pie charts.

An example of what could be done is below, with a single Pie chart that is resized to various ratios. Some of this is likely garbage in garbage out, especially the vertically short but horizontally wide one, but most are realistic possibilities.

I've tried really hard to get the labels to work nicely at different sizes using the existing labelling solutions. However, I feel like a few additions to the current solutions would really be useful.

All these changes would go to the oversizedBehavior option to better control the various existing options.

My suggestions here are:

"wrap-no-break"

This would operate the same way as fit currently does, however it would not cut in the middle of a word and wait until the next whitespace came along. This would typically improve readability quite significantly. Of course, it has the limitation that it can overflow maxWidth but since it would aid readability and be opt-in, I think this is a much-needed option.

"wrap-fit" and "wrap-no-break-fit"

This would be a combination of "wrap" and "fit", where it would first wrap the label, and then if it still overflows a maxHeight value it would then fit the text down. This would allow a bounding box for the size of the label to be created. Adapters could be used to control the maxHeight value so that labels on the top of the pie when alignLabels = false, so that it would emphasise fitting over wrapping.

If you would consider only one of these then I would ask that the "wrap-no-break" option would be considered first.

Environment (if applicable)

N/a

Additional context

Screenshot 2022-10-05 at 17 53 50

@martynasma martynasma added the enhancement Feature request label Oct 6, 2022
@martynasma
Copy link
Collaborator

Excellent suggestions. Thanks!

We're adding the wrap-no-break option since it makes the most sense.

We'll consider other options as well. No promises, though :)

@martynasma martynasma added the in next release Implemented. Available soon. label Oct 7, 2022
@martynasma
Copy link
Collaborator

Implemented in 5.2.29.

[5.2.29] - 2022-10-07

Added

  • Additional option for Label's oversizedBehavior setting: "wrap-no-break". If set, the labels will wrap to maxWidth, but will not brak words even if they do not fit.

Fixed

  • If timezone was set in a chart with a DateAxis with baseInterval set to "day", axis could show wrong date and axis tooltip could snap to a wring date on a DLS switch.

Full change log.

Download options.

Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.

@martynasma martynasma removed the in next release Implemented. Available soon. label Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

No branches or pull requests

2 participants