Reputation: 81
I am trying to generate a 3D barchart using the echarts4r
library but I can see an issue where it is accepting only x-axis as single letter.
See below working example:
library(echarts4r)
data <- data.frame(
x = c("A"
),
y = c(1
),
z = c(
35820
)
)
e_charts(data, x) %>%
e_bar_3d(y, z) %>%
e_x_axis_3d(type= "category") %>% e_y_axis_3d(type= "category") %>% e_z_axis_3d(type= "value")
the screenshot for the working example:
This the example that does not generate the barchart
library(echarts4r)
data <- data.frame(
x = c("HS"
),
y = c(1
),
z = c(
35820
)
)
e_charts(data, x) %>%
e_bar_3d(y, z) %>%
e_x_axis_3d(type= "category") %>% e_y_axis_3d(type= "category") %>% e_z_axis_3d(type= "value")
See x-axis is not well displayed:
Upvotes: 1
Views: 46
Reputation: 125687
Agree that this looks like a bug. A workaround would be to use a list column. To this end I use a tibble
instead of a data.frame
and wrap the x axis category in list
:
library(echarts4r)
library(tibble)
data <- tibble(
x = list("HS"),
y = c(1),
z = c(
35820
)
)
e_charts(data, x) %>%
e_bar_3d(y, z) %>%
e_x_axis_3d(type = "category") %>%
e_y_axis_3d(type = "category") %>%
e_z_axis_3d(type = "value")
Upvotes: 3