conditional formatting of html table cells

前端 未结 6 1268
鱼传尺愫
鱼传尺愫 2021-02-04 12:49

Are there any out of the box solutions to have conditional formatting of HTML tables?

With conditional formatting I am more interested in having different colors as cell

6条回答
  •  别跟我提以往
    2021-02-04 13:23

    I have done similar to similar to what ZDYN and David propose but in a more mathematically proven way.

    After my dynamic values are calculated I go around calculating percentiles for the columns that I want to color code using

    (L/N)*100
    where: L=> Number of Items less the value for which percentile is being calculated
    N => Total number of items

    Now, depending on the percentile I get from the above calculations, appropriate colors are assigned for use when displaying the table.
    With this approach I get the flexibility of using different color palettes at different granularity levels as the need be.
    For example I can use Red for percentile ranging from 0-5 in one case and 0-10 in another. All these parts can be flexibly coded for as all of the above steps are done @ backend. (in Java)

提交回复
热议问题