Modifies an existing Datawrapper chart.

dw_edit_chart(
  chart_id,
  api_key = "environment",
  title = "",
  intro = "",
  annotate = "",
  type = "",
  source_name = "",
  source_url = "",
  folderId = "",
  data = list(),
  visualize = list(),
  describe = list(),
  publish = list()
)

Arguments

chart_id

Required. A Datawrapper-chart-id as character string, usually a five character combination of digits and letters, e.g. "aBcDe". Or a dw_chart-object.

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. Adds a title to the plot.

intro

Optional. Adds an intro below the title.

annotate

Optional. Adds a annotation below the plot.

type

Optional. Changes the type of the chart. See the documentation for the different types.

source_name

Optional. Adds a source name to the plot.

source_url

Optional. Adds a URL to the source name (displayed only, if source name specified). Include http(s):// before URL.

folderId

Optional. Moves the chart to the specified folder (by folder-id, which can be found using dw_list_folders).

data

Optional. A list. Add separate arguments for the data. See the documentation for details.

visualize

Optional. A list. Add separate arguments for the visualization. See the documentation for details.

describe

Optional. A list. Add separate arguments for the description. See the documentation for details.

publish

Optional. A list. Add separate arguments for publication. See the documentation for details.

Value

A terminal message: "Chart xyz succesfully updated." - or an error message.

Note

This function builds a body for a API-call to the Datawrapper-API, which contains changes to an existing chart.

Check their reference guide or API-documentation.

Examples

if (FALSE) dw_edit_chart("aBcDE") # uses the preset key in the .Renviron-file, no changes if (FALSE) dw_edit_chart(chart_id = "a1B2Cd", api_key = "1234ABCD") # uses the specified key, no changes if (FALSE) dw_edit_chart(chart_id = "a1B2Cd", title = "I'm a title", intro = "Data showing daily results") # changes title and intro if (FALSE) dw_edit_chart(chart_id = "a1B2Cd", title = "I'm a title", data = list("transpose" = "true")) # transpose data