0
嘗試在閃亮的應用中渲染Plotly圖形。基本圖形正在生成,但無法格式化軸。能夠在Plotly Web應用程序中獲得所需的圖形選項,其佈局如下所示。如何在renderPlotly中指定詳細的佈局(Shiny r)
"layout": {
"autosize": true,
"height": 831.625,
"hovermode": "x",
"width": 1480,
"xaxis": {
"autorange": true,
"hoverformat": "%Y-%m",
"range": [
1356978600000,
1391193000000
],
"rangeselector": {
"buttons": [
{
"label": "reset",
"step": "all"
},
{
"label": "#1",
"step": "month"
}
]
},
"tickformat": "%Y-%m",
"tickmode": "auto",
"tickprefix": "",
"title": "B",
"type": "date"
},
"yaxis": {
"autorange": true,
"range": [
-19.888888888888893,
397.8888888888889
],
"title": "A",
"type": "linear"
}
}
在閃亮的代碼中指定此佈局時遇到問題。對於簡單的對象,如標題,它可以工作(如下所示)。
output$plot <- renderPlotly({
new_plot <- plot_ly(plot_data, x = plot_data$FY_Month, y = plot_data$Booking_Amount , name = "Test Data (Actual)")
new_plot <- layout(new_plot,title = "Random Title")
new_plot
})
我該如何給複雜的xaxis和yaxis佈局?