-
Notifications
You must be signed in to change notification settings - Fork 970
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
Add percentages to exchange tooltip #5791
base: master
Are you sure you want to change the base?
Add percentages to exchange tooltip #5791
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been hesitant to add this to the tooltip because I don't think there is a good way to do it (a way to do it without adding ambiguity or confusion).
The current implementation for example does not always match what you expect it to if you compare it to the horizontal bar breakdown graph. This is due to the fact that the net values are a weigted average and can't really be compared to the more granular data we have in the bar breakdown.
<b> | ||
{getRatioPercent( | ||
Math.abs(netExchange), | ||
netExchange >= 0 ? netConsumption : netProduction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how these values are intended to be used, we should not switch between them like this. These should only be switched when using the production<->consumption toggle.
This is related to #6204 |
Description
This PR adds the percentage of electricity that net exchanges represent to the net exchange tooltip.
I've decided to make it so that the percentage is calculated with the total electricity produced or total consumed based on whether the imports are positive or negative. I feel it is a more useful metric, and also avoids confusing users in some strange cases, e.g. country exports 50 % of electricity produced but it says 100 % of electricity available.
The PR is mostly done, but I'd need some help regarding translations.
Also, feel free to raise any issues about code style as this is my first time writing typescript.
Preview
It also works in the CO2 category:
I thought about changing the text in the case of being in the CO2 category but "CO2 available" seems a bit wrong. It would be interesting if someone came with some better text.
Check
pnpx prettier --write .
andpoetry run format
to format my changes.