-
Notifications
You must be signed in to change notification settings - Fork 162
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
Color by legend is broken for numeric traits #926
Comments
Thanks for tracking this down! I think we can throw |
Yeah, this is a JavaScript type thing. Strings have a substring method, but Numbers don't. I expect a forced conversion to string is needed. There are many ways to format a Number, but Edit: or what Jover said! |
Fixes a bug where the tree legend could not be displayed for numeric color by values because those values do not have a substring function. Closes #926.
Ok, I actually was able to fix the issue with an explicit check for type (5f4a6d7), but if y'all prefer casting to string for everything, that's fine, too. |
Thanks! I think that type check is fine. The |
Selecting a color by option that has numerical values produces an error that "something has gone wrong". For example, selecting "Age" in the novel coronavirus build (https://nextstrain.org/ncov?c=age) produces this output:
Using git bisect, I tracked this error down to the truncation of legend labels using the substring method.
I'm not familiar enough with React to implement a solution here, but it seems like we need to check the type of the label prior to applying substring.
The text was updated successfully, but these errors were encountered: