conglang 用datatable做shiny页面表格,想用styleColorBar根据百分比显示不同长度的色块。 但做出来的styleColorBar都是右端对齐的,现在想把它左端对齐,修改了backgroundPosition参数都没有作用。'center left'、'center right'、'bottom right'、'bottom left'等参数都试过了,水平位置还是没有变。 求解决办法,谢谢。 相关代码: # using styleColorBar datatable(df) %>% formatStyle(names(df), background = styleColorBar(range(df), 'lightblue'), backgroundSize = '98% 88%', backgroundRepeat = 'no-repeat', backgroundPosition = 'center') 官网例子连接: http://rstudio.github.io/DT/010-style.html
ryo @conglang</a>: 樓主或許可以參考一下table 2.2.1 : The leagues of football teams.哦! 此外,還有個formattable#417655#417655#1 也非常管用噢!
doubletang 设置angle = -90即可: datatable(df) %>% formatStyle(names(df), background = styleColorBar(range(df), 'lightblue', angle = -90), backgroundSize = '98% 88%', backgroundRepeat = 'no-repeat', backgroundPosition = 'center')
doubletang [未知用户] DT包是基于jQuery DataTables library的,如果懂javascript的话,可以看看DataTables的主页: https://datatables.net/