Shiny with plotly

46 views
Skip to first unread message

Eliano Marques

unread,
Sep 3, 2015, 6:46:17 AM9/3/15
to Shiny - Web Framework for R
Hi everyone,

I'm creating a notebook with shiny and i have found the following issue when using the add-on plotly:

Data_xts=Data_xts()  #this return a reactive data.frame. fm_timeseries is already formated as POSIXct and has the following format : YYYY-MM-DD hh:mm:ss
plot_ly(x=Data_xts$fm_timeseries, y = Data_xts$Open,name='Stock Prices',showlegend = FALSE) %>%
add_trace(x=Data_xts$fm_timeseries, y = Data_xts$UKX_open, yaxis='y2') %>%
add_trace(x=Data_xts$fm_timeseries, y = Data_xts$TotalNews, yaxis='y3') %>%
layout(yaxis=list(title='Stock Price'),
yaxis2=list(title='Market Index', overlaying = "y",side='right',position=.97,tickfont = list(size = 8)), 
yaxis3=list(title='Total News', overlaying = "y",side='right',anchor='free', tickfont = list(size = 8),position=1),
xaxis=list(title='Time Series') , showlegend = TRUE)

Here is a couple of issues I'm founding:

Time stamp don't show as timestamp (I even tried the simple example from plotly and R and verified that it doesn't work on Shiny). In fact timestamp is categorize as string and the xaxis tittle can't be seen as a result of this. 

Challenges getting the yaxis2 and 3 in the same axes without overlapping with the chart itself. 

To solve this wonder if there is a format that we can pass into the xaxis (tried type='date' but didn't work) and if there is anytype of auto-arrange on the yaxis on the right (2 and 3).

Attached a picture of the issue. 

Thank you,
Eliano
ScreenShot.png
Reply all
Reply to author
Forward
0 new messages