我試圖用rCharts包繪製數千個點,但是我發現它使用默認參數有點慢。我試圖設置turboThresold參數爲0,但它沒有幫助。在繪製數千個點時提高rCharts性能
這裏是性能的表格:
- 繪製100分:00.05小號
- 繪製1000點:00.54小號
- 繪製10000點:17.00小號
任何人都可以提高此代碼的性能?
library(shiny)
library(rCharts)
runApp(
# User interface with 1 select box, 1 graph and 1 timer
list(ui = pageWithSidebar(
headerPanel(""),
sidebarPanel(
selectInput("value",NULL,choices=c(100,1000,10000), selected = 100)
),
mainPanel(
showOutput("plot", "highcharts"),
textOutput("timer")
)
),
# server side
server = function(input, output){
values<-reactiveValues()
values$timer <- NULL
# generating highcharts plot
output$plot <- renderChart2({
x <- 1:input$value
df <- data.frame(x, x^2)
names(df) <- c("x","xpower2")
values$timer <- Sys.time()
plot <- Highcharts$new()
plot$series(
data = toJSONArray2(df, json = F, names = F),
name = "xpower2",
type = "line"
)
plot$plotOptions(series=list(turboThreshold=0))
return(plot)
})
# calculating time
output$timer <- renderText({
input$value
isolate({
values$timer <- Sys.time() - values$timer
return(paste("Time elapsed :", round(values$timer,3) , "seconds"))
})
})
}
)
)
感謝您的幫助, 馬特
這些命令沒有幫助: 情節$ plotOptions(系列=名單(動畫= FALSE,enableMouseTracking = FALSE)) – mbh86
嘗試O禁止陰影/動畫/標記 –
嗨塞巴斯蒂安。不幸的是沒有改善 – mbh86