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

Add percentages to exchange tooltip #5791

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

silimotion
Copy link
Contributor

@silimotion silimotion commented Aug 29, 2023

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

Screenshot_20230829_210307

It also works in the CO2 category:

Screenshot_20230830_125727

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

  • I have run pnpx prettier --write . and poetry run format to format my changes.

Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a 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.

web/src/utils/helpers.ts Outdated Show resolved Hide resolved
<b>
{getRatioPercent(
Math.abs(netExchange),
netExchange >= 0 ? netConsumption : netProduction
Copy link
Member

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.

web/src/utils/helpers.ts Outdated Show resolved Hide resolved
web/src/utils/helpers.ts Fixed Show fixed Hide fixed
web/src/utils/helpers.ts Fixed Show fixed Hide fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants