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

Choropleth keep d3.geoAlbers the default projection but deprecate it #1379

Closed
gordonwoodhull opened this issue Mar 23, 2018 · 5 comments
Closed
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

In the future we want geoChoroplethChart to default to the null (identity) projection since it is built on d3.geoPath which so defaults.

However we have the opportunity to get there in a backward-compatible way, with a deprecation warning.

Here's one way to get there:

  • add a member _projection, which defaults to undefined
  • at the start of doRender and doRedraw (maybe in a helper function)
if(_projection === undefined) { 
    console.warn('choropleth projection default of geoAlbers is deprecated');
    _geoPath.projection(d3.geoAlbers());
} else {
     _geoPath.projection(_projection);
}
  • geoChoroplethChart.projection becomes a regular getter/setter of _projection (note getter is currently broken)
@gordonwoodhull gordonwoodhull added this to the 3.0 milestone Mar 23, 2018
@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Mar 23, 2018

In the future, we just default _projection to null and get rid of the if(_projection stuff.

@kum-deepak
Copy link
Collaborator

Good idea!

@kum-deepak
Copy link
Collaborator

Going after this one next :)

From https://github.com/d3/d3/blob/master/CHANGES.md

The default projection for d3.geoPath is now null rather than d3.geoAlbersUsa; a null projection is used with pre-projected geometry and is typically faster to render.

Also going through https://bl.ocks.org/mbostock/5557726

It seems that null is a valid value for projection now. So, will program accordingly.

@gordonwoodhull
Copy link
Contributor Author

Great! Yes let's plan for null being the default in the future. If people want it now they can set it explicitly. But undefined for now means "no value set", which we'll default to Albers.

@gordonwoodhull
Copy link
Contributor Author

fixed by #1382

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