undeprecate colorCalculator and fix the fishy code
See original GitHub issueAlthough scales and accessors are bright and shiny, they don’t cover all use cases.
In particular, it’s much easier to special-case a specific value using the colorCalculator
, as seen in the venture capital example. I don’t know how to create a scale that returns normal values for everything except for one exact value (undefined
in this case).
I had two reasons for deprecating this method:
- It’s assigning to
getColor
, which is a horrible horrible thing for a setter to do - I thought that it’s always better to use a D3 object than to write code
The second reason isn’t all that good - D3 is not supposed to be a framework that stops you from writing code! Sometimes writing a little logic is better than the best-abstracted toolkit.
The first reason can be fixed without hurting efficiency too much.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
LED ColorCalculator | OSRAM SYLVANIA Homepage
Estimate the photometric performance of color mixing schemes. The ColorCalculator software was developed by OSRAM SYLVANIA to aid designers develop color mixing ...
Read more >Untitled
Solomon k bright, Mtr hong kong stock code, Mr maker bottle bird, ... Big fish eating small fish, Surtido de mariscos, Free walking...
Read more >Delicious Bookmarks - Tilde.club
This is a collection of 10562 URLs. Collected of the years using Delicious bookmark tool. As you know, the bookmark manager stopped it's...
Read more >Untitled
Ubmc urgent care, Baobab whole foods, Mesilla park nm zip code, Hed kandi ibiza 2013 album ... 20 inch rims ford f150, Song...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released in 3.0.11; backported to 2.2.2 for all those folks still using d3v3!
More recent versions of d3-scale include .unknown() and diverging scales, which cover some of the use cases for
colorCalculator
. However, a function will inevitably be easier in some cases.I’m fixing this by adding an override function
_colorCalculator
, and removing the horrible assignment to.getColor
, as well as the deprecation warning.