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

y axis title should be visible for each sector #87

Closed
MonikaFu opened this issue Nov 29, 2024 · 2 comments · Fixed by #123
Closed

y axis title should be visible for each sector #87

MonikaFu opened this issue Nov 29, 2024 · 2 comments · Fixed by #123
Assignees
Labels
ADO Also Tracked on Azure DevOps plot

Comments

@MonikaFu
Copy link
Contributor

MonikaFu commented Nov 29, 2024

Currently for aviation:

image

Increase plot height to fit the text.

AB#12272

@MonikaFu MonikaFu added ADO Also Tracked on Azure DevOps plot labels Nov 29, 2024
@cjyetman
Copy link
Member

cjyetman commented Dec 4, 2024

The text for this y-axis label is baked into the data, e.g. here

"unit": "tons of CO₂ per passenger km per active planes",

@jdhoffa suggested that rather than increasing the height of the plot, that I break the text into two lines so that it fits. In principal, that seems to be the safest thing to do, especially since the text comes from the data, so the plot ideally should be able to recognize that whatever text it is told to put there, it should automatically break it into multiple lines if it's not going to fit.

Doing that though, is more complicated than it may seem... the plot code would need to estimate the space needed, if the text is too big then it would need to parse the text and find the appropriate place to split it (e.g. at the closest space, or breaking a long word with a hyphen), then add a newline/s where appropriate and adjust the baseline so the new lines do not overlap the plot.

An easier solution would be to modify the data in the text beforehand by adding a newline when/where appropriate in workflow.pacta.dashboard, though the plot might still have to adjust the baseline appropriately, e.g. if it detects one or more newline characters in the text.

The easiest solution would be to just bump the plot height a bit, especially seeing that only the last character is partially cut off, so we likely only need a few extra pixels.

Does that change your opinion at all @jdhoffa?

@MonikaFu
Copy link
Contributor Author

MonikaFu commented Dec 4, 2024

Indeed, splitting the next is non-trivial and adding a new line in the text does not work for text within svgs. We would need to append two separate lines of text to svg instead of one in case the text is too long and find some sensible way of telling where the text should be split. I think that insteasing the height of the plot is currently the best solution, especially because the units are hard-coded so we know exactly how long the longest label will be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO Also Tracked on Azure DevOps plot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants