% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ms_waterfallchart.R
\name{ms_waterfallchart}
\alias{ms_waterfallchart}
\title{Waterfall chart object}
\usage{
ms_waterfallchart(data, x, y, subtotals = NULL)
}
\arguments{
\item{data}{a data.frame.}

\item{x}{category column name.}

\item{y}{numeric value column name. Signed values: positive = up,
negative = down. For subtotal rows, the value should be the running
total at that point.}

\item{subtotals}{integer vector of 1-based row indices that should
be rendered as subtotal/total bars. Defaults to none.}
}
\value{
An \code{ms_chart} object (subclass \code{ms_waterfallchart}).
}
\description{
Creation of a waterfall chart object that can be inserted
in a 'Microsoft' document. Waterfall charts use the chartEx pipeline
(Office 2016+); older versions of 'Microsoft Office' will display a
fallback placeholder.

Each row is one bar. Positive values rise, negative values fall.
Categories listed in \code{subtotals} are rendered as absolute totals
(typical for "Start", intermediate totals, and "End" bars).
}
\examples{
library(officer)

dat <- data.frame(
  step = c("Start", "Q1", "Q2", "Q3", "End"),
  amount = c(100, 30, -20, 40, 150),
  stringsAsFactors = FALSE
)
wf <- ms_waterfallchart(
  data = dat, x = "step", y = "amount",
  subtotals = c(1, 5)
)

doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, wf, location = ph_location_fullsize())
print(doc, target = tempfile(fileext = ".pptx"))
}
\seealso{
\code{\link[=chart_labels]{chart_labels()}}

Other 'Office' chart objects:
\code{\link[=ms_areachart]{ms_areachart()}},
\code{\link[=ms_barchart]{ms_barchart()}},
\code{\link[=ms_boxplotchart]{ms_boxplotchart()}},
\code{\link[=ms_bubblechart]{ms_bubblechart()}},
\code{\link[=ms_chart_combine]{ms_chart_combine()}},
\code{\link[=ms_funnelchart]{ms_funnelchart()}},
\code{\link[=ms_histogramchart]{ms_histogramchart()}},
\code{\link[=ms_linechart]{ms_linechart()}},
\code{\link[=ms_paretochart]{ms_paretochart()}},
\code{\link[=ms_piechart]{ms_piechart()}},
\code{\link[=ms_radarchart]{ms_radarchart()}},
\code{\link[=ms_scatterchart]{ms_scatterchart()}},
\code{\link[=ms_stockchart]{ms_stockchart()}},
\code{\link[=ms_sunburstchart]{ms_sunburstchart()}},
\code{\link[=ms_treemapchart]{ms_treemapchart()}}
}
\concept{'Office' chart objects}
