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

Support changing colors from within a legend #368

Open
fedarko opened this issue Sep 3, 2020 · 0 comments
Open

Support changing colors from within a legend #368

fedarko opened this issue Sep 3, 2020 · 0 comments
Assignees
Labels
feature request refactoring Use best practices or improve the usage of public APIs
Milestone

Comments

@fedarko
Copy link
Collaborator

fedarko commented Sep 3, 2020

This would involve doing what Emperor does: rather than drawing just a colored square for each category we'd add a Spectrum.js colorpicker.

// Add a color box (could totally be replaced by e.g. a Spectrum
// color picker in the future).
var colorCell = newRow.insertCell(-1);
colorCell.classList.add("category-color");
colorCell.classList.add("frozen-cell");
colorCell.setAttribute("style", "background: " + info[key] + ";");

Actually adding the colorpickers likely wouldn't be too bad (although if a field has like a thousand groups it might slow down the page, see e.g. #344, so we may want to only create a colorpicker when a field is clicked on by the user) -- I think the hard part will likely be refactoring the code to use the selected colors efficiently? Like, preferably we'd store the Colorer created for a given field and just modify that, rather than calling colorByFeatureMetadata / colorBySampleCat again. Or maybe that wouldn't be too slow, I dunno.

This would impact:

  • sample metadata coloring
  • feature metadata coloring
  • barplots (categorical feature metadata / stacked sample metadata)
  • animations (I think colors are assigned based on the trajectory? We could probably draw a legend for the trajectory in the side panel, similarly to how barplot legends are drawn, so that users can manipulate it there.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request refactoring Use best practices or improve the usage of public APIs
Projects
None yet
Development

No branches or pull requests

3 participants