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

e_add when using timeline #165

Closed
nschwamm opened this issue Jun 18, 2020 · 3 comments
Closed

e_add when using timeline #165

nschwamm opened this issue Jun 18, 2020 · 3 comments
Labels
bug

Comments

@nschwamm
Copy link

@nschwamm nschwamm commented Jun 18, 2020

Hi -

If I want to set bars to custom colors, I typically can do that with e_add. For example, this code works perfectly:

library(dplyr)
library(echarts4r)

tibble(
  A=c("a","b","c","a","b","c"),
  B=c("A","B","C","D","E","F"),
  D=c(1,2,3,4,5,6),
  color=c("black","red","green","orange","purple","grey")
) %>%
  e_charts(B) %>%
  e_bar(D) %>%
  e_add("itemStyle",color)

However, if I group the data by say column A to use as a timeline, I get the error Error in tmp [[j]] : subscript out of bounds

library(dplyr)
library(echarts4r)

tibble(
  A=c("a","b","c","a","b","c"),
  B=c("A","B","C","D","E","F"),
  D=c(1,2,3,4,5,6),
  color=c("black","red","green","orange","purple","grey")
) %>%
  group_by(A) %>%
  e_charts(B,timeline=T) %>%
  e_bar(D) %>%
  e_add("itemStyle",color)

I'm guessing that the timeline changes the nesting somehow, but I'm unsure how to resolve. Thanks!

JohnCoene added a commit that referenced this issue Jun 18, 2020
@JohnCoene JohnCoene added the bug label Jun 18, 2020
@JohnCoene
Copy link
Owner

@JohnCoene JohnCoene commented Jun 18, 2020

Thanks for reporting this, that was a bug. I just pushed a fix which solves this issue. You can reinstall from Github and try again.

remotes::install_github("JohnCoene/echarts4r")
@JohnCoene
Copy link
Owner

@JohnCoene JohnCoene commented Jun 19, 2020

I hope this work, feel free to reopen if not. Note that the fix is now on CRAN.

@JohnCoene JohnCoene closed this Jun 19, 2020
@nschwamm
Copy link
Author

@nschwamm nschwamm commented Jun 19, 2020

This worked great - thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.