Hi,
I am trying to set set the background colour of a call in ag grid bia the following loop
(rel_delta holds relative difference data and the shading is meant to reflect to relative distance iin increasing shades of red)
# Define conditional formatting based on bins
background_colors = interpolate_rgb(color_scale_in=sequential.Reds,
n_bins=n_bins)
legend = []
cond_list = []
for i, background_color in enumerate(background_colors):
min_bound = step_val * i
max_bound = min_bound + step_val
# Add positive and negative conditions in one loop
cond_list.append({
'condition': f'Math.abs(params.data[\'rel_delta\']) > {min_bound} && Math.abs(params.data[\'rel_delta\']) <= {max_bound}',
'backgroundColor': background_color
})
The list will then be inserted at the ‘styleConditions’ key to trigger the styling for the relevant column. now I do not seem to get the Math.abs() syntax to work correctly.
If there was experience with using the Math() functions in the ag grid namespace via Python, any advice or hint towards the correct usage would be greatly appreciated.
Thank you in advance and have a great weekend (hopefully soon)