Creates and returns a new Datawrapper chart object.

dw_create_chart(api_key = "environment", title = "", type = "", folderId = "")

Arguments

api_key

Required. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by datawrapper_auth.

title

Optional. Will set a chart's title on creation.

type

Optional. Changes the type of the chart. E.g. "d3-bars" for bars, "tables" for a table. Default is "d3-lines". See the documentation for the different types.

folderId

Optional. Creates chart in specified folder.

Value

It prints the new chart's id and returns a S3-structure of type dw_chart with the elements from the Datawrapper-API, the same as in dw_retrieve_chart_metadata.

Note

If not specified, the new chart will by default be created without a title and with the type d3-lines.

Examples

if (FALSE) { dw_create_chart() } # uses the preset key in the .Renviron-file if (FALSE) dw_create_chart(title = "Testtitle") if (FALSE) dw_create_chart(api_key = "1234ABCD") # uses the specified key