r - 闪亮的 checkFunc 没有触发 valueFunc
问题描述
我正在构建一个仪表板以留在电视上。不需要用户会话,部署将在私有服务器(不是 shiny.io)上。主要想法是仪表板每 15 秒更新一次。
我的问题出在服务器功能上,实际上是 atcheckFun
和valueFunc
of reactivePoll()
。这是我所做的:
- 我创建了一个名为
checkUpdateData()
检查当月总收入(decFat
下面的变量)是否增加的函数。此函数在控制台上打印一个日志,显示返回的旧值和当前值之间的差异decFat
。 - 我创建了一个名为从调用
getData()
中获取JSON()
对象的函数。REST GET
- 我创建了一个名为
etl(input = getData())
传递JSON
作为输入参数的函数。此函数执行所有 ETL 过程并输出一个已清理/处理过的list()
对象,并附有data.frame
' 对象。
如果返回和 previouscheckUpdateData()
之间的差异,则调用of ,对吗?decFat
decFat
valueFunc
reactivePoll()
server <- function(input, output, session) {
pollData <- reactivePoll(
intervalMillis = 15000,
session = NULL,
checkFunc = function() {
checkUpdateData(ambiente = pAmbiente)
},
valueFunc = function() {
etl(listObj = getData(ambiente = pAmbiente,
dataI = pDataI,
dataF = pDataF))
print("************************ check")
}
)
output$dataReq <- renderTable({ pollData() })
output$tabela <- renderDataTable({
DT::datatable(dataReq$tbRepresent %>%
filter(Mes == format(Sys.Date(), format="%m")) %>%
select(" " = emoji, "Rep" = Representante, "Fat" = Faturamento2, "Região" = Regiao, "% Met Bat." = percMetaBatida, "% Fat" = percFaturamento),
options = list(pageLength = 20, dom = ''), rownames = FALSE)
})
output$updateTime <- renderText(dataReq$updateTime$children[[1]] %>%
as.character() %>%
stringr::str_replace_all(., "\n", "") %>%
stringr::str_replace_all(., " ", " "))
}
print("***check")
运行时从未打印过。App运行时的日志下方:
Listening on http://127.0.0.1:567
13/11/2020 10:37:08
Last decFat: 9209947.53363352 | Previous decFat: 430074.858996368
13/11/2020 10:37:08
Last decFat: 9213301.07789995 | Previous decFat: 430074.858996368
13/11/2020 10:37:24
Last decFat: 9206235.81931037 | Previous decFat: 430074.858996368
我不知道如何强制dataReq
更新自己。任何想法将不胜感激。
提前谢谢。
解决方案
推荐阅读
- c - 无法编译 Y86 模拟器 (CSAPP)
- rstudio - 改变 Rstudio 的外观
- bash - 将双循环并行化为数组作业(Matlab + bash)
- python - 如何使python文件在windows上可执行?
- sql - Access/SQL:如何检查表中所有重复项(同一日期)的值是否为 0,除了一个?
- javascript - 如何在 MongoDB/Mongoose 文档数组中找到重复次数最多的值?
- android - FLAG_WINDOW_IS_OBSCURED 不适用于较新的 android
- reactjs - 尝试在 React JS 获取 JSX 表达式的函数中添加循环必须有一个父元素
- javascript - 类型 'Query' 不可分配给类型 '[(options?: QueryLazyOptions
在 codegen 的帮助下,我生成了自定义的 graphql 钩子和类型。
query loadUsers($where: UserFilter) { users(where: $where) { nodes { id email f
- azure - 如何为用户关闭 Azure 服务通知?