我正在尝试根据输入更改y轴标签。我正在使用dygraphs和Shiny。我的猜测是input$type
不正确,但我不确定......感谢任何帮助!
if (input$type== 'Power'){
dygraph(TempData, main = "Battery Data") %>%
dyAxis("y", label = "Watts")
}
if (input$type== 'Current'){
dygraph(TempData, main = "Battery Data") %>%
dyAxis("y", label = "Amps")
}
dygraph(TempData, main = "Temperature") %>%
dyAxis("y", label = "Temp (C)")
})
})
答案 0 :(得分:0)
Solved! The fix is below:
if (colnames(Data1xts$Watts) == "Watts"){
dygraph(TempData, main = "Battery Data") %>%
dyAxis("y", label = "Watts (W)")
}
if (colnames(Data1xts$Volts) == "Volts"){
dygraph(TempData, main = "Battery Data") %>%
dyAxis("y", label = "Volts (V)")
}
else
dygraph(TempData, main = "Battery Data") %>%
dyAxis("y", label = "Temp (C)")
})
})