owid-grapher
owid-grapher copied to clipboard
LineChart/StackedArea: Improve labelling when space is tight
Description
- When space is tight, the labelling algorithm used in line charts and stacked area charts doesn't do a good job
- This has been noted by Pablo A when trying to prepare a mobile static chart for data insights (see screenshots below)
- This is also the reason why we don't re-use the labelling algorithm for slope charts
Expected behaviour
- Show as many labels as possible, even when space is tight
Steps to reproduce
- Go to https://owid.cloud/admin/charts/383/edit
- Click on the 'Export' tab
- Switch to the mobile version
Screenshots
When space is tight:
If there is more space (here achieved by removing text elements):