Learn R Programming

xlcharts (version 0.0.1)

add_chart: Add a chart to the sheet

Description

Optionally provide a cell for the top-left anchor

Usage

add_chart(py_obj, chart, anchor = NULL, ...)

Value

An openpyxl Python object.

Arguments

py_obj

py_obj

chart

chart

anchor

anchor

...

Additional arguments, i.e. kwargs.

Details

https://openpyxl.readthedocs.io/en/stable/api/openpyxl.worksheet.worksheet.html#openpyxl.worksheet.worksheet.Worksheet.add_chart

Examples

Run this code
if (FALSE) {
wb <- Workbook()
ws <- wb$active
chart <- BarChart(type = "col")
data <- Reference(ws, min_col=2, min_row=1, max_row=7, max_col=3)
cats <- Reference(ws, min_col=1, min_row=2, max_row=7)
chart |>
  add_data(data = data, titles_from_data = TRUE) |>
  set_categories(cats)
ws |> add_chart(chart, "A10")
}

Run the code above in your browser using DataLab