question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

remove schemeCategory20c in a backward-compatible way

See original GitHub issue

In #1394 I wrote:

There are good reasons why schemeCategory20c was removed. So we should switch probably to schemeCategory10c or a colorbrewer scheme e.g. as suggested in #831.

This means fixing a lot of tests, documenting the change pointing to the rationale in d3v5, and offering the workaround used here in the documentation. IMO we should not provide schemeCategory20c in the library because it is misleading.

@kum-deepak wrote:

Alternatively we can introduce a global switch to keep current behavior with a warning. In 3.1 we can make full switch.

I replied:

The color brewer colors are dramatically different but much more clear, so I agree we should probably do backward compatibility with a warning.

We don’t currently have any global flags, but that’s an interesting idea. Maybe it would be worth introducing a special facility under dc just for this, say dc.compatFlags, since we have so many things we want to fix while allowing backward compatibility.

In this case, there could be a flag, say brewerCategoricalColors, which defaults to false. The first time we need defaulted categorical colors, because the chart doesn’t have any colors set, we check this flag and if it’s still false, we use the copied colors from above and issue a warning that says we’re moving to brewer and mentions schemeCategory10c, which is close to the old default but obviously has less colors.

If it’s true, we use the color brewer colors with no warning.

This is just a suggestion; there are other ways to implement this. But in any case, we should not write to d3. src/d3v3-compat.js should go away before we release dc.js 3.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
gordonwoodhullcommented, May 30, 2018

The warning is mostly there because the colors will change (probably to one of the colorbrewer schemes) in 3.1, so you need to take steps if you want to keep the old colors.

The old colors are arguably defective because they imply relationships which are not there - see the above links for details.

1reaction
kum-deepakcommented, May 30, 2018

@badrinath389 it is a warning, please check https://github.com/d3/d3-scale-chromatic for some alternatives. If you are confused, you can ignore the comment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

d3 | Yarn - Package Manager
D3 6.0 introduces several non-backwards-compatible changes. Remove d3.event. Change selection.on to pass the event directly to listeners.
Read more >
d3 pie chart all black fill, d3.schemeCategory20c not being ...
schemeCategory20c array doesn't seems to be called at all. I have no errors I have unexpected output by the method.
Read more >
gmc.geofisica.unam.mx/papime2020/recursos/d3/CHANG...
Breaking Changes D3 6.0 introduces several non-backwards-compatible changes. * Remove [d3.event](https://observablehq.com/d/f91cccf0cad5e9cb#events).
Read more >
CHANGES.md · master · Libraries / d3 · GitLab
D3 5.0 introduces only a few non-backwards-compatible changes. ... The inherently unsafe d3.round method has been removed, along with d3.requote.
Read more >
'.d.key . 'with ' . d.values.length .' items
**Kind**: instance method of [ logger ](#dc.logger) | Param | Type ... Setting this value will also remove any previously set [gap](#dc.barChart+gap).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found