Open mathiasleroy opened 7 years ago
Hi all,
I get an issue: my dygraph is non aligned with the time range:
`sidebar <- dashboardSidebar(
sidebarMenu( menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")), menuItem("Widgets", icon = icon("th"), tabName = "widgets", badgeLabel = "new", badgeColor = "green") ) )
body <- dashboardBody( tabItems( tabItem(tabName = "dashboard", h2("Dashboard tab content"),
sidebarPanel(
fileInput("file1", "Choose CSV File",
multiple = TRUE,
accept = c("text/csv",
"text/comma-separated-values,text/plain",
".csv")),
tags$hr(),
checkboxInput("header", "Header", TRUE),
radioButtons("sep", "Separator",
choices = c(Comma = ",",
Semicolon = ";",
Tab = "\t"),
selected = ";"),
radioButtons("quote", "Quote",
choices = c(None = "",
"Double Quote" = '"',
"Single Quote" = "'"),
selected = "")
),
dygraphOutput("dygraph",width = "50%", height = "300px"),
tabPanel('Display length',DT::dataTableOutput('dt'))
),
tabItem(tabName = "widgets",
h2("Widgets tab content")
)
) )
dashboardPage( dashboardHeader(title = "Simple tabs"), sidebar, body )`
`server <- function(input, output) {
require(input$file1)
df <- reactive({ inFile <- input$file1 if (is.null(inFile)) return(NULL) df0 <- read.csv(inFile$datapath, header = input$header, sep = input$sep, quote = input$quote, stringsAsFactors = T) return(df0) })
df2 <- reactive({ if (is.null(input$file1)) return(NULL)else{ DataCleaning(df())} })
graphe <- reactive({ if (is.null(input$file1)) return(NULL)else{ TauxDef(df2()[[9]],df2()[[10]])} })
output$dygraph <- renderDygraph({ if (is.null(input$file1)) return(NULL)else{ MyGraph<-graphe() dyRangeSelector(dygraph(MyGraph, main = "Taux de defaut"))}
})
output$dt <- DT::renderDataTable( DT::datatable(df(), options = list(pageLength = 10,scrollX = TRUE)) )
}`
@davRuser it's better to report your issue in RStudio/dygraphs repo.
I found out that the
rollPeriod
is not centered like I thought.In fact the
rollPeriod
corresponds the n days after any date. e.g. for n=7:It would be useful to be able to change the alignment like a centered moving average
and even to shift the moving average window before the date
The problem is that if your last date is
y
and you select arollPeriod
ofn
, then the last date appearing on the chart will bey+n-1
.