Commit 79d3068a authored by arsenij.ustjanzew's avatar arsenij.ustjanzew
Browse files

changed manpage description

added newline and small changes
parent dc38e8af
#' Renders a barplot
#' Renders a horizontal barplot
#'
#' @param object A \linkS4class{i2dash::i2dashboard} object.
#' @param group_by A factor, by which observations are grouped. In case of a named list, a dropdown menu will be provided in the interactive mode.
#' @param x Numeric observations for the boxplot. In case of a named list, a dropdown menu will be provided in the interactive mode.
#' @param title_x A title of the y-axis that describes the observations. In case of a named list this parameter is not needed because the names of the list will be used as title of the y axis.
#' @param title_group_by A title of the x-axis that describes the grouping factor. In case of a named list this parameter is not needed because the names of the list will be used as title of the x axis.
#' @param title The title of the components junk.
#'
#' @return A string containing markdown code for the rendered textbox
......
......@@ -89,7 +89,7 @@
#' @return An object of class \code{plotly}.
#' @export
plotly_barplot <- function(group_by, x = NULL, names = NULL, showlegend = NULL, title_x = NULL, title_group_by = NULL){
p <- plotly::plot_ly(type = "bar", orientation = "h", opacity = 0.7, x = x, y = group_by, name = names) %>%
p <- plotly::plot_ly(type = "bar", orientation = "h", opacity = 0.7, x = x[[1]], y = group_by[[1]], name = names[[1]]) %>%
plotly::layout(xaxis = list(title = title_x, showline = T),
yaxis = list(title = title_group_by, showline = T, showticklabels = T),
barmode = 'stack',
......
......@@ -67,8 +67,8 @@ ui_list <- rlist::list.append(ui_list, tags$div(tags$br(), downloadButton('downl
if(is.null(x)){
tab <- table(group_by)
df <- as.data.frame(tab)
x <- df[[2]]
y <- df[[1]]
x <- df[2]
y <- df[1]
names <- NULL
showlegend <- F
return(list("df" = df, "x" = x, "y" = y, "names" = names, "showlegend" = showlegend))
......@@ -77,9 +77,9 @@ ui_list <- rlist::list.append(ui_list, tags$div(tags$br(), downloadButton('downl
tab <- table(group_by, x)
ptab <- prop.table(tab, margin = 1)
df <- as.data.frame(ptab)
x <- df[[3]]
y <- df[[1]]
names <- df[[2]]
x <- df[3]
y <- df[1]
names <- df[2]
showlegend <- T
return(list("df" = df, "x" = x, "y" = y, "names" = names, "showlegend" = showlegend))
}
......@@ -125,3 +125,4 @@ shiny::fillCol(flex = c(NA, 1),
plotly::plotlyOutput("plot_{{ env_id }}", height = "100%")
)
```
......@@ -2,7 +2,7 @@
% Please edit documentation in R/barplot.R
\name{barplot}
\alias{barplot}
\title{Renders a barplot}
\title{Renders a horizontal barplot}
\usage{
barplot(object, group_by, x = NULL, title = NULL,
title_group_by = NULL, title_x = NULL)
......@@ -15,10 +15,14 @@ barplot(object, group_by, x = NULL, title = NULL,
\item{x}{Numeric observations for the boxplot. In case of a named list, a dropdown menu will be provided in the interactive mode.}
\item{title}{The title of the components junk.}
\item{title_group_by}{A title of the x-axis that describes the grouping factor. In case of a named list this parameter is not needed because the names of the list will be used as title of the x axis.}
\item{title_x}{A title of the y-axis that describes the observations. In case of a named list this parameter is not needed because the names of the list will be used as title of the y axis.}
}
\value{
A string containing markdown code for the rendered textbox
}
\description{
Renders a barplot
Renders a horizontal barplot
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment