Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with changing theme in dw_edit_chart #59

Closed
michaelgoodier opened this issue Apr 7, 2021 · 2 comments
Closed

Issue with changing theme in dw_edit_chart #59

michaelgoodier opened this issue Apr 7, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@michaelgoodier
Copy link

michaelgoodier commented Apr 7, 2021

Really useful package for a current project i'm having to work on at work - thanks!

For some reason I was unable to change the name of the datawrapper theme using the following dw_edit_chart().
(x here being the name of a dw_chart-object)

dw_edit_chart(x, title="Example title",
                type="d3-bars-grouped",
                theme="custom_theme")

I managed to add it using a custom httr::Patch()

call_body <- list(title="Example title",
                    type="d3-bars-grouped",
                    theme = dw_theme,
                    metadata = list(describe = list(`source-name` = "Global Data")))    
  
  httr::PATCH(url = paste0('https://api.datawrapper.de/v3/charts/',x$id), httr::add_headers(Authorization = paste0('Bearer ',api_key)), body = call_body, encode = "json",.DATAWRAPPR_UA)

I'm not sure why - maybe it is to do with the order of things in the call body as as theme isn't a default option in dw_edit_chart it gets added to the end? Thought I'd flag anyway!

@munichrocker munichrocker self-assigned this Apr 8, 2021
@munichrocker munichrocker added the bug Something isn't working label Apr 8, 2021
@munichrocker
Copy link
Owner

munichrocker commented Apr 8, 2021

Seems to be an issue with rlist::list.append(). It's appending a nested item to call_body, instead of a vector element (theme = "xyz").

I am testing a fix with base append() in 599bfac

@munichrocker
Copy link
Owner

This issue should be fixed in V1.2 (599bfac)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants