Dash - Table - conditional cell formating

What would be the best approach to select cell style based on cell value in the whole Table versus in a single column?

Let’s say, I have a table that contains cells with random numbers from 1 to 10 in each cell. I want all numbers lower than 3, to be green, 4-7 yellow, and 8+ to be black.

For what I’ve read, I need to pull all column names and iterate by each column to apply colors. That may work for smaller tables but I afraid that this method can be a bottleneck if Table grows in size.

I’m reading docs and studying examples but cant find a good solution.

Any suggestions, pls?

Hi @Marcas

See Highlighting a range of values in this link:

.
https://dash.plotly.com/datatable/conditional-formatting

Thanks. I went over those examples and, if I’m not mistaken, I see ‘by column’ or ‘by row’ approach there.
I was looking for functionality that takes all numerical data at once and applies styling based on value (goes over rows/columns under the hood with some fast algo).
Not a big deal. I don’t deal with data big enough to make a significant difference, I hope.

BTW. Very nice Stock Analysis, Euardo. I do apps for similar purpose, options focused :slight_smile:

Hey @Marcas

Thanks !!

The example I linked take all the columns together in the same condition. :smiley:

Just finished coding in. I got what I wanted. Works well, not much delays.
I followed examples but there was some digging involved for newbie like me. I spent time figuring out how to set multi-section conditional-data-formating ( […] + […] ) in callback but somehow managed to do it.

Eduardo, thanks for feedback!
Dash team, thanks for Dash!

1 Like