You can create a custom colormap with 2 values using d3-scale-chromatic
library in JavaScript. Here's an example function that takes in a value (val
) and returns a color based on whether it's positive or negative:
index.tsx419 chars11 lines
You can then use this getColor
function to color your data points or areas based on their values.
gistlibby LogSnag