owid-grapher icon indicating copy to clipboard operation
owid-grapher copied to clipboard

Long StackedDiscreteBar labels should wrap

Open samizdatco opened this issue 11 months ago • 0 comments

Core problem

Long labels will compress the amount of space left over for the graph itself (see slack discussion):

image

Proposed solution

A max-width cutoff of, say 25%, could be chosen and any labels wider than that could be broken into multiple lines when rendered by TextWrap. The cutoffs could also use px sizes with breakpoints detected using the new isSmall, isMedium, and isLarge grapher attributes.

Alternatives

We could leave line-breaking for authors to control manually and parse strings for a <br>, \n, or other newline symbol.


Progess

  • https://github.com/owid/owid-grapher/pull/3341
  • (to do) label wrapping for DiscreteBar charts

samizdatco avatar Sep 11 '23 20:09 samizdatco