I successfully added conditional coloring of cells in a column of a custom list using JSON.
So I have browsed several resources at M$ for formatting options. E.g. column-formatting
I wasn't able to find any possibility to display numbers right flushed. Additionaly I want to display only the integer part of a float. How can I do that?
Bonus: How can I display a number in exponential form e.g. \$2.345\cdot10^{12}\$ (it's a pity tex formatting doesn't work here)
Update Here's my current json code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if(@currentField < 10000, 'sp-field-severity--good', if(@currentField < 300000, 'sp-field-severity--low', if(@currentField < 2000000, 'sp-field-severity--warning', if(@currentField < 20000000, 'sp-field-severity--severeWarning', 'sp-field-severity--blocked'))))+ ' ms-fontColor-neutralSecondary'"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": "=if(@currentField <= 70,'Error', '')"
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}
The first elmType isn't relevant, it's a relic from the sample code where I started :)