【发布时间】:2021-01-07 19:38:17
【问题描述】:
我的闪亮服务器中有以下代码:
output$SimilarityComparison <- renderPlotly({
df <- newmpresults[place == input$CitySelected & upc_code == input$SKUSelected & category == input$categoryselectedtrends,]
graph.title <- df$description
plot_ly(
#newmpresults[place == input$CitySelected & upc_code == input$SKUSelected & category == input$categoryselectedtrends,],
df,
x=~quantity,
y = ~unit_price,
text = ~paste("Precio: ", unit_price, '$<br>Cantidad:', quantity, '<br>MP:', type),
color = ~as.factor(type)) %>%
add_markers()%>%
layout(
title = ~paste('Producto:', graph.title),
xaxis = list(title ='Cantidad'),
yaxis = list(title ='Precio')) %>%
config(displayModeBar = FALSE)
})
我希望在更改 UI 中的选择时,我的图表标题会更改并显示在图表中(只有 layout( title = ~paste('Producto:', graph.title) 部分给我带来了问题)。我认为这就像将df$description 声明为我的标题输入一样简单,但它没有显示在图表中。其他一切都很好。有什么建议可以给我吗?
【问题讨论】: