Open carlosyanez opened 2 years ago
Hi, Thank you for creating and maintaining this great package.
I'm trying to use e_facet() to create parallel charts, each showing data for one category. Basically, I'm trying to mimic ggplot2::facet_wrap(..., scales="free"), i.e
data <- tribble(~Cat,~Value, "AAAAA", 1, "AAAAA", 2, "AAAAA", 5, "BBBBB", 3, "BBBBB", 3, "BBBBB", 4, "CCCC", 1, "CCCC", 9, "CCCC", 5) data |> ggplot(aes(y=Cat,x=Value)) + geom_point() + facet_wrap(.~Cat, scale="free_y",ncol=1)
Which will produce (plus theming):
Using e_facet() I'm getting every category in each facet:
p <-data |> group_by(Cat)|> e_charts(Cat) |> e_scatter(Value, symbol_size = 10, jitter_factor =1, itemStyle=list(color= "green")) |> e_y_axis(min=0,max=10) |> e_flip_coords() |> e_tooltip(trigger = "item") |> e_legend(show = FALSE) |> e_facet(cols=1,rows=3)
As a workaround, I'm editing the echarts4r object in R directly, but the result decomposes each string into 1-character labels:
for(i in 1:length(cats)) p$x$opts$yAxis[[i]]$data <- cats[i]
When looking at the element I'm modifying I'm getting the following before and after:
Before
p$x$opts$yAxis[[1]]$data #> [1] "AAAAA" "BBBBB" "CCCC"
After modifying
p$x$opts$yAxis[[1]]$data #> [1] "AAAAA"
Please note the change works well when each category is already a 1-character string.
Is there a work around for this from R?
Thanks, Carlos
Hi, Thank you for creating and maintaining this great package.
I'm trying to use e_facet() to create parallel charts, each showing data for one category. Basically, I'm trying to mimic ggplot2::facet_wrap(..., scales="free"), i.e
Which will produce (plus theming):
Using e_facet() I'm getting every category in each facet:
As a workaround, I'm editing the echarts4r object in R directly, but the result decomposes each string into 1-character labels:
When looking at the element I'm modifying I'm getting the following before and after:
Before
After modifying
Please note the change works well when each category is already a 1-character string.
Is there a work around for this from R?
Thanks, Carlos