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

Legend controls #100

Merged
merged 15 commits into from Jul 22, 2018
Merged

Legend controls #100

merged 15 commits into from Jul 22, 2018

Conversation

akacarlyann
Copy link
Collaborator

@akacarlyann akacarlyann commented May 5, 2018

Work in progress!

  • adds legend parameter to MapViz to control legend visibility (defaults to True for all viz classes except HeatmapViz, RasterTilesViz and ImageViz)
  • moves legend div creation to JS
  • refine CSS style for default legend
  • horizontal legend style
  • continuous gradient legend

Leave for separate pr:

  • variable radius legend

May leave these for map-collections pr:

  • multi-layer legends
  • multi-variable legends

@akacarlyann akacarlyann mentioned this pull request May 6, 2018
@akacarlyann
Copy link
Collaborator Author

The new Mapbox attribution icon takes up a ton of room, which makes the legend look out of place. Looking for suggestions on how to rearrange legend and other map info/controls!

screen shot 2018-05-05 at 5 45 45 pm

@ryanbaumann
Copy link
Contributor

Nice, that legend design looks great @akacarlyann! Huge improvement. 🙏

Looking for suggestions on how to rearrange legend and other map info/controls!

Lots of options here - what about putting both the attribution and legend at the bottom of the map, and move the attribution icon to the left of the legend?

@akacarlyann
Copy link
Collaborator Author

Thought heatmaps could benefit from a continuous legend titled using weight_property . Implementation is clunky atm and assumes evenly spaced colors/stops. screen shot 2018-05-06 at 1 26 07 am

@ryanbaumann
Copy link
Contributor

Looks good as a starting point @akacarlyann.

The hard part with Heatmaps is that the color is not a perfect representation of the values specified in the legend, since the kernel density calculation sums up all values in the specified heatmap-radius region to calculate the color.

We could solve that by clustering & aggregating the underlying data, and choosing a heatmap-radius to match the cluster-radius, so that the kernel density calculation is close to an exact representation of the color shown on the screen.

@akacarlyann
Copy link
Collaborator Author

@ryanbaumann Got it. I think I'll roll back the heatmap legend for now and leave that for someone's future PR since it will be more involved. I'll try to get the variable-radius legend in this week and I'll let you know when it's ready for review!

@ryanbaumann
Copy link
Contributor

ryanbaumann commented May 28, 2018

No rush here - but wanted to ask if this is ready for review @akacarlyann?

@akacarlyann
Copy link
Collaborator Author

@ryanbaumann Not quite yet. Happy to wrap up this week though if you're looking for something to review.

@ryanbaumann
Copy link
Contributor

No rush - we'll have more bandwidth here starting next week too.

@ryanbaumann
Copy link
Contributor

@akacarlyann the latest changes look great! Are you ready for a review?

@akacarlyann
Copy link
Collaborator Author

akacarlyann commented Jun 25, 2018

@ryanbaumann Really close! I have a couple moving parts - setting a default shape for legend keys in each viz type and supporting circular legend keys in the horizontal layout. Happy to take any comments now but I should have those last pieces done by Wed, I think!
screen shot 2018-06-25 at 11 49 22 pm

@akacarlyann
Copy link
Collaborator Author

@ryanbaumann Ready for a review on this :)

…halo color for legend header text, precision for rounding numeric legend values, and adds contiguous bar legend key shapes
Copy link
Contributor

@ryanbaumann ryanbaumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akacarlyann this is an incredible PR, what a huge improvement in understanding data from all of these legend options. No more HTML / CSS wizardry required. 🙏

@ryanbaumann ryanbaumann merged commit 79d6af4 into mapbox:master Jul 22, 2018
@akacarlyann
Copy link
Collaborator Author

🎉

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

Successfully merging this pull request may close these issues.

None yet

2 participants