output$col3<-renderPlotly({
fig <- plot_ly(type = "indicator",mode = "gauge+number",value=VTE_cal(),height = 265,
gauge = list(axis = list(range = list(NULL,100),tickwidth = 1, tickcolor = "black"),
bar = list(color = "darkblue"),bgcolor = "white",borderwidth = 2,bordercolor = "gray",
steps = list(list(range = c(0,20), color = "red"),list(range = c(20,40), color = "pink"),list(range = c(40,60), color = "yellow"),list(range = c(60,80), color = "gold"),list(range = c(80,100), color = "teal")),
threshold = list(line = list(color = "black", width = 4),thickness = 0.75,value = VTE_cal())))
fig <- fig %>%layout(margin = list(l=30,r=50),paper_bgcolor = "lavender",font = list(color = "black", family = "Arial"))
# annotations=list(showarrow=T,arrowhead=3,arrowsize=1,arrowwidth=4))
fig
})
问问题
160 次
1 回答
2
您可以使用number
参数指定前缀或后缀value
; 这是一个示例(带有适当的缩进!)
plot_ly(
type = "indicator",
mode = "gauge+number",
value = 86,
number = list(suffix = "%"), # <- Specify `prefix` or `suffix`
gauge = list(
axis = list(
range = list(NULL,100),
tickwidth = 1,
tickcolor = "black"),
bar = list(color = "darkblue"),
bgcolor = "white",
borderwidth = 2,
bordercolor = "gray",
steps = list(
list(range = c(0,20), color = "red"),
list(range = c(20,40), color = "pink"),
list(range = c(40,60), color = "yellow"),
list(range = c(60,80), color = "gold"),
list(range = c(80,100), color = "teal")),
threshold = list(
line = list(color = "black", width = 4),
thickness = 0.75,
value = 86))) %>%
layout(
margin = list(l = 30, r = 50),
paper_bgcolor = "lavender",
font = list(color = "black", family = "Arial"))
于 2021-06-22T07:01:19.470 回答