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

Add support for 'subplots' from plot_ly and ggplotly in DashR #84

Merged
merged 2 commits into from
Apr 18, 2019

Conversation

rpkyle
Copy link
Contributor

@rpkyle rpkyle commented Apr 17, 2019

As pointed out by @sacul-git in #83, DashR would fail to properly mutate plot_ly and ggplotly objects constructed using the subplots function from the plotly R package.

The changes proposed in this PR change the logic for mutating the layout in encode_plotly; now, the function will

  • introspect the object to check to see if it is a list; if it is, then
  • check to see if the object class attributes include plotly; if they do, then
  • check to see if the list contains a named element x; if it does, then
  • check to see if any names within x match visdat or data; if they do, mutate

dashR/R/utils.R

Lines 579 to 582 in 5264c7c

if (is.list(layout_objs)) {
if ("plotly" %in% class(layout_objs) &&
"x" %in% names(layout_objs) &&
any(c("visdat", "data") %in% names(layout_objs$x))) {

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful 💃

@rpkyle rpkyle merged commit 1721101 into master Apr 18, 2019
rpkyle added a commit that referenced this pull request Apr 18, 2019
* remove gsub 🍝

* Add support for 'subplots' from plot_ly and ggplotly in DashR (#84)

* ✨ add support for plotly pkg 'subplots'
@rpkyle rpkyle deleted the 0.0.7-dev-issue83 branch November 4, 2019 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants