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

Color legend values #996

Open
manthey opened this issue Apr 29, 2019 · 1 comment
Open

Color legend values #996

manthey opened this issue Apr 29, 2019 · 1 comment

Comments

@manthey
Copy link
Contributor

manthey commented Apr 29, 2019

In the color legend widget, we use d3 scales with the nice() property to round to even values. We either need to expose a method to get this generated scale OR adjust the rendered colors in the scale, since this causes the displayed colors to not match the colors expected by the caller.

For instance, suppose we use a continuous color scale with a domain of [0.05, 0.95] and colors ['#000000', '#ffffff']. The caller expects that the scale will show 0.05 as black and 0.95 as white, but the nice values shift these to 0 and 1, so 0.05 maps to #0d0d0d and 0.95 to #f2f2f2.

Since the nice values are visually pleasing, it might be best to fix this by changing the rendered scale to have the end color values for values between the specified domain ends and the computed nice values. In the example above, [0,0.05] would all render as black and [0.95,1] would all render as white.

@jeffbaumes
Copy link
Contributor

Another option would be to allow the user to disable the nice() in instances where the user really wants to clamp max/min values. This perhaps should be the default since it is less surprising, and additional processing (nice()) would require an additional flag.

In visualizations, I have not seen the approach of clamping the range between the nice value and the data max/min. It seems misleading, with the user perhaps inferring that the range of the data is the nice values, since they are rendered at the "endpoint" colors. It seems best to have "messy" (non-nice) legends or "messy" (non-endpoint) colors, and not to try to accommodate both at the same time.

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

No branches or pull requests

2 participants