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

colorCalculator docs duplicate getColor #1225

Closed
gordonwoodhull opened this issue Nov 15, 2016 · 3 comments
Closed

colorCalculator docs duplicate getColor #1225

gordonwoodhull opened this issue Nov 15, 2016 · 3 comments

Comments

@gordonwoodhull
Copy link
Contributor

looks like they were copied and pasted

@gordonwoodhull
Copy link
Contributor Author

colorCalculator is now deprecated with the following message:

colorMixin.colorCalculator has been deprecated. Please colorMixin.colors and colorMixin.colorAccessor instead

The rationale is described in the documentation:

This actually replaces the getColor method!

This is not recommended, since using a colorAccessor and color scale .colors is more powerful and idiomatic d3.

However, I'm open to arguments for keeping colorCalculator. Please comment here if it's something you can't do without! Thank you.

@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jan 23, 2017

One place where colorCalculator is still useful is in the choropleth, where the reduced data may not have all the keys that the map has, so it's common to do stuff like

       .colorCalculator(function (d) { return d ? usChart.colors()(d) : '#ccc'; })

However, that's partly because of #1268 - since the map data is primary and the crossfilter data is secondary, the choropleth needs to call .getColor for many elements which don't have data. Arguably it should not be calling .getColor but should have an option for the "blank color".

@adrm
Copy link
Contributor

adrm commented Aug 21, 2017

Is there any way to keep the functionality you mention in your last comment for choropleths without using colorCalculator, thus avoiding the deprecate message?

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