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

Support MapboxGL 'step' expression for color and height function types #169

Open
kevinlib opened this issue Oct 8, 2019 · 5 comments
Open
Assignees

Comments

@kevinlib
Copy link

kevinlib commented Oct 8, 2019

When I create the Viz object and try to pass in a different color_function_type value (e.g. 'step'), the Viz display maintains the interpolate function even though the attribute in the Viz object has been changed.

Any ideas on why this is happening?

@akacarlyann
Copy link
Collaborator

Hi @kevinlib! Can you describe the 'step' color_function_type? In the docs, I only see support for 'interpolate' (the default) or 'match'.

@kevinlib
Copy link
Author

kevinlib commented Oct 9, 2019

I'd like to have discrete steps instead of having a continuous scale by interpolating. For reference: https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-step. I couldn't find in the docs the supported values.

@akacarlyann
Copy link
Collaborator

akacarlyann commented Oct 9, 2019

@kevinlib As a quick fix, I would suggest binning your source data and assigning a color_property that can be used with the 'match' color function. Let me know if that makes sense for your use case?

You might also want to take a look at PR #161 .

Longer term-- sounds like the issue here is you'd like support for the native MapboxGL step expression. Mind if I update the issue title to reflect that? Then someone can get started on a PR for this feature :)

@akacarlyann
Copy link
Collaborator

@kevinlib Also to strictly answer your original q: changing the color_function_type will only have an effect if it is changed to 'match' or (soon) 'identity' (when #161 gets merged in). Otherwise, it will default to 'interpolate'. Thanks for pointing out that we may need to provide some logic to validate other user input.

@kevinlib
Copy link
Author

@akacarlyann, thanks for being so responsive. I'll try out binning beforehand with 'match' and yes feel free to change the issue title.

@akacarlyann akacarlyann changed the title ChoroplethViz color function type always default Support MapboxGL 'step' expression for color and height function types Oct 20, 2019
@akacarlyann akacarlyann self-assigned this Dec 3, 2019
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