Hey folks!
I’m using Dash AQ Grid, and I’m trying to create a valueFormatter
function for one of my columns to highlight the background colour of the column based on a decimal between 0-1. While I’ve got the basic mechanism working, I now need to make the highlighted color normalized based on the range of the values in this column. eg for a given set of data the range could be say 0.2-0.7.
Is there a way I can access the entire column’s data within my valueFormatter JavaScript function, so that I can get the min and max values dynamicly? So far I’ve only seen examples where the current row’s values have been used.
The closest thing I’ve come across is the last example on this page: Styling Cells | Dash for Python Documentation | Plotly. This uses the cellRendererParams
of the target column, and giving it min and max values. However these values have been generated up front in Python using the grid’s initial data. My data is dynamic, being updated by a callback, so this approach won’t work, unless I have the callback also dynamically update the columnDefs
prop of the Dash AgGrid
component.
I imagine this approach should work, but it it would be much cleaner if I could derive min/max values dynamically inside the valueFormatter
JavaScript function. Does anyone know if this is possible?