Comments (8)
I also think that the documentation could maybe call this out, especially in this section: https://echarts4r.john-coene.com/articles/connect.html#shiny
from echarts4r.
Yes, I actually have not tried the function in Shiny, only R markdown. The thing is you should not need it. It truly just lays out (or tries to 😄) layout the charts in a grid. You can use fluidRow
and column
in shiny, the charts will still be connected :)
There is an example here.
library(shiny)
library(echarts4r)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
id = "tabs",
menuItem("Users activity", tabName = "users_activity")
)
),
dashboardBody(
tabItems(
tabItem(
tabName = "users_activity",
fluidRow(
column(4, echarts4rOutput("plot1")),
column(4, echarts4rOutput("plot2")),
column(4, echarts4rOutput("plot3"))
)
)
)
)
)
server <- function(input, output, session) {
df <- data.frame(
weekDay = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
"Sunday"),
a = rnorm(7, 15, 3),
b= rnorm(7, 10, 4),
c = rnorm(7, 8, 5)
)
output$plot1 <- renderEcharts4r({
df %>%
e_charts(weekDay) %>%
e_bar(a) %>%
e_grid(left = '4%', right = '3%', bottom = '10%', containLabel = TRUE) %>%
e_tooltip(trigger = "axis") %>%
e_legend(show = FALSE) %>%
e_title(text = "This is title 1") %>%
e_color(color = "#00e5ff") %>%
e_group("grp") # assign group
})
output$plot2 <- renderEcharts4r({
df %>%
e_charts(weekDay) %>%
e_bar(b) %>%
e_grid(left = '4%', right = '3%', bottom = '10%', containLabel = TRUE) %>%
e_tooltip(trigger = "axis") %>%
e_legend(show = FALSE) %>%
e_title(text = "This is title 2") %>%
e_color(color = "#33ff99")%>%
e_group("grp") %>%
e_connect_group("grp")
})
output$plot3 <- renderEcharts4r({
df %>%
e_charts(weekDay, height = 200, width = "100%") %>%
e_bar(c) %>%
e_grid(left = '4%', right = '3%', bottom = '10%', containLabel = TRUE) %>%
e_tooltip(trigger = "axis") %>%
e_legend(show = FALSE) %>%
e_title(text = "This is title 3") %>%
e_color(color = "#ff33b8") %>%
e_group("grp") %>%
e_connect_group("grp")
})
}
shinyApp(ui, server)
I'll have it work in Shiny.
Does that help?
from echarts4r.
Yes, it helps! Thank you.
from echarts4r.
@JohnCoene, use shiny layout are workaround but not a solution.
plotly subplots
works as well and some users need the same behavior.
from echarts4r.
I think a possible solution is alternative renderEcharts4r function.
from echarts4r.
Yes indeed. I have it labeled as enhancement, I'll tackle this eventually, just not very high on the priority list.
from echarts4r.
Note as @artemklevtsov suggests: a new render*
function would be required.
from echarts4r.
Just wanted to put a +1 in this enhancement. I think it's a really nice feature to have for people that need to plot a dynamic number of plots in a grid for example.
from echarts4r.
Related Issues (20)
- timeline with multiple-y-axis setting y axis doesn't work
- e_bar chart combine with e_pie chart HOT 3
- Formatter with ec.clmn HOT 1
- e_river HOT 2
- Race and Waterfalls Charts HOT 6
- 'Cannot find function renderEcharts4r' error in Shiny Quarto document HOT 1
- Problem chaining e_text_g for multiple text placement HOT 2
- Question on shared dataset charts HOT 4
- `e_showtip_p`/ `e_dispatch_action_p` not working in modularized shiny app, attempting to debug with local fork but `debugger` doesn't register in the `addCustomMessageHandler` HOT 2
- How can I change the height and width of the elements (rectangles) on the heat map? HOT 3
- Themes from theme builder needs editing
- Make echarts4r available for webR HOT 1
- [Bug] on example code of Histogram HOT 1
- How to give each grid its own axis maximum? HOT 1
- e_radar not supporting group_by? HOT 1
- Scoring ring HOT 4
- Formatting dataView HOT 2
- margin not working when there are multiple groups of series HOT 10
- leaflet broken
- Bubble size on grouped bubble plot - bubbles scaled within groups HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from echarts4r.