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

fill transform breaks legend color accuracy #42

Open
mrjones-plip opened this issue Dec 1, 2016 · 5 comments
Open

fill transform breaks legend color accuracy #42

mrjones-plip opened this issue Dec 1, 2016 · 5 comments

Comments

@mrjones-plip
Copy link
Contributor

mrjones-plip commented Dec 1, 2016

update: while filed as a but, this has since been moved to an enhancement. See comments below.

when you have map.countries.attr.fill.transform() method declared, the legend ends up being the wrong color compared to color the country is filled with.

steps to reproduce:

  1. go to https://bl.ocks.org/melalj/07be61a538509b8e4a7e where map.countries.attr.fill.transform() is defined as:

    transform: function(val) {
        if (val === 0) return 0;
        return Math.sqrt(val);
    },
    
  2. zoom in to Australia so it is behind the legend

  3. hover over Australia so it's value is displayed on the legend

expected: legend color matches country color
actual: country color is much darker than legend color
workarounds: don't declare a transform() :(

@mrjones-plip
Copy link
Contributor Author

here's the screenshot from step #3 above. you can see that the legend color of 222 does not match the country color:
australia

@melalj
Copy link
Member

melalj commented Jul 16, 2018

@Ths2-9Y-LqJt6
The legend supports only a linear scale.
On the transform attribute, it transforms values with a square-root.
We should create a separate ticket to request this feature

@mrjones-plip
Copy link
Contributor Author

@melalj - makes sense! I'll just convert this from a bug to a feature request.

@mrjones-plip
Copy link
Contributor Author

if we implement PCH's IXP Dirs (https://pch.net/ixp) two functions (generateRanksFromMultipleRows() and getPercentile()) we could know how to properly render the legend

@melalj
Copy link
Member

melalj commented Nov 15, 2018

@Ths2-9Y-LqJt6 this might be fixed with the new aggregate function, can you QA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants