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

Combination chart (bar + line) #21

Open
newuserofthis opened this issue Oct 27, 2020 · 2 comments
Open

Combination chart (bar + line) #21

newuserofthis opened this issue Oct 27, 2020 · 2 comments

Comments

@newuserofthis
Copy link

Is it possible to draw combination charts like this one using billboarder? All three ways to map the variables failed. They produced graphs where a redundant bar variable is added showing the x-axis values.

data <- data.frame(
  "index" = 1:6,
  "data4" = c(200, 130, 90, 240, 130, 220),
  "data5" = c(130, 120, 150, 140, 160, 150)
)

billboarder() %>%
  bb_linechart(data[-3]) %>%
  bb_barchart(data[-2])

billboarder(data = data) %>% 
  bb_aes(x = index, y = data4) %>%
  bb_linechart() %>%
  bb_aes(x = index, y = data5) %>% 
  bb_barchart()

billboarder(data = data) %>% 
  bb_linechart(mapping = bbaes(x = index, y = data4)) %>%
  bb_barchart(mapping = bbaes(x = index, y = data5))

Your help is highly appreciated.
Thanks!
Anja

@pvictor
Copy link
Member

pvictor commented Nov 9, 2020

Hello,

That's easier I think without using helper functions but using billboard API directly:

billboarder() %>% 
  bb_data(
    json = as.list(data),
    x = "index",
    types = list(
      data4 = "line",
      data5 = "bar"
    )
  )

Which gives:
image

I think bb_linechart and bb_barchart try both to add an x-axis without knowing there's already one... I'll look what I can do.

Victor

@Kvit
Copy link

Kvit commented Jun 17, 2021

Same issue here, suggested approach does not work well with subsequent %>% operations for chart decorations. As an alternative is it possible to remove a series from the chart?

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

No branches or pull requests

3 participants