View source: R/dw_publish_chart.R
dw_publish_chart | R Documentation |
Publish a chart on Datawrapper.
dw_publish_chart(
chart_id,
api_key = "environment",
return_urls = TRUE,
return_object = FALSE
)
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 |
Optional. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by |
return_urls |
Optional. If TRUE (default) it returns the code for the responsive iFrame and an URL to the chart. |
return_object |
Optional. Defaults to FALSE. Returns an object if set to TRUE which contains |
A message that specifies, if the publication was successful. If set, including the iFrame-Code and chart-URL. If return_object
is set to TRUE it returns a S3-structure of type dw_chart
This function publishes a chart in Datawrapper.
Benedict Witzenberger
## Not run:
dw_publish_chart("aBcDE")
## End(Not run) # uses the preset key in the .Renviron-file
## Not run:
dw_publish_chart(chart_id = "a1B2Cd", api_key = "1234ABCD")
## End(Not run) # uses the specified key
## Not run:
dw_publish_chart(chart_id = "a1B2Cd", return_urls = FALSE)
## End(Not run) # won't return code and URLs for chart
## Not run:
published_chart <- dw_publish_chart(chart_id = "a1B2Cd", return_object = TRUE)
## End(Not run) # returns an object with URL and IframeCode
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.