hodcroftlab / covariants

Real-time updates and information about key SARS-CoV-2 variants, plus the scripts that generate this information.
https://covariants.org/
GNU Affero General Public License v3.0
316 stars 111 forks source link

equal Y axis for cases by country charts #316

Open yuval-harpaz opened 2 years ago

yuval-harpaz commented 2 years ago

Please add a field for setting a high limit for Y-axis to all the charts in the cases page. It would make a fairer comparison between countries and allow zooming in when looking at a new variant. Thanks. image

emmahodcroft commented 2 years ago

Interactive axes would be a great addition to CoVariants. Unfortunately we haven't had time to look into this, but we are looking to perhaps switch to a new charting library soon. This may open up more options! In the meantime, happy to take PRs that may improve this functionality!

yuval-harpaz commented 2 years ago

Unfortunately I've got zero experience with Recharts, so I cannot add a user input box. But it may be simple to make "other" also disappear when "deselect all". This seems to be what's keeping Y up there

emmahodcroft commented 2 years ago

Ah, that's a good point @yuval-harpaz . @ivan-aksamentov would it be possible to add 'other' to the left-hand selection bar on the 'Cases' page, so it can be deselected - and if someone wants, not selected back in again?

ivan-aksamentov commented 2 years ago

@emmahodcroft It's not easy to do in the app. There is no "other" variant. Instead, it is currently computed ad-hoc as a difference between the sum of all variants and total. It is computed for every user on each their visit for every country being displayed, for every time point. And, as any computation done in the covariants frontend, it's a very silly thing to do, because it's constant data.

If you want "other" to behave as a variant, then the right thing to do is to add it as a variant named "other" to the data in the backend scripts. And it will appear automagically, on the plot and in the side panel. We could then remove the ad-hoc computation in javascript and the corresponding grey areas on the plot.

This should hopefully allow Y axis to rescale.

Depending on the priorities of this, compared to other tasks, you think you or Moira can adjust the data? And then ping me and I'll see what needs to be removed in the app, to avoid having the "other" twice.

yuval-harpaz commented 2 years ago

Unless you need "other" separately for other uses, I'd consider making a shortcut, leave it there, just compute max for Yaxis ignoring it.

emmahodcroft commented 2 years ago

Hi @ivan-aksamentov - that makes sense to me. I'll see if we can work that in!