% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/encharter.R, R/encharter_chart.R,
%   R/encharter_chartex.R
\name{encharter}
\alias{encharter}
\alias{ec}
\alias{Chart}
\alias{ChartEx}
\title{Create an Encharter Chart}
\usage{
encharter(type = "lineChart")

ec(type = "lineChart")
}
\arguments{
\item{type}{A character string specifying the chart type. Common R-style
aliases are accepted (see Details).}
}
\value{
An R6 object of class \code{Chart} or \code{ChartEx}.
}
\description{
Factory function that initialises an R6 chart object. Returns a \code{Chart}
object for standard OOXML chart types (bar, line, scatter, ...) or a
\code{ChartEx} object for modern extended chart types (waterfall, treemap, ...).

The \code{Chart} class provides a flexible interface to build Office OpenXML
(OOXML) chart objects. It allows for granular control over grid lines,
secondary axes, and combined chart types (e.g., Bar and Line) within a
single plot area.

An R6 class to create and manipulate Office OpenXML (OOXML) Extended Charts (ChartEx),
including Waterfall, Sunburst, Treemap, and Region Maps, which are not
supported by standard Office Open XML chart types.
}
\details{
\strong{Supported Chart Types:}
\itemize{
\item \strong{Bar/Column:} \code{"barChart"}, \code{"barplot"},
\code{"hist"}, \code{"histogram"}
\item \strong{Line/Area:} \code{"lineChart"}, \code{"line"},
\code{"areaChart"}, \code{"area"}
\item \strong{Scatter:} \code{"scatterChart"}, \code{"scatter"},
\code{"point"}
\item \strong{Pie/Doughnut:} \code{"pieChart"}, \code{"pie"},
\code{"doughnutChart"}, \code{"doughnut"}
\item \strong{Extended (ChartEx):} \code{"waterfall"}, \code{"treemap"},
\code{"sunburst"}, \code{"regionMap"},
\code{"boxWhisker"} / \code{"boxplot"}, \code{"funnel"}
}

\strong{Bar vs Column direction:}
For bar/column charts, orientation is set via the \code{dir} argument in
\verb{$add_series()}: \code{"col"} (vertical, default) or \code{"bar"}
(horizontal).

This class is designed to work with the \code{openxlsx2} package by generating
the underlying XML required for the \code{add_chart_xml} method.

This class uses XML to manipulate the underlying XML structure and
integrates with \code{openxlsx2} for workbook generation.
}
\examples{
# Standard line chart
ec("lineChart")

# Extended waterfall chart
ec("waterfall")

# R-style alias
ec("barplot")


## ------------------------------------------------
## Method `Chart$set_x2_title`
## ------------------------------------------------

ec("scatter")$
  add_series(data = "Sheet1!A1:A10", secondary = "x")$
  set_x2_title("Secondary X", font_color = "888888")

## ------------------------------------------------
## Method `Chart$set_y2_title`
## ------------------------------------------------

ec("line")$
  add_series(data = "Sheet1!A1:A10")$
  add_series(data = "Sheet1!B1:B10", secondary = TRUE)$
  set_y2_title("Growth Rate (\%)")
}
\section{Super class}{
\code{\link[encharter:EncharterBase]{encharter::EncharterBase}} -> \code{Chart}
}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{x2_title}}{List containing text and style for the secondary X-axis.}

\item{\code{y2_title}}{List containing text and style for the secondary Y-axis.}

\item{\code{first_slice_ang}}{Integer. Rotation of the first slice (0-360).}

\item{\code{expansion}}{Integer. Size of the expansion for pie charts.}

\item{\code{hole_size}}{Integer. Size of the hole for doughnut charts (0-90).}

\item{\code{show_data_table}}{Logical if a data table should be added.}

\item{\code{drop_lines}}{Logical; show lines from points to the axis.}

\item{\code{high_low_lines}}{Logical; show lines between max/min points.}

\item{\code{up_down_bars}}{Logical; show bars between first and last series.}

\item{\code{bubble_scale}}{Numeric; the scale factor for bubbles (default 100).}

\item{\code{show_neg_bubbles}}{Logical; whether to show bubbles with negative values.}

\item{\code{disp_blanks_as}}{Character; "gap", "span", or "zero".}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-Chart-new}{\code{Chart$new()}}
\item \href{#method-Chart-set_x2_title}{\code{Chart$set_x2_title()}}
\item \href{#method-Chart-set_y2_title}{\code{Chart$set_y2_title()}}
\item \href{#method-Chart-set_y2_axis}{\code{Chart$set_y2_axis()}}
\item \href{#method-Chart-set_x2_axis}{\code{Chart$set_x2_axis()}}
\item \href{#method-Chart-set_data_table}{\code{Chart$set_data_table()}}
\item \href{#method-Chart-set_pie_options}{\code{Chart$set_pie_options()}}
\item \href{#method-Chart-set_bubble_options}{\code{Chart$set_bubble_options()}}
\item \href{#method-Chart-set_disp_blanks}{\code{Chart$set_disp_blanks()}}
\item \href{#method-Chart-add_series}{\code{Chart$add_series()}}
\item \href{#method-Chart-render}{\code{Chart$render()}}
\item \href{#method-Chart-clone}{\code{Chart$clone()}}
}
}
\if{html}{\out{
<details><summary>Inherited methods</summary>
<ul>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="print"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-print'><code>encharter::EncharterBase$print()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_chart_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_chart_style'><code>encharter::EncharterBase$set_chart_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_chart_title"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_chart_title'><code>encharter::EncharterBase$set_chart_title()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_data_label_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_data_label_style'><code>encharter::EncharterBase$set_data_label_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_legend_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_legend_style'><code>encharter::EncharterBase$set_legend_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_plot_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_plot_style'><code>encharter::EncharterBase$set_plot_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_x_axis"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_x_axis'><code>encharter::EncharterBase$set_x_axis()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_x_title"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_x_title'><code>encharter::EncharterBase$set_x_title()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_y_axis"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_y_axis'><code>encharter::EncharterBase$set_y_axis()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_y_title"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_y_title'><code>encharter::EncharterBase$set_y_title()</code></a></span></li>
</ul>
</details>
}}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-new"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-new}{}}}
\subsection{Method \code{new()}}{
Initialize a new Chart object.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$new(type = NULL)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{type}}{Initial chart type (e.g., "lineChart", "barChart", "pieChart").}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_x2_title"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_x2_title}{}}}
\subsection{Method \code{set_x2_title()}}{
Set the secondary X-axis title.

Only takes effect if at least one series has been assigned to the
secondary X-axis via \code{add_series(secondary = "x")}. Issues a warning
and returns \code{self} silently otherwise.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_x2_title(
  text,
  font_size = NULL,
  font_name = NULL,
  font_color = NULL,
  bold = NULL,
  italic = NULL,
  fill = NULL,
  line = NULL,
  line_width = NULL
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{text}}{Title string.}

\item{\code{font_size}}{Numeric font size in points.}

\item{\code{font_name}}{Font typeface name.}

\item{\code{font_color}}{Six-digit hex color for the title text.}

\item{\code{bold, italic}}{Logical font style.}

\item{\code{fill}}{Six-digit hex color for the title background box.}

\item{\code{line}}{Six-digit hex color for the title border.}

\item{\code{line_width}}{Numeric border width in points.}
}
\if{html}{\out{</div>}}
}
\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{ec("scatter")$
  add_series(data = "Sheet1!A1:A10", secondary = "x")$
  set_x2_title("Secondary X", font_color = "888888")
}
\if{html}{\out{</div>}}

}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_y2_title"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_y2_title}{}}}
\subsection{Method \code{set_y2_title()}}{
Set the secondary Y-axis title.

Only takes effect if at least one series has been assigned to the
secondary Y-axis via \code{add_series(secondary = TRUE)} or
\code{secondary = "y"}. Issues a warning otherwise.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_y2_title(
  text,
  font_size = NULL,
  font_name = NULL,
  font_color = NULL,
  bold = NULL,
  italic = NULL,
  fill = NULL,
  line = NULL,
  line_width = NULL
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{text}}{Title string.}

\item{\code{font_size}}{Numeric font size in points.}

\item{\code{font_name}}{Font typeface name.}

\item{\code{font_color}}{Six-digit hex color for the title text.}

\item{\code{bold, italic}}{Logical font style.}

\item{\code{fill}}{Six-digit hex color for the title background box.}

\item{\code{line}}{Six-digit hex color for the title border.}

\item{\code{line_width}}{Numeric border width in points.}
}
\if{html}{\out{</div>}}
}
\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{ec("line")$
  add_series(data = "Sheet1!A1:A10")$
  add_series(data = "Sheet1!B1:B10", secondary = TRUE)$
  set_y2_title("Growth Rate (\%)")
}
\if{html}{\out{</div>}}

}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_y2_axis"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_y2_axis}{}}}
\subsection{Method \code{set_y2_axis()}}{
Set Secondary Y-axis scaling, units, and format.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_y2_axis(
  min = NULL,
  max = NULL,
  major = NULL,
  minor = NULL,
  major_time = NULL,
  minor_time = NULL,
  base_time = NULL,
  major_tick = NULL,
  minor_tick = NULL,
  format = NULL,
  log_base = NULL,
  color = NULL,
  font_name = NULL,
  font_size = NULL,
  bold = NULL,
  italic = NULL,
  font_color = NULL,
  rotation = NULL,
  grid_color = NULL,
  grid_lines = NULL,
  minor_grid_color = NULL,
  minor_grid_lines = NULL,
  cross_between = NULL,
  line_width = NULL,
  grid_width = NULL,
  minor_grid_width = NULL,
  crosses = "max",
  crosses_at = NULL,
  label_pos = NULL
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{min}}{Minimum value for the axis.}

\item{\code{max}}{Maximum value for the axis.}

\item{\code{major}}{Numeric value for major unit interval.}

\item{\code{minor}}{Numeric value for minor unit interval.}

\item{\code{major_time}}{Time unit for major steps ("days", "months", "years"). Used for date axes.}

\item{\code{minor_time}}{Time unit for minor steps ("days", "months", "years"). Used for date axes.}

\item{\code{base_time}}{Base time unit for date axes ("days", "months", "years").}

\item{\code{major_tick, minor_tick}}{Tick marks for major and minor ("cross", "in", "none", "out").}

\item{\code{format}}{A number format string (e.g., "#,##0" or "yyyy-mm-dd").}

\item{\code{log_base}}{Base for logarithmic scaling (e.g., 10).}

\item{\code{color, font_color}}{Hex color for the axis lines and label (or independent label color).}

\item{\code{font_name}}{Font typeface name (e.g., "Arial", "Calibri").}

\item{\code{font_size}}{Font size for the axis labels.}

\item{\code{bold}}{Logical; if \code{TRUE}, axis labels will be bold.}

\item{\code{italic}}{Logical; if \code{TRUE}, axis labels will be italicized.}

\item{\code{rotation}}{Rotation in degrees.}

\item{\code{grid_color, minor_grid_color}}{Hex color for the grid lines.}

\item{\code{grid_lines, minor_grid_lines}}{Logical. Show or hide grid lines.}

\item{\code{cross_between}}{Specifies how the value axis crosses the category axis ('between' or 'midCat').}

\item{\code{line_width, grid_width, minor_grid_width}}{Numeric. Change the width of the axis and grid lines.}

\item{\code{crosses}}{Intersection: "autoZero" (default), "min" (start), or "max" (end).}

\item{\code{crosses_at}}{Numeric axis value for intersection. Overrides 'crosses'.}

\item{\code{label_pos}}{Label position: "nextTo" (default), "low" (edge of chart), "high" (opposite edge), or "none".}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_x2_axis"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_x2_axis}{}}}
\subsection{Method \code{set_x2_axis()}}{
Set Secondary X-axis scaling, units, and format.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_x2_axis(
  min = NULL,
  max = NULL,
  major = NULL,
  minor = NULL,
  major_time = NULL,
  minor_time = NULL,
  base_time = NULL,
  major_tick = NULL,
  minor_tick = NULL,
  format = NULL,
  log_base = NULL,
  color = NULL,
  font_name = NULL,
  font_size = NULL,
  bold = NULL,
  italic = NULL,
  font_color = NULL,
  rotation = NULL,
  grid_color = NULL,
  grid_lines = NULL,
  minor_grid_color = NULL,
  minor_grid_lines = NULL,
  cross_between = NULL,
  line_width = NULL,
  grid_width = NULL,
  minor_grid_width = NULL,
  crosses = "max",
  crosses_at = NULL,
  label_pos = NULL
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{min}}{Minimum value for the axis.}

\item{\code{max}}{Maximum value for the axis.}

\item{\code{major}}{Numeric value for major unit interval.}

\item{\code{minor}}{Numeric value for minor unit interval.}

\item{\code{major_time}}{Time unit for major steps ("days", "months", "years"). Used for date axes.}

\item{\code{minor_time}}{Time unit for minor steps ("days", "months", "years"). Used for date axes.}

\item{\code{base_time}}{Base time unit for date axes ("days", "months", "years").}

\item{\code{major_tick, minor_tick}}{Tick marks for major and minor ("cross", "in", "none", "out").}

\item{\code{format}}{A number format string (e.g., "#,##0" or "yyyy-mm-dd").}

\item{\code{log_base}}{Base for logarithmic scaling (e.g., 10).}

\item{\code{color, font_color}}{Hex color for the axis lines and label (or independent label color).}

\item{\code{font_name}}{Font typeface name (e.g., "Arial", "Calibri").}

\item{\code{font_size}}{Font size for the axis labels.}

\item{\code{bold}}{Logical; if \code{TRUE}, axis labels will be bold.}

\item{\code{italic}}{Logical; if \code{TRUE}, axis labels will be italicized.}

\item{\code{rotation}}{Rotation in degrees.}

\item{\code{grid_color, minor_grid_color}}{Hex color for the grid lines.}

\item{\code{grid_lines, minor_grid_lines}}{Logical. Show or hide grid lines.}

\item{\code{cross_between}}{Specifies how the value axis crosses the category axis ('between' or 'midCat').}

\item{\code{line_width, grid_width, minor_grid_width}}{Numeric. Change the width of the axis and grid lines.}

\item{\code{crosses}}{Intersection: "autoZero" (default), "min" (start), or "max" (end).}

\item{\code{crosses_at}}{Numeric axis value for intersection. Overrides 'crosses'.}

\item{\code{label_pos}}{Label position: "nextTo" (default), "low" (edge of chart), "high" (opposite edge), or "none".}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_data_table"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_data_table}{}}}
\subsection{Method \code{set_data_table()}}{
Set the data table.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_data_table(show = TRUE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{show}}{Logical TRUE or FALSE.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_pie_options"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_pie_options}{}}}
\subsection{Method \code{set_pie_options()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_pie_options(rotation = NULL, expansion = NULL, hole_size = NULL)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{rotation}}{The angle of the first slice in degrees, from 0 to 360.
This rotates the chart clockwise.}

\item{\code{expansion}}{Sets the expansion, from 0 to 400.}

\item{\code{hole_size}}{Set the hole size of (only doughnut charts), from 0 to 90.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_bubble_options"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_bubble_options}{}}}
\subsection{Method \code{set_bubble_options()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_bubble_options(scale = 100, show_neg = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{scale}}{The scale factor for bubbles, from 0 to 300 (expressed as a percentage).}

\item{\code{show_neg}}{Logical; if \code{TRUE}, bubbles with negative values will be displayed on the chart.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-set_disp_blanks"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-set_disp_blanks}{}}}
\subsection{Method \code{set_disp_blanks()}}{
Set missing value behavior ("gap", "span", "zero").
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$set_disp_blanks(val = "gap")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{val}}{Character. One of "gap" (break), "span" (continue), or "zero" (drop).}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-add_series"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-add_series}{}}}
\subsection{Method \code{add_series()}}{
Add a data series to the chart with independent styling.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$add_series(
  name = NULL,
  data,
  label = NULL,
  weight = NULL,
  color = "4472C4",
  type = NULL,
  secondary = FALSE,
  dir = "col",
  grouping = "standard",
  overlap = NULL,
  gap_width = NULL,
  smooth = FALSE,
  show_line = TRUE,
  marker = "none",
  marker_size = 5,
  marker_fill = NULL,
  marker_line = NULL,
  marker_line_width = 0.75,
  show_val = NULL,
  show_cat = NULL,
  line_type = NULL,
  line_width = 1,
  line_color = NULL,
  filled = FALSE,
  error_bars = FALSE,
  trendline = FALSE
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{name}}{Cell range or string for series name.}

\item{\code{data}}{Cell range for series values.}

\item{\code{label}}{Cell range for category labels.}

\item{\code{weight}}{Cell range for bubble sizes (bubbleChart only).}

\item{\code{color}}{Primary Hex color for the series (used as default for line and markers).}

\item{\code{type}}{Chart type for this specific series (for combo charts).}

\item{\code{secondary}}{Logical. Set to TRUE to move series to secondary axis.}

\item{\code{dir}}{Bar direction ("col" or "bar").}

\item{\code{grouping}}{Chart grouping ("standard", "stacked", "percentStacked").}

\item{\code{overlap}}{Integer between -100 and 100 for bar charts.}

\item{\code{gap_width}}{Integer between 0 and 500 for bar charts.}

\item{\code{smooth}}{Logical. Enable line smoothing for line/scatter charts.}

\item{\code{show_line}}{Logical. Show the line connecting points.}

\item{\code{marker}}{Marker type ("none", "circle", "square", "diamond", "triangle").}

\item{\code{marker_size}}{Integer size of marker.}

\item{\code{marker_fill}}{Hex color for the interior of the marker. Defaults to \code{color}.}

\item{\code{marker_line}}{Hex color for the marker border. Defaults to \code{color}.}

\item{\code{marker_line_width}}{Numeric width of the marker border.}

\item{\code{show_val}}{Logical. Override global label settings for this series (show value).}

\item{\code{show_cat}}{Logical. Override global label settings for this series (show category).}

\item{\code{line_type}}{Line style: "dashed", "dotted", "dashDot", or "solid".}

\item{\code{line_width}}{Numeric width of the connecting line.}

\item{\code{line_color}}{Hex color for the connecting line. Defaults to \code{color}.}

\item{\code{filled}}{Logical; for radar charts, fills the interior area. Default FALSE.}

\item{\code{error_bars}}{A list of error bar properties:
\itemize{
\item \code{type}: The error value type (\code{ST_ErrValType}).
Must be one of: \code{"fixedVal"} (Fixed Value), \code{"percentage"} (Percentage),
\code{"stdDev"} (Standard Deviation), \code{"stdErr"} (Standard Error),
or \code{"cust"} (Custom).
\item \code{value}: The numeric value for the error bars (e.g., 10 for 10\% or 5 for fixed units).
\item \code{direction}: Direction of bars. One of \code{"both"}, \code{"plus"}, or \code{"minus"}.
\item \code{color}: Hex color code for the bars (e.g., "FF0000").
}}

\item{\code{trendline}}{A list of regression line properties:
\itemize{
\item \code{type}: The regression type (\code{ST_TrendlineType}).
Must be one of: \code{"linear"} (Linear), \code{"exp"} (Exponential),
\code{"log"} (Logarithmic), \code{"movingAvg"} (Moving Average),
\code{"poly"} (Polynomial), or \code{"power"} (Power).
\item \code{order}: Required for \code{"poly"}; an integer between 2 and 6.
\item \code{period}: Required for \code{"movingAvg"}; an integer representing the window size.
\item \code{color}: Hex color code for the line.
\item \code{show_r2}: Logical; if \code{TRUE}, displays the R-squared value on the chart.
}}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-render"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-render}{}}}
\subsection{Method \code{render()}}{
Generate the final XML string for the chart.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$render(
  u_ids = c("53178645", "60812428", "64752656", "81893617", "90007639")
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{u_ids}}{five unique ids}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
A character string containing the OOXML chart definition.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-Chart-clone"></a>}}
\if{latex}{\out{\hypertarget{method-Chart-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{Chart$clone(deep = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}
\section{Super class}{
\code{\link[encharter:EncharterBase]{encharter::EncharterBase}} -> \code{ChartEx}
}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{color_xml}}{color}

\item{\code{style_xml}}{style}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-ChartEx-new}{\code{ChartEx$new()}}
\item \href{#method-ChartEx-add_series}{\code{ChartEx$add_series()}}
\item \href{#method-ChartEx-render}{\code{ChartEx$render()}}
\item \href{#method-ChartEx-clone}{\code{ChartEx$clone()}}
}
}
\if{html}{\out{
<details><summary>Inherited methods</summary>
<ul>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="print"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-print'><code>encharter::EncharterBase$print()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_chart_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_chart_style'><code>encharter::EncharterBase$set_chart_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_chart_title"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_chart_title'><code>encharter::EncharterBase$set_chart_title()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_data_label_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_data_label_style'><code>encharter::EncharterBase$set_data_label_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_legend_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_legend_style'><code>encharter::EncharterBase$set_legend_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_plot_style"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_plot_style'><code>encharter::EncharterBase$set_plot_style()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_x_axis"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_x_axis'><code>encharter::EncharterBase$set_x_axis()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_x_title"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_x_title'><code>encharter::EncharterBase$set_x_title()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_y_axis"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_y_axis'><code>encharter::EncharterBase$set_y_axis()</code></a></span></li>
<li><span class="pkg-link" data-pkg="encharter" data-topic="EncharterBase" data-id="set_y_title"><a href='../../encharter/html/EncharterBase.html#method-EncharterBase-set_y_title'><code>encharter::EncharterBase$set_y_title()</code></a></span></li>
</ul>
</details>
}}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ChartEx-new"></a>}}
\if{latex}{\out{\hypertarget{method-ChartEx-new}{}}}
\subsection{Method \code{new()}}{
Create a new ChartEx object.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ChartEx$new(type = NULL)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{type}}{Initial chart type (e.g., "waterfall", "treemap").}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
A new \code{ChartEx} object.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ChartEx-add_series"></a>}}
\if{latex}{\out{\hypertarget{method-ChartEx-add_series}{}}}
\subsection{Method \code{add_series()}}{
Add a data series to the chart.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ChartEx$add_series(
  name = NULL,
  data,
  label = NULL,
  type = NULL,
  color = "auto",
  line_color = NULL,
  line_width = 1,
  gap_width = NULL,
  subtotals = NULL,
  statistics = NULL,
  binning = NULL,
  visibility = NULL,
  parent_label = "overlapping"
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{name}}{Cell range for the series name.}

\item{\code{data}}{Cell range for the numeric values.}

\item{\code{label}}{Cell range for the category labels.}

\item{\code{type}}{Type of chart (waterfall, sunburst, treemap, regionMap).}

\item{\code{color}}{Hex color or "auto".}

\item{\code{line_color}}{Border color.}

\item{\code{line_width}}{Border width.}

\item{\code{gap_width}}{Integer between 0 and 500.}

\item{\code{subtotals}}{Numeric vector of indices to treat as subtotals (Waterfall only).}

\item{\code{statistics}}{Quartile method: "inclusive" or "exclusive".}

\item{\code{binning}}{A list for Histogram/BoxWhisker:
\code{binSize} (numeric), \code{binCount} (integer), \code{intervalClosed} ("left", "right"),
\code{underflow} (numeric or "auto"), \code{overflow} (numeric or "auto").}

\item{\code{visibility}}{A named list of logicals for BoxWhisker/Waterfall:
\code{connectorLines}, \code{meanLine}, \code{meanMarker}, \code{nonoutliers}, \code{outliers}.}

\item{\code{parent_label}}{Treemap label style: "overlapping", "banner", or "none".}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ChartEx-render"></a>}}
\if{latex}{\out{\hypertarget{method-ChartEx-render}{}}}
\subsection{Method \code{render()}}{
Render the internal XML for writing to a file.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ChartEx$render(id_start = 1, guid = "{C59B1284-E301-0D0F-1B20-FD96A66D6E43}")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{id_start}}{Numeric starting ID for XML data references.}

\item{\code{guid}}{a guid}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
A list containing the XML and attribute mappings.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ChartEx-clone"></a>}}
\if{latex}{\out{\hypertarget{method-ChartEx-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ChartEx$clone(deep = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}
