% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ms_chart.R
\name{ms_stockchart}
\alias{ms_stockchart}
\title{Stockchart object}
\usage{
ms_stockchart(data, x, open = NULL, high, low, close)
}
\arguments{
\item{data}{a data.frame}

\item{x}{column name for categories (typically dates)}

\item{open}{column name for open values (optional, enables OHLC mode)}

\item{high}{column name for high values}

\item{low}{column name for low values}

\item{close}{column name for close values}
}
\value{
An \code{ms_chart} object.
}
\description{
Creation of a stock chart object that can be inserted
in a 'Microsoft' document. When \code{open} is omitted the chart is
a High-Low-Close chart. When \code{open} is provided it becomes an
Open-High-Low-Close chart with up/down bars (candlestick).
}
\examples{
library(officer)

dat <- data.frame(
  date = as.Date("2024-01-01") + 0:4,
  open = c(44, 25, 38, 50, 34),
  high = c(55, 57, 57, 58, 58),
  low = c(11, 12, 13, 11, 25),
  close = c(32, 35, 34, 35, 43)
)

# HLC chart
stock_hlc <- ms_stockchart(
  data = dat, x = "date",
  high = "high", low = "low", close = "close"
)
stock_hlc

# OHLC chart (candlestick)
stock_ohlc <- ms_stockchart(
  data = dat, x = "date",
  open = "open", high = "high",
  low = "low", close = "close"
)
stock_ohlc
}
\seealso{
\code{\link[=chart_settings]{chart_settings()}}, \code{\link[=chart_ax_x]{chart_ax_x()}}, \code{\link[=chart_ax_y]{chart_ax_y()}},
\code{\link[=chart_theme]{chart_theme()}}, \code{\link[=chart_labels]{chart_labels()}}

Other 'Office' chart objects: 
\code{\link{ms_areachart}()},
\code{\link{ms_barchart}()},
\code{\link{ms_bubblechart}()},
\code{\link{ms_chart_combine}()},
\code{\link{ms_linechart}()},
\code{\link{ms_piechart}()},
\code{\link{ms_radarchart}()},
\code{\link{ms_scatterchart}()}
}
\concept{'Office' chart objects}
