将标准扩展到SharePoint Online JSON格式的底部
我想通过JSON以蓝色或红色为蓝色或红色的栏。
我该如何实现?
这是我的代码:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "span",
"txtContent": "=(@currentField) + '%'",
"style": {
"padding-left": "8px",
"white-space": "nowrap"
}
}
],
"style": {
"width": "=if(@currentField == 100, '100%', toString(@currentField * 100/ 100) +'%')",
"background-color": "=if(@currentField <= 20 ,'#F08080',if(@currentField <= 60 ,'
#FFFACD',if(@currentField <= 80 ,'#228B22','#4169e1')))",
"border-top": "='2px solid' + if(@currentField <= 20, '#800000', if(@currentField <= 60,
'#997825',if(@currentField <= 80, '#006400','#006400')))",
"color": "black",
"font-weight": "bold"
}
}
这是我在酒吧中的差距的地方
I want to extend the bar, in blue or red up to the bottom of the row via JSON.
How can I achieve that?
Here is my code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "span",
"txtContent": "=(@currentField) + '%'",
"style": {
"padding-left": "8px",
"white-space": "nowrap"
}
}
],
"style": {
"width": "=if(@currentField == 100, '100%', toString(@currentField * 100/ 100) +'%')",
"background-color": "=if(@currentField <= 20 ,'#F08080',if(@currentField <= 60 ,'
#FFFACD',if(@currentField <= 80 ,'#228B22','#4169e1')))",
"border-top": "='2px solid' + if(@currentField <= 20, '#800000', if(@currentField <= 60,
'#997825',if(@currentField <= 80, '#006400','#006400')))",
"color": "black",
"font-weight": "bold"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加“填充”:“ 0”到“样式”元素应该执行技巧
https://learn.microsoft.com/en-us/sharepoint/sharepoint/declarative/declarative-customization/column-formatting#format -number-column-as-a-data-data-bar-advanced
Adding "padding":"0" to "style" element should do the trick
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#format-a-number-column-as-a-data-bar-advanced