dw_create_chart: Creates a new Datawrapper chart

View source: R/dw_create_chart.R

dw_create_chartR Documentation

Creates a new Datawrapper chart

Description

\lifecycle

stable Creates and returns a new Datawrapper chart object. This function starts the chart-making process

Usage

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

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 or the Chart Types section below. If you do not set this here you can set it with dw_edit_chart()

folderId

Optional. Creates chart in specified folder.

theme

Optional. Creates chart with specified theme.

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.

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

  • multiple-lines : Multiple Lines 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

Note

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

Author(s)

Benedict Witzenberger

Examples


## Not run: 
dw_create_chart()

## End(Not run) # uses the preset key in the .Renviron-file

## Not run: dw_create_chart(title = "Testtitle")

## Not run: dw_create_chart(api_key = "1234ABCD") # uses the specified key

munichrocker/DatawRappr documentation built on March 20, 2024, 6:08 a.m.