Plot tweaks#11
Conversation
…Ranges is false; otherwise displays solid dot with variant colour on mouseover; something is wrong with how segment coords are being calculated
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ivan-aksamentov
left a comment
There was a problem hiding this comment.
Thanks for inviting me for a review!
I am not in the loop with regards to the science of this work and as an engineer I am only competent to comment on the technical side of things. I will let Richard and Cornelius to comment on scientific soundness, utility and usability of the feature.
Technically though, it's a good start and it seems to be displaying nice bubbles, however, there is a few problems I noticed:
-
The PR does not have any description. I don't know what was the goal and what have been done exactly. So it's difficult for me to make a review.
-
CustomizedDotandCustomizedActiveDotcomponents don't need to be nested inside the plot component. We could put them into a separate file or two. -
It is recommended to use plain function syntax
function MyComponent() { ... }for most places, instead of arrow functionsconst MyComponent = () => { ... }. -
Would be nice to avoid defining multiple variables with the comma operator. It's hard to read and is error prone. A
conston every line is fine. -
Use
constwhere possible (instead oflet) -
Lots of magic numbers and operations without explanation. Some more comments and/or extracting formulas into named functions, and numbers into named constants would be nice.
The linter and type checker are disabled in the PR deployments currently, but there are probably more things they will catch. Here is how to run them locally:
yarn run lint
automated fixes can be applied with:
yarn run lint:fix
automated code formatting:
yarn format:fix
There will be type errors. For example type any is not allowed. Typing the props for the dot components is difficult. I will adjust it later.
Let me know if there's technical troubles I can help to resolve.
I suggest to add Richard and/or Cornelius to the reviewers or to chat with them in person, to discuss the science of things (if not already).
|
Thanks @ivan-aksamentov - I've since found some bugs that arise when the frequency estimate is 1 (causes a division by zero error because I'm relying on this quantity to scale to the plot region) |
|
@ArtPoon By Richard's request I just merged branch |
|
Do you guys use a primary dev branch or can a PR come from any branch? |
|
@ArtPoon
(examples are with Nextclade because flu_frequencies does not have deployment environments or even domain name yet) |
- declared const on separate lines (no commas) - fixed problem when value=1 - fixed lint issues - forgot to add new file
Starting from parent component, I tracked down the dot props type `DotProps`, then added the missing `payload` filed. Then added more null-checks for now strictly typed props (typescript compiler told me which ones). This should hopefully be a bit more type safe, although I don't have much hopes, because the typings shipped with Recharts is a a mess.
|
I made a few refactorings to address linter warnings and improve type-safety (hopefully). Technically this looks good to me. However, now that I learned how it works, I find the UX a bit strange. The bubbles introduce quite a bit of visual load, and they are displayed unconditionally. Then the bubbles are filled on mouse hover when the ranges are not shown, but not filled when ranges are shown. Similarly, the lines are shown in one mode and not another. I understand that hollow bubbles allow to see through them better. But this all seems quite random to me. As a user I would not be able to tell what to expect every time I hover a mouse and why it is done this way. I propose to consider (perhaps in followup PRs) to add checkboxes or switch toggles to enable and disable the bubbles and confidence lines independently, without attaching this to one another and to confidence ranges (they will also stay independent). Some users have very large displays and they browse in full screen mode, so they can have preferences different from someone browsing from a phone. Ability to configure plot components independently would offload UX decisions away from us to the end users. Additionally, in this application we have 2 types of plots: for regions and for variants. Which are really the same plot, but with different data. For symmetry, is the bubbles and lines something that also makes sense in the other type of plots? In any case, I will let Richard and Cornelius to comment on the scientific side and UX of this feature as well as its further extensions, and to make the final decision. |
|
Okay fair point about giving users the option to turn off the bubbles. I will have line segments displayed whether or not shaded regions are being displayed instead of switching to filled cirlces, i.e., previous behaviour. I was going to port these interface changes to the variant-specific plot after drafting the implementation in the region-specific plots. |
- confidence interval line segments now always displayed, as before - removed filled dots
|
@ArtPoon Haha! No worries! |
|
I'm trying to resolve two This seems to be associated with the following line: |
|
Hm, never mind - I'm getting the same errors on |
rneher
left a comment
There was a problem hiding this comment.
thanks, Art. This looks great to me.
|
Thanks @rneher! @ivan-aksamentov is this ok to merge? |
monotonicsmoothing of lines with defaultlinearmode to avoid over-smoothing