简体   繁体   中英

R & Shiny - Sidebar text alignment justified

I have created a Shiny application which you you can view right here: http://www.agristats.eu/en/prices-agricultural-commodities/

The R code for this app is here . The problem is with the text in the app's sidebar. It keeps hiding behind the plots, so I need its alignment to be justified within the sidebar. 在此处输入图片说明 The respective code part is:

sidebar <- dashboardSidebar(sidebarMenu(selectInput('commodity', 'Προϊόν', 
    choices = unique(data_quandl$data_product)),
    tags$footer(tags$p("This application is based on Quandl data."))))

What is more puzzling is that, within the same website, I have another similar application in which the respective sidebar text is correctly printed. You can view the app performing correctly here .

How do I fix this?

Adding the footer outside sidebarMenu will do the trick as follows :

sidebar <- dashboardSidebar(sidebarMenu(
  selectInput('commodity', 'Προϊόν', choices = unique(data_quandl$data_product))
  ),
  tags$footer(
    tags$p("This application is based on Quandl data.")))

Output :

snap1

Other workaround is using div tag to align the text as well.

sidebar <- dashboardSidebar(sidebarMenu(
  selectInput('commodity', 'Προϊόν', choices = unique(data_quandl$data_product)),
  div(style="text-align:center","This application is based on",br(), "Quandl Data")
  ))

This results in :

snap2

The one you are having the problem, footer is present inside the ul tag, issue is because of the {white-space:nowrap} rule on the ul.

If possible print the footer outside the ul tag, it should solve the problem.

or else try this property using custom css {white-space:initial;}

hope this helps..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM