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

Chapter 12 - freakOut function in each() #51

Open
ialsjbn opened this issue Nov 10, 2022 · 1 comment
Open

Chapter 12 - freakOut function in each() #51

ialsjbn opened this issue Nov 10, 2022 · 1 comment
Assignees
Labels
v5 This needs revision for D3 v5.x

Comments

@ialsjbn
Copy link

ialsjbn commented Nov 10, 2022

The original code for freakout() has:

var colors = d3.schemeCategory20;
var colorIndex = Math.round(Math.random() *20);

For D3v5 and newer:

D3 no longer provides the d3.schemeCategory20* categorical color schemes. These twenty-color schemes were flawed because their grouped design could falsely imply relationships in the data: a shared hue can imply that the encoded data are part of a group (a super-category), while relative lightness can imply order

To get it to work, I changed it to:

var colors = d3.schemeCategory10;
var colorIndex = Math.round(Math.random() *10);
@scotthmurray scotthmurray self-assigned this Nov 10, 2022
@scotthmurray scotthmurray added the v5 This needs revision for D3 v5.x label Nov 10, 2022
@scotthmurray
Copy link
Owner

Thanks @ialsjbn! I'm keeping this issue open, but filing it away in the event of a v5+ update for the book.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v5 This needs revision for D3 v5.x
Projects
None yet
Development

No branches or pull requests

2 participants