[Maturing] Modifies an existing Datawrapper chart.

dw_edit_chart(
  chart_id,
  api_key = "environment",
  title = "",
  intro = "",
  annotate = "",
  byline = "",
  type = "",
  source_name = "",
  source_url = "",
  folderId = "",
  axes = list(),
  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.

byline

Optional. Adds the name of the chart's creator.

type

Optional. Changes the type of the chart. See the documentation for the different types or the Chart Type section below.

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.

...

Optional. Will be added as a list to the top-level of the call-body. Use with caution, as it may overwrite some values defined earlier.

axes.

Optional. A list which specifies the axes.

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.

Check their reference guide or API-documentation.

Chart Types

  • d3-bars : Bar Chart

  • d3-bars-split : Split Bars

  • d3-bars-stacked : Stacked Bars

  • d3-bars-bullet : Bullet Bars

  • d3-dot-plot : Dot Plot

  • d3-range-plot : Range Plot

  • d3-arrow-plot : Arrow Plot

  • column-chart : Column Chart

  • grouped-column-chart : Grouped Column Chart

  • stacked-column-chart : Stacked Column Chart

  • d3-area : Area Chart

  • d3-lines : Line Chart

  • d3-pies : Pie Chart

  • d3-donuts : Donut Chart

  • d3-multiple-pies : Multiple Pies

  • d3-multiple-donuts : Multiple Donuts

  • d3-scatter-plot : Scatter Plot

  • election-donut-chart : Election Donut

  • tables : Table

  • d3-maps-choropleth : Choropleth Map

  • d3-maps-symbols : Symbol Map

  • locator-map : Locator Map

Chart Properties

Datawrapper defines the properties of a chart in the following structure.

Note: Not all possibilities are displayed, as different chart-types offer different design features.

You can find more on this structure in the API-Guide.

 {
"id": "6Ba3L",
"type": "d3-scatter-plot",
"title": "A grat chart",
...

"metadata": {

  "data": {
    "transpose": false,
    ...
  },

  "publish": {
    "embed-codes": {
      "embed-method-iframe": "<iframe title=\"\" aria-label=\"Scatter Plot\" src=\"//datawrapper.dwcdn.net/6Ba3L/1/\" scrolling=\"no\" frameborder=\"0\" style=\"border: none;\" width=\"600\" height=\"294\"></iframe>",
      ...
    },
    "embed-width": 600,
    "chart-height": 33.859375,
    ...
  }
},

"annotate": {
  "notes": "Updates from 2018 are excluded."
},

"describe": {
  "intro": "",
  "byline": "",
  ...
},

"visualize": {
  "size": "fixed",
  "rules": false,
  "shape": "fixed",
  ...
},

"json_error": null
},

"language": "en-US",
"externalData": null,
...
},
"url": "/v3/charts/6Ba3L"
}

Author

Benedict Witzenberger

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 }