remove schemeCategory20c in a backward-compatible way
See original GitHub issueIn #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, saydc.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 mentionsschemeCategory10c
, 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:
- Created 5 years ago
- Comments:17 (8 by maintainers)
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.
@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.