-
Notifications
You must be signed in to change notification settings - Fork 377
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 color maps for enumerated fields #1067
Comments
Come to think of it, we should allow this for numeric fields too. Currently our colorMaps map to scale of 0 to 1, dependent on whatever the actual values end up being. In some cases it would be better to be able to do:
Maybe with |
How close is this to #1097? |
They're actually quite independent.
|
Is this covered by #1551? |
No. That one only covers boundaries of numeric fields. This one is about enumerated fields. Possibly they could be unified in this somewhat awkward way:
|
@RacingTadpole, @stevage Are you both happy if I go ahead and implement this How does setting a binning method interact with explicit colour bins? |
Hmm I actually think I like my original syntax better:
Any complications with that? |
I'll go ahead with the |
sounds good to me! |
I've come back to this issue today, and I think that it would be better to fully separate colouring of scalar and enum columns. Proposed changes:
This will clean Potential problems:
|
That sounds good to me - anything that cleans up the code is welcome. We should keep an eye on backwards compatibility though - eg. if you go with your plan above, add a deprecation warning if |
I've started making changes to add this feature and clean up the mix of scalar and enum code in Note: that commit is very WIP. There's no error checking, it works by converting |
Without looking into it in depth, that all sounds good to me. Just check where indicesIntoUniqueValues is used in terriajs, I'd be surprised if anyone else uses it. But add a deprecation warning anyway if you can. Maybe lazy calc it in the case? Note Cycle is the default in many cases. |
Where is cycle used? Is it used with columns that have a large number of unique values? |
Even with Syntax-wise, I've chosen:
If values are specified more than once, the last is used. Any values that are not specified form part of the "other" group. |
Deprecating |
Does explicitly colouring So, say I have a column whose "colorBins": [
{ "color": "red",
"value": "A"
}, {
"color":"blue",
"value": "D"
}
] and then any Is it advantageous to have this explicit colouring for cycled enum columns? |
Hmm, there are always so many edge cases! A very related question is (or a different view of the same question): if explicit colors are provided, how do we color any values that aren't explicitly defined? There are three obvious possibilities:
I'm not sure it really makes sense to cycle values when a user has explicitly mapped colors to values - as opposed to, say, just providing a palette ( |
We currently don't have any nice way to set specific colours for different enumerated values in CSV files. It would probably be reasonable to do something like:
C.f.
offset
instead ofvalue
for numeric fields.The text was updated successfully, but these errors were encountered: