Set chart properties.

chart_settings(x, ...)

# S3 method for ms_barchart
chart_settings(x, vary_colors, gap_width, dir, grouping, overlap, ...)

# S3 method for ms_linechart
chart_settings(x, vary_colors, style = "lineMarker", ...)

# S3 method for ms_areachart
chart_settings(x, vary_colors = FALSE, grouping = "standard", ...)

# S3 method for ms_scatterchart
chart_settings(x, vary_colors = FALSE, style = "marker", ...)

Arguments

x

an ms_chart object.

...

unused parameter

vary_colors

if TRUE the data points in the single series are displayed the same color.

gap_width

A gap appears between the bar or clustered bars for each category on a bar chart. The default width for this gap is 150 percent of the bar width. It can be set between 0 and 500 percent of the bar width.

dir

the direction of the bars in the chart, value must one of "horizontal" or "vertical".

grouping

grouping for a barchart, a linechart or an area chart. must be one of "percentStacked", "clustered", "standard" or "stacked".

overlap

In a bar chart having two or more series, the bars for each category are clustered together. By default, these bars are directly adjacent to each other. The bars can be made to overlap each other or have a space between them using the overlap property. Its values range between -100 and 100, representing the percentage of the bar width by which to overlap adjacent bars. A setting of -100 creates a gap of a full bar width and a setting of 100 causes all the bars in a category to be superimposed. The default value is 0.

style

Style for the linechart or scatterchart type of markers. One of 'none', 'line', 'lineMarker', 'marker', 'smooth', 'smoothMarker'.

Methods (by class)

  • chart_settings(ms_barchart): barchart settings

  • chart_settings(ms_linechart): linechart settings

  • chart_settings(ms_areachart): linechart settings

  • chart_settings(ms_scatterchart): linechart settings

Illustrations

Examples

library(mschart)
library(officer)

chart_01 <- ms_barchart(
  data = browser_data, x = "browser",
  y = "value", group = "serie"
)
chart_01 <- chart_theme(chart_01,
  grid_major_line_x = fp_border(width = 0),
  grid_minor_line_x = fp_border(width = 0)
)

chart_02 <- chart_settings(
  x = chart_01,
  grouping = "stacked", overlap = 100
)


chart_03 <- ms_areachart(data = browser_ts, x = "date",
  y = "freq", group = "browser")
chart_03 <- chart_settings(chart_03,
  grouping = "percentStacked")