Comments (2)
Thanks for the detailed issue once again!
I'm afraid I haven't had any luck either. Doesn't work in pure. JavaScript either, echarts4r proxy code does execute but echarts.js fails to show the tooltip.
Perhaps we'll need to update the JavaScript dependencies in echarts4r.
from echarts4r.
After much trial & error, I've managed to get e_highlight_p
and e_downplay_p
to work in tandem with one another, but no luck on the tooltips:
library(shiny)
devtools::load_all()
ui <- fluidPage(
fluidRow(
column(6, echarts4rOutput("plot")),
column(6, echarts4rOutput("plot2"))
)
)
server <- function(input, output, session) {
output$plot <- renderEcharts4r({
mtcars |>
e_charts(mpg) |>
e_line(disp, bind = carb, name = "displacement", emphasis = list(
disabled = FALSE,
lineStyle = list(opacity = 1,
width = 6)
)) |>
e_line(hp, emphasis = list(
disabled = FALSE,
lineStyle = list(opacity = 1,
width = 6)
)) |>
e_x_axis(min = 10) |>
e_tooltip() |>
e_theme("westeros") |>
e_group('p') |>
e_on(
"series",
event = "mouseover",
"
(event) => {
Shiny.setInputValue('plot_mouseover_seriesIndex', event.seriesIndex, {priority: 'event'})
}
"
) |>
e_on(
"series",
event = "mouseover",
"
(event) => {
Shiny.setInputValue('plot_mouseout_seriesIndex', event.seriesIndex, {priority: 'event'})
}
"
)
})
output$plot2 <- renderEcharts4r({
mtcars |>
e_charts(mpg) |>
e_line(disp, bind = carb, name = "displacement", emphasis = list(
disabled = FALSE,
lineStyle = list(opacity = 1,
width = 6)
)) |>
e_line(hp, emphasis = list(
disabled = FALSE,
lineStyle = list(opacity = 1,
width = 6)
)) |>
e_x_axis(min = 10) |>
e_tooltip() |>
e_theme("westeros") |>
e_group('p') |>
e_on(
"series",
event = "mouseover",
"
(event) => {
Shiny.setInputValue('plot2_mouseover_seriesIndex', event.seriesIndex, {priority: 'event'})
}
"
) |>
e_on(
"series",
event = "mouseout",
"
(event) => {
Shiny.setInputValue('plot2_mouseout_seriesIndex', event.seriesIndex, {priority: 'event'})
}
"
)
# |>
# e_connect_group("p")
})
browse = FALSE
observeEvent(input$plot_mouseover_seriesIndex, {
cli::cli_inform("plot_mouseover")
if (browse)
browser()
prox <- echarts4rProxy("plot2")
e_dispatch_action_p(
prox,
"select",
seriesIndex = input$plot_mouseover_seriesIndex
)
e_showtip_p(
prox,
seriesIndex = input$plot_mouseover_seriesIndex
)
e_highlight_p(
prox,
series_index = input$plot_mouseover_seriesIndex
)
})
observeEvent(input$plot2_mouseover_seriesIndex, {
cli::cli_inform("plot2_mouseover")
if (browse)
browser()
prox <- echarts4rProxy("plot")
e_dispatch_action_p(
prox,
"select",
seriesIndex = input$plot2_mouseover_seriesIndex
)
e_showtip_p(
prox,
seriesIndex = input$plot2_mouseover_seriesIndex
)
e_highlight_p(
prox,
series_index = input$plot2_mouseover_seriesIndex
)
})
observeEvent(input$plot_mouseout_seriesIndex, {
cli::cli_inform("plot2_mouseout")
if (browse)
browser()
prox <- echarts4rProxy("plot2")
e_dispatch_action_p(
prox,
"select",
seriesIndex = input$plot_mouseout_seriesIndex
)
e_hidetip_p(
prox
)
e_downplay_p(
prox,
series_index = input$plot_mouseout_seriesIndex
)
})
observeEvent(input$plot2_mouseout_seriesIndex, {
cli::cli_inform("plot2_mouseout")
if (browse)
browser()
prox <- echarts4rProxy("plot")
e_dispatch_action_p(
prox,
"select",
seriesIndex = input$plot2_mouseout_seriesIndex
)
e_hidetip_p(
prox
)
e_downplay_p(
prox,
series_index = input$plot2_mouseout_seriesIndex
)
})
}
if (interactive()) {
shinyApp(ui, server)
}
from echarts4r.
Related Issues (20)
- timeline with multiple-y-axis setting y axis doesn't work
- 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
- 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
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.