Highlight line when country name moused-over #102
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One way to address the problem of distinguishing between many different lines is with interactivity.
I tried implementing a features that highlights the corresponding line on the plot when a user mouses-over a country name in the panel on the left.
A user can thus rapidly scrub their cursor down the list of names, and see the trend for that country in the plots for each variant.
When mousing-over Spain (the cursor does not appear in the screenshot), this looks like:
However, performance is unacceptably bad, and there is a noticeable delay between moving the cursor to another country name and the plots updating.
The flamegraph in React dev tools suggest that re-rendering each line-chart takes roughly 50-60ms, even though only two lines have changed thickness and need to be re-rendered, and the others are unaffected.
I haven't used recharts before and I'm not sure what's causing this problem or whether there's an easy solution.