This simple example comes from my blog on Using gradients for abrupt color changes in data visualizations
Showing how an underlying gradient can be updated when you move the brush over the rectangle
You can see this technique of abrupt color changes applied to an actual data visualization in these two examples
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js