0
我有一个闪亮的应用程序,它使用传单库。 我现在需要使用get.Bounds()
函数来获取一些坐标。很容易(js file
):奇怪的行为传单和闪亮
var myBounds = map.getBounds();
console.log(myBounds);
然后我需要发送的坐标闪亮作进一步处理(也是我js file
:
Shiny.onInputChange("bounds", myBounds);
要查看是否奏效,它在server.R
这并:
observe({
print(input$bounds)
})
然而,当我运行在R中的应用控制台出现NULL
。通过我的.js file
中的console.log
坐标打印在Firefox控制台上。
但是,它现在工作。当我运行Shiny App十次时,它有时会运行三次,有时甚至四次,有时甚至从未运行。我得到的坐标,他们打印到R控制台。我也尝试过reactive
,但那不可能。这里同样的行为。
#get extensions of map
myBoundsR <- reactive({
input$bounds
})
#print extensions
observe(print(myBoundsR()))
为什么?为什么不相关的行为?!为什么行Shiny.onInputChange("bounds", myBounds);
将坐标发送到server.R
?
现在效果更好。每隔一段时间我都会得到一个NULL值。但是,这种情况非常罕见。 – Stophface