This is the normal solution I have when it comes to highlighting cell color. However, How do I make it so that the reds and green are highlighted at different shades based on how positive/negative they are?
gd= GridOptionsBuilder.from_dataframe(display_df)
cellstyle_jscode = JsCode("""
function(params){
if (params.value == '0') {
return {
'color': 'black',
'backgroundColor': 'orange',
}
}
if (params.value < '0') {
return{
'color': 'white',
'backgroundColor': 'red',
}
}
if (params.value > '0') {
return{
'color': 'white',
'backgroundColor': 'green',
}
}
}
""")
gd.configure_pagination(enabled=True)
gd.configure_columns(display_df, cellStyle= cellstyle_jscode)
grid_options = gd.build()