-
Notifications
You must be signed in to change notification settings - Fork 17
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
fluid.plotter: correctly construct unique labels #412
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a line I don't understand why it is there?
jsui/fluid.plotter.js
Outdated
|
||
colorMap = {}; | ||
var scheme = strChunk(_colorscheme, 6); | ||
uniques = uniques.removeDuplicates() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to run this here? the keys.forEach is not supposed to add anything that is found, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory you should not need it, but it makes for a good guard against the original problem emerging.
It is very cheap to run so I would opt to just keep it, even though it is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yeah looking at that its very meaningless to put this into an array prototype function.
I did update the check to actually work, which is why I think I needed the removal of duplicates: a2f90e0
indeed high priority. I've removed the code that is redundant since the first iteration does not allow for duplicates. Please test on your side and let me know if that works as intended. |
I'll test again and then get back to you :) |
This is something Rod found in the Max Beta and well it is certainly weird that it worked at all for so long... I think.
Old
New
At first I suspected maybe I was treating dictionaries incorrectly (with
.get()
and friends) but that was quickly snuffed out when I changed everything to use JSON representations (and found it to produce exactly the same behaviour). I then stepped through the code manually with a small test case and was intrigued why the programmer (💀) initially wrote this bit of code...label
is not a number or a string as I assumed it to be but is rather an object... Thus the sorting, sort of works accidentally in most cases but also there are duplicate uniques 🤦. When you get to constructing the colour map you are iterating over the colours and replacing them because the index is not necessarily any more tied to the instance of when the loop has first seen a colour. Durp.