Reputation: 2066
This may be a silly question but I can't seem to figure it out - is there a way in D3 to fill a rectangle based on a linear color scale? That is, I have a linear scale from white to green so I want to display a "legend" which is basically a rectangle with color transitioning from white to green. Is there a simple way to do this?
Upvotes: 0
Views: 1267
Reputation: 109232
What you are looking for is an SVG gradient. Here is an example in D3.
Upvotes: 1