I use plotly to make a scatter graph. I use a checkbox to add or not some lines. Here's the code :
p <- plot_ly(stocks, x = ~as.Date(index(stocks)), y = ~stocks[,which(colnames(stocks)==input$typetrack)], name = input$typetrack, type = 'scatter', mode = 'lines', evaluation = T)
if(!is.null(input$checkotherclass))
{
for(i in c(1:length(input$checkotherclass)))
{
p <-add_trace(p, y = ~stocks[,which(colnames(stocks)==input$checkotherclass[i])], name = input$checkotherclass[i], evaluation = T)
}
}
When I click on checkbox, I get only one plot with multiplies lines on over each other. I know this question has already been posted but the solution is not good enough. Thanks You !!!
Aucun commentaire:
Enregistrer un commentaire