JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
593 stars 81 forks source link

How to put more than one pointer in gauge in case of timeline? #280

Open rdatasculptor opened 3 years ago

rdatasculptor commented 3 years ago

Take a look at this example . Is there a way to do something like this in echarts4r?

In the echarts4 r function there only seems room for just one pointer.

This works:

 e_charts() %>%
   e_gauge(57, "PERCENT") %>%
   e_gauge(20, "")

This works as well:

df <- data.frame(group=c(1,2), value=c(10,90))

df %>% group_by(group) %>%
  e_charts(timeline=TRUE) %>%
  e_gauge_("value", "PERCENT")

But this doesn't work:

df <- data.frame(group=c(1,2), value=c(10,90), value2=c(40,80))

df %>% group_by(group) %>%
  e_charts(timeline=TRUE) %>%
  e_gauge_("value", "PERCENT") %>%
  e_gauge_("value2", "")

In my RStudio console nothing is shown, the viewer is empty.

Does anyone know how to fix this? Or isn't it possible? Many thanks in advance!

JohnCoene commented 3 years ago

Yes indeed, that's a new feature from version 5, I have not gotten around to supporting that in echarts4r yet.

rdatasculptor commented 3 years ago

No rush, just curious. Any news on this issue?

JohnCoene commented 3 years ago

Similar with timeline and a single arrow.

iris |> 
  group_by(Species) |> 
  e_charts(Sepal.Length, timeline = TRUE) |>
  e_gauge(
    c(57, 23, 65),
    c("percent", "percentage", "cases")
  )
rdatasculptor commented 3 years ago

Nice! Do I understand correctly that this should work:


df <- data.frame(group=c(1,2), value=c(10,90), value2=c(40,80))

df %>% group_by(group) %>%
  e_charts(timeline=TRUE) %>%
  e_gauge_(c("value","value2" ), "PERCENT")