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

Fix two bugs related to changing taxonomic level in the barplot #126

Merged
merged 11 commits into from
Jul 26, 2019

Conversation

fedarko
Copy link
Contributor

@fedarko fedarko commented Jul 22, 2019

Previously, if a user changed the bar width and then changed the Taxonomic Level, the bar widths would've gotten reset (due to appendTaxaPicker() calling init() instead of render()). This problem also impacted the currently selected color scheme (aka "Color Palette") -- it would keep getting reset to schemeAccent. (I looked around, and I don't think either of these bugs had open issues.)

Now, init() takes as an argument a state object which stores some information about the current state of the bar plot visualization. I also added helper functions to toolbar.js (getBarWidth() and getColorScheme()) which attempt to get information about parts of this state from the DOM and fall back on sane defaults in the case where these elements don't exist (yet).

As mentioned in the commit messages, this sort of solution could probably be used to address other problems in the visualization (e.g. #87, #90, #91) if this design pattern doesn't seem egregious.

There are definitely still some quirks in the visualization (mostly related to visibility selection stuff), but it should definitely be more pleasant to use the bar plot now :)

Edit: as with prior PRs I've made here, github is showing all of the unique commits on my fork of q2-taxa. The pertinent commits are the two most recent ones (30a17d2 and ef72b55).

fedarko added 11 commits May 10, 2019 12:32
Will make it easier to adjust this in the future, if desired.
The min size increase should at least prevent the labels from getting
squished together.
TODOs remaining:
-Preserve the bar width on changing taxonomic level
-When filtering the bar chart to show a certain taxon/level, ensure
 that this filtering is respected upon changing the bar width.
This is done by passing bar width to init(), which in turn is now
done by a "state" object that init() accepts as an argument.

It seems like some of the open problems in the bar plot visualization
(e.g. qiime2#91) could be addressed by storing more information about the
visualization's state. (Not sure just passing this around between
functions is the *best* way to structure things, though.)
Previously, changing the taxonomic level would revert the color
scheme back to the default (schemeAccent). Now, it should stick
with whatever the user had selected.

This is done by using the new "state" option of init(). I imagine we
could also use this in the future for outstanding issues like qiime2#87.
Copy link
Contributor

@thermokarst thermokarst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo! Thanks so much @fedarko! 🎉

@thermokarst thermokarst merged commit 37228ae into qiime2:master Jul 26, 2019
@fedarko
Copy link
Contributor Author

fedarko commented Jul 26, 2019

@thermokarst yay! want me to update the changelog again re: the now-fixed bugs?

@thermokarst
Copy link
Contributor

Yes please!

@fedarko
Copy link
Contributor Author

fedarko commented Jul 26, 2019

Ok, done! Thanks a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants