javascript - Conditional Formatting in Angular -
here conditional formatting feature in microsoft excel color bars represent percentage in comparing highest value.
is there anyway achieve html5 using either css or javascript? or maybe using additional angular library well.
i'm thinking using clip-path feature may not supported on browsers
do mean this?
you can simple in vanillajs. must elements
const elnodes = document.queryselectorall('.element'); const elements = [...elnodes]; get values , find max value
const elementsvalues = elements.map((el) => parsefloat(el.children[1].textcontent)); const maxvalue = math.max(...elementsvalues); finally change width of elements based on value:
elements.foreach((el) => { el.children[0].style.width = 100 / (maxvalue / parsefloat(el.children[1].textcontent)) + '%'; }); wiki

Comments
Post a Comment