File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,26 @@ const HeatMapChart = ({
5050 "@import url('https://fonts.googleapis.com/css2?family=Avenir:wght@600');"
5151 ) ;
5252
53- const colorScale = d3
54- . scaleSequential ( )
55- . domain ( [ rangeMin , rangeMax ] )
56- . interpolator (
57- colors === 'RdYlBu' ? d3 . interpolateRdYlBu : d3 . interpolatePuRd
58- ) ;
53+ const customColors = [ '#ddebd5' , '#f4b183' , '#c15811' , '#f50101' ] ;
54+
55+ // Create a linear color scale
56+ const customColorScale = d3
57+ . scaleLinear < string > ( )
58+ . domain ( [
59+ 0 ,
60+ 1 / ( customColors . length - 1 ) ,
61+ 2 / ( colors . length - 1 ) ,
62+ 1 ,
63+ ] )
64+ . range ( customColors ) ;
65+
66+ const colorScale =
67+ colors === 'RdYlBu'
68+ ? d3
69+ . scaleSequential ( )
70+ . domain ( [ rangeMin , rangeMax ] )
71+ . interpolator ( d3 . interpolateRdYlBu )
72+ : customColorScale ;
5973
6074 const domain = colorScale . domain ( ) ;
6175
You can’t perform that action at this time.
0 commit comments