-1

DATA

I want to add text in rightmost region in the dashboard and the text should cover all the right space column. DASHBOARD

    dashboardPage(skin="yellow",
  dashboardHeader(title = "Wheat Price dashboard  ),
   dashboardSidebar(
      sidebarMenu( 
  menuItem("Punjab-khanna", tabName = "dashboard", icon = icon("area-chart"))
       )
       ),
   dashboardBody(
         tabItems(
       tabItem(tabName = "dashboard",
          fluidPage(
            titlePanel("Wheat DARA"),
             mainPanel(fluidRow(
              box( side="right",
                           tabPanel("Price chart", dygraphOutput("plot1")

              )
            ),box(side = "right",height="250px",includeMarkdown("read.md")))

          ) )
          )
  ))

)

SERVER.R

   d1<-read_excel("data/Wheat data forecasted.xlsx",sheet = 1,col_names =   
       TRUE)
   #stock
   d2 <-subset(d1, select = c(1,2,3,4,5))
  #last
  d1 <-subset(d1, select = c(1,5,6,7))
  d1$`Date GMT` <- as.POSIXct(d1$`Date GMT`, format = "%Y-%m-%d", tz="GMT")
  ts1 <- irts(time=d1$`Date GMT`,value=as.matrix(d1[,2:4]))
  #stock
  d2$`Date GMT` <- as.POSIXct(d2$`Date GMT`, format = "%Y-%m-%d", tz="GMT")
   ts2 <- irts(time=d2$`Date GMT`,value=as.matrix(d2[,2:5]))

   shinyServer(function(input, output) {
   output$plot1 <- renderDygraph({   
  dygraph(ts1) %>% 
  dyRangeSelector() %>% 
  dyLegend(show = "always", hideOnMouseOut = FALSE) %>%
  dyHighlight(highlightCircleSize = 5) %>%
  dyOptions(axisLineColor = "navy", gridLineColor = "grey")
 })


  } ) 

I am not able to arrange it to the right side.

NOTE:I have written different text(from the image) but the task is same to arrange the text to rightmost region in dashboard

1 Answers1

0

I've added a minimal reproducible code myself. Please check. You just have to play with fluidrow and column with width values.

enter image description here

if(interactive()) {



## app.R ##
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard"),
  dashboardSidebar(),
  dashboardBody(
    # Boxes need to be put in a row (or column)
    fluidRow(
      column(

      column(
        fluidRow(
          box(plotOutput("plot1"))
        ),
        fluidRow(
          box(plotOutput("plot2"))
        ),
        width = 10
      ),

      column(
        h3(
          textOutput('text1')
        ),
        width = 2
      ),
      width = 12
      )

    )
  )
)

server <- function(input, output) {
  set.seed(122)
  histdata <- rnorm(500)

  output$plot1 <- renderPlot({

    hist(histdata)
  })


  output$plot2 <- renderPlot({

    hist(histdata)
  })

  output$text1 <- renderText({
    "Uniform: These functions provide information about the uniform distribution on the interval from min to max. dunif gives the density, punif gives the distribution function qunif gives the quantile function and runif generates random deviates."
  })



}

shinyApp(ui, server)

}

Source Code modified:

Please modify your dashboard input like this below. It also has plot2, since your initial question had one.

dashboardBody(
  # Boxes need to be put in a row (or column)
  fluidRow(
    column(

      column(
        fluidRow(
          tabPanel("Price chart", dygraphOutput("plot1")
        ),
        fluidRow(
          plotOutput("plot2")
        ),
        width = 10
      ),

      column(
        h3(
          includeMarkdown("read.md")
        ),
        width = 2
      ),
      width = 12
    )

  )
)
amrrs
  • 6,215
  • 2
  • 18
  • 27